sbbsecho.h 7.35 KB
Newer Older
rswindell's avatar
rswindell committed
1
/* sbbsecho.h */
2

rswindell's avatar
rswindell committed
3
4
5
6
7
8
9
10
/* Synchronet FidoNet Echomail tosser/scanner/areafix program */

/* $Id$ */

/****************************************************************************
 * @format.tab-size 4		(Plain Text/Source Code File Header)			*
 * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
 *																			*
11
 * Copyright Rob Swindell - http://www.synchro.net/copyright.html			*
rswindell's avatar
rswindell committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 *																			*
 * This program is free software; you can redistribute it and/or			*
 * modify it under the terms of the GNU General Public License				*
 * as published by the Free Software Foundation; either version 2			*
 * of the License, or (at your option) any later version.					*
 * See the GNU General Public License for more details: gpl.txt or			*
 * http://www.fsf.org/copyleft/gpl.html										*
 *																			*
 * Anonymous FTP access to the most recent released source is available at	*
 * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net	*
 *																			*
 * Anonymous CVS access to the development source and modification history	*
 * is available at cvs.synchro.net:/cvsroot/sbbs, example:					*
 * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login			*
 *     (just hit return, no password is necessary)							*
 * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src		*
 *																			*
 * For Synchronet coding style and modification guidelines, see				*
 * http://www.synchro.net/source.html										*
 *																			*
 * You are encouraged to submit any modifications (preferably in Unix diff	*
 * format) via e-mail to mods@synchro.net									*
 *																			*
 * Note: If this box doesn't appear square, then you need to fix your tabs.	*
 ****************************************************************************/
37
38
39

/* Portions written by Allen Christiansen 1994-1996 						*/

rswindell's avatar
rswindell committed
40
41
42
43
44
#include <str_list.h>
#include <stdbool.h>
#include <smbdefs.h>
#include "sbbsdefs.h"
#include "fidodefs.h"
45

rswindell's avatar
rswindell committed
46
47
#define SBBSECHO_VERSION_MAJOR		3
#define SBBSECHO_VERSION_MINOR		00
48

rswindell's avatar
rswindell committed
49
#define SBBSECHO_PRODUCT_CODE		0x12FF	/* from http://ftsc.org/docs/ftscprod.013 */
50

rswindell's avatar
rswindell committed
51
52
53
54
55
enum mail_status {
	 MAIL_STATUS_NORMAL
	,MAIL_STATUS_HOLD
	,MAIL_STATUS_CRASH
};
56

rswindell's avatar
rswindell committed
57
58
59
60
61
enum pkt_type {
	 PKT_TYPE_2_PLUS				/* Type 2+ Packet Header  (FSC-48)		*/
	,PKT_TYPE_2_2					/* Type 2.2 Packet Header (FSC-45)		*/
	,PKT_TYPE_2_0 					/* Old Type Packet Header (FTS-1)		*/	
};
62

rswindell's avatar
rswindell committed
63
64
#define DFLT_PKT_SIZE   (250*1024L)
#define DFLT_BDL_SIZE   (250*1024L)
65

rswindell's avatar
rswindell committed
66
#define SBBSECHO_MAX_KEY_LEN	25	/* for AreaFix/EchoList keys (previously known as "flags") */
67
68

typedef struct {
69
70
71
72
73
74
75
    uint		sub;						/* Set to INVALID_SUB if pass-thru */
	uint32_t	tag;						/* CRC-32 of tag name */
    char*		name;						/* Area tag name */
	uint		imported; 					/* Total messages imported this run */
	uint		exported; 					/* Total messages exported this run */
	uint		circular; 					/* Total circular paths detected */
	uint		dupes;						/* Total duplicate messages detected */
rswindell's avatar
rswindell committed
76
77
78
    uint		links;						/* Total number of links for this area */
    fidoaddr_t*	link;						/* Each link */
} area_t;
79
80

typedef struct {
rswindell's avatar
rswindell committed
81
82
83
	uint			addrs; 		/* Total number of links */
	fidoaddr_t *	addr;		/* Each link */
} addrlist_t;
84
85
86
87

typedef struct {
	char name[26]				/* Short name of archive type */
		,hexid[26]				/* Hexadecimal ID to search for */
rswindell's avatar
rswindell committed
88
89
		,pack[MAX_PATH+1]		/* Pack command line */
		,unpack[MAX_PATH+1];	/* Unpack command line */
90
	uint byteloc;				/* Offset to Hex ID */
rswindell's avatar
rswindell committed
91
} arcdef_t;
92
93

typedef struct {
rswindell's avatar
rswindell committed
94
	fidoaddr_t 	addr			/* Fido address of this node */
95
			   ,route;			/* Address to route FLO stuff through */
rswindell's avatar
rswindell committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	enum pkt_type pkt_type;		/* Packet type to use for outgoing PKTs */
	char		password[FIDO_SUBJ_LEN];	/* Areafix password for this node */
	char		pktpwd[FIDO_PASS_LEN+1];	/* Packet password for this node */
	char		comment[64];	/* Comment for this node */
	char		inbox[MAX_PATH+1];
	char		outbox[MAX_PATH+1];
	str_list_t	keys;
	bool		send_notify;
	bool		passive;
	bool		direct;
	enum mail_status status;
#define SBBSECHO_ARCHIVE_NONE	NULL
	arcdef_t*	archive;
} nodecfg_t;
110
111

