2 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3 * Copyright (C) 2005 Atsushi Konno All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #ifndef __MOD_CHXJ_H__
18 #define __MOD_CHXJ_H__
20 #if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE)
21 #define AP_NEED_SET_MUTEX_PERMS
28 #include "http_config.h"
29 #include "http_protocol.h"
30 #include "http_request.h"
32 #include "ap_config.h"
33 #include "apr_strings.h"
34 #include "apr_buckets.h"
36 #include "apr_tables.h"
38 #include "apr_general.h"
39 #include "apr_pools.h"
40 #include "util_filter.h"
42 #if defined(AP_NEED_SET_MUTEX_PERMS)
46 #include "qs_ignore_sp.h"
48 #include "qs_malloc.h"
49 #include "qs_parse_attr.h"
50 #include "qs_parse_file.h"
51 #include "qs_parse_string.h"
52 #include "qs_parse_tag.h"
59 #undef PACKAGE_TARNAME
60 #undef PACKAGE_VERSION
64 #ifdef HAVE_AP_REGEX_H
65 # include "ap_regex.h"
67 # include "pcreposix.h"
69 # if !defined(AP_REG_ASSERT)
70 # define AP_REG_ASSERT REG_ASSERT
72 # if !defined(AP_REG_BADBR)
73 # define AP_REG_BADBR REG_BADBR
75 # if !defined(AP_REG_BADPAT)
76 # define AP_REG_BADPAT REG_BADPAT
78 # if !defined(AP_REG_BADRPT)
79 # define AP_REG_BADRPT REG_BADRPT
81 # if !defined(AP_REG_EBRACE)
82 # define AP_REG_EBRACE REG_EBRACE
84 # if !defined(AP_REG_EBRACK)
85 # define AP_REG_EBRACK REG_EBRACK
87 # if !defined(AP_REG_ECOLLATE)
88 # define AP_REG_ECOLLATE REG_ECOLLATE
90 # if !defined(AP_REG_ECTYPE)
91 # define AP_REG_ECTYPE REG_ECTYPE
93 # if !defined(AP_REG_EESCAPE)
94 # define AP_REG_EESCAPE REG_EESCAPE
96 # if !defined(AP_REG_EMPTY)
97 # define AP_REG_EMPTY REG_EMPTY
99 # if !defined(AP_REG_EPAREN)
100 # define AP_REG_EPAREN REG_EPAREN
102 # if !defined(AP_REG_ERANGE)
103 # define AP_REG_ERANGE REG_ERANGE
105 # if !defined(AP_REG_ESIZE)
106 # define AP_REG_ESIZE REG_ESIZE
108 # if !defined(AP_REG_ESPACE)
109 # define AP_REG_ESPACE REG_ESPACE
111 # if !defined(AP_REG_ESUBREG)
112 # define AP_REG_ESUBREG REG_ESUBREG
114 # if !defined(AP_REG_INVARG)
115 # define AP_REG_INVARG REG_INVARG
117 # if !defined(AP_REG_NOMATCH)
118 # define AP_REG_NOMATCH REG_NOMATCH
121 # if !defined(AP_REG_ICASE)
122 # define AP_REG_ICASE REG_ICASE
124 # if !defined(AP_REG_NEWLINE)
125 # define AP_REG_NEWLINE REG_NEWLINE
127 # if !defined(AP_REG_NOTBOL)
128 # define AP_REG_NOTBOL REG_NOTBOL
130 # if !defined(AP_REG_NOTEOL)
131 # define AP_REG_NOTEOL REG_NOTEOL
134 # if !defined(AP_REG_EXTENDED)
135 # define AP_REG_EXTENDED REG_EXTENDED
137 # if !defined(AP_REG_NOSUB)
138 # define AP_REG_NOSUB REG_NOSUB
141 # define ap_regex_t regex_t
142 # define ap_regmatch_t regmatch_t
148 #ifdef HAVE_APR_GLOBAL_MUTEX_H
149 # include "apr_global_mutex.h"
152 #ifdef HAVE_APR_SHM_H
153 # include "apr_shm.h"
157 typedef struct _imode_emoji_t {
164 typedef struct _ezweb_emoji_t {
171 typedef struct _jphone_emoji_t {
175 typedef struct _emoji_t {
176 struct _emoji_t* next;
178 imode_emoji_t* imode;
179 ezweb_emoji_t* ezweb;
180 jphone_emoji_t* jphone;
183 typedef struct _chxjconvrule_entry {
191 } chxjconvrule_entry;
194 char* (*start_tag_handler)(void* doc, Node* node);
195 char* (*end_tag_handler)(void* doc, Node* node);
198 #include "chxj_specified_device.h"
202 tag_handler* handler;
253 char* device_data_file;
254 char* emoji_data_file;
256 char* image_cache_dir;
257 char* image_copyright;
258 device_table_list* devices;
261 char* server_side_encoding;
263 char* dir; /* for LOG */
265 apr_array_header_t *convrules;
270 #define CONVRULE_ENGINE_ON_BIT (0x00000001)
271 #define CONVRULE_ENGINE_OFF_BIT (0x00000002)
272 #define CONVRULE_COOKIE_ON_BIT (0x00000004)
274 #define CONVRULE_ENGINE_ON_CMD "EngineOn"
275 #define CONVRULE_ENGINE_OFF_CMD "EngineOff"
276 #define CONVRULE_COOKIE_ON_CMD "CookieOn"
277 #define CONVRULE_COOKIE_OFF_CMD "CookieOff"
280 #define CONVRULE_FLAG_NOTMATCH (0x00000001)
282 #define CONVRULE_PC_FLAG_ON_CMD "PC"
284 #define CONVRULE_PC_FLAG_ON_BIT (0x00000001)
285 #define CONVRULE_PC_FLAG_OFF_BIT (0x00000002)
288 apr_global_mutex_t* cookie_db_lock;
289 } mod_chxj_global_config;
294 apr_bucket_brigade *bb;
299 #include "chxj_tag_util.h"
301 #define CHXJ_MOD_CONFIG_KEY "chxj_module_key"
303 #define HTTP_USER_AGENT "User-Agent"
304 #define CHXJ_HTTP_USER_AGENT "CHXJ_HTTP_USER_AGENT"
306 module AP_MODULE_DECLARE_DATA chxj_module;
308 #define CHXJ_IMG_ON (1)
309 #define CHXJ_IMG_OFF (0)
312 #define DBG(X,Y) ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(request_rec*)(X),(Y))
313 #define DBG1(X,Y,Za) ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za))
314 #define DBG2(X,Y,Za,Zb) ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb))
315 #define DBG3(X,Y,Za,Zb,Zc) ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb),(Zc))
316 #define DBG4(X,Y,Za,Zb,Zc,Zd) ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb),(Zc),(Zd))
317 #define DBG5(X,Y,Za,Zb,Zc,Zd,Ze) ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb),(Zc),(Zd),(Ze))
318 #define SDBG(X,Y) ap_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y))
319 #define SDBG1(X,Y,Za) ap_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za))
320 #define SDBG2(X,Y,Za,Zb) ap_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb))
321 #define SDBG3(X,Y,Za,Zb,Zc) ap_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb),(Zc))
322 #define SDBG4(X,Y,Za,Zb,Zc,Zd) ap_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb),(Zc),(Zd))
323 #define SDBG5(X,Y,Za,Zb,Zc,Zd,Ze) ap_log_error(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb),(Zc),(Zd),(Ze))
324 #define ERR(X,Y) ap_log_rerror(APLOG_MARK,APLOG_ERR,0,(X),(Y))
325 #define ERR1(X,Y,Za) ap_log_rerror(APLOG_MARK,APLOG_ERR,0,(X),(Y),(Za))
326 #define ERR2(X,Y,Za,Zb) ap_log_rerror(APLOG_MARK,APLOG_ERR,0,(X),(Y),(Za),(Zb))
327 #define SERR(X,Y) ap_log_error(APLOG_MARK,APLOG_ERR,0,(X),(Y))
328 #define SERR1(X,Y,Za) ap_log_error(APLOG_MARK,APLOG_ERR,0,(X),(Y),(Za))
329 #define SERR2(X,Y,Za,Zb) ap_log_error(APLOG_MARK,APLOG_ERR,0,(X),(Y),(Za),(Zb))
331 extern tag_handlers chxj_tag_handlers[];
332 extern tag_handler chtml10_handler[];
333 extern tag_handler chtml20_handler[];
334 extern tag_handler chtml30_handler[];
335 extern tag_handler xhtml_handler[];
336 extern tag_handler hdml_handler[];
337 extern tag_handler jhtml_handler[];
339 extern char* chxj_node_exchange(