|
|
1.1 ! root 1: /* websrvr.h */ ! 2: ! 3: /* Synchronet Web Server */ ! 4: ! 5: /* $Id: websrvr.h,v 1.31 2004/12/02 09:21:20 rswindell Exp $ */ ! 6: ! 7: /**************************************************************************** ! 8: * @format.tab-size 4 (Plain Text/Source Code File Header) * ! 9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * ! 10: * * ! 11: * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html * ! 12: * * ! 13: * This program is free software; you can redistribute it and/or * ! 14: * modify it under the terms of the GNU General Public License * ! 15: * as published by the Free Software Foundation; either version 2 * ! 16: * of the License, or (at your option) any later version. * ! 17: * See the GNU General Public License for more details: gpl.txt or * ! 18: * http://www.fsf.org/copyleft/gpl.html * ! 19: * * ! 20: * Anonymous FTP access to the most recent released source is available at * ! 21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * ! 22: * * ! 23: * Anonymous CVS access to the development source and modification history * ! 24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: * ! 25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login * ! 26: * (just hit return, no password is necessary) * ! 27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src * ! 28: * * ! 29: * For Synchronet coding style and modification guidelines, see * ! 30: * http://www.synchro.net/source.html * ! 31: * * ! 32: * You are encouraged to submit any modifications (preferably in Unix diff * ! 33: * format) via e-mail to [email protected] * ! 34: * * ! 35: * Note: If this box doesn't appear square, then you need to fix your tabs. * ! 36: ****************************************************************************/ ! 37: ! 38: #ifndef _WEBSRVR_H_ ! 39: #define _WEBSRVR_H_ ! 40: ! 41: #include "client.h" /* client_t */ ! 42: #include "startup.h" /* BBS_OPT_* */ ! 43: #include "semwrap.h" /* sem_t */ ! 44: ! 45: typedef struct { ! 46: DWORD size; /* sizeof(web_startup_t) */ ! 47: WORD port; ! 48: WORD max_clients; ! 49: WORD max_inactivity; ! 50: WORD max_cgi_inactivity; ! 51: WORD sem_chk_freq; /* semaphore file checking frequency (in seconds) */ ! 52: DWORD interface_addr; ! 53: DWORD options; ! 54: DWORD js_max_bytes; ! 55: DWORD js_cx_stack; ! 56: DWORD js_branch_limit; ! 57: DWORD js_yield_interval; ! 58: DWORD js_gc_interval; ! 59: ! 60: void* cbdata; /* Private data passed to callbacks */ ! 61: ! 62: /* Callbacks (NULL if unused) */ ! 63: int (*lputs)(void*, int, char*); ! 64: void (*status)(void*, char*); ! 65: void (*started)(void*); ! 66: void (*recycle)(void*); ! 67: void (*terminated)(void*, int code); ! 68: void (*clients)(void*, int active); ! 69: void (*thread_up)(void*, BOOL up, BOOL setuid); ! 70: void (*socket_open)(void*, BOOL open); ! 71: void (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update); ! 72: BOOL (*seteuid)(BOOL user); ! 73: BOOL (*setuid)(BOOL); ! 74: ! 75: /* Paths */ ! 76: char ssjs_ext[16]; /* Server-Side JavaScript file extension */ ! 77: char js_ext[16]; /* Embedded JavaScript file extension */ ! 78: char** cgi_ext; /* CGI Extensions */ ! 79: char cgi_dir[128]; /* relative to root_dir (all files executable) */ ! 80: char ctrl_dir[128]; ! 81: char root_dir[128]; /* HTML root directory */ ! 82: char error_dir[128]; /* relative to root_dir */ ! 83: char cgi_temp_dir[128]; ! 84: char** index_file_name; /* Index filenames */ ! 85: char logfile_base[128]; /* Logfile base name (date is appended) */ ! 86: char answer_sound[128]; ! 87: char hangup_sound[128]; ! 88: char hack_sound[128]; ! 89: ! 90: /* Misc */ ! 91: char host_name[128]; ! 92: BOOL recycle_now; ! 93: BOOL shutdown_now; ! 94: DWORD log_mask; ! 95: uint bind_retry_count; /* Number of times to retry bind() calls */ ! 96: uint bind_retry_delay; /* Time to wait between each bind() retry */ ! 97: ! 98: } web_startup_t; ! 99: ! 100: #if defined(STARTUP_INIT_FIELD_TABLES) ! 101: /* startup options that requires re-initialization/recycle when changed */ ! 102: static struct init_field web_init_fields[] = { ! 103: OFFSET_AND_SIZE(web_startup_t,port) ! 104: ,OFFSET_AND_SIZE(web_startup_t,interface_addr) ! 105: ,OFFSET_AND_SIZE(web_startup_t,ctrl_dir) ! 106: ,OFFSET_AND_SIZE(web_startup_t,root_dir) ! 107: ,OFFSET_AND_SIZE(web_startup_t,error_dir) ! 108: ,OFFSET_AND_SIZE(web_startup_t,cgi_dir) ! 109: ,OFFSET_AND_SIZE(web_startup_t,logfile_base) ! 110: ,{ 0,0 } /* terminator */ ! 111: }; ! 112: #endif ! 113: ! 114: #define WEB_OPT_DEBUG_RX (1<<0) /* Log all received requests */ ! 115: #define WEB_OPT_DEBUG_TX (1<<1) /* Log all transmitted responses */ ! 116: #define WEB_OPT_VIRTUAL_HOSTS (1<<4) /* Use virutal host html subdirs */ ! 117: #define WEB_OPT_NO_CGI (1<<5) /* Disable CGI support */ ! 118: #define WEB_OPT_HTTP_LOGGING (1<<6) /* Create/write-to HttpLogFile */ ! 119: ! 120: /* web_startup_t.options bits that require re-init/recycle when changed */ ! 121: #define WEB_INIT_OPTS (BBS_OPT_LOCAL_TIMEZONE|WEB_OPT_HTTP_LOGGING) ! 122: ! 123: #if defined(STARTUP_INI_BITDESC_TABLES) ! 124: static ini_bitdesc_t web_options[] = { ! 125: ! 126: { WEB_OPT_DEBUG_RX ,"DEBUG_RX" }, ! 127: { WEB_OPT_DEBUG_TX ,"DEBUG_TX" }, ! 128: { WEB_OPT_VIRTUAL_HOSTS ,"VIRTUAL_HOSTS" }, ! 129: { WEB_OPT_NO_CGI ,"NO_CGI" }, ! 130: { WEB_OPT_HTTP_LOGGING ,"HTTP_LOGGING" }, ! 131: ! 132: /* shared bits */ ! 133: { BBS_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" }, ! 134: { BBS_OPT_NO_RECYCLE ,"NO_RECYCLE" }, ! 135: { BBS_OPT_GET_IDENT ,"GET_IDENT" }, ! 136: { BBS_OPT_NO_JAVASCRIPT ,"NO_JAVASCRIPT" }, ! 137: { BBS_OPT_LOCAL_TIMEZONE ,"LOCAL_TIMEZONE" }, ! 138: { BBS_OPT_MUTE ,"MUTE" }, ! 139: ! 140: /* terminator */ ! 141: { 0 ,NULL } ! 142: }; ! 143: #endif ! 144: ! 145: #define WEB_DEFAULT_ROOT_DIR "../html" ! 146: #define WEB_DEFAULT_ERROR_DIR "error" ! 147: #define WEB_DEFAULT_CGI_DIR "cgi-bin" ! 148: ! 149: #ifdef DLLEXPORT ! 150: #undef DLLEXPORT ! 151: #endif ! 152: #ifdef DLLCALL ! 153: #undef DLLCALL ! 154: #endif ! 155: ! 156: #ifdef _WIN32 ! 157: #ifdef WEBSRVR_EXPORTS ! 158: #define DLLEXPORT __declspec(dllexport) ! 159: #else ! 160: #define DLLEXPORT __declspec(dllimport) ! 161: #endif ! 162: #ifdef __BORLANDC__ ! 163: #define DLLCALL __stdcall ! 164: #else ! 165: #define DLLCALL ! 166: #endif ! 167: #else ! 168: #define DLLEXPORT ! 169: #define DLLCALL ! 170: #endif ! 171: ! 172: #ifdef __cplusplus ! 173: extern "C" { ! 174: #endif ! 175: DLLEXPORT void DLLCALL web_server(void* arg); ! 176: DLLEXPORT void DLLCALL web_terminate(void); ! 177: DLLEXPORT const char* DLLCALL web_ver(void); ! 178: #ifdef __cplusplus ! 179: } ! 180: #endif ! 181: ! 182: #endif /* Don't add anything after this line */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.