|
|
1.1 root 1: /* ftpsrvr.h */
2:
3: /* Synchronet FTP server */
4:
5: /* $Id: ftpsrvr.h,v 1.45 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 _FTPSRVR_H_
39: #define _FTPSRVR_H_
40:
41: #include "startup.h"
42:
43: typedef struct {
44:
45: DWORD size; /* sizeof(ftp_startup_t) */
46: WORD port;
47: WORD max_clients;
48: WORD max_inactivity;
49: WORD qwk_timeout;
50: WORD sem_chk_freq; /* semaphore file checking frequency (in seconds) */
51: DWORD interface_addr;
52: DWORD pasv_ip_addr;
53: WORD pasv_port_low;
54: WORD pasv_port_high;
55: DWORD options; /* See FTP_OPT definitions */
56:
57: void* cbdata; /* Private data passed to callbacks */
58:
59: /* Callbacks (NULL if unused) */
60: int (*lputs)(void*, int, char*);
61: void (*status)(void*, char*);
62: void (*started)(void*);
63: void (*recycle)(void*);
64: void (*terminated)(void*, int code);
65: void (*clients)(void*, int active);
66: void (*thread_up)(void*, BOOL up, BOOL setuid);
67: void (*socket_open)(void*, BOOL open);
68: void (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
69: BOOL (*seteuid)(BOOL user);
70: BOOL (*setuid)(BOOL force);
71:
72: /* Paths */
73: char ctrl_dir[128];
74: char index_file_name[64];
75: char html_index_file[64];
76: char html_index_script[64];
77: char temp_dir[128];
78: char answer_sound[128];
79: char hangup_sound[128];
80: char hack_sound[128];
81:
82: /* Misc */
83: char host_name[128];
84: BOOL recycle_now;
85: BOOL shutdown_now;
86: int log_level;
87: uint bind_retry_count; /* Number of times to retry bind() calls */
88: uint bind_retry_delay; /* Time to wait between each bind() retry */
89:
90: /* JavaScript operating parameters */
91: js_startup_t js;
92:
93: } ftp_startup_t;
94:
95: /* startup options that requires re-initialization/recycle when changed */
96: #if defined(STARTUP_INIT_FIELD_TABLES)
97: static struct init_field ftp_init_fields[] = {
98: OFFSET_AND_SIZE(ftp_startup_t,port)
99: ,OFFSET_AND_SIZE(ftp_startup_t,interface_addr)
100: ,OFFSET_AND_SIZE(ftp_startup_t,ctrl_dir)
101: ,OFFSET_AND_SIZE(ftp_startup_t,temp_dir)
102: ,{ 0,0 } /* terminator */
103: };
104: #endif
105:
106: #define FTP_OPT_DEBUG_RX (1<<0)
107: #define FTP_OPT_DEBUG_DATA (1<<1)
108: #define FTP_OPT_INDEX_FILE (1<<2) /* Auto-generate ASCII Index files */
109: #define FTP_OPT_DEBUG_TX (1<<3)
110: #define FTP_OPT_ALLOW_QWK (1<<4)
111: #define FTP_OPT_NO_LOCAL_FSYS (1<<5)
112: #define FTP_OPT_DIR_FILES (1<<6) /* Allow access to files in dir but not in database */
113: #define FTP_OPT_KEEP_TEMP_FILES (1<<7) /* Don't delete temp files (for debugging) */
114: #define FTP_OPT_HTML_INDEX_FILE (1<<8) /* Auto-generate HTML index files */
115: #define FTP_OPT_LOOKUP_PASV_IP (1<<9) /* resolve public IP address for PASV response */
116: #define FTP_OPT_NO_HOST_LOOKUP (1<<11)
117: #define FTP_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */
118: #define FTP_OPT_NO_JAVASCRIPT (1<<29) /* JavaScript disabled */
119: #define FTP_OPT_LOCAL_TIMEZONE (1<<30) /* Don't force UTC/GMT */
120: #define FTP_OPT_MUTE (1<<31)
121:
122: /* ftp_startup_t.options bits that require re-init/recycle when changed */
123: #define FTP_INIT_OPTS (FTP_OPT_LOCAL_TIMEZONE)
124:
125: #if defined(STARTUP_INI_BITDESC_TABLES)
126: static ini_bitdesc_t ftp_options[] = {
127:
128: { FTP_OPT_DEBUG_RX ,"DEBUG_RX" },
129: { FTP_OPT_DEBUG_DATA ,"DEBUG_DATA" },
130: { FTP_OPT_INDEX_FILE ,"INDEX_FILE" },
131: { FTP_OPT_DEBUG_TX ,"DEBUG_TX" },
132: { FTP_OPT_ALLOW_QWK ,"ALLOW_QWK" },
133: { FTP_OPT_NO_LOCAL_FSYS ,"NO_LOCAL_FSYS" },
134: { FTP_OPT_DIR_FILES ,"DIR_FILES" },
135: { FTP_OPT_KEEP_TEMP_FILES ,"KEEP_TEMP_FILES" },
136: { FTP_OPT_HTML_INDEX_FILE ,"HTML_INDEX_FILE" },
137: { FTP_OPT_LOOKUP_PASV_IP ,"LOOKUP_PASV_IP" },
138: { FTP_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" },
139: { FTP_OPT_NO_RECYCLE ,"NO_RECYCLE" },
140: { FTP_OPT_NO_JAVASCRIPT ,"NO_JAVASCRIPT" },
141: { FTP_OPT_LOCAL_TIMEZONE ,"LOCAL_TIMEZONE" },
142: { FTP_OPT_MUTE ,"MUTE" },
143: /* terminator */
144: { 0 ,NULL }
145: };
146: #endif
147:
148: #ifdef DLLEXPORT
149: #undef DLLEXPORT
150: #endif
151: #ifdef DLLCALL
152: #undef DLLCALL
153: #endif
154:
155: #ifdef _WIN32
156: #ifdef FTPSRVR_EXPORTS
157: #define DLLEXPORT __declspec(dllexport)
158: #else
159: #define DLLEXPORT __declspec(dllimport)
160: #endif
161: #ifdef __BORLANDC__
162: #define DLLCALL __stdcall
163: #else
164: #define DLLCALL
165: #endif
166: #else
167: #define DLLEXPORT
168: #define DLLCALL
169: #endif
170:
171: #ifdef __cplusplus
172: extern "C" {
173: #endif
174: /* arg is pointer to static ftp_startup_t */
175: DLLEXPORT void DLLCALL ftp_server(void* arg);
176: DLLEXPORT void DLLCALL ftp_terminate(void);
177: DLLEXPORT const char* DLLCALL ftp_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.