|
|
1.1 root 1: /* mailsrvr.h */
2:
3: /* Synchronet Mail (SMTP/POP3/SendMail) server */
4:
5: /* $Id: mailsrvr.h,v 1.61 2006/12/27 06:00:48 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 _MAILSRVR_H_
39: #define _MAILSRVR_H_
40:
41: #include "startup.h"
42: #include "sockwrap.h" /* SOCKET */
43:
44: typedef struct {
45:
46: DWORD size; /* sizeof(mail_startup_t) */
47: WORD smtp_port;
48: WORD pop3_port;
49: WORD max_clients;
50: WORD max_inactivity;
51: WORD max_delivery_attempts;
52: WORD rescan_frequency; /* In seconds */
53: WORD relay_port;
54: WORD lines_per_yield;
55: WORD max_recipients;
56: WORD sem_chk_freq; /* semaphore file checking frequency (in seconds) */
57: DWORD interface_addr;
58: DWORD options; /* See MAIL_OPT definitions */
59: DWORD max_msg_size;
60:
61: void* cbdata; /* Private data passed to callbacks */
62:
63: /* Callbacks (NULL if unused) */
64: int (*lputs)(void*, int, char*);
65: void (*status)(void*, char*);
66: void (*started)(void*);
67: void (*recycle)(void*);
68: void (*terminated)(void*, int code);
69: void (*clients)(void*, int active);
70: void (*thread_up)(void*, BOOL up, BOOL setuid);
71: void (*socket_open)(void*, BOOL open);
72: void (*client_on)(void*, BOOL on, int sock, client_t*, BOOL update);
73: BOOL (*seteuid)(BOOL user);
74: BOOL (*setuid)(BOOL force);
75:
76: /* Paths */
77: char ctrl_dir[128];
78: char temp_dir[128];
79:
80: /* Strings */
81: char dns_server[128];
82: char default_user[128];
83: char dnsbl_tag[32]; // Tag to add to blacklisted subject
84: char dnsbl_hdr[32]; // Header field to add to msg header
85: char inbound_sound[128];
86: char outbound_sound[128];
87: char pop3_sound[128];
88: char default_charset[128];
89:
90: /* Misc */
91: char host_name[128];
92: BOOL recycle_now;
93: BOOL shutdown_now;
94: int log_level;
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: /* Relay Server */
99: char relay_server[128];
100: /* Relay authentication required */
101: char relay_user[128];
102: char relay_pass[128];
103:
104: /* JavaScript operating parameters */
105: js_startup_t js;
106:
107: } mail_startup_t;
108:
109: /* startup options that requires re-initialization/recycle when changed */
110: #if defined(STARTUP_INIT_FIELD_TABLES)
111: static struct init_field mail_init_fields[] = {
112: OFFSET_AND_SIZE(mail_startup_t,smtp_port)
113: ,OFFSET_AND_SIZE(mail_startup_t,pop3_port)
114: ,OFFSET_AND_SIZE(mail_startup_t,interface_addr)
115: ,OFFSET_AND_SIZE(mail_startup_t,ctrl_dir)
116: ,{ 0,0 } /* terminator */
117: };
118: #endif
119:
120: #define MAIL_OPT_DEBUG_RX_HEADER (1<<0)
121: #define MAIL_OPT_DEBUG_RX_BODY (1<<1)
122: #define MAIL_OPT_ALLOW_POP3 (1<<2)
123: #define MAIL_OPT_DEBUG_TX (1<<3)
124: #define MAIL_OPT_DEBUG_RX_RSP (1<<4)
125: #define MAIL_OPT_RELAY_TX (1<<5) /* Use SMTP relay server */
126: #define MAIL_OPT_DEBUG_POP3 (1<<6)
127: #define MAIL_OPT_ALLOW_RX_BY_NUMBER (1<<7) /* Receive mail sent to user # */
128: #define MAIL_OPT_NO_NOTIFY (1<<8) /* Don't notify local recipients */
129: #define MAIL_OPT_ALLOW_SYSOP_ALIASES (1<<9) /* Receive mail sent to built-in sysop aliases (i.e. "sysop" and "postmaster") */
130: #define MAIL_OPT_NO_HOST_LOOKUP (1<<11) /* Don't look-up hostnames */
131: #define MAIL_OPT_USE_TCP_DNS (1<<12) /* Use TCP vs UDP for DNS req */
132: #define MAIL_OPT_NO_SENDMAIL (1<<13) /* Don't run SendMail thread */
133: #define MAIL_OPT_ALLOW_RELAY (1<<14) /* Allow relays from stored user IPs */
134: #define MAIL_OPT_DNSBL_REFUSE (1<<15) /* Refuse session, return error */
135: #define MAIL_OPT_DNSBL_IGNORE (1<<16) /* Dump mail, return success */
136: #define MAIL_OPT_DNSBL_BADUSER (1<<17) /* Refuse mail (bad user name) */
137: #define MAIL_OPT_DNSBL_CHKRECVHDRS (1<<18) /* Check all Recieved: from addresses */
138: #define MAIL_OPT_DNSBL_THROTTLE (1<<19) /* Throttle receive from blacklisted servers */
139: #define MAIL_OPT_DNSBL_DEBUG (1<<20) /* Debug DNSBL activity */
140: #define MAIL_OPT_SMTP_AUTH_VIA_IP (1<<21) /* Allow SMTP authentication via IP */
141: #define MAIL_OPT_SEND_INTRANSIT (1<<22) /* Send mail, even if already "in transit" */
142: #define MAIL_OPT_RELAY_AUTH_PLAIN (1<<23)
143: #define MAIL_OPT_RELAY_AUTH_LOGIN (1<<24)
144: #define MAIL_OPT_RELAY_AUTH_CRAM_MD5 (1<<25)
145: #define MAIL_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */
146: #define MAIL_OPT_LOCAL_TIMEZONE (1<<30) /* Don't force UTC/GMT */
147: #define MAIL_OPT_MUTE (1<<31)
148:
149: #define MAIL_OPT_RELAY_AUTH_MASK (MAIL_OPT_RELAY_AUTH_PLAIN|MAIL_OPT_RELAY_AUTH_LOGIN|MAIL_OPT_RELAY_AUTH_CRAM_MD5)
150:
151: /* mail_startup_t.options bits that require re-init/recycle when changed */
152: #define MAIL_INIT_OPTS (MAIL_OPT_ALLOW_POP3|MAIL_OPT_NO_SENDMAIL|MAIL_OPT_LOCAL_TIMEZONE)
153:
154: #if defined(STARTUP_INI_BITDESC_TABLES)
155: static ini_bitdesc_t mail_options[] = {
156:
157: { MAIL_OPT_DEBUG_RX_HEADER ,"DEBUG_RX_HEADER" },
158: { MAIL_OPT_DEBUG_RX_BODY ,"DEBUG_RX_BODY" },
159: { MAIL_OPT_ALLOW_POP3 ,"ALLOW_POP3" },
160: { MAIL_OPT_DEBUG_TX ,"DEBUG_TX" },
161: { MAIL_OPT_DEBUG_RX_RSP ,"DEBUG_RX_RSP" },
162: { MAIL_OPT_RELAY_TX ,"RELAY_TX" },
163: { MAIL_OPT_DEBUG_POP3 ,"DEBUG_POP3" },
164: { MAIL_OPT_ALLOW_RX_BY_NUMBER ,"ALLOW_RX_BY_NUMBER" },
165: { MAIL_OPT_ALLOW_SYSOP_ALIASES ,"ALLOW_SYSOP_ALIASES" },
166: { MAIL_OPT_NO_NOTIFY ,"NO_NOTIFY" },
167: { MAIL_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" },
168: { MAIL_OPT_USE_TCP_DNS ,"USE_TCP_DNS" },
169: { MAIL_OPT_NO_SENDMAIL ,"NO_SENDMAIL" },
170: { MAIL_OPT_ALLOW_RELAY ,"ALLOW_RELAY" },
171: { MAIL_OPT_SMTP_AUTH_VIA_IP ,"SMTP_AUTH_VIA_IP" },
172: { MAIL_OPT_DNSBL_REFUSE ,"DNSBL_REFUSE" },
173: { MAIL_OPT_DNSBL_IGNORE ,"DNSBL_IGNORE" },
174: { MAIL_OPT_DNSBL_BADUSER ,"DNSBL_BADUSER" },
175: { MAIL_OPT_DNSBL_CHKRECVHDRS ,"DNSBL_CHKRECVHDRS" },
176: { MAIL_OPT_DNSBL_THROTTLE ,"DNSBL_THROTTLE" },
177: { MAIL_OPT_DNSBL_DEBUG ,"DNSBL_DEBUG" },
178: { MAIL_OPT_SEND_INTRANSIT ,"SEND_INTRANSIT" },
179: { MAIL_OPT_RELAY_AUTH_PLAIN ,"RELAY_AUTH_PLAIN" },
180: { MAIL_OPT_RELAY_AUTH_LOGIN ,"RELAY_AUTH_LOGIN" },
181: { MAIL_OPT_RELAY_AUTH_CRAM_MD5 ,"RELAY_AUTH_CRAM_MD5" },
182: { MAIL_OPT_NO_RECYCLE ,"NO_RECYCLE" },
183: { MAIL_OPT_LOCAL_TIMEZONE ,"LOCAL_TIMEZONE" },
184: { MAIL_OPT_MUTE ,"MUTE" },
185: /* terminator */
186: { 0 ,NULL }
187: };
188: #endif
189:
190: #ifdef DLLEXPORT
191: #undef DLLEXPORT
192: #endif
193: #ifdef DLLCALL
194: #undef DLLCALL
195: #endif
196:
197: #ifdef _WIN32
198: #ifdef MAILSRVR_EXPORTS
199: #define DLLEXPORT __declspec(dllexport)
200: #else
201: #define DLLEXPORT __declspec(dllimport)
202: #endif
203: #ifdef __BORLANDC__
204: #define DLLCALL __stdcall
205: #else
206: #define DLLCALL
207: #endif
208: #else
209: #define DLLEXPORT
210: #define DLLCALL
211: #endif
212:
213: #ifdef __cplusplus
214: extern "C" {
215: #endif
216: /* arg is pointer to static mail_startup_t* */
217: DLLEXPORT void DLLCALL mail_server(void* arg);
218: DLLEXPORT void DLLCALL mail_terminate(void);
219: DLLEXPORT const char* DLLCALL mail_ver(void);
220: #ifdef __cplusplus
221: }
222: #endif
223:
224: int sockprintf(SOCKET sock, char *fmt, ...);
225:
226: #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.