1 /*
2  *  FECFG146.H
3  *
4  *  'C' Structures of FastEcho 1.46
5  *  Copyright (c) 1995 by Tobias Burchhardt.  Last update: 30 Jun 1995.
6  *  Modified by Aleksandar Ivanisevic 30 Oct 1996.
7  *  Minor alterations by Andrew Clarke 22 Dec 1996.
8  *  Modfications by Tobias Ernst 04 Oct 1998
9  *  Merged changes from fecfg146.h from T. Burchhardt 04 Oct 2000
10  */
11 
12 #ifndef __FECFG146_H__
13 #define __FECFG146_H__
14 
15 /*
16 We don't set pragma pack anymore. The result is that the structures below
17 are probably larger than their pendants in the binary file. You need to write
18 portable reader functions for reading them from file. For those structures
19 that are used by MsgEd, such reader functions can be found in fecfg145.c.
20 
21 #if defined(PACIFIC) || defined(_MSC_VER) || defined(__EMX__) || defined(__IBMC__) || defined(__HIGHC__) || defined(__UNIX__) || defined(__DJGPP__)
22 #pragma pack(1)
23 #endif
24 
25 */
26 
27 /********************************************************
28  * FASTECHO.CFG = <CONFIG>                              *
29  *                + <optional extensions>               *
30  *                + <CONFIG.NodeCnt * Node>             *
31  *                + <CONFIG.AreaCnt * Area>             *
32  ********************************************************/
33 
34 #define REVISION        6       /* current revision     */
35 
36 /*
37  *  Note: there is a major change in this revision - the Node records
38  *  have no longer a fixed length!
39  */
40 
41 #define MAX_AREAS       4096    /* max # of areas          */
42 #define MAX_NODES       1024    /* max # of nodes          */
43 #define MAX_GROUPS      32      /* max # of groups         */
44 #define MAX_AKAS        32      /* max # of akas           */
45 #define MAX_ROUTE       15      /* max # of 'vias'         */
46 #define MAX_ORIGINS     20      /* max # of origins        */
47 #define MAX_GATES	10	/* max # of Internet gates */
48 
49 /*
50  *  Note: The MAX_AREAS and MAX_NODES are only the absolute maximums as the
51  *  handling is flexible. To get the maximums which are used for the config
52  *  file you read, you have to examine the CONFIG.MaxAreas and
53  *  CONFIG.MaxNodes variables!
54  *
55  *  Note: The MAX_AREAS and MAX_NODES maximums are subject to change with
56  *  any new version, therefore - if possible - make handling as flexible as
57  *  possible and use CONFIG.MaxAreas and .MaxNodes whereever possible. But
58  *  be aware that you might (under normal DOS and depending on the way you
59  *  handle it) hit the 64kB segment limit pretty quickly!
60  *
61  *  Same goes for the # of AKAs and Groups - use the values found in
62  *  CONFIG.AkaCnt and CONFIG.GroupCnt!
63  *
64  *  Note: Define INC_FE_TYPES, INC_FE_BAMPROCS  and  INC_FE_DATETYPE
65  *  to include the typedefs if necessary.
66  */
67 
68 /********************************************************
69  * CONFIG.flags                                         *
70  ********************************************************/
71 
72 #define RETEAR                  0x00000001l
73 #define AUTOCREATE              0x00000002l
74 #define KILLEMPTY               0x00000004l
75 #define KILLDUPES               0x00000008l
76 #define CLEANTEARLINE           0x00001000l
77 #define IMPORT_INCLUDEUSERSBBS  0x00002000l
78 #define KILLSTRAYATTACHES       0x00004000l
79 #define PURGE_PROCESSDATE       0x00008000l
80 #define MAILER_RESCAN           0x00010000l
81 #define EXCLUDE_USERS           0x00020000l
82 #define EXCLUDE_SYSOPS          0x00040000l
83 #define CHECK_DESTINATION       0x00080000l
84 #define UPDATE_BBS_CONFIG       0x00100000l
85 #define KILL_GRUNGED_DATE       0x00200000l
86 #define NOT_BUFFER_EMS          0x00400000l
87 #define KEEP_NETMAILS           0x00800000l
88 #define NOT_UPDATE_MAILER       0x01000000l
89 #define NOT_CHECK_SEMAPHORES    0x02000000l
90 #define CREATE_SEMAPHORES       0x04000000l
91 #define CHECK_COMPLETE          0x08000000l
92 #define RESPOND_TO_RRQ          0x10000000l
93 #define TEMP_OUTB_HARDDISK      0x20000000l
94 #define FORWARD_PACKETS         0x40000000l
95 #define UNPACK_UNPROTECTED      0x80000000l
96 
97 /********************************************************
98  * CONFIG.mailer                                        *
99  ********************************************************/
100 
101 #define FrontDoor               0x0001
102 #define InterMail               0x0002
103 #define DBridge                 0x0004
104 #define Binkley                 0x0010
105 #define PortalOfPower           0x0020
106 #define McMail                  0x0040
107 
108 /********************************************************
109  * CONFIG.BBSSoftware                                   *
110  ********************************************************/
111 
112 enum BBSSoft
113 {
114     NoBBSSoft = 0,
115     RemoteAccess111,
116     QuickBBS,
117     SuperBBS,
118     ProBoard122 /* Unused */,
119     TagBBS,
120     RemoteAccess200,
121     ProBoard130 /* Unused */,
122     ProBoard200,
123     ProBoard202,
124     Maximus202,
125     Maximus300
126 };
127 
128 /********************************************************
129  * CONFIG.CC.what                                       *
130  ********************************************************/
131 
132 #define CC_FROM                 1
133 #define CC_TO                   2
134 #define CC_SUBJECT              3
135 #define CC_KLUDGE               4
136 
137 /********************************************************
138  * CONFIG.QuietLevel                                    *
139  ********************************************************/
140 
141 #define QUIET_PACK              0x0001
142 #define QUIET_UNPACK            0x0002
143 #define QUIET_EXTERN            0x0004
144 
145 /********************************************************
146  * CONFIG.Swapping                                      *
147  ********************************************************/
148 
149 #define SWAP_TO_XMS             0x0001
150 #define SWAP_TO_EMS             0x0002
151 #define SWAP_TO_DISK            0x0004
152 
153 /********************************************************
154  * CONFIG.Buffers                                       *
155  ********************************************************/
156 
157 #define BUF_LARGE               0x0000
158 #define BUF_MEDIUM              0x0001
159 #define BUF_SMALL               0x0002
160 
161 /********************************************************
162  * CONFIG.arcext.inb/outb                               *
163  ********************************************************/
164 
165 enum ARCmailExt
166 {
167     ARCDigits = 0, ARCHex, ARCAlpha
168 };
169 
170 /********************************************************
171  * CONFIG.AreaFixFlags                                  *
172  ********************************************************/
173 
174 #define ALLOWRESCAN             0x0001
175 #define KEEPREQUEST             0x0002
176 #define KEEPRECEIPT             0x0004
177 #define ALLOWREMOTE             0x0008
178 #define DETAILEDLIST            0x0010
179 #define ALLOWPASSWORD           0x0020
180 #define ALLOWPKTPWD             0x0040
181 #define ALLOWCOMPRESS           0x0080
182 #define SCANBEFORE              0x0100
183 #define ADDRECEIPTLIST          0x0200
184 #define NOTIFYPASSWORDS         0x0400
185 #define SENDCONFERENCERULES     0x0800
186 
187 /********************************************************
188  * Area.board (1-200 = Hudson)                          *
189  ********************************************************/
190 
191 #define NO_BOARD        0x4000u /* JAM/Sq/Passthru etc. */
192 #define AREA_DELETED    0x8000u /* usually never written */
193 
194 /********************************************************
195  * Area.flags.storage                                   *
196  ********************************************************/
197 
198 #define FE_QBBS                 0
199 #define FE_FIDO                 1  /* to avoid confusion with Msged's defs */
200 #define FE_SQUISH               2
201 #define FE_JAM                  3
202 #define FE_PASSTHRU             7
203 
204 /********************************************************
205  * Area.flags.atype                                     *
206  ********************************************************/
207 
208 #define AREA_ECHOMAIL           0
209 #define AREA_NETMAIL            1
210 #define AREA_LOCAL              2
211 #define AREA_BADMAILBOARD       3
212 #define AREA_DUPEBOARD          4
213 
214 /********************************************************
215  * GateDef.flags                                        *
216  ********************************************************/
217 #define GATE_KEEPMAILS	0x0001
218 
219 /********************************************************
220  * Types and other definitions                          *
221  ********************************************************/
222 
223 enum ARCers
224 {
225     ARC_Unknown = -1, ARC_SeaArc, ARC_PkArc, ARC_Pak,
226     ARC_ArcPlus, ARC_Zoo, ARC_PkZip, ARC_Lha, ARC_Arj,
227     ARC_Sqz, ARC_RAR, ARC_UC2
228 };  /* for Unpackers */
229 
230 enum NetmailStatus
231 {
232     NetNormal = 0, NetHold, NetCrash, NetImm
233 };
234 
235 enum AreaFixType
236 {
237     NoAreaFix = 0, NormalAreaFix, FSC57AreaFix
238 };
239 enum AreaFixSendTo
240 {
241     AreaFix = 0, AreaMgr, AreaLink, EchoMgr
242 };
243 
244 /********************************************************
245  * Structures                                           *
246  ********************************************************/
247 
248 typedef struct
249 {
250     unsigned short zone, net, node, point;
251 }
252 FEAddress;
253 #define FE_ADDRESS_SIZE 8
254 
255 #define _MAXPATH 56
256 
257 typedef struct CONFIGURATION
258 {
259     unsigned short revision;
260     unsigned long flags;
261     unsigned short NodeCnt, AreaCnt, unused1;
262     char NetMPath[_MAXPATH];
263     char MsgBase[_MAXPATH];
264     char InBound[_MAXPATH];
265     char OutBound[_MAXPATH];
266     char Unpacker[_MAXPATH];    /* DOS default decompression program */
267     char LogFile[_MAXPATH];
268     char unused2[280];
269     char RulesDir[_MAXPATH];
270     char Unpacker2[_MAXPATH];   /* OS/2 default decompression program */
271     char UnprotInBound[_MAXPATH];
272     char StatFile[_MAXPATH];
273     char SwapPath[_MAXPATH];
274     char SemaphorePath[_MAXPATH];
275     char BBSConfigPath[_MAXPATH];
276     char QueuePath[_MAXPATH];   /* DBQueuePath */
277     char RulesPrefix[32];
278     char RetearTo[40];
279     char LocalInBound[_MAXPATH];
280     char ExtAfter[_MAXPATH - 4];
281     char ExtBefore[_MAXPATH - 4];
282     unsigned char unused3[480];
283     struct
284     {
285         unsigned char what;
286         char object[31];
287         unsigned short conference;
288     }
289     CC[10];
290     unsigned char security, loglevel;
291     unsigned short def_days, def_messages;
292     unsigned char unused4[462];
293     unsigned short autorenum;
294     unsigned short def_recvdays;
295     unsigned char openQQQs, Swapping;
296     unsigned short compressafter;
297     unsigned short afixmaxmsglen;
298     unsigned short compressfree;
299     char TempPath[_MAXPATH];
300     unsigned char graphics, BBSSoftware;
301     char AreaFixHelp[_MAXPATH];
302     unsigned char unused5[504];
303     unsigned short AreaFixFlags;
304     unsigned char QuietLevel, Buffers;
305     unsigned char FWACnt;  /* # of ForwardAreaFix records */
306     unsigned char GDCnt;   /* # of Group Default records */
307     struct
308     {
309         unsigned short flags;
310         unsigned short days[2];
311         unsigned short msgs[2];
312     }
313     rescan_def;
314     unsigned long duperecords;
315     struct
316     {
317         unsigned char inb;
318         unsigned char outb;
319     }
320     arcext;
321     unsigned short AFixRcptLen;
322     unsigned char AkaCnt, resv;  /* # of Aka records stored */
323     unsigned short maxPKT;
324     unsigned char sharing, sorting;
325     struct
326     {
327         char name[36];
328         unsigned long resv;
329     }
330     sysops[11];
331     char AreaFixLog[_MAXPATH];
332     char TempInBound[_MAXPATH];
333     unsigned short maxPKTmsgs;
334     unsigned short RouteCnt;              /* # of PackRoute records */
335     unsigned char maxPACKratio;
336     unsigned char SemaphoreTimer;
337     unsigned char PackerCnt, UnpackerCnt; /* # of Packer + Unpacker records */
338     unsigned char GroupCnt, OriginCnt;    /* # of GroupName + Origin records */
339     unsigned short mailer;
340     unsigned short maxarcsize, maxarcdays;
341     unsigned short minInbPKTSize;
342     char reserved[804];
343 
344     unsigned short AreaRecSize, GrpDefRecSize;
345                                        /*
346                                         *  Size of Area and GroupDefaults
347                                         *  records stored in this file
348                                         */
349 
350     unsigned short MaxAreas, MaxNodes; /* Current max values for this config */
351     unsigned short NodeRecSize;        /* Size of each stored Node record */
352 
353     unsigned long offset;              /*
354                                         *  This is the offset from the current
355                                         *  file-pointer to the 1st Node
356                                         */
357 }
358 CONFIG;
359 #define FE_CONFIG_SIZE 4644
360 
361 /*
362  *  To directly access the 'Nodes' and/or 'Areas' while bypassing the
363  *  Extensions, perform an absolute (from beginning of file) seek to
364  *  sizeof(CONFIG) + CONFIG.offset.
365  *
366  *  If you want to access the 'Areas', you have to add the following value
367  *  to the above formula: CONFIG.NodeCnt * CONFIG.NodeRecSize.
368  */
369 
370 typedef struct
371 {
372     FEAddress addr;               /* Main address */
373     FEAddress arcdest;            /* ARCmail fileattach address */
374     unsigned char aka, autopassive, newgroup, resv1;
375     struct
376     {
377         unsigned passive          : 1;
378         unsigned dddd             : 1; /*Type 2+/4D */
379         unsigned arcmail060       : 1;
380         unsigned tosscan          : 1;
381         unsigned umlautnet        : 1;
382         unsigned exportbyname     : 1;
383         unsigned allowareacreate  : 1;
384         unsigned disablerescan    : 1;
385         unsigned arc_status       : 2; /*NetmailStatus for ARCmail attaches */
386         unsigned arc_direct       : 1; /*Direct flag for ARCmail attaches   */
387         unsigned noattach         : 1; /*don't create a ARCmail file attach */
388         unsigned mgr_status       : 2; /*NetMailStatus for AreaFix receipts */
389         unsigned mgr_direct       : 1; /*Direct flag for ... */
390         unsigned not_help         : 1;
391         unsigned not_notify       : 1;
392         unsigned packer           : 4;
393         unsigned packpriority     : 1;
394         unsigned resv             : 2;
395     }
396     flags;                      /* 24 bits total! */
397     union
398     { struct{
399         unsigned areafixtype      : 2;  /* Type of AreaFix: None (human),       */
400                                         /* Normal or Advanced (FSC-57)          */
401         unsigned forward          : 1;  /* Forward AreaFix requests             */
402         unsigned allowremote      : 1;  /*                                      */
403         unsigned allowdelete      : 1;  /* flags for different FSC-57 requests  */
404         unsigned allowrename      : 1;  /* all 3 reserved for future use        */
405         unsigned binarylist       : 1;  /* Forward changes (FSC-57)             */
406         unsigned addplus          : 1;  /* add '+' when requesting new area     */
407         unsigned addtear          : 1;  /* add tearline to the end of requests  */
408         unsigned sendto           : 3;  /* name of this systems's AreaFix robot */
409         unsigned nosendrules      : 1;  /* Send rules or not                    */
410         unsigned resv             : 3;  /* Reserved (unused space)              */
411       }bits;
412       unsigned short afixflags;
413     }
414     afixflags;
415     unsigned short resv2;
416     char password[9];          /* .PKT password    */
417     char areafixpw[9];         /* AreaFix password */
418     unsigned short sec_level;
419     unsigned long groups;      /* Bit-field, UCHAR 0/Bit 7 = 'A' etc. */
420     /* FALSE means group is active */
421     unsigned long resv3;
422     unsigned short resv4;
423     unsigned short maxarcsize;
424     char name[36];             /* Name of sysop */
425     unsigned char *areas;      /*
426                                 *  Bit-field with CONFIG.MaxAreas / 8
427                                 *  bits, Unsigned Char 0/Bit 7 is conference #0
428                                 *
429                                 *  Pointer will be alloc'ed by read_fe_node;
430                                 *  call free_fe_node to release it!
431                                 */
432 }
433 Node;                          /*
434                                 *  Total size of each record is stored in
435                                 *  CONFIG.NodeRecSize.
436                                 */
437 #define FE_NODE_SIZE (79 + (2 * FE_ADDRESS_SIZE))
438                                 /* FE_NODE_SIZE is size of the record except
439                                    for the variable length "areas" field */
440 
441 
442 typedef struct
443 {
444     char name[52];
445     unsigned short board;        /* 1-200 Hudson, others reserved/special */
446     unsigned short conference;   /* 0 ... CONFIG.MaxAreas-1 */
447     unsigned short read_sec, write_sec;
448     struct
449     {
450         unsigned aka    : 8;     /* 0 ... CONFIG.AkaCnt */
451         unsigned group  : 8;     /* 0 ... CONFIG.GroupCnt */
452     }
453     info;
454     struct
455     {
456         unsigned storage: 4;
457         unsigned atype  : 4;
458         unsigned origin : 5;     /* # of origin line */
459         unsigned resv   : 3;
460     }
461     flags;
462     struct
463     {
464         unsigned autoadded  : 1;
465         unsigned tinyseen   : 1;
466         unsigned cpd        : 1;
467         unsigned passive    : 1;
468         unsigned keepseen   : 1;
469         unsigned mandatory  : 1;
470         unsigned keepsysop  : 1;
471         unsigned killread   : 1;
472         unsigned disablepsv : 1;
473         unsigned keepmails  : 1;
474         unsigned hide       : 1;
475         unsigned manual     : 1;
476         unsigned umlaut     : 1;
477         unsigned resv       : 3;
478     }
479     advflags;
480     unsigned short resv1;
481     unsigned long seenbys;              /* LSB = Aka0, MSB = Aka31        */
482     unsigned long resv2;
483     short days;
484     short messages;
485     short recvdays;
486     char path[_MAXPATH];
487     char desc[52];
488 }
489 Area;
490 
491 #define FE_AREA_SIZE 190
492 
493 /********************************************************
494  * Optional Extensions                                  *
495  ********************************************************
496  *
497  *  These are the variable length extensions between CONFIG and the first
498  *  Node record. Each extension has a header which contains the info about
499  *  the type and the length of the extension. You can read the fields using
500  *  the following algorithm:
501  *
502  *    offset = 0;
503  *    while (offset < CONFIG.offset)
504  *    {
505  *        read_header();
506  *        if (header.type == EH_abc)
507  *        {
508  *            read_and_process_data();
509  *        }
510  *        else if (header.type == EH_xyz)
511  *        {
512  *            read_and_process_data();
513  *        }
514  *        else if (header.type == ...)
515  *        {
516  *            ...
517  *        }
518  *        else
519  *        {
520  *            */ /*  unknown or unwanted extension found */ /*
521  *        }
522  *        seek_forward(header.offset);  */ /*  Seek to next header */ /*
523  *        offset += header.offset + sizeof(header);
524  *    }
525  *
526  */
527 
528 typedef struct
529 {
530     unsigned short type;                /* EH_...                           */
531     unsigned long offset;               /* length of field excluding header */
532 }
533 ExtensionHeader;
534 #define FE_EXTHEADER_SIZE 6
535 
536                                 /* note: original .h file defined this constant
537                                    to 0x0001, but this obviously did not work
538                                  */
539 #define EH_AREAFIX      0x000d          /* CONFIG.FWACnt * <ForwardAreaFix> */
540 
541 enum AreaFixAreaListFormat
542 {
543     Areas_BBS = 0, Area_List
544 };
545 
546 typedef struct
547 {
548     unsigned short nodenr;
549     struct
550     {
551 /*
552         unsigned newgroup : 8;
553         unsigned active   : 1;
554         unsigned valid    : 1;
555         unsigned uncond   : 1;
556         unsigned format   : 3;
557         unsigned resv     : 2;
558 */
559         unsigned short flags;
560     }
561     flags;
562     char file[_MAXPATH];
563     char resv0[56];
564     unsigned short sec_level;
565     unsigned short resv1;
566     unsigned char resv3[3];
567     unsigned long groups;
568     char resv2[33];              /* THIS LOOKS LIKE BULLSHIT FIXME */
569 }
570 ForwardAreaFix;
571 
572 #define FE_FORWARD_AREAFIX_SIZE 160
573 
574 #define EH_GROUPS       0x000C  /* CONFIG.GroupCnt * <GroupNames> */
575 
576 typedef struct
577 {
578     char name[36];
579 }
580 GroupNames;
581 #define FE_GROUPNAMES_LEN 36
582 
583 #define EH_GRPDEFAULTS  0x0006  /* CONFIG.GDCnt * <GroupDefaults> */
584 
585 /* Size of each full GroupDefault record is CONFIG.GrpDefResSize */
586 
587 typedef struct
588 {
589     unsigned char group;
590     unsigned char resv[15];
591     Area area;
592     unsigned char *nodes;       /*
593                                  * variable, c.MaxNodes / 8 bytes
594                                  *
595                                  *  Pointer will be malloc'ed by
596                                  *  read_fe_groupdefaults,
597                                  *  call free_fe_groupdefaults to release it!
598                                  */
599 
600 }
601 GroupDefaults;
602 #define FE_GROUPDEFAULTS_SIZE (16 + FE_AREA_SIZE)
603                                 /* This is the length of the record except for
604                                    the variable length "nodes" field */
605 
606 #define EH_AKAS         0x0007  /* CONFIG.AkaCnt * <SysAddress> */
607 
608 typedef struct
609 {
610     FEAddress main;
611     char domain[28];
612     unsigned short pointnet;
613     unsigned long flags;        /* unused */
614 }
615 SysAddress;
616 #define FE_SYS_ADDRESS_SIZE (FE_ADDRESS_SIZE + 34)
617 
618 #define EH_ORIGINS      0x0008  /* CONFIG.OriginCnt * <OriginLines> */
619 
620 typedef struct
621 {
622     char line[62];
623 }
624 OriginLines;
625 
626 #define EH_PACKROUTE    0x0009  /* CONFIG.RouteCnt * <PackRoute> */
627 
628 typedef struct
629 {
630     FEAddress dest;
631     FEAddress routes[MAX_ROUTE];
632 }
633 PackRoute;
634 
635 #define EH_PACKERS      0x000A  /* CONFIG.Packers * <Packers> (DOS)  */
636 #define EH_PACKERS2     0x100A  /* CONFIG.Packers * <Packers> (OS/2) */
637 
638 typedef struct
639 {
640     char tag[6];
641     char command[_MAXPATH];
642     char list[4];
643     unsigned char ratio;
644     unsigned char resv[7];
645 }
646 Packers;
647 #define FE_PACKERS_SIZE 74
648 
649 #define EH_UNPACKERS    0x000B  /* CONFIG.Unpackers * <Unpackers> (DOS)  */
650 #define EH_UNPACKERS2   0x100B  /* CONFIG.Unpackers * <Unpackers> (OS/2) */
651 
652 /* Calling convention:                                      *
653  * 0 = change path to inbound directory, 1 = <path> *.PKT,  *
654  * 2 = *.PKT <path>, 3 = *.PKT #<path>, 4 = *.PKT -d <path> */
655 
656 typedef struct
657 {
658     char command[_MAXPATH];
659     unsigned char callingconvention;
660     unsigned char resv[7];
661 }
662 Unpackers;
663 
664 #define FE_UNPACKERS_SIZE sizeof(Unpackers)
665 
666 #define EH_RA111_MSG    0x0100  /* Original records of BBS systems */
667 #define EH_QBBS_MSG     0x0101
668 #define EH_SBBS_MSG     0x0102
669 #define EH_TAG_MSG      0x0104
670 #define EH_RA200_MSG    0x0105
671 #define EH_PB200_MSG    0x0106  /* See BBS package's documentation */
672 #define EH_PB202_MSG    0x0107  /* for details                     */
673 #define EH_MAX202_MSG   0x0108
674 
675 
676 /********************************************************
677  * Routines to access Node.areas, Node.groups           *
678  ********************************************************/
679 
680 #ifdef INC_FE_BAMPROCS
681 
AddBam(unsigned char * bam,unsigned short nr)682 unsigned short AddBam(unsigned char * bam, unsigned short nr)
683 {
684     unsigned char c, d;
685     c = (unsigned char)(1 << (7 - (nr & 7)));
686     d = bam[nr / 8] & c;
687     bam[nr / 8] |= c;
688     return d;
689 }
690 
FreeBam(unsigned char * bam,unsigned short nr)691 void FreeBam(unsigned char * bam, unsigned short nr)
692 {
693     bam[nr / 8] &= ~(1 << (7 - (nr & 7)));
694 }
695 
GetBam(unsigned char * bam,unsigned short nr)696 unsigned short GetBam(unsigned char * bam, unsigned short nr)
697 {
698     if (bam[nr / 8] & (1 << (7 - (nr & 7))))
699     {
700         return TRUE;
701     }
702     return FALSE;
703 }
704 
705 #define IsActive(nr,area)      GetBam(Node[nr].areas,area)
706 #define SetActive(nr,area)     AddBam(Node[nr].areas,area)
707 #define SetDeActive(nr,area)   FreeBam(Node[nr].areas,area)
708 
709 #endif
710 
711 /********************************************************
712  * FASTECHO.DAT = <STATHEADER>                          *
713  *                + <STATHEADER.NodeCnt * StatNode>     *
714  *                + <STATHEADER.AreaCnt * StatArea>     *
715  ********************************************************/
716 
717 #define STAT_REVISION       3   /* current revision */
718 
719 struct fe_date                  /* Used in FASTECHO.DAT */
720 {
721     unsigned short year;
722     unsigned char day;
723     unsigned char month;
724 };
725 
726 typedef struct
727 {
728     char signature[10];                /* contains 'FASTECHO\0^Z' */
729     unsigned short revision;
730     struct fe_date lastupdate;         /* last time file was updated */
731     unsigned short NodeCnt, AreaCnt;
732     unsigned long startnode, startarea;/* unix timestamp of last reset */
733     unsigned short NodeSize, AreaSize; /* size of StatNode and StatArea records */
734     char resv[32];
735 }
736 STATHEADER;
737 
738 typedef struct
739 {
740     FEAddress adr;
741     unsigned long n_import, n_export;
742     struct fe_date lastimport, lastexport;
743     unsigned long dupes;
744     unsigned long importbytes, exprotbytes;
745 }
746 StatNode;
747 
748 typedef struct
749 {
750     unsigned short conference;         /* conference # of area */
751     unsigned long tagcrc;              /* CRC32 of area tag    */
752     unsigned long n_import, n_export;
753     struct fe_date lastimport, lastexport;
754     unsigned long dupes;
755 }
756 StatArea;
757 
758 /* ======================================================================= */
759 /* Functions for reading some of these structs in a portable manner        */
760 /* ======================================================================= */
761 
762 #ifdef __cplusplus
763 extern "C" {
764 #endif
765 
766 int read_fe_config(CONFIG *c, FILE *fp);
767 int read_fe_extension_header(ExtensionHeader *h, FILE *fp);
768 int read_fe_sysaddress(SysAddress *a, FILE *fp);
769 int read_fe_area(Area *a, FILE *fp);
770 
771                                 /* length is the length as announced by the
772                                    extension header */
773 int read_fe_node(Node *n, FILE *fp, size_t length);
774 void free_fe_node(Node *n);
775 int read_fe_groupdefaults(GroupDefaults *g, FILE *fp, size_t length);
776 void free_fe_groupdefaults(GroupDefaults *g);
777 
778 int read_fe_packers(Packers *p, FILE *fp);
779 int read_fe_unpackers(Unpackers *p, FILE *fp);
780 int read_fe_frequest(ForwardAreaFix *f, FILE *fp);
781 
782 #ifdef __cplusplus
783 }
784 #endif
785 
786 #endif
787