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