|
|
1.1 root 1: /* websrvr.h */
2:
3: /* Synchronet Web Server */
4:
1.1.1.2 ! root 5: /* $Id: websrvr.h,v 1.44 2011/09/01 02:50:16 rswindell Exp $ */
1.1 root 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: * *
1.1.1.2 ! root 11: * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
1.1 root 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:
55: void* cbdata; /* Private data passed to callbacks */
56:
57: /* Callbacks (NULL if unused) */
1.1.1.2 ! root 58: int (*lputs)(void*, int level, const char* msg);
! 59: void (*errormsg)(void*, int level, const char* msg);
! 60: void (*status)(void*, const char*);
1.1 root 61: void (*started)(void*);
62: void (*recycle)(void*);
63: void (*terminated)(void*, int code);
64: void (*clients)(void*, int active);
65: void (*thread_up)(void*, BOOL up, BOOL setuid);
66: void (*socket_open)(void*, BOOL open);
67: void (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
68: BOOL (*seteuid)(BOOL user);
69: BOOL (*setuid)(BOOL);
70:
71: /* Paths */
72: char ssjs_ext[16]; /* Server-Side JavaScript file extension */
73: char js_ext[16]; /* Embedded JavaScript file extension */
74: char** cgi_ext; /* CGI Extensions */
75: char cgi_dir[128]; /* relative to root_dir (all files executable) */
76: char ctrl_dir[128];
77: char root_dir[128]; /* HTML root directory */
78: char error_dir[128]; /* relative to root_dir */
79: char temp_dir[128];
80: char** index_file_name; /* Index filenames */
81: char logfile_base[128]; /* Logfile base name (date is appended) */
82: char answer_sound[128];
83: char hangup_sound[128];
84: char hack_sound[128];
85:
86: /* Misc */
87: char host_name[128];
88: BOOL recycle_now;
89: BOOL shutdown_now;
90: int log_level;
91: uint bind_retry_count; /* Number of times to retry bind() calls */
92: uint bind_retry_delay; /* Time to wait between each bind() retry */
93: char default_cgi_content[128];
1.1.1.2 ! root 94: char default_auth_list[128];
1.1 root 95: WORD outbuf_highwater_mark; /* output block size control */
96: WORD outbuf_drain_timeout;
97:
98: /* JavaScript operating parameters */
99: js_startup_t js;
100:
1.1.1.2 ! root 101: /* Login Attempt parameters */
! 102: ulong login_attempt_delay;
! 103: ulong login_attempt_throttle;
! 104: ulong login_attempt_hack_threshold;
! 105: ulong login_attempt_filter_threshold;
! 106: link_list_t* login_attempt_list;
! 107:
1.1 root 108: } web_startup_t;
109:
110: #if defined(STARTUP_INIT_FIELD_TABLES)
111: /* startup options that requires re-initialization/recycle when changed */
112: static struct init_field web_init_fields[] = {
113: OFFSET_AND_SIZE(web_startup_t,port)
114: ,OFFSET_AND_SIZE(web_startup_t,interface_addr)
115: ,OFFSET_AND_SIZE(web_startup_t,ctrl_dir)
116: ,OFFSET_AND_SIZE(web_startup_t,root_dir)
117: ,OFFSET_AND_SIZE(web_startup_t,error_dir)
118: ,OFFSET_AND_SIZE(web_startup_t,cgi_dir)
119: ,OFFSET_AND_SIZE(web_startup_t,logfile_base)
120: ,{ 0,0 } /* terminator */
121: };
122: #endif
123:
124: #define WEB_OPT_DEBUG_RX (1<<0) /* Log all received requests */
125: #define WEB_OPT_DEBUG_TX (1<<1) /* Log all transmitted responses */
126: #define WEB_OPT_DEBUG_SSJS (1<<2) /* Don't delete sbbs_ssjs.*.html */
127: #define WEB_OPT_VIRTUAL_HOSTS (1<<4) /* Use virutal host html subdirs */
128: #define WEB_OPT_NO_CGI (1<<5) /* Disable CGI support */
129: #define WEB_OPT_HTTP_LOGGING (1<<6) /* Create/write-to HttpLogFile */
130:
131: /* web_startup_t.options bits that require re-init/recycle when changed */
1.1.1.2 ! root 132: #define WEB_INIT_OPTS (WEB_OPT_HTTP_LOGGING)
1.1 root 133:
134: #if defined(STARTUP_INI_BITDESC_TABLES)
135: static ini_bitdesc_t web_options[] = {
136:
137: { WEB_OPT_DEBUG_RX ,"DEBUG_RX" },
138: { WEB_OPT_DEBUG_TX ,"DEBUG_TX" },
139: { WEB_OPT_DEBUG_SSJS ,"DEBUG_SSJS" },
140: { WEB_OPT_VIRTUAL_HOSTS ,"VIRTUAL_HOSTS" },
141: { WEB_OPT_NO_CGI ,"NO_CGI" },
142: { WEB_OPT_HTTP_LOGGING ,"HTTP_LOGGING" },
143:
144: /* shared bits */
145: { BBS_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" },
146: { BBS_OPT_NO_RECYCLE ,"NO_RECYCLE" },
147: { BBS_OPT_GET_IDENT ,"GET_IDENT" },
148: { BBS_OPT_NO_JAVASCRIPT ,"NO_JAVASCRIPT" },
149: { BBS_OPT_MUTE ,"MUTE" },
150:
151: /* terminator */
152: { 0 ,NULL }
153: };
154: #endif
155:
156: #define WEB_DEFAULT_ROOT_DIR "../web/root"
157: #define WEB_DEFAULT_ERROR_DIR "error"
158: #define WEB_DEFAULT_CGI_DIR "cgi-bin"
1.1.1.2 ! root 159: #define WEB_DEFAULT_AUTH_LIST "Basic,Digest"
1.1 root 160: #define WEB_DEFAULT_CGI_CONTENT "text/plain"
161:
162: #ifdef DLLEXPORT
163: #undef DLLEXPORT
164: #endif
165: #ifdef DLLCALL
166: #undef DLLCALL
167: #endif
168:
169: #ifdef _WIN32
170: #ifdef WEBSRVR_EXPORTS
171: #define DLLEXPORT __declspec(dllexport)
172: #else
173: #define DLLEXPORT __declspec(dllimport)
174: #endif
175: #ifdef __BORLANDC__
176: #define DLLCALL __stdcall
177: #else
178: #define DLLCALL
179: #endif
180: #else
181: #define DLLEXPORT
182: #define DLLCALL
183: #endif
184:
185: #ifdef __cplusplus
186: extern "C" {
187: #endif
188: DLLEXPORT void DLLCALL web_server(void* arg);
189: DLLEXPORT void DLLCALL web_terminate(void);
190: DLLEXPORT const char* DLLCALL web_ver(void);
191: #ifdef __cplusplus
192: }
193: #endif
194:
195: #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.