|
|
1.1 root 1: /* services.h */
2:
3: /* Synchronet main/telnet server thread startup structure */
4:
5: /* $Id: services.h,v 1.32 2004/11/06 02:15:16 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 _SERVICES_H_
39: #define _SERVICES_H_
40:
41: #include "startup.h"
42:
43: typedef struct {
44:
45: DWORD size; /* sizeof(bbs_struct_t) */
46: DWORD interface_addr;
47: DWORD options; /* See BBS_OPT definitions */
48: DWORD js_max_bytes;
49: DWORD js_cx_stack;
50: DWORD js_branch_limit;
51: DWORD js_yield_interval;
52: DWORD js_gc_interval;
53: WORD sem_chk_freq; /* semaphore file checking frequency (in seconds) */
54:
55: void* cbdata; /* Private data passed to callbacks */
56:
57: /* Callbacks (NULL if unused) */
58: int (*lputs)(void*, int, char*); /* Log - put string */
59: void (*status)(void*, char*);
60: void (*started)(void*);
61: void (*recycle)(void*);
62: void (*terminated)(void*, int code);
63: void (*clients)(void*, int active);
64: void (*thread_up)(void*, BOOL up, BOOL setuid);
65: void (*socket_open)(void*, BOOL open);
66: void (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
67: BOOL (*seteuid)(BOOL user);
68: BOOL (*setuid)(BOOL force);
69:
70: /* Paths */
71: char ctrl_dir[128];
72: char answer_sound[128];
73: char hangup_sound[128];
74:
75: /* Misc */
76: char host_name[128];
77: BOOL recycle_now;
78: BOOL shutdown_now;
79: DWORD log_mask;
80: uint bind_retry_count; /* Number of times to retry bind() calls */
81: uint bind_retry_delay; /* Time to wait between each bind() retry */
82:
83: } services_startup_t;
84:
85: #if 0
86: /* startup options that requires re-initialization/recycle when changed */
87: static struct init_field services_init_fields[] = {
88: OFFSET_AND_SIZE(services_startup_t,interface_addr)
89: ,OFFSET_AND_SIZE(services_startup_t,ctrl_dir)
90: ,{ 0,0 } /* terminator */
91: };
92: #endif
93:
94: /* Option bit definitions */
95: #define SERVICE_OPT_UDP (1<<0) /* UDP Socket */
96: #define SERVICE_OPT_STATIC (1<<1) /* Static service (accepts client connectsions) */
97: #define SERVICE_OPT_STATIC_LOOP (1<<2) /* Loop static service until terminated */
98: #define SERVICE_OPT_NATIVE (1<<3) /* non-JavaScript service */
99: #define SERVICE_OPT_FULL_ACCEPT (1<<4) /* Accept/close connections when server is full */
100:
101: /* services_startup_t.options bits that require re-init/recycle when changed */
102: #define SERVICE_INIT_OPTS (BBS_OPT_LOCAL_TIMEZONE)
103:
104: #if defined(STARTUP_INI_BITDESC_TABLES) || defined(SERVICES_INI_BITDESC_TABLE)
105: static ini_bitdesc_t service_options[] = {
106:
107: { BBS_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" },
108: { BBS_OPT_GET_IDENT ,"GET_IDENT" },
109: { BBS_OPT_NO_RECYCLE ,"NO_RECYCLE" },
110: { BBS_OPT_MUTE ,"MUTE" },
111: { SERVICE_OPT_UDP ,"UDP" },
112: { SERVICE_OPT_STATIC ,"STATIC" },
113: { SERVICE_OPT_STATIC_LOOP ,"LOOP" },
114: { SERVICE_OPT_NATIVE ,"NATIVE" },
115: { SERVICE_OPT_FULL_ACCEPT ,"FULL_ACCEPT" },
116: /* terminator */
117: { 0 ,NULL }
118: };
119: #endif
120:
121: #ifdef __cplusplus
122: extern "C" {
123: #endif
124:
125: #ifdef DLLEXPORT
126: #undef DLLEXPORT
127: #endif
128: #ifdef DLLCALL
129: #undef DLLCALL
130: #endif
131:
132: #ifdef _WIN32
133: #ifdef SERVICES_EXPORTS
134: #define DLLEXPORT __declspec(dllexport)
135: #else
136: #define DLLEXPORT __declspec(dllimport)
137: #endif
138: #ifdef __BORLANDC__
139: #define DLLCALL __stdcall
140: #else
141: #define DLLCALL
142: #endif
143: #else
144: #define DLLEXPORT
145: #define DLLCALL
146: #endif
147:
148: /* arg is pointer to static bbs_startup_t* */
149: DLLEXPORT void DLLCALL services_thread(void* arg);
150: DLLEXPORT void DLLCALL services_terminate(void);
151: DLLEXPORT const char* DLLCALL services_ver(void);
152:
153: #ifdef __cplusplus
154: }
155: #endif
156:
157: #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.