1 /*:ts=8*/ 2 /***************************************************************************** 3 * FIDOGATE --- Gateway UNIX Mail/News <-> FTN NetMail/EchoMail 4 * 5 * 6 * An assortment of FIDOGATE data structure definitions 7 * 8 ***************************************************************************** 9 * Copyright (C) 1990-2002 10 * _____ _____ 11 * | |___ | Martin Junius <mj@fidogate.org> 12 * | | | | | | Radiumstr. 18 13 * |_|_|_|@home| D-51069 Koeln, Germany 14 * 15 * This file is part of FIDOGATE. 16 * 17 * FIDOGATE is free software; you can redistribute it and/or modify it 18 * under the terms of the GNU General Public License as published by the 19 * Free Software Foundation; either version 2, or (at your option) any 20 * later version. 21 * 22 * FIDOGATE is distributed in the hope that it will be useful, but 23 * WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 * General Public License for more details. 26 * 27 * You should have received a copy of the GNU General Public License 28 * along with FIDOGATE; see the file COPYING. If not, write to the Free 29 * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 30 *****************************************************************************/ 31 32 #ifndef FIDOGATE_STRUCTS_H 33 #define FIDOGATE_STRUCTS_H 34 35 /* 36 must be included by fidogate.h 37 since requires config.h and amendmends 38 */ 39 40 #include "node.h" 41 #include "constants.h" 42 #include <time.h> 43 44 /* 45 * Textline, Textlist 46 */ 47 typedef struct st_textline { 48 char *line; 49 struct st_textline *next; 50 struct st_textline *prev; 51 } Textline; 52 53 typedef struct st_textlist { 54 Textline *first; 55 Textline *last; 56 unsigned long n; 57 } Textlist; 58 59 typedef struct st_tl_char_iterator { 60 Textlist *list; 61 Textline *cur; 62 size_t len; /* length of current line */ 63 size_t pos; /* position in the current line */ 64 } TextlistCharIterator; 65 66 typedef struct st_tl_iterator { 67 Textline *cur; 68 } TextlistIterator; 69 70 /* 71 * Alias 72 */ 73 typedef struct st_alias { 74 struct st_alias *next; 75 Node node; 76 char *username; 77 char *userdom; 78 char *fullname; 79 char type; 80 } Alias; 81 82 /* 83 * Area Uplink 84 */ 85 typedef struct st_areauplink { 86 struct st_areauplink *next; 87 int areafix; 88 char *areas; 89 Node uplink; 90 char *robotname; 91 char *password; 92 char *options; 93 } AreaUplink; 94 95 /* 96 * Area 97 */ 98 typedef struct st_area { /* Area/newsgroup entry with options */ 99 struct st_area *next; /* For linked list */ 100 char *area; /* FTN area */ 101 char *group; /* Newsgroup */ 102 int zone; /* FTN zone AKA */ 103 Node addr; /* FTN node address */ 104 char *origin; /* FTN origin line */ 105 char *distribution; /* Distribution */ 106 int flags; /* Area/group flags, see AREA_xx defines */ 107 int rfc_lvl; /* -R ^ARFC header level */ 108 long maxsize; /* -m max. size of message for split */ 109 long limitsize; /* -L message size limit */ 110 Textlist x_hdr; /* -X "Xtra: xyz" extra RFC headers */ 111 char *charset; /* -C def:in:out charset setting */ 112 int encoding; /* desired 8bit/base64/QP */ 113 } Area; 114 115 #define AREA_LOCALXPOST 1 /* -l Only local crosspostings */ 116 #define AREA_NOXPOST 2 /* -x No crosspostings */ 117 #define AREA_NOGATE 4 /* -g No messages from other gateways */ 118 #define AREA_HIERARCHY 8 /* -H Area/group names match entire hierar. */ 119 #define AREA_NO 16 /* -! Don't gate area/group */ 120 #define AREA_HEADERS_PLAIN 32 /* -nh Don't encode headers */ 121 122 /* 123 * AreasBBS 124 */ 125 typedef struct st_areasbbs { /* AREAS.BBS entry */ 126 char *dir; /* Directory */ 127 char *key; /* Areafix access key */ 128 int lvl; /* Areafix access level */ 129 int zone; /* Zone AKA for area */ 130 Node addr; /* Node AKA for area */ 131 char *area; /* Area tag */ 132 LON nodes; /* Nodes linked to this area */ 133 int flags; /* Area flags, see AREASBBS_xx defines */ 134 char *desc; /* Area description */ 135 LON passive; /* Passive */ 136 time_t time; /* Time */ 137 int expire_n; 138 int expire_t; 139 int msgs_in; 140 int msgs_out; 141 int msgs_dupe; 142 int msgs_routed; 143 int msgs_insecure; 144 #ifdef FTN_ACL 145 int msgs_readonly; 146 #endif /* FTN_ACL */ 147 int msgs_path; 148 long msgs_size; 149 char *state; /* Area state flags */ 150 struct st_areasbbs *next; /* For linked list */ 151 int uplinks; 152 } AreasBBS; 153 154 #define AREASBBS_PASSTHRU 1 /* Passthru area (#dir) */ 155 #define AREASBBS_READONLY 2 /* Read-only for new downlinks */ 156 157 /* 158 * News Active 159 */ 160 #ifdef ACTIVE_LOOKUP 161 typedef struct st_group { 162 struct st_group *next; 163 char *group; 164 #ifndef SN 165 int art_h; 166 int art_l; 167 #endif /* SN */ 168 char *flag; 169 } Active; 170 #endif /* ACTIVE_LOOKUP */ 171 172 /* 173 * TIMEINFO 174 */ 175 typedef struct _TIMEINFO { 176 time_t time; 177 long usec; 178 long tzone; 179 int isdst; 180 } TIMEINFO; 181 182 /* 183 * Host 184 */ 185 typedef struct st_host { /* hosts entry */ 186 struct st_host *next; /* for linked list */ 187 Node node; /* FTN address */ 188 char *name; /* Internet address */ 189 int flags; /* flags */ 190 } Host; 191 192 #define HOST_POINT 1 /* Addresses with pX point address */ 193 #define HOST_DOWN 2 /* Temporary down */ 194 #ifdef AI_1 195 #define HOST_ADDR 4 /* Real Fidonet address in .pkt file. 196 Like key '-a' in command line rfc2ftn */ 197 #endif 198 199 /* 200 * Acl 201 */ 202 typedef struct st_acl { /* acl entry */ 203 struct st_acl *next; /* for linked list */ 204 char type; 205 char *email_pat; /* E-Mail address pattern */ 206 char *ngrp_pat; /* Newsgroup pattern */ 207 char gate; 208 } Acl; 209 210 #ifdef SPYES 211 /* 212 * Spy 213 */ 214 typedef struct st_spy { 215 struct st_spy *next; 216 Node node; 217 Node forward_node; 218 } Spy; 219 #endif /* SPYES */ 220 221 /* 222 * Passwd 223 */ 224 typedef struct st_passwd { /* Password list entry */ 225 char *context; /* "packet" | "af" ... */ 226 Node node; /* Address */ 227 char *passwd; /* Password */ 228 char *args; /* More args in PASSWD file */ 229 struct st_passwd *next; /* For linked list */ 230 } Passwd; 231 232 /* 233 * Routing commands, Remap, Rewrite 234 */ 235 #define TYPE_NETMAIL 'n' 236 #define TYPE_ECHOMAIL 'e' 237 #define TYPE_TICK 't' 238 #ifdef FTN_ACL 239 #define TYPE_ECHO 'e' 240 #define TYPE_FECHO 'f' 241 #endif /* FTN_ACL */ 242 243 #define CMD_SEND 's' 244 #define CMD_ROUTE 'r' 245 #define CMD_CHANGE 'c' 246 #define CMD_HOSTROUTE 'h' 247 #define CMD_HUBROUTE 'u' 248 #define CMD_REMAP 'm' 249 #define CMD_REMAP_TO 'm' 250 #define CMD_REMAP_FROM 'f' 251 #define CMD_REWRITE 'w' 252 #define CMD_REWRITE_FROM 'g' 253 #define CMD_REWRITE_TO 'k' 254 #define CMD_SENDMOVE 'v' 255 #define CMD_XROUTE 'x' 256 #define CMD_BOSSROUTE 'b' 257 258 #define FLAV_NONE '-' 259 #define FLAV_NORMAL 'n' 260 #define FLAV_HOLD 'h' 261 #define FLAV_CRASH 'c' 262 #define FLAV_DIRECT 'd' 263 #define PACK_LAC 'l' 264 265 typedef struct st_routing { 266 int type; 267 int cmd; 268 int flav; 269 int flav_new; 270 LON nodes; 271 272 struct st_routing *next; 273 } Routing; 274 275 typedef struct st_remap { 276 int type; /* 'f' = RemapFrom, 'm' = RemapTo */ 277 Node from; /* From/to pattern */ 278 Node to; /* New dest. address */ 279 char *name; /* Name pattern */ 280 281 struct st_remap *next; 282 } Remap; 283 284 typedef struct st_rewrite { 285 int type; /* 'f' = RewriteFrom, 'm' = RewriteTo */ 286 Node from; /* From pattern */ 287 Node to; /* To pattern */ 288 char *name; /* Name pattern */ 289 290 struct st_rewrite *next; 291 } Rewrite; 292 293 typedef struct st_MkRoute { 294 Node uplink; 295 LON links; 296 int cmd; 297 int flav; 298 struct st_MkRoute *next; 299 } MkRoute; 300 301 /* 302 * Archiver or program 303 */ 304 #define PACK_NORMAL 's' /* Pack to pkt dest archive */ 305 #define PACK_ROUTE 'r' /* Pack to other archive */ 306 #define PACK_FLO 'f' /* Attach archive to other FLO */ 307 #define PACK_DIR 'd' /* Pack to separate directory */ 308 #define PACK_MOVE 'm' /* Move to separate directory */ 309 310 #define PACK_ARC 'a' 311 #define PACK_PROG 'p' 312 #define PACK_PROGN 'q' 313 314 typedef struct st_arcprog { 315 int pack; 316 char *name; 317 char *prog; 318 319 struct st_arcprog *next; 320 } ArcProg; 321 322 /* 323 * Packing entry 324 */ 325 typedef struct st_packing { 326 int pack; 327 char *dir; 328 ArcProg *arc; 329 int type; 330 LON nodes; 331 long maxarc; 332 333 struct st_packing *next; 334 } Packing; 335 336 /* 337 * Unpacking entry 338 */ 339 typedef struct st_unpacking { 340 char *name; 341 char *unarc; 342 char *list; 343 char *iden; 344 345 struct st_unpacking *next; 346 } Unpacking; 347 348 /* 349 * Runtoss entry 350 */ 351 typedef struct st_runtoss { 352 char *name; 353 char *inbound; 354 char *fadir; 355 char *grade; 356 char *flags; 357 358 struct st_runtoss *next; 359 } Runtoss; 360 361 /* 362 * Descriptor for packet files 363 */ 364 typedef struct st_pktdesc { 365 Node from; 366 Node to; 367 int grade; 368 int type; 369 int flav; 370 int move_only; 371 } PktDesc; 372 373 /* 374 * RFCAddr 375 */ 376 typedef struct st_rfcaddr { 377 /* user@addr (real) */ 378 char user[MAXUSERNAME]; 379 char addr[MAXINETADDR]; 380 char real[MAXUSERNAME]; 381 // int flags; 382 } RFCAddr; 383 384 #define ADDR_MAUS 1 385 386 /* 387 * MsgBody 388 */ 389 typedef struct st_body { 390 /* structured FTN message body */ 391 char *area; /* AREA:xxxx echo tag */ 392 Textlist kludge; /* ^A kludges at start of message */ 393 Textlist rfc; /* RFC headers at start of message */ 394 Textlist body; /* text body */ 395 char *tear; /* NetMail / EchoMail: --- tear line */ 396 char *origin; /* EchoMail: * Origin: xxxx (addr) line */ 397 Textlist seenby; /* EchoMail: SEEN-BY lines */ 398 Textlist path; /* EchoMail: ^APATH lines */ 399 Textlist via; /* NetMail: ^AVia lines */ 400 } MsgBody; 401 402 /* 403 * TIC file 404 */ 405 typedef struct st_tick { /* .TIC file description, see also FSC-0028 */ 406 Node origin; /* Origin address */ 407 Node from; /* From (this tic) address */ 408 Node to; /* To (this tic) addresss */ 409 char *area; /* Area name */ 410 char *file; /* File name */ 411 char *replaces; /* File to replace in file area */ 412 Textlist desc; /* Description (multiple lines) */ 413 Textlist ldesc; /* Description (multiple lines) */ 414 unsigned long crc; /* File CRC32 checksum */ 415 char *created; /* Creator */ 416 unsigned long size; /* File size */ 417 Textlist path; /* Path (TL because of extra stuff) */ 418 LON seenby; /* Seenby */ 419 char *pw; /* Password */ 420 time_t release; /* Release date */ 421 time_t date; /* File date */ 422 Textlist app; /* Application specific */ 423 } Tick; 424 425 /* 426 * Temporary string 427 */ 428 typedef struct st_tmps { 429 char *s; 430 size_t len; 431 struct st_tmps *next; 432 } TmpS; 433 434 /* 435 * FTN address 436 */ 437 typedef struct st_ftnaddr { 438 char name[MAXUSERNAME]; /* No FTS-0001 limits here! */ 439 Node node; 440 } FTNAddr; 441 442 /* 443 * Charset mapping 444 */ 445 #define MAX_CHARSET_NAME 16 446 #define MAX_CHARSET_IN 128 447 #define MAX_CHARSET_OUT 4 448 449 #define CHARSET_FILE_ALIAS 'A' /* Id for binary file */ 450 #define CHARSET_FILE_TABLE 'T' /* Id for binary file */ 451 452 typedef struct st_charset_alias { 453 char alias[MAX_CHARSET_NAME]; /* Alias charset name */ 454 char name[MAX_CHARSET_NAME]; /* Real charset name */ 455 struct st_charset_alias *next; 456 } CharsetAlias; 457 458 typedef struct st_charset_table { 459 char in[MAX_CHARSET_NAME]; /* Input charset name */ 460 char out[MAX_CHARSET_NAME]; /* Output charset name */ 461 char map[MAX_CHARSET_IN][MAX_CHARSET_OUT]; 462 struct st_charset_table *next; 463 } CharsetTable; 464 465 /* 466 * MIME (RFC 2045) header info 467 */ 468 typedef struct st_mimeinfo { 469 char *version; /* MIME-Version */ 470 char *type; /* Content-Type (complete header) */ 471 char *type_type; /* MIME type part */ 472 char *type_charset; /* charset part */ 473 char *type_boundary; /* boundary part */ 474 char *encoding; /* Content-Transfer-Encoding */ 475 char *disposition; /* Content-Disposition */ 476 char *disposition_filename; /* filename from C-Disposition header */ 477 struct st_mimeinfo *next; 478 } MIMEInfo; 479 480 /* 481 * Zonegate list 482 */ 483 typedef struct st_zonegate { 484 Node node; 485 LON seenby; 486 struct st_zonegate *next; 487 } ZoneGate; 488 489 /* 490 * Config list 491 */ 492 typedef struct st_cflist { 493 char *key; 494 char *string; 495 struct st_cflist *next; 496 } cflist; 497 498 typedef struct rfcheader { 499 Textlist headers; 500 Textline *last_header; 501 } RFCHeader; 502 503 #endif 504