src/server/nsapi.h

changeset 9
30e51941a673
parent 8
f4d56bf9de40
equal deleted inserted replaced
8:f4d56bf9de40 9:30e51941a673
830 typedef struct conf_global_vars_s conf_global_vars_s; 830 typedef struct conf_global_vars_s conf_global_vars_s;
831 struct conf_global_vars_s { 831 struct conf_global_vars_s {
832 832
833 /* What port we listen to */ 833 /* What port we listen to */
834 int Vport; /* OBSOLETE */ 834 int Vport; /* OBSOLETE */
835 #define server_portnum conf_getglobals()->Vport 835 #define server_portnum 80
836 836
837 /* What address to bind to */ 837 /* What address to bind to */
838 char *Vaddr; /* OBSOLETE */ 838 char *Vaddr; /* OBSOLETE */
839 839
840 /* User to run as */ 840 /* User to run as */
861 int Vpool_minthreads; /* OBSOLETE */ 861 int Vpool_minthreads; /* OBSOLETE */
862 862
863 char *Vsecure_keyfn; /* OBSOLETE */ 863 char *Vsecure_keyfn; /* OBSOLETE */
864 char *Vsecure_certfn; /* OBSOLETE */ 864 char *Vsecure_certfn; /* OBSOLETE */
865 865
866 #define security_active conf_getglobals()->Vsecurity_active 866 #define security_active 0
867 int Vsecurity_active; 867 int Vsecurity_active;
868 int Vssl3_active; /* OBSOLETE */ 868 int Vssl3_active; /* OBSOLETE */
869 int Vssl2_active; /* OBSOLETE */ 869 int Vssl2_active; /* OBSOLETE */
870 int Vsecure_auth; /* OBSOLETE */ 870 int Vsecure_auth; /* OBSOLETE */
871 int Vsecurity_session_timeout; 871 int Vsecurity_session_timeout;
872 long Vssl3_session_timeout; 872 long Vssl3_session_timeout;
873 873
874 /* The server's hostname as should be reported in self-ref URLs */ 874 /* The server's hostname as should be reported in self-ref URLs */
875 #define server_hostname conf_getglobals()->Vserver_hostname 875 #define server_hostname "x4"
876 char *Vserver_hostname; 876 char *Vserver_hostname;
877 877
878 /* The main object from which all are derived */ 878 /* The main object from which all are derived */
879 #define root_object conf_getglobals()->Vroot_object 879 #define root_object conf_getglobals()->Vroot_object
880 char *Vroot_object; 880 char *Vroot_object;
1063 1063
1064 1064
1065 /* --- End type definitions --- */ 1065 /* --- End type definitions --- */
1066 1066
1067 /* --- Begin dispatch vector table definition --- */ 1067 /* --- Begin dispatch vector table definition --- */
1068
1069 typedef struct nsapi_dispatch_s nsapi_dispatch_t;
1070 struct nsapi_dispatch_s {
1071 char *(*f_system_version)();
1072 void *(*f_system_malloc)(int size);
1073 void *(*f_system_calloc)(int size);
1074 void *(*f_system_realloc)(void *ptr, int size);
1075 void (*f_system_free)(void *ptr);
1076 char *(*f_system_strdup)(const char *ptr);
1077 void *(*f_system_malloc_perm)(int size);
1078 void *(*f_system_calloc_perm)(int size);
1079 void *(*f_system_realloc_perm)(void *ptr, int size);
1080 void (*f_system_free_perm)(void *ptr);
1081 char *(*f_system_strdup_perm)(const char *ptr);
1082 int (*f_getThreadMallocKey)(void);
1083 void (*f_magnus_atrestart)(void (*fn)(void *), void *data);
1084 filebuf_t *(*f_filebuf_open)(SYS_FILE fd, int sz);
1085 netbuf *(*f_netbuf_open)(SYS_NETFD sd, int sz);
1086 filebuf_t *(*f_filebuf_create)(SYS_FILE fd, caddr_t mmap_ptr,
1087 int mmap_len, int bufsz);
1088 void (*f_filebuf_close_buffer)(filebuf_t *buf, int clean_mmap);
1089 filebuf_t *(*f_filebuf_open_nostat)(SYS_FILE fd, int sz,
1090 struct stat *finfo);
1091 #ifdef XP_WIN32
1092 filebuf_t *(*f_pipebuf_open)(SYS_FILE fd, int sz, struct stat *finfo);
1093 #else
1094 void *(*f_pipebuf_open)(void);
1095 #endif /* XP_WIN32 */
1096 int (*f_filebuf_next)(void);
1097 int (*f_netbuf_next)(netbuf *buf, int advance);
1098 #ifdef XP_WIN32
1099 int (*f_pipebuf_next)(filebuf_t *buf, int advance);
1100 #else
1101 int (*f_pipebuf_next)(void);
1102 #endif /* XP_WIN32 */
1103 void (*f_filebuf_close)(filebuf_t *buf);
1104 void (*f_netbuf_close)(netbuf *buf);
1105 #ifdef XP_WIN32
1106 void (*f_pipebuf_close)(filebuf_t *buf);
1107 #else
1108 void (*f_pipebuf_close)(void);
1109 #endif /* XP_WIN32 */
1110 int (*f_filebuf_grab)(filebuf_t *buf, int sz);
1111 int (*f_netbuf_grab)(netbuf *buf, int sz);
1112 #ifdef XP_WIN32
1113 int (*f_pipebuf_grab)(filebuf_t *buf, int sz);
1114 #else
1115 int (*f_pipebuf_grab)(void);
1116 #endif /* XP_WIN32 */
1117 int (*f_netbuf_buf2sd)(netbuf *buf, SYS_NETFD sd, int len);
1118 int (*f_filebuf_buf2sd)(filebuf_t *buf, SYS_NETFD sd);
1119 #ifdef XP_WIN32
1120 int (*f_pipebuf_buf2sd)(filebuf_t *buf, SYS_NETFD sd, int len);
1121 int (*f_pipebuf_netbuf2sd)(netbuf *buf, SYS_FILE sd, int len);
1122 int (*f_pipebuf_netbuf2pipe)(netbuf *buf, SYS_NETFD sd, int len);
1123 #else
1124 int (*f_pipebuf_buf2sd)(void);
1125 int (*f_pipebuf_netbuf2sd)(void);
1126 int (*f_pipebuf_netbuf2pipe)(void);
1127 #endif /* XP_WIN32 */
1128 void (*f_cinfo_init)(void);
1129 void (*f_cinfo_terminate)(void);
1130 char *(*f_cinfo_merge)(char *fn);
1131 cinfo *(*f_cinfo_find)(char *uri);
1132 cinfo *(*f_cinfo_lookup)(char *type);
1133 void (*f_cinfo_dump_database)(FILE *dump);
1134 CRITICAL (*f_crit_init)(void);
1135 void (*f_crit_enter)(CRITICAL id);
1136 void (*f_crit_exit)(CRITICAL id);
1137 void (*f_crit_terminate)(CRITICAL id);
1138 CONDVAR (*f_condvar_init)(CRITICAL id);
1139 void (*f_condvar_wait)(CONDVAR cv);
1140 void (*f_condvar_notify)(CONDVAR cv);
1141 void (*f_condvar_notifyAll)(CONDVAR cv);
1142 void (*f_condvar_terminate)(CONDVAR cv);
1143 COUNTING_SEMAPHORE (*f_cs_init)(int initial_count);
1144 void (*f_cs_terminate)(COUNTING_SEMAPHORE csp);
1145 int (*f_cs_wait)(COUNTING_SEMAPHORE csp);
1146 int (*f_cs_trywait)(COUNTING_SEMAPHORE csp);
1147 int (*f_cs_release)(COUNTING_SEMAPHORE csp);
1148 void (*f_daemon_atrestart)(void (*fn)(void *), void *data);
1149 /* Obsolete: servssl_init() */
1150 void (*f_servssl_init)(void);
1151 int (*f_ereport)(int degree, const char *fmt, ...);
1152 int (*f_ereport_v)(int degree, const char *fmt, va_list args);
1153 char *(*f_ereport_init)(const char *err_fn, const char *email,
1154 struct passwd *pwuser, const char *version,
1155 int restart);
1156 void (*f_ereport_terminate)(void);
1157 SYS_FILE (*f_ereport_getfd)(void);
1158 SYS_FILE (*f_system_fopenRO)(const char *path);
1159 SYS_FILE (*f_system_fopenWA)(const char *path);
1160 SYS_FILE (*f_system_fopenRW)(const char *path);
1161 SYS_FILE (*f_system_fopenWT)(const char *path);
1162 int (*f_system_fread)(SYS_FILE fd, void *buf, int sz);
1163 int (*f_system_fwrite)(SYS_FILE fd, const void *buf,int sz);
1164 int (*f_system_fwrite_atomic)(SYS_FILE fd, const void *buf, int sz);
1165 int (*f_system_lseek)(SYS_FILE fd, int off, int wh);
1166 int (*f_system_fclose)(SYS_FILE fd);
1167 int (*f_system_stat)(const char *name, struct stat *finfo);
1168 int (*f_system_rename)(const char *oldpath, const char *newpath);
1169 int (*f_system_unlink)(const char *path);
1170 int (*f_system_tlock)(SYS_FILE fd);
1171 int (*f_system_flock)(SYS_FILE fd);
1172 int (*f_system_ulock)(SYS_FILE fd);
1173 #ifdef XP_WIN32
1174 SYS_DIR (*f_dir_open)(const char *path);
1175 SYS_DIRENT *(*f_dir_read)(SYS_DIR ds);
1176 void (*f_dir_close)(SYS_DIR ds);
1177 #else
1178 void *(*f_dir_open)(void);
1179 void *(*f_dir_read)(void);
1180 void (*f_dir_close)(void);
1181 #endif /* XP_WIN32 */
1182 int (*f_dir_create_all)(char *dir);
1183 #ifdef XP_WIN32
1184 void *(*f_system_winsockerr)(void);
1185 void *(*f_system_winerr)(void);
1186 int (*f_system_pread)(SYS_FILE fd, void *buf, int sz);
1187 int (*f_system_pwrite)(SYS_FILE fd, const void *buf, int sz);
1188 void (*f_file_unix2local)(const char *path, char *p2);
1189 #else
1190 void *(*f_system_winsockerr)(void);
1191 void *(*f_system_winerr)(void);
1192 int (*f_system_pread)(void);
1193 int (*f_system_pwrite)(void);
1194 void (*f_file_unix2local)(void);
1195 #endif /* XP_WIN32 */
1196 int (*f_system_nocoredumps)(void);
1197 int (*f_file_setinherit)(SYS_FILE fd, int value);
1198 int (*f_file_notfound)(void);
1199 char *(*f_system_errmsg)(void);
1200 int (*f_system_errmsg_fn)(char **buff, size_t maxlen);
1201 SYS_NETFD (*f_net_socket)(int domain, int type, int protocol);
1202 int (*f_net_listen)(SYS_NETFD s, int backlog);
1203 SYS_NETFD (*f_net_create_listener)(const char *ipaddr, int port);
1204 int (*f_net_connect)(SYS_NETFD s, const void *sockaddr, int namelen);
1205 int (*f_net_getpeername)(SYS_NETFD s, struct sockaddr *name, int *namelen);
1206 int (*f_net_close)(SYS_NETFD s);
1207 int (*f_net_bind)(SYS_NETFD s, const struct sockaddr *name, int namelen);
1208 SYS_NETFD (*f_net_accept)(SYS_NETFD s, struct sockaddr *addr, int *addrlen);
1209 int (*f_net_read)(SYS_NETFD sd, void *buf, int sz, int timeout);
1210 int (*f_net_write)(SYS_NETFD sd, const void *buf, int sz);
1211 int (*f_net_writev)(SYS_NETFD sd, const NSAPIIOVec *iov, int iovlen);
1212 int (*f_net_isalive)(SYS_NETFD sd);
1213 char *(*f_net_ip2host)(const char *ip, int verify);
1214 int (*f_net_getsockopt)(SYS_NETFD s, int level, int optname,
1215 void *optval, int *optlen);
1216 int (*f_net_setsockopt)(SYS_NETFD s, int level, int optname,
1217 const void *optval, int optlen);
1218 int (*f_net_select)(int nfds, fd_set *r, fd_set *w, fd_set *e,
1219 struct timeval *timeout);
1220 int (*f_net_ioctl)(SYS_NETFD s, int tag, void *result);
1221 pb_param *(*f_param_create)(const char *name, const char *value);
1222 int (*f_param_free)(pb_param *pp);
1223 pblock *(*f_pblock_create)(int n);
1224 void (*f_pblock_free)(pblock *pb);
1225 char *(*f_pblock_findval)(const char *name, const pblock *pb);
1226 pb_param *(*f_pblock_nvinsert)(const char *name, const char *value, pblock *pb);
1227 pb_param *(*f_pblock_nninsert)(const char *name, int value, pblock *pb);
1228 void (*f_pblock_pinsert)(pb_param *pp, pblock *pb);
1229 int (*f_pblock_str2pblock)(const char *str, pblock *pb);
1230 char *(*f_pblock_pblock2str)(const pblock *pb, char *str);
1231 int (*f_pblock_copy)(const pblock *src, pblock *dst);
1232 pblock *(*f_pblock_dup)(const pblock *src);
1233 char **(*f_pblock_pb2env)(const pblock *pb, char **env);
1234 pb_param *(*f_pblock_fr)(const char *name, pblock *pb, int remove);
1235 char * (*f_pblock_replace)(const char *name,char * new_value,pblock *pb);
1236 pool_handle_t *(*f_pool_create)(void);
1237 void (*f_pool_destroy)(pool_handle_t *pool_handle);
1238 int (*f_pool_enabled)(void);
1239 void *(*f_pool_malloc)(pool_handle_t *pool_handle, size_t size );
1240 void (*f_pool_free)(pool_handle_t *pool_handle, void *ptr );
1241 void *(*f_pool_calloc)(pool_handle_t *pool_handle, size_t nelem, size_t elsize);
1242 void *(*f_pool_realloc)(pool_handle_t *pool_handle, void *ptr, size_t size );
1243 char *(*f_pool_strdup)(pool_handle_t *pool_handle, const char *orig_str );
1244 int (*f_regexp_valid)(const char *exp);
1245 int (*f_regexp_match)(const char *str, const char *exp);
1246 int (*f_regexp_cmp)(const char *str, const char *exp);
1247 int (*f_regexp_casecmp)(const char *str, const char *exp);
1248 SEMAPHORE (*f_sem_init)(char *name, int number);
1249 void (*f_sem_terminate)(SEMAPHORE id);
1250 int (*f_sem_grab)(SEMAPHORE id);
1251 int (*f_sem_tgrab)(SEMAPHORE id);
1252 int (*f_sem_release)(SEMAPHORE id);
1253 Session *(*f_session_alloc)(SYS_NETFD csd, struct sockaddr_in *sac); /* internal */
1254 Session *(*f_session_fill)(Session *sn); /* internal */
1255 Session *(*f_session_create)(SYS_NETFD csd, struct sockaddr_in *sac);
1256 void (*f_session_free)(Session *sn);
1257 char *(*f_session_dns_lookup)(Session *sn, int verify);
1258 int (*f_shexp_valid)(const char *exp);
1259 int (*f_shexp_match)(const char *str, const char *exp);
1260 int (*f_shexp_cmp)(const char *str, const char *exp);
1261 int (*f_shexp_casecmp)(const char *str, const char *exp);
1262 shmem_s *(*f_shmem_alloc)(char *name, int size, int expose);
1263 void (*f_shmem_free)(shmem_s *region);
1264 SYS_THREAD (*f_systhread_start)(int prio, int stksz, void (*fn)(void *), void *arg);
1265 SYS_THREAD (*f_systhread_current)(void);
1266 void (*f_systhread_yield)(void);
1267 SYS_THREAD (*f_systhread_attach)(void);
1268 void (*f_systhread_detach)(SYS_THREAD thr);
1269 void (*f_systhread_terminate)(SYS_THREAD thr);
1270 void (*f_systhread_sleep)(int milliseconds);
1271 void (*f_systhread_init)(char *name);
1272 void (*f_systhread_timerset)(int usec);
1273 int (*f_systhread_newkey)(void);
1274 void *(*f_systhread_getdata)(int key);
1275 void (*f_systhread_setdata)(int key, void *data);
1276 void (*f_systhread_set_default_stacksize)(unsigned long size);
1277 int (*f_util_getline)(filebuffer *buf, int lineno, int maxlen, char *l);
1278 char **(*f_util_env_create)(char **env, int n, int *pos);
1279 char *(*f_util_env_str)(const char *name, const char *value);
1280 void (*f_util_env_replace)(char **env, const char *name, const char *value);
1281 void (*f_util_env_free)(char **env);
1282 char **(*f_util_env_copy)(char **src, char **dst);
1283 char *(*f_util_env_find)(char **env, const char *name);
1284 char *(*f_util_hostname)(void);
1285 int (*f_util_chdir2path)(char *path);
1286 int (*f_util_is_mozilla)(char *ua, char *major, char *minor);
1287 int (*f_util_is_url)(const char *url);
1288 int (*f_util_later_than)(const struct tm *lms, const char *ims);
1289 int (*f_util_time_equal)(const struct tm *lms, const char *ims);
1290 int (*f_util_str_time_equal)(const char *t1, const char *t2);
1291 int (*f_util_uri_is_evil)(const char *t);
1292 void (*f_util_uri_parse)(char *uri);
1293 void (*f_util_uri_unescape)(char *s);
1294 char *(*f_util_uri_escape)(char *d, const char *s);
1295 char *(*f_util_url_escape)(char *d, const char *s);
1296 char *(*f_util_sh_escape)(char *s);
1297 int (*f_util_mime_separator)(char *sep);
1298 int (*f_util_itoa)(int i, char *a);
1299 int (*f_util_vsprintf)(char *s, register const char *fmt, va_list args);
1300 int (*f_util_sprintf)(char *s, const char *fmt, ...);
1301 int (*f_util_vsnprintf)(char *s, int n, register const char *fmt,
1302 va_list args);
1303 int (*f_util_snprintf)(char *s, int n, const char *fmt, ...);
1304 int (*f_util_strftime)(char *s, const char *format, const struct tm *t);
1305 char *(*f_util_strtok)(char *s1, const char *s2, char **lasts);
1306 struct tm *(*f_util_localtime)(const time_t *clock, struct tm *res);
1307 char *(*f_util_ctime)(const time_t *clock, char *buf, int buflen);
1308 char *(*f_util_strerror)(int errnum, char *msg, int buflen);
1309 struct tm *(*f_util_gmtime)(const time_t *clock, struct tm *res);
1310 char *(*f_util_asctime)(const struct tm *tm,char *buf, int buflen);
1311 #ifdef NEED_STRCASECMP
1312 int (*f_util_strcasecmp)(const char *one, const char *two);
1313 #else
1314 int (*f_util_strcasecmp)(void);
1315 #endif /* NEED_STRCASECMP */
1316 #ifdef NEED_STRNCASECMP
1317 int (*f_util_strncasecmp)(const char *one, const char *two, int n);
1318 #else
1319 int (*f_util_strncasecmp)(void);
1320 #endif /* NEED_STRNCASECMP */
1321 #ifdef XP_UNIX
1322 int (*f_util_can_exec)(struct stat *finfo, uid_t uid, gid_t gid);
1323 struct passwd *(*f_util_getpwnam)(const char *name, struct passwd
1324 *result, char *buffer, int buflen);
1325 pid_t (*f_util_waitpid)(pid_t pid, int *statptr, int options);
1326 #else
1327 int (*f_util_can_exec)(void);
1328 void *(*f_util_getpwnam)(void);
1329 int (*f_util_waitpid)(void);
1330 #endif /* XP_UNIX */
1331 #ifdef XP_WIN32
1332 VOID (*f_util_delete_directory)(char *FileName, BOOL delete_directory);
1333 #else
1334 void (*f_util_delete_directory)(void);
1335 #endif /* XP_WIN32 */
1336 void *(*f_conf_init)(void);
1337 void *(*f_conf_run_init_functions)(void);
1338 void (*f_conf_terminate)(void);
1339 conf_global_vars_s *(*f_conf_getglobals)(void);
1340 void (*f_func_init)(struct FuncStruct *func_standard);
1341 FuncPtr (*f_func_find)(char *name);
1342 int (*f_func_exec)(pblock *pb, Session *sn, Request *rq);
1343 struct FuncStruct *(*f_func_insert)(char *name, FuncPtr fn);
1344 int (*f_object_execute)(directive *inst, Session *sn, Request *rq);
1345 void *(*f_http_find_request)(void);
1346 int (*f_http_parse_request)(char *t, Request *rq, Session *sn);
1347 int (*f_http_scan_headers)(void);
1348 int (*f_http_start_response)(Session *sn, Request *rq);
1349 char **(*f_http_hdrs2env)(pblock *pb);
1350 void (*f_http_status)(Session *sn, Request *rq, int n, const char *r);
1351 int (*f_http_set_finfo)(Session *sn, Request *rq, struct stat *finfo);
1352 char *(*f_http_dump822)(pblock *pb, char *t, int *pos, int tsz);
1353 void (*f_http_finish_request)(Session *sn, Request *rq);
1354 void (*f_http_handle_session)(void);
1355 char *(*f_http_uri2url)(const char *prefix, const char *suffix);
1356 char *(*f_http_uri2url_dynamic)(const char *prefix, const char *suffix,
1357 Session *sn, Request *rq);
1358 void (*f_http_set_keepalive_timeout)(int secs);
1359 int (*f_log_error_v)(int degree, const char *func, Session *sn,
1360 Request *rq, const char *fmt, va_list args);
1361 int (*f_log_error)(int degree, const char *func, Session *sn, Request *rq,
1362 const char *fmt, ...);
1363 int (*f_log_ereport_v)(int degree, const char *fmt, va_list args);
1364 int (*f_log_ereport)(int degree, const char *fmt, ...);
1365 httpd_object *(*f_object_create)(int nd, pblock *name);
1366 void (*f_object_free)(httpd_object *obj);
1367 void (*f_object_add_directive)(int dc, pblock *p, pblock *c,
1368 httpd_object *obj);
1369 httpd_objset *(*f_objset_scan_buffer)(filebuffer *buf, char *errstr,
1370 httpd_objset *os);
1371 httpd_objset *(*f_objset_create)(void);
1372 void (*f_objset_free)(httpd_objset *os);
1373 void (*f_objset_free_setonly)(httpd_objset *os);
1374 httpd_object *(*f_objset_new_object)(pblock *name, httpd_objset *os);
1375 void (*f_objset_add_object)(httpd_object *obj, httpd_objset *os);
1376 void (*f_objset_add_init)(pblock *initfn, httpd_objset *os);
1377 httpd_object *(*f_objset_findbyname)(const char *name, httpd_objset *ign,
1378 httpd_objset *os);
1379 httpd_object *(*f_objset_findbyppath)(char *ppath, httpd_objset *ign,
1380 httpd_objset *os);
1381 Request *(*f_request_create)(void);
1382 void (*f_request_free)(Request *req);
1383 Request *(*f_request_restart_internal)(const char *uri, Request *rq);
1384 int (*f_request_header)(char *name, char **value, Session *sn,
1385 Request *rq);
1386 struct stat *(*f_request_stat_path)(const char *path, Request *rq);
1387 const char *(*f_conf_getServerString)(void);
1388 FuncPtr (*f_func_replace)(char *funcname, FuncPtr fn);
1389 int (*f_net_socketpair)(SYS_NETFD *pair);
1390 #ifdef XP_UNIX
1391 SYS_NETFD (*f_net_dup2)(SYS_NETFD prfd, int osfd);
1392 int (*f_net_is_STDOUT)(SYS_NETFD prfd);
1393 int (*f_net_is_STDIN)(SYS_NETFD prfd);
1394 #else
1395 void *(*f_net_dup2)(void);
1396 int (*f_net_is_STDOUT)(void);
1397 int (*f_net_is_STDIN)(void);
1398 #endif /* XP_UNIX */
1399 int (*f_func_set_native_thread_flag)(char *name, int flags);
1400 #ifdef NET_SSL
1401 void *(*f_random_create)(void);
1402 void (*f_random_update)(void *rctx, unsigned char *inbuf, int length);
1403 void (*f_random_generate)(void *rctx, unsigned char *outbuf, int length);
1404 void (*f_random_destroy)(void *rctx);
1405 void *(*f_md5hash_create)(void);
1406 void *(*f_md5hash_copy)(void *hctx);
1407 void (*f_md5hash_begin)(void *hctx);
1408 void (*f_md5hash_update)(void *hctx, unsigned char *inbuf, int length);
1409 void (*f_md5hash_end)(void *hctx, unsigned char *outbuf);
1410 void (*f_md5hash_destroy)(void *hctx);
1411 void (*f_md5hash_data)(unsigned char *outbuf, unsigned char *src, int length);
1412 #else
1413 void *(*f_random_create)(void);
1414 void (*f_random_update)(void);
1415 void (*f_random_generate)(void);
1416 void (*f_random_destroy)(void);
1417 void *(*f_md5hash_create)(void);
1418 void *(*f_md5hash_copy)(void);
1419 void (*f_md5hash_begin)(void);
1420 void (*f_md5hash_update)(void);
1421 void (*f_md5hash_end)(void);
1422 void (*f_md5hash_destroy)(void);
1423 void (*f_md5hash_data)(void);
1424 #endif
1425 int (*f_ACL_SetupEval)(struct ACLListHandle *acllist, Session *sn, Request *rq, char **rights, char **map_generic, const char *user);
1426 int (*f_netbuf_getbytes)(netbuf *buf, char *buffer, int size);
1427 char *(*f_servact_translate_uri)(char *uri, Session *sn);
1428 #ifdef NET_SSL
1429 int (*f_rsa_set_priv_fn)(void *);
1430 #else
1431 int (*f_rsa_set_priv_fn)(void);
1432 #endif
1433 #ifdef XP_UNIX
1434 int (*f_net_native_handle)(SYS_NETFD s);
1435 #else
1436 HANDLE (*f_net_native_handle)(SYS_NETFD s);
1437 #endif /* XP_UNIX */
1438 int (*f_internal_request)(Request *rq);
1439 char *(*f_util_cookie_find)(char *cookie, const char *name);
1440 char *(*f_util_cookie_next)(char *cookie, char **name, char **value);
1441 char *(*f_util_cookie_next_av_pair)(char *cookie, char **name, char **value);
1442 int (*f_objset_get_number_objects)(const httpd_objset *objset);
1443 const httpd_object *(*f_objset_get_object)(const httpd_objset *objset, int pos);
1444 const pblock * const *(*f_objset_get_initfns)(const httpd_objset *objset);
1445 const pblock *(*f_object_get_name)(const httpd_object *object);
1446 int (*f_object_get_num_directives)(const httpd_object *object);
1447 const dtable *(*f_object_get_directive_table)(const httpd_object *object, int n);
1448 int (*f_directive_table_get_num_directives)(const dtable *dt);
1449 const directive *(*f_directive_table_get_directive)(const dtable *dt, int pos);
1450 const pblock *(*f_directive_get_pblock)(const directive *);
1451 const FuncStruct *(*f_directive_get_funcstruct)(const directive *);
1452 const pblock *(*f_directive_get_client_pblock)(const directive *);
1453 #if NSAPI_VERSION >= 301
1454 int (*f_vs_register_cb)(VSInitFunc *vs_init_func, VSDestroyFunc *vs_destroy_func);
1455 const char* (*f_vs_get_id)(const VirtualServer *vs);
1456 const char* (*f_vs_lookup_config_var)(const VirtualServer *vs, const char *name);
1457 int (*f_vs_alloc_slot)(void);
1458 void* (*f_vs_set_data)(const VirtualServer *vs, int *slot, void *data);
1459 void* (*f_vs_get_data)(const VirtualServer *vs, int slot);
1460 const VirtualServer* (*f_request_get_vs)(Request *rq);
1461 httpd_objset* (*f_vs_get_httpd_objset)(VirtualServer *vs);
1462 httpd_object* (*f_vs_get_default_httpd_object)(VirtualServer *vs);
1463 char* (*f_vs_get_doc_root)(const VirtualServer *vs);
1464 char* (*f_vs_translate_uri)(const VirtualServer *vs, const char *uri);
1465 char* (*f_vs_get_mime_type)(const VirtualServer *vs, const char *uri);
1466 int (*f_vs_is_default_vs)(const VirtualServer *vs);
1467 void *(*f_vs_get_acllist)(const VirtualServer *vs);
1468 void (*f_vs_set_acllist)(VirtualServer *vs, void *acllist);
1469 int (*f_file_is_path_abs)(const char *path);
1470 char* (*f_file_canonicalize_path)(const char* path);
1471 int (*f_file_are_files_distinct)(SYS_FILE fd1, SYS_FILE fd2);
1472 int (*f_vs_directive_register_cb)(FuncPtr func, VSDirectiveInitFunc *vs_init_func, VSDirectiveDestroyFunc *vs_destroy_func);
1473 char* (*f_vs_substitute_vars)(const VirtualServer *vs, const char *string);
1474 const char *(*f_conf_getfilename)(void);
1475 const char *(*f_conf_getstring)(const char *name, const char *def);
1476 int (*f_conf_getboolean)(const char *name, int def);
1477 int (*f_conf_getinteger)(const char *name, int def);
1478 int (*f_conf_getboundedinteger)(const char *name, int min, int max, int def);
1479 void (*f_prepare_nsapi_thread)(Request *rq, Session *sn);
1480 #endif /* NSAPI_VERSION >= 301 */
1481 };
1482
1483 #if NSAPI_VERSION >= 302
1484 typedef struct nsapi302_dispatch_s nsapi302_dispatch_t;
1485 struct nsapi302_dispatch_s {
1486 int (*f_net_flush)(SYS_NETFD sd);
1487 int (*f_net_sendfile)(SYS_NETFD sd, sendfiledata *sfd);
1488 const Filter *(*f_filter_create)(const char *name, int order, const FilterMethods *methods);
1489 const char *(*f_filter_name)(const Filter *filter);
1490 const Filter *(*f_filter_find)(const char *name);
1491 FilterLayer *(*f_filter_layer)(SYS_NETFD sd, const Filter *filter);
1492 int (*f_filter_insert)(SYS_NETFD sd, pblock *pb, Session *sn, Request *rq, void *data, const Filter *filter);
1493 int (*f_filter_remove)(SYS_NETFD sd, const Filter *filter);
1494 SYS_NETFD (*f_filter_create_stack)(Session *sn);
1495 };
1496 #endif /* NSAPI_VERSION >= 302 */
1497
1498 #if NSAPI_VERSION >= 303
1499 typedef struct nsapi303_dispatch_s nsapi303_dispatch_t;
1500 struct hostent;
1501 struct nsapi303_dispatch_s {
1502 int (*f_dns_set_hostent)(struct hostent *he, Session *sn, Request *rq);
1503 };
1504 #endif /* NSAPI_VERSION >= 303 */
1505
1506 /* --- End dispatch vector table definition --- */ 1068 /* --- End dispatch vector table definition --- */
1507 1069
1508 /* --- Begin API macro definitions --- */ 1070 /* --- Begin API macro definitions --- */
1509 1071
1510 #ifndef INTNSAPI 1072 #ifndef INTNSAPI
1586 * session_maxdns looks up a hostname from an IP address, and then verifies 1148 * session_maxdns looks up a hostname from an IP address, and then verifies
1587 * that the host is really who they claim to be. 1149 * that the host is really who they claim to be.
1588 */ 1150 */
1589 #define session_maxdns(sn) session_dns_lookup(sn, 1) 1151 #define session_maxdns(sn) session_dns_lookup(sn, 1)
1590 1152
1153
1154 /* nsapi functions */
1155
1156 ssize_t net_write(SYS_NETFD fd, void *buf, size_t nbytes);
1157
1158 NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value);
1159
1160 NSAPI_PUBLIC int INTparam_free(pb_param *pp);
1161
1162 NSAPI_PUBLIC pblock *INTpblock_create(int n);
1163
1164 NSAPI_PUBLIC void INTpblock_free(pblock *pb);
1165
1166 NSAPI_PUBLIC char *INTpblock_findval(const char *name, const pblock *pb);
1167
1168 NSAPI_PUBLIC pb_param *INTpblock_nvinsert(const char *name, const char *value, pblock *pb);
1169
1170 NSAPI_PUBLIC pb_param *pblock_nvlinsert(const char *name, int namelen, const char *value, int valuelen, pblock *pb);
1171
1172 NSAPI_PUBLIC pb_param *INTpblock_nninsert(const char *name, int value, pblock *pb);
1173
1174 NSAPI_PUBLIC void INTpblock_pinsert(pb_param *pp, pblock *pb);
1175
1176 NSAPI_PUBLIC int INTpblock_str2pblock(const char *str, pblock *pb);
1177
1178 NSAPI_PUBLIC char *INTpblock_pblock2str(const pblock *pb, char *str);
1179
1180 NSAPI_PUBLIC int INTpblock_copy(const pblock *src, pblock *dst);
1181
1182 NSAPI_PUBLIC pblock *INTpblock_dup(const pblock *src);
1183
1184 NSAPI_PUBLIC char **INTpblock_pb2env(const pblock *pb, char **env);
1185
1186 NSAPI_PUBLIC void pblock_nvreplace (const char *name, const char *value, pblock *pb);
1187
1188 NSAPI_PUBLIC pb_param *pblock_param_create(pblock *pb, const char *name, const char *value);
1189
1190 NSAPI_PUBLIC pblock *pblock_create_pool(pool_handle_t *pool_handle, int n);
1191
1192 NSAPI_PUBLIC pb_param *INTpblock_fr(const char *name, pblock *pb, int remove);
1193
1194 NSAPI_PUBLIC char *INTpblock_replace(const char *name,char * new_value,pblock *pb);
1195
1196 NSAPI_PUBLIC int INTpblock_str2pblock_lowercasename(const char *str, pblock *pb);
1197
1198 //NSAPI_PUBLIC pb_param *pblock_removeone(pblock *pb);
1199
1200 //NSAPI_PUBLIC const pb_key *pblock_key(const char *name);
1201
1202 //NSAPI_PUBLIC pb_param *pblock_key_param_create(pblock *pb, const pb_key *key, const char *value, int valuelen);
1203
1204 //NSAPI_PUBLIC char *pblock_findkeyval(const pb_key *key, const pblock *pb);
1205
1206 //NSAPI_PUBLIC pb_param *pblock_findkey(const pb_key *key, const pblock *pb);
1207
1208 //NSAPI_PUBLIC pb_param *pblock_removekey(const pb_key *key, pblock *pb);
1209
1210 //NSAPI_PUBLIC pb_param *pblock_kvinsert(const pb_key *key, const char *value, int valuelen, pblock *pb);
1211
1212 //NSAPI_PUBLIC void pblock_kpinsert(const pb_key *key, pb_param *pp, pblock *pb);
1213
1214 //NSAPI_PUBLIC void pblock_kvreplace(const pb_key *key, const char *value, int valuelen, pblock *pb);
1215
1216 //NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb);
1217
1218 //NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, PRInt64 value, pblock *pb);
1219
1220 #define param_create INTparam_create
1221 #define param_free INTparam_free
1222 #define pblock_create INTpblock_create
1223 #define pblock_free INTpblock_free
1224 #define pblock_findval INTpblock_findval
1225 #define pblock_nvinsert INTpblock_nvinsert
1226 #define pblock_nninsert INTpblock_nninsert
1227 #define pblock_pinsert INTpblock_pinsert
1228 #define pblock_str2pblock INTpblock_str2pblock
1229 #define pblock_pblock2str INTpblock_pblock2str
1230 #define pblock_copy INTpblock_copy
1231 #define pblock_dup INTpblock_dup
1232 #define pblock_pb2env INTpblock_pb2env
1233 #define pblock_fr INTpblock_fr
1234 #define pblock_replace INTpblock_replace
1235
1236
1237
1238 void protocol_status(Session *sn, Request *rq, int n, const char *m);
1239
1240 int http_start_response(Session *sn, Request *rq);
1591 #define protocol_start_response http_start_response 1241 #define protocol_start_response http_start_response
1592 #define protocol_status http_status 1242 int request_header(char *name, char **value, Session *sn, Request *rq);
1593 #define protocol_set_finfo http_set_finfo 1243
1594 #define protocol_finish_request http_finish_request 1244 typedef void (*thrstartfunc)(void *);
1595 #define protocol_uri2url http_uri2url 1245 SYS_THREAD INTsysthread_start(int prio, int stksz, thrstartfunc fn, void *arg);
1596 #define protocol_uri2url_dynamic http_uri2url_dynamic 1246 NSAPI_PUBLIC void INTsysthread_sleep(int milliseconds);
1597 1247
1598 #define request_translate_uri servact_translate_uri 1248 #define systhread_start INTsysthread_start
1249 #define systhread_sleep INTsysthread_sleep
1250
1251
1252 void webserver_atrestart(void (*fn)(void *), void *data);
1253 #define magnus_atrestart webserver_atrestart
1254
1255
1256 NSAPI_PUBLIC int INTshexp_match(const char *str, const char *exp);
1257 #define shexp_match INTshexp_match
1258
1259
1260
1261 NSAPI_PUBLIC char *session_dns_lookup(Session *s, int verify);
1262
1599 1263
1600 /* --- OBSOLETE ---------------------------------------------------------- 1264 /* --- OBSOLETE ----------------------------------------------------------
1601 * The following macros/functions are obsolete and are only maintained for 1265 * The following macros/functions are obsolete and are only maintained for
1602 * compatibility. Do not use them. 1266 * compatibility. Do not use them.
1603 * ----------------------------------------------------------------------- 1267 * -----------------------------------------------------------------------
1666 #endif /* NSAPI_VERSION >= 303 */ 1330 #endif /* NSAPI_VERSION >= 303 */
1667 #endif /* INTNSAPI */ 1331 #endif /* INTNSAPI */
1668 1332
1669 #else /* !XP_WIN32 */ 1333 #else /* !XP_WIN32 */
1670 1334
1671 NSAPI_PUBLIC extern nsapi_dispatch_t *__nsapi30_table;
1672 #if NSAPI_VERSION >= 302
1673 NSAPI_PUBLIC extern nsapi302_dispatch_t *__nsapi302_table;
1674 #endif /* NSAPI_VERSION >= 302 */
1675 #if NSAPI_VERSION >= 303
1676 NSAPI_PUBLIC extern nsapi303_dispatch_t *__nsapi303_table;
1677 #endif /* NSAPI_VERSION >= 303 */
1678 1335
1679 #endif /* XP_WIN32 */ 1336 #endif /* XP_WIN32 */
1680 1337
1681 #ifdef __cplusplus 1338 #ifdef __cplusplus
1682 } 1339 }

mercurial