1 /*:ts=8*/
2 /*****************************************************************************
3  * FIDOGATE --- Gateway UNIX Mail/News <-> FTN NetMail/EchoMail
4  *
5  * $Id: structs.h,v 4.23 2004/08/22 20:19:12 n0ll Exp $
6  *
7  * An assortment of FIDOGATE data structure definitions
8  *
9  *****************************************************************************
10  * Copyright (C) 1990-2004
11  *  _____ _____
12  * |     |___  |   Martin Junius             <mj.at.n0ll.dot.net>
13  * | | | |   | |   Radiumstr. 18
14  * |_|_|_|@home|   D-51069 Koeln, Germany
15  *
16  * This file is part of FIDOGATE.
17  *
18  * FIDOGATE is free software; you can redistribute it and/or modify it
19  * under the terms of the GNU General Public License as published by the
20  * Free Software Foundation; either version 2, or (at your option) any
21  * later version.
22  *
23  * FIDOGATE is distributed in the hope that it will be useful, but
24  * WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  * General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with FIDOGATE; see the file COPYING.  If not, write to the Free
30  * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
31  *****************************************************************************/
32 
33 /*
34  * Textline, Textlist
35  */
36 typedef struct st_textline {
37     char		*line;
38     struct st_textline	*next;
39     struct st_textline	*prev;
40 } Textline;
41 
42 typedef struct st_textlist {
43     Textline		*first;
44     Textline		*last;
45     unsigned long        n;
46 } Textlist;
47 
48 
49 
50 /*
51  * Alias
52  */
53 typedef struct st_alias {
54     struct st_alias *next;
55     Node node;
56     char *username;
57     char *userdom;
58     char *fullname;
59 } Alias;
60 
61 
62 
63 /*
64  * Area
65  */
66 typedef struct st_area {	/* Area/newsgroup entry with options */
67     struct st_area *next;	    /* For linked list */
68     char *area;			    /* FTN area */
69     char *group;		    /* Newsgroup */
70     int   zone;			    /* FTN zone AKA */
71     Node  addr;			    /* FTN node address */
72     char *origin;		    /* FTN origin line */
73     char *distribution;		    /* Distribution */
74     int   flags;		    /* Area/group flags, see AREA_xx defines */
75     int   rfc_lvl;		    /* -R ^ARFC header level */
76     long  maxsize;		    /* -m max. size of message for split */
77     long  limitsize;		    /* -L message size limit */
78     Textlist x_hdr;		    /* -X "Xtra: xyz" extra RFC headers */
79     char *charset;		    /* -C def:in:out charset setting */
80 } Area;
81 
82 #define AREA_LOCALXPOST	1	/* -l  Only local crosspostings */
83 #define AREA_NOXPOST	2	/* -x  No crosspostings */
84 #define AREA_NOGATE	8	/* -g  No messages from other gateways */
85 #define AREA_8BIT	16	/* -8  Use 8 bit ISO-8859-1 character set */
86 #define AREA_HIERARCHY	32	/* -H  Area/group names match entire hierar. */
87 #define AREA_NO		64	/* -!  Don't gate area/group */
88 #define AREA_QP		128	/* -Q  Use quoted-printable ISO-8859-1 */
89 
90 
91 
92 /*
93  * AreasBBS
94  */
95 typedef struct st_areasbbs	/* AREAS.BBS entry */
96 {
97     char *dir;			    /* Directory */
98     char *key;			    /* Areafix access key */
99     int   lvl;			    /* Areafix access level */
100     int   zone;			    /* Zone AKA for area */
101     Node  addr;			    /* Node AKA for area */
102     char *area;			    /* Area tag */
103     LON   nodes;		    /* Nodes linked to this area */
104     int   flags;		    /* Area flags, see AREASBBS_xx defines */
105     char *desc;			    /* Area description */
106     char *state;		    /* Area state flags */
107     struct st_areasbbs *next;	    /* For linked list */
108 }
109 AreasBBS;
110 
111 #define AREASBBS_PASSTHRU 1	/* Passthru area (#dir) */
112 #define AREASBBS_READONLY 2	/* Read-only for new downlinks */
113 
114 
115 
116 /*
117  * TIMEINFO
118  */
119 typedef struct _TIMEINFO {
120     time_t	time;
121     long	usec;
122     long	tzone;
123 } TIMEINFO;
124 
125 
126 
127 /*
128  * Host
129  */
130 typedef struct st_host {	/* hosts entry */
131     struct st_host *next;	/*     for linked list */
132     Node	node;		/*     FTN address */
133     char       *name;		/*     Internet address */
134     int		flags;		/*     flags */
135 } Host;
136 
137 #define HOST_POINT	1	/* Addresses with pX point address */
138 #define HOST_DOWN	2	/* Temporary down */
139 #ifdef AI_1
140 #define HOST_ADDR	4	/* Real Fidonet address in .pkt file.
141                                    Like key '-a' in command line rfc2ftn    */
142 #endif
143 
144 #ifdef AI_8
145 /*
146  * Acl
147  */
148 typedef struct st_acl {	        /* acl entry */
149     struct st_acl *next;	/*     for linked list */
150     char	  *email_pat;	/*     E-Mail address pattern */
151     char          *ngrp_pat;	/*     Newsgroup pattern */
152 } Acl;
153 #endif
154 
155 
156 /*
157  * Maus
158  */
159 typedef struct st_maus {	/* MAUSNET domain list entry */
160     struct st_maus *next;	    /* for linked list */
161     char *name;			    /* MAUS system name */
162     char *domain;		    /* Internet domain address */
163     Node  gate;			    /* FTN gateway for MAUS system */
164 } Maus;
165 
166 
167 
168 /*
169  * Passwd
170  */
171 typedef struct st_passwd	/* Password list entry */
172 {
173     char *context;			/* "ffx" | "packet" | "af" ... */
174     Node node;				/* Address */
175     char *passwd;			/* Password */
176     char *args;				/* More args in PASSWD file */
177     struct st_passwd *next;		/* For linked list */
178 }
179 Passwd;
180 
181 
182 
183 /*
184  * Routing commands, Remap, Rewrite
185  */
186 #define TYPE_NETMAIL	'n'
187 #define TYPE_ECHOMAIL	'e'
188 
189 #define CMD_SEND	's'
190 #define CMD_ROUTE	'r'
191 #define CMD_CHANGE	'c'
192 #define CMD_HOSTROUTE	'h'
193 #define CMD_HUBROUTE	'u'
194 #define CMD_REMAP	'm'
195 #define CMD_REMAP_TO	'm'
196 #define CMD_REMAP_FROM	'f'
197 #define CMD_REWRITE	'w'
198 #define CMD_SENDMOVE	'v'
199 #define CMD_XROUTE	'x'
200 #define CMD_BOSSROUTE	'b'
201 
202 #define FLAV_NONE	'-'
203 #define FLAV_NORMAL	'n'
204 #define FLAV_HOLD	'h'
205 #define FLAV_CRASH	'c'
206 #define FLAV_DIRECT	'd'
207 
208 typedef struct st_routing
209 {
210     int type;
211     int cmd;
212     int flav;
213     int flav_new;
214     LON nodes;
215 
216     struct st_routing *next;
217 }
218 Routing;
219 
220 typedef struct st_remap
221 {
222     int  type;				/* 'f' = RemapFrom, 'm' = RemapTo */
223     Node from;				/* From/to pattern */
224     Node to;				/* New dest. address */
225     char *name;				/* Name pattern */
226 
227     struct st_remap *next;
228 }
229 Remap;
230 
231 typedef struct st_rewrite
232 {
233     Node from;				/* From pattern */
234     Node to;				/* To pattern */
235 
236     struct st_rewrite *next;
237 }
238 Rewrite;
239 
240 
241 
242 /*
243  * Archiver or program
244  */
245 #define PACK_NORMAL	'n'		/* Pack to pkt dest archive */
246 #define PACK_ROUTE	'r'		/* Pack to other archive */
247 #define PACK_FLO	'f'		/* Attach archive to other FLO */
248 #define PACK_DIR	'd'		/* Pack to separate directory */
249 #define PACK_MOVE	'm'		/* Move to separate directory */
250 
251 #define PACK_ARC	'a'
252 #define PACK_PROG	'p'
253 #define PACK_PROGN	'q'
254 
255 typedef struct st_arcprog
256 {
257     int pack;
258     char *name;
259     char *prog;
260 
261     struct st_arcprog *next;
262 }
263 ArcProg;
264 
265 /*
266  * Packing entry
267  */
268 typedef struct st_packing
269 {
270     int pack;
271     char *dir;
272     ArcProg *arc;
273     LON nodes;
274 
275     struct st_packing *next;
276 }
277 Packing;
278 
279 
280 
281 /*
282  * Descriptor for packet files
283  */
284 typedef struct st_pktdesc
285 {
286     Node from;
287     Node to;
288     int  grade;
289     int  type;
290     int  flav;
291     int  move_only;
292 }
293 PktDesc;
294 
295 
296 /*
297  * RFCAddr
298  */
299 typedef struct st_rfcaddr {
300     /* user@addr (real) */
301     char user[MAXUSERNAME];
302     char addr[MAXINETADDR];
303     char real[MAXUSERNAME];
304     int  flags;
305 } RFCAddr;
306 
307 #define ADDR_MAUS	1
308 
309 
310 /*
311  * MsgBody
312  */
313 typedef struct st_body {
314     /* structured FTN message body */
315     char    *area;		/* AREA:xxxx echo tag */
316     Textlist kludge;		/* ^A kludges at start of message */
317     Textlist rfc;		/* RFC headers at start of message */
318     Textlist body;		/* text body */
319     char    *tear;		/* NetMail / EchoMail: --- tear line */
320     char    *origin;		/* EchoMail:  * Origin: xxxx (addr) line */
321     Textlist seenby;		/* EchoMail: SEEN-BY lines */
322     Textlist path;		/* EchoMail: ^APATH lines */
323     Textlist via;		/* NetMail: ^AVia lines */
324 } MsgBody;
325 
326 
327 
328 /*
329  * TIC file
330  */
331 typedef struct st_tick 		/* .TIC file description, see also FSC-0028 */
332 {
333     Node     origin;			/* Origin address */
334     Node     from;			/* From (this tic) address */
335     Node     to;			/* To (this tic) addresss */
336     char    *area;			/* Area name */
337     char    *file;			/* File name */
338     char    *replaces;			/* File to replace in file area */
339     Textlist desc;			/* Description (multiple lines) */
340     Textlist ldesc;			/* Description (multiple lines) */
341     unsigned long crc;			/* File CRC32 checksum */
342     char    *created;			/* Creator */
343     unsigned long size;			/* File size */
344     Textlist path;			/* Path (TL because of extra stuff) */
345     LON      seenby;			/* Seenby */
346     char    *pw;			/* Password */
347     time_t   release;			/* Release date */
348     time_t   date;			/* File date */
349     Textlist app;			/* Application specific */
350 }
351 Tick;
352 
353 
354 
355 /*
356  * Temporary string
357  */
358 typedef struct st_tmps
359 {
360     char *s;
361     size_t len;
362     struct st_tmps *next;
363 }
364 TmpS;
365 
366 
367 
368 /*
369  * FTN address
370  */
371 typedef struct st_ftnaddr {
372     char name[MAXUSERNAME];		/* No FTS-0001 limits here! */
373     Node node;
374 } FTNAddr;
375 
376 
377 
378 /*
379  * Charset mapping
380  */
381 #define MAX_CHARSET_NAME	16
382 #define MAX_CHARSET_IN		128
383 #define MAX_CHARSET_OUT		4
384 
385 #define CHARSET_FILE_ALIAS	'A'	/* Id for binary file */
386 #define CHARSET_FILE_TABLE	'T'	/* Id for binary file */
387 
388 typedef struct st_charset_alias
389 {
390     char alias[MAX_CHARSET_NAME];	/* Alias charset name */
391     char name[MAX_CHARSET_NAME];	/* Real charset name */
392     struct st_charset_alias *next;
393 }
394 CharsetAlias;
395 
396 typedef struct st_charset_table
397 {
398     char in[MAX_CHARSET_NAME];		/* Input charset name */
399     char out[MAX_CHARSET_NAME];		/* Output charset name */
400     char map[MAX_CHARSET_IN][MAX_CHARSET_OUT];
401     struct st_charset_table *next;
402 }
403 CharsetTable;
404