|
|
1.1 root 1: /* SBBSECHO.H */
2:
3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
4:
5: /* Portions written by Allen Christiansen 1994-1996 */
6:
7: #define SBBSECHO_VER "1.25"
8:
9: #define IMPORT_NETMAIL (1L<<0)
10: #define IMPORT_PACKETS (1L<<1)
11: #define IMPORT_ECHOMAIL (1L<<2)
12: #define EXPORT_ECHOMAIL (1L<<3)
13: #define DELETE_NETMAIL (1L<<4)
14: #define DELETE_PACKETS (1L<<5)
15: #define STORE_SEENBY (1L<<6) /* Store SEEN-BYs in SMB */
16: #define STORE_PATH (1L<<7) /* Store PATHs in SMB */
17: #define STORE_KLUDGE (1L<<8) /* Store unknown kludges in SMB */
18: #define IGNORE_MSGPTRS (1L<<9)
19: #define UPDATE_MSGPTRS (1L<<10)
20: #define LEAVE_MSGPTRS (1L<<11)
21: #define CHECKMEM (1L<<12) /* Display available memory */
22: #define ASCII_ONLY (1L<<13)
23: #define LOGFILE (1L<<14)
24: #define REPORT (1L<<15)
25: #define EXPORT_ALL (1L<<16)
26: #define UNKNOWN_NETMAIL (1L<<17)
27: #define IGNORE_ADDRESS (1L<<18)
28: #define IGNORE_RECV (1L<<19)
29: #define CONVERT_TEAR (1L<<20)
30: #define IMPORT_PRIVATE (1L<<21)
31: #define LOCAL_NETMAIL (1L<<22)
32: #define NOTIFY_RECEIPT (1L<<23)
33: #define FLO_MAILER (1L<<24) /* Binkley .FLO style mailer */
34: #define PACK_NETMAIL (1L<<25) /* Pack *.MSG NetMail into packets */
35: #define FUZZY_ZONE (1L<<26)
36: #define FAST_OPEN (1L<<27)
37: #define SECURE (1L<<28) /* Secure operation */
38: #define ELIST_ONLY (1L<<29) /* Allow adding from AREAS.BBS */
39: #define GEN_NOTIFY_LIST (1L<<30) /* Generate Notify Lists */
40: #define KILL_EMPTY_MAIL (1L<<31) /* Kill empty netmail messages */
41:
42: #define ATTR_HOLD (1<<0) /* Hold */
43: #define ATTR_CRASH (1<<1) /* Crash */
44: #define ATTR_DIRECT (1<<2) /* Direct */
45: #define ATTR_PASSIVE (1<<3) /* Used to temp disconnect */
46: #define SEND_NOTIFY (1<<4) /* Send Notify Lists */
47:
48:
49: #define LOG_AREAFIX (1L<<0) /* Log areafix messages */
50: #define LOG_IMPORTED (1L<<1) /* Log imported netmail messages */
51: #define LOG_PACKETS (1L<<2) /* Log imported packet names/types */
52: #define LOG_SECURITY (1L<<3) /* Log security violations */
53: #define LOG_GRUNGED (1L<<4) /* Log grunged messages */
54: #define LOG_PRIVATE (1L<<5) /* Log disallowed private msgs */
55: #define LOG_AREA_TOTALS (1L<<6) /* Log totals for each area */
56: #define LOG_TOTALS (1L<<7) /* Log over-all totals */
57: #define LOG_PACKING (1L<<8) /* Log packing of out-bound netmail */
58: #define LOG_ROUTING (1L<<9) /* Log routing of out-bound netmail */
59:
60: #define LOG_DUPES (1L<<24) /* Log individual dupe messages */
61: #define LOG_CIRCULAR (1L<<25) /* Log individual circ paths */
62: #define LOG_IGNORED (1L<<26) /* Log ignored netmail */
63: #define LOG_UNKNOWN (1L<<27) /* Log netmail for unknown users */
64:
65: #define LOG_DEFAULTS 0xffffffL /* Low 24 bits default to ON */
66:
67: #define PKT_TWO_PLUS 0 /* Type 2+ Packet Header */
68: #define PKT_TWO_TWO 1 /* Type 2.2 Packet Header */
69: #define PKT_TWO 2 /* Old Type Packet Header */
70:
71: #define MAX_OPEN_SMBS 2
72: #define DFLT_OPEN_PKTS 4
73: #define MAX_TOTAL_PKTS 100
74: #define DFLT_PKT_SIZE 250*1024L
75: #define DFLT_BDL_SIZE 250*1024L
76:
77: #define NOFWD (1<<0) /* Do not forward requests */
78:
79: typedef struct { /* Fidonet Packet Header */
80: short orignode, /* Origination Node of Packet */
81: destnode, /* Destination Node of Packet */
82: year, /* Year of Packet Creation e.g. 1995 */
83: month, /* Month of Packet Creation 0-11 */
84: day, /* Day of Packet Creation 1-31 */
85: hour, /* Hour of Packet Creation 0-23 */
86: min, /* Minute of Packet Creation 0-59 */
87: sec, /* Second of Packet Creation 0-59 */
88: baud, /* Max Baud Rate of Orig & Dest */
89: pkttype, /* Packet Type (-1 is obsolete) */
90: orignet, /* Origination Net of Packet */
91: destnet; /* Destination Net of Packet */
92: uchar prodcode, /* Product Code (00h is Fido) */
93: sernum, /* Binary Serial Number or NULL */
94: password[8]; /* Session Password or NULL */
95: short origzone, /* Origination Zone of Packet or NULL */
96: destzone; /* Destination Zone of Packet or NULL */
97: uchar empty[20]; /* Fill Characters */
98: } pkthdr_t;
99:
100: typedef struct { /* Type 2+ Packet Header Info */
101: short auxnet, /* Orig Net if Origin is a Point */
102: cwcopy; /* Must be Equal to cword */
103: uchar prodcode, /* Product Code */
104: revision; /* Revision */
105: short cword, /* Compatibility Word */
106: origzone, /* Zone of Packet Sender or NULL */
107: destzone, /* Zone of Packet Receiver or NULL */
108: origpoint, /* Origination Point of Packet */
109: destpoint; /* Destination Point of Packet */
110: uchar empty[4];
111: } two_plus_t;
112:
113: typedef struct { /* Type 2.2 Packet Header Info */
114: uchar origdomn[8], /* Origination Domain */
115: destdomn[8], /* Destination Domain */
116: empty[4]; /* Product Specific Data */
117: } two_two_t;
118:
119: typedef struct {
120: uint sub; /* Set to INVALID_SUB if pass-thru */
121: ulong tag; /* CRC-32 of tag name */
122: char *name; /* Area tag name */
123: uint uplinks; /* Total number of uplinks for this echo */
124: uint imported; /* Total messages imported this run */
125: uint exported; /* Total messages exported this run */
126: uint circular; /* Total circular paths detected */
127: uint dupes; /* Total duplicate messages detected */
128: faddr_t *uplink; /* Each uplink */
129: } areasbbs_t;
130:
131: typedef struct {
132: char flag[5];
133: } flag_t;
134:
135: typedef struct {
136: uint tags; /* Number of area tags */
137: char **tag; /* Name of each area tag */
138: } area_t;
139:
140: typedef struct {
141: FILE *stream; /* The stream associated with this packet */
142: faddr_t uplink; /* The current uplink for this packet */
143: uchar filename[128],curopen;/* Name of the file and if it's open or not */
144: } outpkt_t;
145:
146: typedef struct {
147: uint addrs; /* Total number of uplinks */
148: faddr_t *addr; /* Each uplink */
149: } addrlist_t;
150:
151: typedef struct {
152: char name[26] /* Short name of archive type */
153: ,hexid[26] /* Hexadecimal ID to search for */
154: ,pack[81] /* Pack command line */
155: ,unpack[81]; /* Unpack command line */
156: uint byteloc; /* Offset to Hex ID */
157: } arcdef_t;
158:
159: typedef struct {
160: faddr_t faddr /* Fido address of this node */
161: ,route; /* Address to route FLO stuff through */
162: ushort arctype /* De/archiver to use for this node */
163: ,numflags /* Number of flags defined for this node */
164: ,pkt_type; /* Packet type to use for outgoing PKTs */
165: ushort attr; /* Message bits to set for this node */
166: char password[26]; /* Areafix password for this node */
167: char pktpwd[9]; /* Packet password for this node */
168: flag_t *flag; /* Areafix flags for this node */
169: } nodecfg_t;
170:
171: typedef struct {
172: char listpath[129]; /* Path to this echolist */
173: uint numflags,misc; /* Number of flags for this echolist */
174: flag_t *flag; /* Flags to access this echolist */
175: faddr_t forward; /* Where to forward requests */
176: char password[72]; /* Password to use for forwarding req's */
177: } echolist_t;
178:
179: typedef struct {
180: faddr_t dest;
181: char fname[13];
182: } attach_t;
183:
184: typedef struct {
185: char inbound[82] /* Inbound directory */
186: ,secure[82] /* Secure Inbound directory */
187: ,outbound[82] /* Outbound directory */
188: ,areafile[128] /* AREAS.BBS path/filename */
189: ,logfile[128] /* LOG path/filename */
190: ,cfgfile[128]; /* Configuration path/filename */
191: ulong maxpktsize /* Maximum size for packets */
192: ,maxbdlsize /* Maximum size for bundles */
193: ,log; /* What do we log? */
194: int badecho; /* Area to store bad echomail msgs */
195: uint arcdefs /* Number of archive definitions */
196: ,nodecfgs /* Number of nodes with configs */
197: ,listcfgs /* Number of echolists defined */
198: ,areas /* Number of areas defined */
199: ,notify; /* User number (sysop) to notify */
200: arcdef_t *arcdef; /* Each archive definition */
201: nodecfg_t *nodecfg; /* Each node configuration */
202: echolist_t *listcfg; /* Each echolist configuration */
203: areasbbs_t *area; /* Each area configuration */
204: } config_t;
205:
206: #ifdef __WATCOMC__
207: struct time {
208: unsigned char ti_min; /* Minutes */
209: unsigned char ti_hour; /* Hours */
210: unsigned char ti_hund; /* Hundredths of seconds */
211: unsigned char ti_sec; /* Seconds */
212: };
213:
214: struct date {
215: int da_year; /* Year - 1980 */
216: char da_day; /* Day of the month */
217: char da_mon; /* Month (1 = Jan) */
218: };
219: #endif
220:
221: /***********************/
222: /* Function prototypes */
223: /***********************/
224: void bail(int code);
225: char *ultoac(ulong l,char *str);
226: int bstrlen(char *str);
227: int nopen(char *str, int access);
228: FILE *fnopen(int *file, char *str,int access);
229: char *sectostr(uint sec, char *str);
230: void truncsp(char *str);
231: ulong ahtoul(char *str);
232: int mv(char *src, char *dest, char copy); /* fast file move/copy function */
233: char *timestr(time_t *intime); /* ASCII representation of time_t */
234: time_t dstrtounix(char *str); /* ASCII date (MM/DD/YY) to unix conversion */
235: char *unixtodstr(time_t unix, char *str); /* Unix time to ASCII date */
236: int chk_ar(char *str, user_t user); /* checks access requirements */
237: ushort crc16(char *str);
238: void ucrc16(uchar ch, ushort *rcrc);
239: char fexist(char *filespec);
240: long flength(char *filespec);
241: long fdate(char *filespec);
242: faddr_t atofaddr(char *str);
243: int matchnode(faddr_t addr, int exact);
244: void export_echomail(char *sub_code,faddr_t addr);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.