/usr/include/cherokee/util.h is in libcherokee-base0-dev 1.2.101-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Cherokee
*
* Authors:
* Alvaro Lopez Ortega <alvaro@alobbs.com>
*
* Copyright (C) 2001-2011 Alvaro Lopez Ortega
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#if !defined (CHEROKEE_INSIDE_CHEROKEE_H) && !defined (CHEROKEE_COMPILATION)
# error "Only <cherokee/cherokee.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef CHEROKEE_UTIL_H
#define CHEROKEE_UTIL_H
#include <cherokee/common.h>
#include <cherokee/avl.h>
#include <cherokee/trace.h>
#include <cherokee/plugin_loader.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef HAVE_GRP_H
# include <grp.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <time.h>
#include <dirent.h>
#include <errno.h>
#include <cherokee/buffer.h>
#include <cherokee/iocache.h>
CHEROKEE_BEGIN_DECLS
/* Error buffer size for cherokee_strerror_r().
*/
#define ERROR_MIN_BUFSIZE 64 /* min. buffer size */
#define ERROR_MAX_BUFSIZE 512 /* max. buffer size */
#ifdef _WIN32
# define cherokee_stat(path,buf) cherokee_win32_stat(path,buf)
# define cherokee_lstat(path,buf) cherokee_win32_stat(path,buf)
# define cherokee_error GetLastError()
#else
# define cherokee_error errno
#endif
/* Missing functions
*/
#ifndef HAVE_STRNSTR
char *strnstr (const char *s, const char *find, size_t slen);
#endif
#ifndef HAVE_STRCASESTR
char *strcasestr (register char *s, register char *find);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat (char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_MALLOC
void *rpl_malloc (size_t n);
#endif
char *strncasestr (const char *s, const char *find, size_t slen);
char *strncasestrn (const char *s, size_t slen, const char *find, size_t findlen);
#define strncasestrn_s(s,s_len,lit) strncasestrn(s, s_len, lit, sizeof(lit)-1)
/* Constants
*/
extern const char hex2dec_tab[256];
extern const char *month[13];
/* String management functions
*/
char *cherokee_strerror_r (int err, char *buf, size_t bufsize);
int cherokee_isbigendian (void);
char *cherokee_min_str (char *s1, char *s2);
char *cherokee_max_str (char *s1, char *s2);
int cherokee_estimate_va_length (const char *format, va_list ap);
long cherokee_eval_formated_time (cherokee_buffer_t *buf);
ret_t cherokee_fix_dirpath (cherokee_buffer_t *buf);
ret_t cherokee_find_header_end (cherokee_buffer_t *buf,
char **end,
cuint_t *sep_len);
ret_t cherokee_find_header_end_cstr (char *c_str,
cint_t c_len,
char **end,
cuint_t *sep_len);
ret_t cherokee_parse_host (cherokee_buffer_t *buf,
cherokee_buffer_t *host,
cuint_t *port);
int cherokee_string_is_ipv6 (cherokee_buffer_t *ip);
ret_t cherokee_copy_local_address (void *socket, cherokee_buffer_t *buf);
ret_t cherokee_buf_add_bogonow (cherokee_buffer_t *buf,
cherokee_boolean_t update);
ret_t cherokee_buf_add_backtrace (cherokee_buffer_t *buf, int n_skip, const char *new_line, const char *line_pre);
ret_t cherokee_find_exec_in_path (const char *bin_name,
cherokee_buffer_t *fullpath);
ret_t cherokee_atoi (const char *str, int *ret_value);
ret_t cherokee_atob (const char *str, cherokee_boolean_t *ret_value);
/* Time management functions
*/
struct tm *cherokee_gmtime (const time_t *timep, struct tm *result);
struct tm *cherokee_localtime (const time_t *timep, struct tm *result);
long *cherokee_get_timezone_ref (void);
/* Thread safe functions
*/
DIR * cherokee_opendir (const char *dirname);
int cherokee_readdir (DIR *dirstream, struct dirent *entry, struct dirent **result);
int cherokee_closedir (DIR *dirstream);
int cherokee_stat (const char *restrict path, struct stat *buf);
int cherokee_lstat (const char *restrict path, struct stat *buf);
int cherokee_fstat (int filedes, struct stat *buf);
int cherokee_access (const char *pathname, int mode);
int cherokee_open (const char *path, int oflag, int mode);
int cherokee_unlink (const char *path);
int cherokee_pipe (int fildes[2]);
ret_t cherokee_gethostbyname (cherokee_buffer_t *hostname, struct addrinfo **addr);
ret_t cherokee_gethostname (cherokee_buffer_t *buf);
ret_t cherokee_syslog (int priority, cherokee_buffer_t *buf);
ret_t cherokee_getpwnam (const char *name, struct passwd *pwbuf, char *buf, size_t buflen);
ret_t cherokee_getpwuid (uid_t uid, struct passwd *pwbuf, char *buf, size_t buflen);
ret_t cherokee_getpwnam_uid (const char *name, struct passwd *pwbuf, char *buf, size_t buflen);
ret_t cherokee_getgrnam (const char *name, struct group *pwbuf, char *buf, size_t buflen);
ret_t cherokee_getgrgid (gid_t gid, struct group *pwbuf, char *buf, size_t buflen);
ret_t cherokee_getgrnam_gid (const char *name, struct group *pwbuf, char *buf, size_t buflen);
ret_t cherokee_mkstemp (cherokee_buffer_t *buffer, int *fd);
ret_t cherokee_mkdtemp (char *template);
ret_t cherokee_mkdir (const char *path, int mode);
ret_t cherokee_mkdir_p (cherokee_buffer_t *path, int mode);
ret_t cherokee_mkdir_p_perm (cherokee_buffer_t *dir_path, int create_mode, int ensure_perm);
ret_t cherokee_rm_rf (cherokee_buffer_t *path, uid_t uid);
void cherokee_random_seed (void);
long cherokee_random (void);
ret_t cherokee_ntop (int family, struct sockaddr *addr, char *dst, size_t cnt);
ret_t cherokee_wait_pid (int pid, int *retcode);
ret_t cherokee_reset_signals (void);
ret_t cherokee_io_stat (cherokee_iocache_t *iocache,
cherokee_buffer_t *path,
cherokee_boolean_t useit,
struct stat *info_space,
cherokee_iocache_entry_t **io_entry,
struct stat **info);
/* File descriptors
*/
ret_t cherokee_fd_set_nonblocking (int fd, cherokee_boolean_t enable);
ret_t cherokee_fd_set_nodelay (int fd, cherokee_boolean_t enable);
ret_t cherokee_fd_set_closexec (int fd);
ret_t cherokee_fd_set_reuseaddr (int fd);
ret_t cherokee_fd_close (int fd);
/* Misc
*/
ret_t cherokee_sys_fdlimit_get (cuint_t *limit);
ret_t cherokee_sys_fdlimit_set (cuint_t limit);
ret_t cherokee_get_shell (const char **shell, const char **binary);
ret_t cherokee_tmp_dir_copy (cherokee_buffer_t *buffer);
/* IO vectors
*/
ret_t cherokee_iovec_skip_sent (struct iovec orig[], uint16_t orig_len,
struct iovec dest[], uint16_t *dest_len,
size_t sent);
ret_t cherokee_iovec_was_sent (struct iovec orig[], uint16_t orig_len, size_t sent);
/* Debug
*/
void cherokee_trace (const char *entry, const char *file, int line, const char *func, const char *fmt, ...);
/* Path management
*/
ret_t cherokee_path_short (cherokee_buffer_t *path);
ret_t cherokee_path_arg_eval (cherokee_buffer_t *path);
/* Path walking
*/
ret_t cherokee_split_pathinfo (cherokee_buffer_t *path,
cuint_t init_pos,
int allow_dirs,
char **pathinfo,
int *pathinfo_len);
ret_t cherokee_split_arguments (cherokee_buffer_t *request,
int init_pos,
char **arguments,
int *arguments_len);
ret_t cherokee_parse_query_string (cherokee_buffer_t *qstring,
cherokee_avl_t *arguments);
char *cherokee_header_get_next_line (char *line);
ret_t cherokee_header_del_entry (cherokee_buffer_t *header,
const char *header_name,
int header_name_len);
CHEROKEE_END_DECLS
#endif /* CHEROKEE_UTIL_H */
|