typedef struct {
rswindell's avatar
rswindell committed
112
113
114
115
116
117
	char		listpath[MAX_PATH+1];	/* Path to this echolist */
	str_list_t	keys;
	fidoaddr_t 	hub;			/* Where to forward requests */
	bool		forward;
	char		password[FIDO_SUBJ_LEN];	/* Password to use for forwarding req's */
} echolist_t;
118
119

typedef struct {
rswindell's avatar
rswindell committed
120
121
122
	fidoaddr_t 	dest;
	char		filename[MAX_PATH+1];	/* The full path to the attached file */
} attach_t;
123

124
125
struct zone_mapping {
	uint16_t	zone;
126
127
	char *		root;
	char *		domain;
128
129
130
	struct zone_mapping *next;
};

131
typedef struct {
rswindell's avatar
rswindell committed
132
133
134
135
136
	char		inbound[MAX_PATH+1]; 	/* Inbound directory */
	char		secure_inbound[MAX_PATH+1];		/* Secure Inbound directory */
	char		outbound[MAX_PATH+1];	/* Outbound directory */
	char		areafile[MAX_PATH+1];	/* AREAS.BBS path/filename */
	char		logfile[MAX_PATH+1];	/* LOG path/filename */
137
	char		logtime[64];			/* format of log timestamp */
rswindell's avatar
rswindell committed
138
139
	char		cfgfile[MAX_PATH+1];	/* Configuration path/filename */
	char		temp_dir[MAX_PATH+1];	/* Temporary file directory */
140
	char		outgoing_sem[MAX_PATH+1];	/* Semaphore file to creat when there's outgoing data */
rswindell's avatar
rswindell committed
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
	str_list_t	sysop_alias_list;		/* List of sysop aliases */
	ulong		maxpktsize				/* Maximum size for packets */
			   ,maxbdlsize;				/* Maximum size for bundles */
	int			log_level;				/* Highest level (lowest severity) */
	int 		badecho;				/* Area to store bad echomail msgs */
	uint		arcdefs 				/* Number of archive definitions */
			   ,nodecfgs				/* Number of nodes with configs */
			   ,listcfgs				/* Number of echolists defined */
			   ,areas					/* Number of areas defined */
			   ;
	char		default_recipient[LEN_ALIAS+1];
	char		areamgr[LEN_ALIAS+1];	/* User to notify of areafix activity */
	arcdef_t*	arcdef; 				/* Each archive definition */
	nodecfg_t*	nodecfg;				/* Each node configuration */
	echolist_t*	listcfg;				/* Each echolist configuration */
	area_t*		area;					/* Each area configuration */
	bool		check_path;				/* Enable circular path detection */
	bool		zone_blind;				/* Pretend zones don't matter when parsing and constructing PATH and SEEN-BY lines (per Wilfred van Velzen, 2:280/464) */
159
	uint16_t	zone_blind_threshold;	/* Zones below this number (e.g. 4) will be treated as the same zone when zone_blind is enabled */
rswindell's avatar
rswindell committed
160
	bool		secure_echomail;
161
	bool		strict_packet_passwords;	/* Packet passwords must always match the configured linked-node */
rswindell's avatar
rswindell committed
162
163
164
165
166
167
168
169
170
171
172
173
174
	bool		strip_lf;
	bool		convert_tear;
	bool		fuzzy_zone;
	bool		flo_mailer;				/* Binkley-Style-Outbound / FLO mailer */
	bool		add_from_echolists_only;
	bool		trunc_bundles;
	bool		kill_empty_netmail;
	bool		delete_netmail;
	bool		delete_packets;
	bool		echomail_notify;
	bool		ignore_netmail_dest_addr;
	bool		ignore_netmail_recv_attr;
	bool		ignore_netmail_local_attr;
175
	bool		use_ftn_domains;
rswindell's avatar
rswindell committed
176
177
178
179
180
	ulong		bsy_timeout;
	ulong		bso_lock_attempts;
	ulong		bso_lock_delay;			/* in seconds */
	ulong		max_netmail_age;
	ulong		max_echomail_age;
181
	struct zone_mapping *zone_map;	// 
rswindell's avatar
rswindell committed
182
183
} sbbsecho_cfg_t;

184
185
char* pktTypeStringList[4];
char* mailStatusStringList[4];
186
187
188
189

/***********************/
/* Function prototypes */
/***********************/
rswindell's avatar
rswindell committed
190
bool sbbsecho_read_ini(sbbsecho_cfg_t*);
191
bool sbbsecho_read_ftn_domains(sbbsecho_cfg_t*, const char*);
rswindell's avatar
rswindell committed
192
bool sbbsecho_write_ini(sbbsecho_cfg_t*);
193
void bail(int code);
rswindell's avatar
rswindell committed
194
195
196
197
198
fidoaddr_t atofaddr(const char *str);
const char *faddrtoa(const fidoaddr_t*);
int  matchnode(sbbsecho_cfg_t*, fidoaddr_t, int exact);
nodecfg_t* findnodecfg(sbbsecho_cfg_t*, fidoaddr_t, int exact);