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