1 /* $Id$ */
2 /******************************************************************************
3  * FIDOCONFIG --- library for fidonet configs
4  ******************************************************************************
5  * Copyright (C) 1998-1999
6  *
7  * Matthias Tichy
8  *
9  * Fido:     2:2433/1245 2:2433/1247 2:2432/605.14
10  * Internet: mtt@tichy.de
11  *
12  * Grimmestr. 12         Buchholzer Weg 4
13  * 33098 Paderborn       40472 Duesseldorf
14  * Germany               Germany
15  *
16  * This file is part of FIDOCONFIG.
17  *
18  * This library is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU Library General Public
20  * License as published by the Free Software Foundation; either
21  * version 2 of the License, or (at your option) any later version.
22  *
23  * This library is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  * Library General Public License for more details.
27  *
28  * You should have received a copy of the GNU Library General Public
29  * License along with this library; see file COPYING. If not, write to the Free
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31  *****************************************************************************/
32 
33 #ifndef FIDOCONFIG_H
34 #define FIDOCONFIG_H
35 
36 #include <time.h>
37 #include <stdio.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #include <huskylib/huskylib.h>
44 
45 
46 #ifndef MSGTYPE_SDM /* see smapi/msgapi.h */
47 #define MSGTYPE_SDM 0x01
48 #endif
49 #ifndef MSGTYPE_SQUISH /* see smapi/msgapi.h */
50 #define MSGTYPE_SQUISH 0x02
51 #endif
52 #ifndef MSGTYPE_PASSTHROUGH /* see smapi/msgapi.h */
53 #define MSGTYPE_PASSTHROUGH 0x04
54 #endif
55 #ifndef MSGTYPE_JAM /* see smapi/msgapi.h */
56 #define MSGTYPE_JAM 0x08
57 #endif
58 
59 #define AREANAMELEN     60
60 
61 /* PATH_DELIM used for consruct full pathname
62  */
63 #ifndef PATH_DELIM
64 #  if defined(SASC) || defined(__UNIX__)
65 #    define PATH_DELIM  '/'
66 #  else
67 #    define PATH_DELIM  '\\'
68 #  endif
69 #endif
70 
71 #define strend(str) ((str) + strlen(str) - 1)
72 
73 extern char *actualLine, *actualKeyword;
74 
75 HUSKYEXT int  actualLineNr;
76 HUSKYEXT char CommentChar;
77 HUSKYEXT int  fc_trycreate;
78 
79 extern char wasError;
80 #define TRUE_COMMENT	"!#$%;"
81 
82 #define ZIPINTERNAL "zipInternal"
83 
84 /* availlist values */
85 enum _eAvailList
86 {
87   AVAILLIST_FULL = 0, /* Default value */
88   AVAILLIST_UNIQUE,
89   AVAILLIST_UNIQUEONE
90 };
91 
92 typedef enum _eAvailList eAvailList;
93 
94 HUSKYEXT char *striptwhite(char *str);
95 
96 typedef struct  pack {
97    char    *packer;
98    char    *call;
99 } s_pack, *ps_pack;
100 
101 typedef struct execonfile {
102    char    *filearea;
103    char    *filename;
104    char    *command;
105 } s_execonfile, *ps_execonfile;
106 
107 typedef enum flavour {flNormal=1, flHold, flCrash, flDirect, flImmediate, /*the last one:*/flUndef=0} e_flavour;
108 typedef enum pollType {PKT, REQUEST, FLOFILE} e_pollType;
109 typedef enum _forward {fOff, fOn, fSecure} e_forward;
110 typedef enum emptypktpwd {eOff, eSecure, eOn} e_emptypktpwd;
111 typedef enum pktheaderdiffer {pdOff, pdOn} e_pktheaderdiffer;
112 typedef enum nameCase { eLower, eUpper} e_nameCase;
113 typedef enum nameCaseConvertion { cLower, cUpper, cDontTouch } e_nameCaseConvertion;
114 typedef enum bundleFileNameStyle { eUndef, eTimeStamp, eAddrDiff, eAddrDiffAlways, eAmiga, eAddrsCRC32, eAddrsCRC32Always} e_bundleFileNameStyle;
115 typedef enum emailEncoding { eeMIME, eeSEAT, eeUUE } e_emailEncoding;
116 typedef enum pauses        { NOPAUSE=0, ECHOAREA=1, FILEAREA=2 } e_pauses; /*bitmasks! ECHOAREA & FILEAREA use also in s_area.areatype*/
117 
118 typedef struct link_robot {
119     unsigned int on;        /*  0 if not allowed for robot (was: AreaFix) */
120     char *pwd;         /* (was: areaFixPwd) */
121     char *baseDir;     /* (was: msgBaseDir, fileBaseDir) */
122     long reportsAttr;       /* (was: areafixReportsAttr) */
123     char *reportsFlags;     /* (was: areafixReportsFlags) */
124     unsigned int echoLimit; /* (was: afixEchoLimit) */
125     unsigned int noRules;   /* don't send rules on subscribe */
126     unsigned int autoCreate;/*  0 if not allowed for autoareacreate (was: autoAreaCreate) */
127     char *autoCreateFile;  /*  file where autocreated areas are written to (was: autoAreaCreateFile) */
128     char *autoCreateDefaults; /* add default string for autocreated area here (was: autoAreaCreateDefaults) */
129 	unsigned int autoSubscribe; /* 0 if the link is not autosubscribed to an autocreated (file)echo */
130     unsigned int forwardRequests; /*  0 if not allowed forward requests */
131     char *name;       /* remote robot (was: RemoteRobotName) */
132     unsigned int forwardPriority; /*  Priority when requests area from uplinks (was: forwardAreaPriority) */
133     char *fwdFile;     /* list of available areas from this link */
134     char *denyFwdFile;
135     char **frMask; /*  forwardRequestMask groups */
136     unsigned int numFrMask;
137     char **dfMask; /*  don't forward this */
138     unsigned int numDfMask;
139     unsigned int denyFRA;  /*  denyFwdReqAccess */
140     unsigned int denyUFRA; /*  denyUncondFwdReqAccess */
141 } s_link_robot, *ps_link_robot;
142 
143 typedef struct link {
144     hs_addr hisAka, *ourAka, hisPackAka;
145     char *name;
146     char *defaultPwd,               /*  8 byte passwords */
147         *pktPwd,
148         *ticPwd,
149         *bbsPwd,
150         *sessionPwd;
151     char *handle;              /*  nickname */
152     char *email;
153     char *emailFrom; /*  sender address for outgoing emails */
154     char *emailSubj;
155     e_emailEncoding emailEncoding;
156 
157     s_link_robot areafix;              /* areafix data */
158     s_link_robot filefix;              /* filefix data */
159 
160     unsigned int FileFixFSC87Subset;   /*  1 if only FSC87-commands are allowable in TIC files */
161 
162     int  allowEmptyPktPwd;     /*  1 if you want to allow empty packet password in */
163     /*    PKT files found in the protected inbound */
164     int  allowPktAddrDiffer;   /*  1 if you want to allow the originating address */
165     /*    in MSG differ from address in PKT */
166     /*    (only for areafix requests) */
167     e_forward forwardPkts;     /*  defines, if pkts should be forwarded to this link */
168     char *pktFile, *packFile;  /*  used only internally by hpt */
169     char *floFile, *bsyFile;   /*  dito */
170     ps_pack packerDef;
171     e_flavour netMailFlavour, echoMailFlavour, fileEchoFlavour;
172     char *LinkGrp;         /*  link's group for autocreate areas */
173     char **AccessGrp;      /*  groups for echo access */
174     unsigned int numAccessGrp;
175     void *msg;                 /*  active msg to the link (used in areafix) */
176     unsigned int noTIC;        /*  0 if TIC files should be generated */
177     unsigned int Pause;        /*  0 if no pause (default) */
178                                /*  1 echo pause */
179                                /*  2 fecho pause */
180     unsigned autoPause;        /*  in days */
181     unsigned level;	           /*  0-65535 */
182     unsigned int dailyBundles; /*  start new arcmail bundle each day */
183     unsigned arcmailSize;      /*  max arcmail size in kb */
184     unsigned pktSize;          /*  max .pkt size in kb */
185     unsigned maxUnpackedNetmail; /*  max size of *.?ut file in kb. If */
186                                  /*  more, then put it into */
187                                  /*  bundle. Default 100 (used in bsopack) */
188     unsigned int packNetmail;    /*  allows to pack outbound */
189                                  /*  netmail. Default no (used in bsopack) */
190     unsigned int aexport, import, mandatory, manual; /*  Default link's options */
191     char **optGrp; /*  groups for this options */
192     unsigned int numOptGrp;
193     unsigned int delNotReceivedTIC; /* 1 - if file not recieved, then remove TIC */
194     unsigned int advancedAreafix;  /*  1 - send ~areatag when area delete */
195     e_bundleFileNameStyle linkBundleNameStyle; /*  Style bundle filenames (timeStamp, addrDiff... */
196 
197     unsigned int autoAreaCreateSubdirs;
198     unsigned int autoFileCreateSubdirs;
199     char  *fileBox;
200     unsigned int fileBoxAlways;
201     unsigned int tickerPackToBox;
202     unsigned int arcNetmail; /*  1 if pack netmail into arcmail bundles */
203     char useFileBox; /*  internal */
204     char sb; /*  internal */
205     FILE *pkt;  /*  for internal usage */
206     unsigned int reducedSeenBy; /*  reduces Seen-BYs (fsc-0093) */
207     eAvailList availlist;
208     unsigned int sendNotifyMessages; /* send netmail messages about */
209                                      /* forward request timeout etc... */
210     unsigned int allowRemoteControl; /* allow %from command for link */
211     unsigned int unsubscribeOnAreaDelete; /* send "-area" request on area delete */
212 
213     unsigned int denyRescan;  /* denies or allows link to rescan areas */
214     char **RescanGrp;         /* specifies which area groups allow/deny to rescan */
215     unsigned int numRescanGrp;
216     int rescanLimit;          /* absolute max of msgs link can ask for rescan */
217 
218 } s_link, *ps_link;
219 
220 typedef enum routing {route_zero, host, hub, boss, noroute, nopack, route_extern} e_routing;
221 
222 typedef enum id {id_route, id_routeMail, id_routeFile} e_id;
223 
224 typedef struct route {
225    e_flavour flavour;
226    ps_link   target;   /*  if target = NULL use */
227    e_routing routeVia; /*  this */
228    char      *pattern;
229    char      *viaStr;  /*  fix for realloc of config->links */
230    e_id      id;
231 } s_route, *ps_route;
232 
233 typedef struct husky_group {
234    char *name;			/* group name */
235    char *desc;			/* group description */
236 } s_group, *ps_group;
237 
238 typedef enum dupeCheck {dcOff, dcMove, dcDel} e_dupeCheck;
239 typedef enum area_def_subscribing_t {RW=0, RO, WO} e_area_def_subscribing;
240 typedef enum scanMode { smNone=0, smNever, smManual, smListed} e_scanMode;
241 
242 typedef struct arealink {
243    ps_link link;
244    unsigned int aexport;		/*  1 - export yes, 0 - export no */
245    unsigned int import;		/*  1 - import yes, 0 - import no */
246    unsigned int mandatory;	/*  1 - mandatory yes, 0 - mandatory no */
247    unsigned int manual;		/*  1 - manual yes, 0 - manual no */
248    unsigned int rescan;         /*  1 - rescan yes, 0 - rescan no */
249    unsigned int defLink;	/*  1 - default uplink */
250 } s_arealink, *ps_arealink;
251 
252 typedef struct area {
253    int areaType;        /* ECHOAREA, FILEAREA */
254 
255    char *areaName;
256    char *fileName;      /* messagebase file for echoarea, directory for filearea or "passthrough" for both */
257    char *description;
258 
259    int msgbType;        /*  MSGTYPE_SDM or MSGTYPE_SQUISH or */
260                         /*  MSGTYPE_JAM or MSGTYPE_PASSTHROUGH */
261 
262    ps_addr useAka;
263 
264    ps_arealink *downlinks;  /*  array of pointers to s_link */
265    unsigned int downlinkCount;
266 
267    unsigned purge, max, dupeHistory;
268    char keepUnread, killRead;
269 
270    e_dupeCheck dupeCheck;
271    e_scanMode  scanMode;	/* val: conditions to scan area */
272    char tinySB, killSB, hide, noPause, mandatory, manual, DOSFile, debug;
273 
274    unsigned levelread;	      /*  0-65535 */
275    unsigned levelwrite;	      /*  0-65535 */
276    void *dupes;        /*  used internally by hpt. pointer to dupeDataBase */
277    void *newDupes;     /*  dito */
278    unsigned int imported;      /*  dito */
279 
280    unsigned int tooOld;       /* move incoming mail older than x days to BadArea */
281                               /* 0 - disabled */
282    unsigned int tooNew;       /* move incoming mail newer than x days to Bad Area */
283                               /* 0 - disabled */
284 
285    char *group;                      /*  used by reader (and areafix soon) */
286 
287    int ccoff;          /*  1 if carbon copy is not allowed from this area */
288 
289    /*  Owner and Group options, msgbase mode */
290    /*  not set if:  uid = -1 , gid = -1 , fperm = -1 */
291    unsigned int uid, gid, fperm;
292 
293    int nolink;         /*  do not reply-link area */
294    int keepsb;         /*  keep seen-by's and path */
295    int scn;            /*  1 if scanned (number of scanned messages-1) */
296    int nopack;         /*  do not pack area */
297    int killMsgBase;    /*  kill msg base */
298 
299    int paused;         /*  1 if area is paused */
300    int noautoareapause;  /*  do not automatically pause area */
301    int sbkeep_all;     /*  1 - keep all SEEN BY's when zone-gating */
302 
303    ps_addr       sbadd;
304    unsigned int  sbaddCount;
305    ps_addr       sbign;
306    unsigned int  sbignCount;
307    ps_addr       sbstrip;          /* AKAs to strip */
308    unsigned int  sbstripCount;
309    ps_addr       sbkeep;           /* AKAs to keep when zone-gating */
310    unsigned int  sbkeepCount;
311 
312    e_area_def_subscribing def_subscribing; /* Default mode for new links (-r -w). */
313 
314 /*   HAREA harea; */       /*   for internal usage; */
315    void *harea;   /* for internal usage: pointer to area handle. Store HAREA type variable (see msgapi.h in smapi) */
316 
317   /* filecho options */
318 
319    int sendorig;       /*  1 - Send Original */
320    int noCRC;          /*  0 if CRC check should be done on incoming files */
321    int noreplace;      /*  1 - no replace files in this filearea */
322    int nodiz;          /*  1 - do not try to get description from <fileDescName> */
323    int rename;         /*  1 - rename file in case of duplicates */
324 
325 } s_area, *ps_area;
326 
327 typedef struct bbsareatype {
328    char *areaName;
329    char *pathName;
330    char *description;
331 } s_bbsarea, *ps_bbsarea;
332 
333 typedef enum carbonType {ct_to, ct_from, ct_kludge, ct_subject, ct_group,
334                          ct_fromarea, ct_msgtext, ct_addr} e_carbonType;
335 typedef enum {CC_OR=0, CC_AND, CC_NOT} e_carbonrule;
336 /* CC_extspawn is reserved to future */
337 typedef enum {CC_copy=0, CC_move=1, CC_delete=2/*, CC_extspawn*/ } e_carbonaction;
338 
339 typedef struct carbon {
340    e_carbonType ctype;
341    char         *str;     /*  string to compare */
342    char         *reason;  /*  reason of carbon action */
343    ps_area      area;     /*  area to copy messages */
344    hs_addr      addr;     /*  from addr to compare */
345    char         *areaName;/*  name of area to copy messages */
346    int          aexport;  /*  export copied msg? */
347    int          netMail;  /*  do this in netmail, not echomail */
348    e_carbonaction  move;  /*  copy, move or delete original msg */
349    int          extspawn; /*  areaName is name of external program to exec */
350    e_carbonrule rule;     /*  OR|AND|NOT with next carbon expr. */
351 } s_carbon, *ps_carbon;
352 
353 typedef struct unpack {
354    int     offset;
355    unsigned char *matchCode;
356    unsigned char *mask;
357    int     codeSize;
358    char    *call;
359 } s_unpack, *ps_unpack;
360 
361 typedef struct remap {
362    hs_addr  oldaddr;
363    hs_addr  newaddr;
364    char   *toname;
365 } s_remap, *ps_remap;
366 
367 /* FTS5000 is the standard nodelist format,
368    POINTS24 is the German Pointlist format
369    POINTS4D is a full 4D pointlist (with 3d "boss" entries) */
370 
371 typedef enum nodelistFormat { fts5000, points24, points4d } e_nodelistFormat;
372 
373 typedef struct nodelist {
374    char *nodelistName;        /* name of unpacked nodelist w/o path */
375    char *diffUpdateStem;      /* with pathname */
376    char *fullUpdateStem;      /* with pathname */
377    unsigned int defaultZone;
378    int delAppliedDiff;
379    int format;
380 } s_nodelist, *ps_nodelist;
381 
382 typedef enum typeDupeCheck {
383                     hashDupes, /*Base bild from crc32*/
384               hashDupesWmsgid, /*Base bild from crc32+MSGID*/
385                     textDupes, /*Base bild from FromName+ToName+Subj+MSGID*/
386                commonDupeBase  /*Common base for all areas bild from crc32*/
387 } e_typeDupeCheck;
388 
389 typedef struct savetictype {
390    char *fileAreaNameMask;
391    char *pathName;
392    int  fileAction;            /* 0 - do nothing */
393                                /* 1 - copy file    -  save tic with ticked file */
394                                /* 2 - link file  */
395    UINT days2save;
396 
397 } s_savetic, *ps_savetic;
398 
399 typedef enum linkWithImportLog { lwiNo, lwiYes, lwiKill } e_linkWithImportLog;
400 typedef enum kludgeAreaNetmail { kanKill, kanIgnore, kanEcho } e_kludgeAreaNetmail;
401 /* val: mode to sort echolist by (as-is, by name, by group, by group and name ) */
402 typedef enum listEchoMode { lemUndef=0, lemUnsorted, lemName, lemGroup, lemGroupName } e_listEchoMode;
403 
404 typedef enum filelistType { flDir, flGlobal, flDirList } e_filelistType;
405 
406 typedef struct filelist
407 {
408   e_filelistType flType;
409   char *destFile;        /* name of file to be written                  */
410   char *dirHdrTpl;       /* filename of directory header template       */
411   char *dirEntryTpl;     /*             directory entry                 */
412   char *dirFtrTpl;       /*             directory footer                */
413   char *globHdrTpl;      /*             global header (flGlobal only)   */
414   char *globFtrTpl;      /*             global footer (flGlobal only)   */
415   char *dirListHdrTpl;   /*             dirlist header (flDirlist only) */
416   char *dirListEntryTpl; /*             dirlist entry  (flDirlist only) */
417   char *dirListFtrTpl;   /*             dirlist footer (flDirlist only) */
418 } s_filelist, *ps_filelist;
419 
420 typedef struct permissions
421 {
422   char *addrMask;	/* address mask for permissions settings */
423   char *areaMask;       /* area mask */
424 } s_permissions;
425 
426 /*  htick announcer */
427 typedef struct anndef /* announce definition */
428 {
429   char  *annAreaTag;     /* name of area when annouce will be placed    */
430   char **annInclude;     /* array of fileecho names|masks that will be  */
431                          /* announced in this annAreaTag                */
432   unsigned numbI;        /* number of annInclude masks                  */
433   char **annExclude;     /* array of fileecho names|masks that won't be */
434                          /* announced in this annAreaTag                */
435   unsigned numbE;        /* number of annExclude masks                  */
436 
437   char *annto;           /* field TONAME  : in announce message         */
438   char *annfrom;         /* field FROMNAME: in announce message         */
439   char *annsubj;         /* field SUBJ:     in announce message         */
440   char *annorigin;       /* Origin          in announce message         */
441   ps_addr annaddrto;      /* field ADDRTO:    in announce message         */
442   ps_addr annaddrfrom;    /* field ADDRFROM:  in announce message         */
443   char *annmessflags;    /* message  flags string                       */
444   dword  attributes;
445   unsigned  annforigin;  /* announce address of system who hatched file */
446   unsigned  annfrfrom;   /* announce address of system which file recived from */
447 } s_anndef, *ps_anndef;
448 
449 typedef struct robot {
450    char *name;              /* name of the robot, "*" for default */
451    char *strA;              /* string for the `area' word (area, filearea) */
452    char *strC;              /* string for the conf token (echoarea, filearea) */
453    ps_area        *areas;     /* pointer to pointer to areas list */
454    unsigned int   *areaCount; /* pointer to areas count */
455    s_str_array *names;        /* (was: areafixNames) */
456    char *fromName;          /* robot from: name (was: areafixFromName) */
457    char *origin;            /* origin line, NULL to disable (was: areafixOrigin) */
458    char *helpFile;          /* help file (was: areafixhelp ) */
459    char *rulesDir;          /* directory where area rules reside */
460    char *newAreaRefuseFile; /* refuse to create areas from this list */
461    char *autoCreateFlag;    /* auto-create flag (was: a[af]cFlag) */
462    char *queueFile;         /* queue (was: areafixQueueFile) */
463    long reportsAttr;        /* report's attrs (was: areafixReportsAttr) */
464    char *reportsFlags;      /* report's ext attrs (was: areafixReportsFlags) */
465    unsigned int killRequests; /* (was: areafixKillRequests) */
466    unsigned int queryReports; /* (was: areafixQueryReports) */
467    unsigned int msgSize;    /* robot's msg max size (was: areafixMsgSize) */
468    char *splitStr;          /* string to split big msgs (was: areafixSplitStr) */
469    unsigned int autoAreaPause;
470    unsigned int forwardRequestTimeout;
471    unsigned int killedRequestTimeout;
472    unsigned int idlePassthruTimeout;
473 } s_robot, *ps_robot;
474 
475 typedef struct fidoconfig {
476    unsigned int    cfgVersionMajor, cfgVersionMinor;
477    char     *name, *location, *sysop, *email;
478 
479    unsigned int   addrCount;
480    ps_addr  addr;
481 
482    unsigned int publicCount;
483    char     **publicDir;
484 
485    unsigned int  linkCount;
486    ps_link  *links;
487 
488    char     *inbound, *outbound, *protInbound, *listInbound, *localInbound, *tempInbound;
489    char     *logFileDir, *dupeHistoryDir, *nodelistDir, *msgBaseDir;
490    char     *magic, *tempOutbound, *ticOutbound;
491    char     *tempDir;         /* Common temporary files directory */
492    char     *fileAreaBaseDir;
493    char     *passFileAreaDir; /* Passthrough File Area */
494    char     *busyFileDir;
495    char     *semaDir, *badFilesDir;
496    char     *loglevels, *screenloglevels;
497    char     *logDateFormat;
498    char     *hptPerlFile;
499    char     *advStatisticsFile;
500    unsigned int fileAreaCreatePerms;
501 
502    s_area   dupeArea, badArea;
503    unsigned int   netMailAreaCount;
504    ps_area  netMailAreas;
505    unsigned int   echoAreaCount;
506    ps_area  echoAreas;
507    unsigned int   localAreaCount;
508    ps_area  localAreas;
509    unsigned int   fileAreaCount;
510    ps_area  fileAreas;
511    unsigned int   bbsAreaCount;
512    ps_bbsarea  bbsAreas;
513 
514    s_area  EchoAreaDefault;
515    s_area  FileAreaDefault;
516 
517    unsigned int   robotCount;
518    ps_robot *robot;
519 
520    unsigned int   routeCount;
521    ps_route route;
522 
523    unsigned int   groupCount;
524    ps_group group;
525 
526    unsigned int   packCount;
527    ps_pack  pack;
528    unsigned int   unpackCount;
529    ps_unpack unpack;
530 
531    char     *intab, *outtab;
532    unsigned int recodeMsgBase;
533    char     *echotosslog, *statlog, *importlog, *lockfile;
534    unsigned loguid, loggid, logperm;
535    char     *fileAreasLog, *longNameList, *fileNewAreasLog;
536    char     *fileArcList, *filePassList, *fileDupeList;
537 
538    e_linkWithImportLog LinkWithImportlog;
539    e_kludgeAreaNetmail kludgeAreaNetmail;
540    e_listEchoMode      listEcho;
541 
542    unsigned int   carbonCount;
543    ps_carbon carbons;
544    unsigned int   carbonAndQuit;
545    unsigned int   carbonKeepSb;  /*  keep SeenBy's and PATH in carbon area */
546    unsigned int   carbonOut;     /*  carbon outgoing messages */
547    unsigned int   exclPassCC;    /*  don't carbon passthough */
548    unsigned int   carbonExcludeFwdFrom; /*  don't print " * Forwarded from area" */
549 
550    unsigned int  remapCount;
551    ps_remap remaps;
552 
553    unsigned int areafixFromPkt;
554    char *robotsArea;
555 
556    char     **PublicGroup;
557    unsigned int numPublicGroup;
558    char     *ReportTo;
559    int      reportRequester;
560 
561    unsigned int   execonfileCount;
562    ps_execonfile execonfile;
563 
564    unsigned int logEchoToScreen;
565    unsigned int separateBundles;
566    unsigned int dailyBundles;
567    unsigned int defarcmailSize;
568    unsigned int ignoreCapWord;
569    unsigned int noProcessBundles;
570    unsigned int disableTID;
571    unsigned int disablePID;
572    unsigned int disableKludgeRescanned;
573 
574    char *afterUnpack, *beforePack;
575    char *processPkt;
576 
577    unsigned int createDirs;
578    unsigned int longDirNames, splitDirs;
579 
580    unsigned int addDLC, fileSingleDescLine, fileCheckDest;
581    e_nameCaseConvertion convertLongNames, convertShortNames;
582 
583    unsigned int fileDescPos, DLCDigits, fileMaxDupeAge;
584    unsigned int fileFileUMask, fileDirUMask;
585    unsigned int originInAnnounce; /* Show origin in announce (for htick) */
586    unsigned int MaxTicLineLength; /*  Maximum length line in TIC (for htick) */
587 
588    char     *fileLocalPwd, *fileLDescString;
589 
590    char     *fileDescription;
591 
592    unsigned int   saveTicCount;
593    ps_savetic    saveTic;
594 
595    unsigned int   fDescNameCount;
596    char           **fileDescNames;
597 
598    unsigned int nodelistCount;
599    ps_nodelist nodelists;
600 
601    char     *fidoUserList; /* without path name - is in nodelistDir */
602 
603    e_typeDupeCheck typeDupeBase;
604    unsigned int areasMaxDupeAge;
605 
606    ps_link   linkDefaults;
607    int      describeLinkDefaults;
608    e_nameCase createAreasCase;
609    e_nameCase areasFileNameCase;
610    char *tossingExt;
611 
612 #if defined ( __NT__ )
613    unsigned int setConsoleTitle; /* change console title */
614 #endif
615 
616    ps_addr       addToSeen;
617    unsigned int  addToSeenCount;
618 
619    ps_addr       ignoreSeen;
620    unsigned int  ignoreSeenCount;
621 
622    char *tearline, *origin;
623 
624    e_bundleFileNameStyle bundleNameStyle;
625 
626    unsigned int keepTrsMail; /*  Keep Transit Netmail */
627    unsigned int keepTrsFiles; /*  Keep Transit Files */
628    unsigned int createFwdNonPass;
629    unsigned int autoPassive;
630    unsigned int createAddUplink; /* add -def for uplink on autocreate */
631 
632    ps_filelist filelists;
633    unsigned int filelistCount;
634 
635    char *netmailFlag;
636 
637    unsigned int minDiskFreeSpace;
638    unsigned int advisoryLock;
639 
640    char *reqidxDir;         /* directory for herp request index files */
641 
642    int syslogFacility;     /* facility to use when logging via syslog */
643 
644    s_permissions *readOnly; /* temporary storage of address & area masks */
645    unsigned int readOnlyCount;
646    s_permissions *writeOnly;
647    unsigned int writeOnlyCount;
648    char *fileBoxesDir;
649    char *announceSpool;
650    char *notValidFNChars;
651    unsigned int packNetMailOnScan;
652 
653    char *seqDir;	/* for msgid generation */
654    unsigned long seqOutrun;
655 
656    char**   uuEGrp; /*  uueEchoAreaGroups; */
657    unsigned int numuuEGrp;
658 
659    /* for emailpkt */
660    char *sendmailcmd;   /* send e-mail command line*/
661    /*  htick announcer */
662    ps_anndef AnnDefs;
663    unsigned int ADCount;
664 
665 } s_fidoconfig, *ps_fidoconfig;
666 
667 /* flags for message.recode */
668 #define REC_HDR 0x0001
669 #define REC_TXT 0x0002
670 
671 struct message {
672    /* Address block */
673    hs_addr destAddr, origAddr;
674 
675 /*    UINT16 attributes; */
676    hINT32 attributes;
677    hUCHAR datetime[22];
678    hCHAR  netMail;
679    hINT32 textLength;
680    hINT32 ctlLength;
681    int    recode;
682 
683    char   *toUserName, *fromUserName, *subjectLine;
684    char   *text;
685    char   *ctl;
686 };
687 
688 struct pktHeader {
689    /* Address block */
690    hs_addr destAddr, origAddr;
691 
692    hUINT16 auxNet;
693 
694    /* product specific */
695    hUCHAR  hiProductCode,
696            loProductCode;
697    hUCHAR  majorProductRev,
698            minorProductRev;
699 
700    /* date */
701    time_t pktCreated;
702 
703    hUINT16 capabilityWord;
704 
705    hUINT32 prodData;
706 
707    char  pktPassword[9]; /* password + \0 */
708 };
709 
710 typedef struct pktHeader s_pktHeader;
711 typedef struct message   s_message;
712 
713 
714 typedef enum { M_NOTDEF=0, M_HPT, M_HTICK, M_EMAILPKT, M_HPUCODE, M_BSOPACK,
715                M_NLTOOLS, M_MSGED, M_HPTKILL, M_HPTSQFIX, M_HPTUTIL, M_HUSKMISC,
716                M_MPOST, M_SQPACK, M_TPARSER,
717                M_OTHER } e_known_moduls;
718 
719 typedef struct {
720     e_known_moduls module;
721     ps_fidoconfig config;
722     /*  for future usage */
723 } sApp;
724 
725 
726 
727 #ifndef _MAKE_DLL_MVC_
728 	extern sApp theApp;
729 #else
730 	HUSKYEXT sApp theApp;
731 #endif
732 
733 HUSKYEXT void SetAppModule(e_known_moduls mod); /*  setup struct sApp */
734 
735 /* Read fidoconfig from file into memory.
736  * Parameter: filename or NULL
737  * if NULL: try to find FIDOCONFIG enviroment variable, next use hardcoded path
738  * Return NULL and print diagnostic message to stdout if error(s) found.
739  */
740 HUSKYEXT ps_fidoconfig readConfig(const char *fileName);
741 
742 /* Dispose fidoconfig structure: free memory.
743  */
744 HUSKYEXT void disposeConfig(ps_fidoconfig config);
745 
746 HUSKYEXT ps_link getLink(s_fidoconfig *config, char *addr);
747 HUSKYEXT ps_link getLinkForArea(const s_fidoconfig *config, char *addr, s_area *area);
748 HUSKYEXT ps_link getLinkFromAddr(s_fidoconfig *config, hs_addr aka);
749 HUSKYEXT ps_addr getAddr(const s_fidoconfig *config, char *addr);
750 int    existAddr(s_fidoconfig *config, hs_addr aka);
751 
752 /* find echo & local areas in config */
753 HUSKYEXT ps_area getArea(ps_fidoconfig config, char *areaName);
754 
755 /* find only echo areas in config */
756 HUSKYEXT ps_area getEchoArea(ps_fidoconfig config, char *areaName);
757 
758 /* find netmail areas in config */
759 HUSKYEXT ps_area getNetMailArea(ps_fidoconfig config, char *areaName);
760 
761 /* find RobotsArea in config. If not found - selects 1st netmail area */
762 HUSKYEXT ps_area getRobotsArea(ps_fidoconfig config);
763 
764 /**
765  * This function return 0 if the link is not linked to the area,
766  * else it returns 1.
767  */
768 HUSKYEXT int isLinkOfArea(ps_link link, s_area *area);
769 
770 /**
771  * This function return -1 if the link is not linked to the area,
772  * else it returns index of link into arealinks array.
773  */
774 
775 HUSKYEXT int isAreaLink(hs_addr link, s_area *area);
776 
777 /**
778  * This function tests if link addr is our aka.
779  */
780 
781 HUSKYEXT int isOurAka(ps_fidoconfig config, hs_addr link);
782 
783 
784 
785 /**
786  * This function dumps the config to a file. The file is in fidoconfig format so,
787  * it is possible to change the config in memory and write it to disk.
788  * All formatting and comments are removed and the include structure of the config
789  * cannot be recreated. So be careful. A file called <fileName> which already exists
790  * will be overwritten.
791  * 1 if there were problems writing the config
792  * 0 else
793  */
794 int dumpConfigToFile(ps_fidoconfig config, char *fileName);
795 
796 /*  the following functions are for internal use. */
797 /*  Only use them if you really know what you do. */
798 HUSKYEXT char *readLine(FILE *f);
799 HUSKYEXT int  parseLine(char *line, ps_fidoconfig config);
800 int parsePath(char *token, char **var, char **alreadyDefined);
801 HUSKYEXT char *getConfigFileName(void);
802 HUSKYEXT char *trimLine(char *line);
803 HUSKYEXT int  carbonNames2Addr(s_fidoconfig *config);
804 HUSKYEXT int  init_conf(const char *conf_name);
805 HUSKYEXT void close_conf(void);
806 HUSKYEXT void setvar(char *name, char *value);
807 HUSKYEXT char *getvar(char *name);
808 void closeall(void);
809 HUSKYEXT char *configline(void);
810 
811 HUSKYEXT char *stripComment(char *line);
812 /* Truncate line at " # " or " #\0" where # is commentchar and any number of spaces before commentchar
813    Truncate all line if 1st non-space char is commentchar
814 */
815 
816 void checkIncludeLogic(ps_fidoconfig config);
817 void free_vars(void);
818 
819 HUSKYEXT const char* getCurConfName();
820 HUSKYEXT long getCurConfPos();
821 HUSKYEXT long get_hcfgPos();
822 HUSKYEXT FILE *get_hcfg();
823 HUSKYEXT const char *cfgEol();
824 
825 /**
826  * This method can be used to get a program-specifically config-filename, in the same directories which are searched for fidoconfig.
827  * envVar should be set to a string which resembles a environment-variable which should be checked if it includes the fileName.
828  * configName is the filename of the config *without* any prefixes.
829  * e.g.
830  *      getConfigFileNameForProgram("FIDOCONFIG", "config");
831  * is the call which is used for fidoconfig
832  */
833 
834 char *getConfigFileNameForProgram(char *envVar, char *configName);
835 
836 HUSKYEXT ps_area getFileArea(char *areaName);
837 
838 /*  this function can be used to dump config to stdout or to an already opened file. */
839 void dumpConfig(ps_fidoconfig config, FILE *f);
840 
841 /*  return 1 if group found in array of strings, else return 0 */
842 HUSKYEXT int grpInArray(char *group, char **strarray, unsigned int len);
843 
844 /* delete the area from in-core config */
845 HUSKYEXT void fc_freeEchoArea(s_area     *area);
846 
847 /* returns 1 if link has right to rescan area, else returns 0 */
848 HUSKYEXT int getLinkRescanAccess(s_area *area, s_link *link);
849 
850 HUSKYEXT void setLinkAccess(s_fidoconfig *config, s_area *area, s_arealink *arealink);
851 
852 void processPermissions (s_fidoconfig *config);
853 
854 /*  define exit codes for non unix systems */
855 #ifndef _SYSEXITS_H
856 #define _SYSEXITS_H
857 #define EX_OK           0       /* successful termination */
858 #define EX_USAGE        64      /* command line usage error */
859 #define EX_NOINPUT      66      /* cannot open input */
860 #define EX_UNAVAILABLE  69      /* service unavailable */
861 #define EX_SOFTWARE     70      /* internal software error */
862 #define EX_CANTCREAT    73      /* can't create (user) output file */
863 #define EX_IOERR        74      /* input/output error */
864 #define EX_TEMPFAIL     75      /* temp failure; user is invited to retry */
865 #define EX_CONFIG       78      /* configuration error */
866 #endif
867 
868 #ifdef __cplusplus
869  }
870 #endif
871 
872 #endif
873