00001
00002
00003
00004
00005 #if !defined(_INCLUDED_SUL_UTILITY_H_HEADER__)
00006 #define _INCLUDED_SUL_UTILITY_H_HEADER__
00007
00019 typedef apr_int32_t fd_t;
00020
00026 typedef apr_int16_t sul_boolean_t;
00027
00033 typedef apr_status_t sul_status_t;
00034
00040 #define SMD_HTTPD_DEFAULT_PORT 8021
00041
00050 #define APR_ARRAY_IDX(ary, i, type) (((type *)(ary)->elts)[i])
00051
00058 #define APR_ARRAY_SIZE(array) ((array)->nelts)
00059
00067 #define APR_ARRAY_TOP(array, type) APR_ARRAY_IDX(array, APR_ARRAY_SIZE(array) - 1, type)
00068
00077 #define APR_PCALLOC_TYPE(pool, type) (type *)apr_pcalloc(pool, sizeof(type))
00078
00087 #define APR_PALLOC_TYPE(pool, type) (type *)apr_palloc(pool, sizeof(type))
00088
00097 #define APR_ARRAY_INTS_CREATE(pool) apr_array_make(pool, 1, sizeof(apr_int32_t))
00098
00107 #define APR_ARRAY_INTS_PUSH(arr, value) *((apr_int32_t *)apr_array_push((arr))) = (value)
00108
00117 #define APR_ARRAY_STRS_CREATE(pool) apr_array_make(pool, 1, sizeof(const char *))
00118
00127 #define APR_ARRAY_STRS_PUSH(arr, value) *((const char **)apr_array_push((arr))) = (value)
00128
00138 SUL_DECLARE(char *)
00139 sul_path_basename(const char *path, apr_pool_t *pool);
00140
00150 SUL_DECLARE(char *)
00151 sul_path_basepath(const char *path, apr_pool_t *pool);
00152
00160 #define sul_memzero(ptr, sz) ((void)memset(ptr, 0, sz))
00161
00168 SUL_DECLARE(double)
00169 sul_get_time_now(void);
00170
00178 SUL_DECLARE(apr_status_t)
00179 sul_get_local_ip(const char **ip, apr_pool_t *pool);
00180
00189 SUL_DECLARE(apr_status_t)
00190 sul_get_nameinfo(char **name, const char *ip, apr_pool_t *pool);
00191
00199 SUL_DECLARE(char *)
00200 sul_strtolower(apr_pool_t *pool, const char *str);
00201
00208 SUL_DECLARE(char *)
00209 sul_string_makelower(char *str);
00210
00222 SUL_DECLARE(apr_status_t)
00223 sul_socket_connect_timed(apr_socket_t *sock, apr_sockaddr_t *sa,
00224 apr_interval_time_t c_secs,
00225 apr_interval_time_t a_secs);
00226
00233 SUL_DECLARE(apr_int32_t)
00234 sul_parse_key(const char *nptr);
00235
00245 SUL_DECLARE(char *)
00246 sul_str_replace(const char *src, const char *from, char to, apr_pool_t *pool);
00247
00257 SUL_DECLARE(apr_status_t)
00258 sul_tokenize_string(apr_array_header_t **toks, const char *str,
00259 const char *delims, apr_pool_t *pool);
00260
00270 SUL_DECLARE(char *)
00271 sul_join_strings(apr_array_header_t *strings, const char *sep, apr_size_t bgn,
00272 apr_pool_t *pool);
00273
00281 SUL_DECLARE(apr_status_t)
00282 sul_pool_cleanup_free(void *arg);
00283
00291 SUL_DECLARE(sul_error_t *)
00292 sul_pcre_compile(pcre **re, const char *pattern, apr_pool_t *pool);
00293
00302 SUL_DECLARE(apr_size_t)
00303 sul_pcre_match_simple(pcre *re, const char *str, apr_pool_t *pool);
00304
00312 SUL_DECLARE(sul_boolean_t)
00313 sul_keys_array_contains(apr_array_header_t *arr, apr_int32_t key);
00314
00319 #define RE_IP "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
00320
00326 #if defined(WIN32)
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337 #endif
00338
00341 #endif