2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. 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.
18 /***************************************************************************
19 * Description: Various utility functions *
20 * Author: Gal Shachor <shachor@il.ibm.com> *
21 * Author: Henri Gomez <hgomez@apache.org> *
22 * Author: Rainer Jung <rjung@apache.org> *
23 * Version: $Revision: 751914 $ *
24 ***************************************************************************/
28 #include "jk_global.h"
29 #include "jk_logger.h"
32 #include "jk_service.h"
34 #define JK_SLEEP_DEF (100)
36 const char *jk_get_bool(int v);
38 int jk_get_bool_code(const char *v, int def);
40 void jk_sleep(int ms);
42 void jk_set_time_fmt(jk_logger_t *l, const char *jk_log_fmt);
44 int jk_parse_log_level(const char *level);
46 int jk_open_file_logger(jk_logger_t **l, const char *file, int level);
48 int jk_attach_file_logger(jk_logger_t **l, int fd, int level);
50 int jk_close_file_logger(jk_logger_t **l);
52 int jk_log(jk_logger_t *l,
53 const char *file, int line, const char *funcname, int level,
54 const char *fmt, ...);
56 /* [V] Two general purpose functions. Should ease the function bloat. */
57 int jk_get_worker_str_prop(jk_map_t *m,
58 const char *wname, const char *pname, const char **prop);
60 int jk_get_worker_int_prop(jk_map_t *m,
61 const char *wname, const char *pname, int *prop);
63 const char *jk_get_worker_host(jk_map_t *m, const char *wname, const char *def);
65 const char *jk_get_worker_type(jk_map_t *m, const char *wname);
67 int jk_get_worker_port(jk_map_t *m, const char *wname, int def);
69 int jk_get_worker_cache_size(jk_map_t *m, const char *wname, int def);
71 int jk_get_worker_cache_size_min(jk_map_t *m, const char *wname, int def);
73 int jk_get_worker_cache_acquire_timeout(jk_map_t *m, const char *wname, int def);
75 int jk_get_worker_socket_timeout(jk_map_t *m, const char *wname, int def);
77 int jk_get_worker_socket_connect_timeout(jk_map_t *m, const char *wname, int def);
79 int jk_get_worker_socket_buffer(jk_map_t *m, const char *wname, int def);
81 int jk_get_worker_socket_keepalive(jk_map_t *m, const char *wname, int def);
83 int jk_get_worker_conn_ping_interval(jk_map_t *m, const char *wname, int def);
85 int jk_get_worker_cache_timeout(jk_map_t *m, const char *wname, int def);
87 int jk_get_worker_recovery_opts(jk_map_t *m, const char *wname, int def);
89 int jk_get_worker_connect_timeout(jk_map_t *m, const char *wname, int def);
91 int jk_get_worker_reply_timeout(jk_map_t *m, const char *wname, int def);
93 int jk_get_worker_prepost_timeout(jk_map_t *m, const char *wname, int def);
95 int jk_get_worker_ping_timeout(jk_map_t *m, const char *wname, int def);
97 int jk_get_worker_ping_mode(jk_map_t *m, const char *wname, int def);
99 int jk_get_worker_recycle_timeout(jk_map_t *m, const char *wname, int def);
101 int jk_get_worker_recover_timeout(jk_map_t *m, const char *wname, int def);
103 int jk_get_worker_error_escalation_time(jk_map_t *m, const char *wname, int def);
105 int jk_get_worker_max_reply_timeouts(jk_map_t *m, const char *wname, int def);
107 int jk_get_worker_retry_interval(jk_map_t *m, const char *wname, int def);
109 const char *jk_get_worker_route(jk_map_t *m, const char *wname, const char *def);
111 const char *jk_get_worker_domain(jk_map_t *m, const char *wname, const char *def);
113 const char *jk_get_worker_redirect(jk_map_t *m, const char *wname, const char *def);
115 const char *jk_get_worker_secret_key(jk_map_t *m, const char *wname);
117 const char *jk_get_lb_session_cookie(jk_map_t *m, const char *wname, const char *def);
119 const char *jk_get_lb_session_path(jk_map_t *m, const char *wname, const char *def);
121 int jk_get_worker_retries(jk_map_t *m, const char *wname, int def);
123 int jk_get_is_worker_disabled(jk_map_t *m, const char *wname);
125 int jk_get_is_worker_stopped(jk_map_t *m, const char *wname);
127 int jk_get_worker_activation(jk_map_t *m, const char *wname);
129 int jk_get_worker_list(jk_map_t *m, char ***list, unsigned *num_of_workers);
131 int jk_get_lb_factor(jk_map_t *m, const char *wname);
133 int jk_get_distance(jk_map_t *m, const char *wname);
135 int jk_get_is_sticky_session(jk_map_t *m, const char *wname);
137 int jk_get_is_sticky_session_force(jk_map_t *m, const char *wname);
139 int jk_get_lb_method(jk_map_t *m, const char *wname);
141 int jk_get_lb_lock(jk_map_t *m, const char *wname);
143 int jk_get_lb_worker_list(jk_map_t *m,
144 const char *lb_wname,
145 char ***list, unsigned int *num_of_workers);
146 int jk_get_worker_mount_list(jk_map_t *m,
148 char ***list, unsigned int *num_of_maps);
149 const char *jk_get_worker_secret(jk_map_t *m, const char *wname);
151 int jk_get_worker_mx(jk_map_t *m, const char *wname, unsigned *mx);
153 int jk_get_worker_ms(jk_map_t *m, const char *wname, unsigned *ms);
155 int jk_get_worker_classpath(jk_map_t *m, const char *wname, const char **cp);
158 int jk_get_worker_bridge_type(jk_map_t *m, const char *wname, unsigned *bt);
160 int jk_get_worker_jvm_path(jk_map_t *m, const char *wname, const char **vm_path);
162 int jk_get_worker_callback_dll(jk_map_t *m,
163 const char *wname, const char **cb_path);
165 int jk_get_worker_cmd_line(jk_map_t *m, const char *wname, const char **cmd_line);
167 int jk_file_exists(const char *f);
169 int jk_is_list_property(const char *prp_name);
171 int jk_is_path_property(const char *prp_name);
173 int jk_is_cmd_line_property(const char *prp_name);
175 int jk_is_unique_property(const char *prp_name);
177 int jk_is_deprecated_property(const char *prp_name);
179 int jk_is_valid_property(const char *prp_name);
181 int jk_get_worker_stdout(jk_map_t *m, const char *wname, const char **stdout_name);
183 int jk_get_worker_stderr(jk_map_t *m, const char *wname, const char **stderr_name);
185 int jk_get_worker_sysprops(jk_map_t *m, const char *wname, const char **sysprops);
187 int jk_get_worker_libpath(jk_map_t *m, const char *wname, const char **libpath);
189 char **jk_parse_sysprops(jk_pool_t *p, const char *sysprops);
192 void jk_append_libpath(jk_pool_t *p, const char *libpath);
194 void jk_set_worker_def_cache_size(int sz);
196 int jk_get_worker_def_cache_size(int protocol);
198 int jk_get_worker_maintain_time(jk_map_t *m);
200 int jk_get_max_packet_size(jk_map_t *m, const char *wname);
202 const char *jk_get_worker_style_sheet(jk_map_t *m, const char *wname, const char *def);
204 int jk_get_is_read_only(jk_map_t *m, const char *wname);
206 int jk_get_worker_user_list(jk_map_t *m,
208 char ***list, unsigned int *num);
210 int jk_get_worker_good_rating(jk_map_t *m,
212 char ***list, unsigned int *num);
214 int jk_get_worker_bad_rating(jk_map_t *m,
216 char ***list, unsigned int *num);
218 const char *jk_get_worker_name_space(jk_map_t *m, const char *wname, const char *def);
220 const char *jk_get_worker_xmlns(jk_map_t *m, const char *wname, const char *def);
222 const char *jk_get_worker_xml_doctype(jk_map_t *m, const char *wname, const char *def);
224 const char *jk_get_worker_prop_prefix(jk_map_t *m, const char *wname, const char *def);
226 int jk_get_worker_fail_on_status(jk_map_t *m, const char *wname,
227 int *list, unsigned int list_size);
229 int jk_get_worker_user_case_insensitive(jk_map_t *m, const char *wname);
231 int is_http_status_fail(unsigned int http_status_fail_num,
232 int *http_status_fail, int status);
234 int jk_wildchar_match(const char *str, const char *exp, int icase);
236 #define TC32_BRIDGE_TYPE 32
237 #define TC33_BRIDGE_TYPE 33
238 #define TC40_BRIDGE_TYPE 40
239 #define TC41_BRIDGE_TYPE 41
240 #define TC50_BRIDGE_TYPE 50
244 #define S_IFREG _S_IFREG
248 void jk_ascii2ebcdic(char *src, char *dst);
249 void jk_ebcdic2ascii(char *src, char *dst);
251 #endif /* AS400_UTF8 */
255 /* i5/OS V5R4 need ASCII-EBCDIC conversion before stat() call */
256 /* added a stat() mapper function, jk_stat, for such purpose */
258 int jk_stat(const char *f, struct stat * statbuf);
263 #endif /* __cplusplus */
268 #endif /* __cplusplus */
269 #endif /* _JK_UTIL_H */