home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / i / imail135.zip / IM_DEV.ZIP / IM_STRUC.H next >
C/C++ Source or Header  |  1992-12-20  |  42KB  |  873 lines

  1.  
  2. /* ============================================================== */
  3. /*                                                                */
  4. /*               IMAIL DEFINITIONS AND STRUCTURES                 */
  5. /*                                                                */
  6. /* ============================================================== */
  7.  
  8. /*
  9.  * The contents of this file are subject to change without notice!
  10.  * Fields marked reserved should NOT be used.
  11.  * It is an ERROR to write to any of the configuration files
  12.  * while IMAIL (or any of its companion programs) is running.
  13.  * Test the semaphore file IMBUSY.NOW (in the IMAIL system directory)
  14.  * before writing to any of the config files.
  15.  * 
  16.  * Copyright (C) 1992 by IMAIL INC. All rights reserved.
  17.  */
  18.  
  19. #include <dir.h>
  20. #include <io.h>
  21. #include <time.h>
  22.  
  23. #define IMAIL_MAJ_VERSION     1
  24. #define IMAIL_MIN_VERSION     35
  25. #define STRUCT_MAJ_VERSION    1
  26. #define STRUCT_MIN_VERSION    00
  27. #define IM_PRD_CODE           0x4B
  28.  
  29. /* -------------------------------------------------------------------- */
  30. /*  Data type definitions                                               */
  31. /* -------------------------------------------------------------------- */
  32.  
  33. #define word                 unsigned
  34. #define byte                 unsigned char
  35. #define boolean              int
  36. #define integer              int
  37. typedef unsigned             bit;
  38.  
  39. /* -------------------------------------------------------------------- */
  40. /*  Internal limits                                                     */
  41. /* -------------------------------------------------------------------- */
  42.  
  43. #define MAXAKAS              16      /* Max # of addresses  */
  44. #define MAXPACKERS           11      /* Max # of packer def */
  45. #define MAXEXPORT            60      /* Max export defs     */
  46. #define MAXVIA               40      /* max nodes packed via*/
  47. #define MAXGROUPS            26      /* max nodes packed via*/
  48. #define MAXEXCEPT            10      /* max EXCEPT nodes    */
  49. #define MAXPACK              32      /* max default pack cmd*/
  50. #define MAXFWDLINK           10      /* max fwd link structs*/
  51. #define MAXNOIMPT            20      /* max # names for IMPORT */
  52. #define ZONESDOM             10      /* zones per domain entry */
  53. #define MAXTAG               51      /* max areatag length  */
  54. #define MAXNAME              37      /* max namefield lenght */
  55. #define MAXPACKNAME          50      /* max packer length   */
  56. #define MAXORIGIN            64      /* max origin length   */
  57.  
  58. /* -------------------------------------------------------------------- */
  59. /*  Log Style Definitions                                               */
  60. /* -------------------------------------------------------------------- */
  61.  
  62. #define LOG_NORMAL           0       /* normal log level    */
  63. #define LOG_VERBOSE          1       /* verbose log level   */
  64.  
  65. #define LOG_LOG              252     /* Always, but to file */
  66. #define LOG_SCREEN           253     /* Always, but to scrn */
  67. #define LOG_ALL              254     /* Always log this     */
  68. #define LOG_ERROR            255     /* Force error logging */
  69.  
  70. /* -------------------------------------------------------------------- */
  71. /*  Environment Type  (FroDo or Bink)                                   */
  72. /* -------------------------------------------------------------------- */
  73.  
  74. #define ENV_FRODO            0       /* FrontDoor/D'Bridge  */
  75. #define ENV_BINK             1       /* Binkley             */
  76.  
  77. /* -------------------------------------------------------------------- */
  78. /*  File Attach Message Status (used in IMAIL.ND)                       */
  79. /* -------------------------------------------------------------------- */
  80.  
  81. #define S_NORMAL             0       /* used in IMAIL.ND    */
  82. #define S_HOLD               1
  83. #define S_CRASH              2
  84.  
  85. /* -------------------------------------------------------------------- */
  86. /*  Message Base Types                                                  */
  87. /* -------------------------------------------------------------------- */
  88.  
  89. #ifndef MSGTYPE_SDM
  90.   #define MSGTYPE_SDM     0x01
  91. #endif
  92. #ifndef MSGTYPE_SQUISH
  93.   #define MSGTYPE_SQUISH  0x02
  94. #endif
  95. #ifndef MSGTYPE_HUDSON
  96.   #define MSGTYPE_HUDSON  0x03
  97. #endif
  98. #ifndef MSGTYPE_QBBS
  99.   #define MSGTYPE_QBBS    0x03
  100. #endif
  101. #ifndef MSGTYPE_PASSTH
  102.   #define MSGTYPE_PASSTH  0x0F
  103. #endif
  104. #ifndef MSGTYPE_ECHO
  105.   #define MSGTYPE_ECHO    0x80
  106. #endif
  107. #ifndef MSGTYPE_LOCAL
  108.   #define MSGTYPE_LOCAL   0x90
  109. #endif
  110. #ifndef MSGTYPE_NET
  111.   #define MSGTYPE_NET     0xA0
  112. #endif
  113.  
  114. /* -------------------------------------------------------------------- */
  115. /*  Via Line Switches                                                   */
  116. /* -------------------------------------------------------------------- */
  117.  
  118. #ifndef VIA_NONE
  119.   #define VIA_NONE        0x01
  120. #endif
  121. #ifndef VIA_EXP
  122.   #define VIA_EXP         0x02
  123. #endif
  124. #ifndef VIA_IMP
  125.   #define VIA_IMP         0x03
  126. #endif
  127. #ifndef VIA_BOTH
  128.   #define VIA_BOTH        0x04
  129. #endif
  130.  
  131. /* -------------------------------------------------------------------- */
  132. /*  Dupe ring check switches                                            */
  133. /* -------------------------------------------------------------------- */
  134.  
  135. #ifndef DUPE_NONE
  136.   #define DUPE_NONE        0x00
  137. #endif
  138. #ifndef DUPE_WARN
  139.   #define DUPE_WARN        0x01
  140. #endif
  141. #ifndef DUPE_ZONE
  142.   #define DUPE_ZONE        0x02
  143. #endif
  144. #ifndef DUPE_KILL
  145.   #define DUPE_KILL        0x03
  146. #endif
  147.  
  148. /* -------------------------------------------------------------------- */
  149. /*  Unlink handling                                                     */
  150. /* -------------------------------------------------------------------- */
  151.  
  152. #ifndef ULNK_NONE
  153.   #define ULNK_NONE        0x00
  154. #endif
  155. #ifndef ULNK_PASSTH
  156.   #define ULNK_PASSTH      0x01
  157. #endif
  158. #ifndef ULNK_ALL
  159.   #define ULNK_ALL         0x02
  160. #endif
  161.  
  162. /* -------------------------------------------------------------------- */
  163. /*  Personal Mail handling                                              */
  164. /* -------------------------------------------------------------------- */
  165.  
  166. #ifndef PERSM_NONE
  167.   #define PERSM_NONE       0x00
  168. #endif
  169. #ifndef PERSM_LOG
  170.   #define PERSM_LOG        0x01
  171. #endif
  172. #ifndef PERSM_MSG
  173.   #define PERSM_MSG        0x02
  174. #endif
  175. #ifndef PERSM_COPY
  176.   #define PERSM_COPY       0x03
  177. #endif
  178.  
  179. /* -------------------------------------------------------------------- */
  180. /*  AreaLink Request Handling                                           */
  181. /* -------------------------------------------------------------------- */
  182.  
  183. #ifndef KEEP_NONE
  184.   #define KEEP_NONE        0x00
  185. #endif
  186. #ifndef KEEP_MSG
  187.   #define KEEP_MSG         0x01
  188. #endif
  189. #ifndef KEEP_ALL
  190.   #define KEEP_ALL         0x02
  191. #endif
  192.  
  193. /* -------------------------------------------------------------------- */
  194. /*  Macros to make life easier                                          */
  195. /* -------------------------------------------------------------------- */
  196.  
  197. #define BASEMASK          0x0F
  198. #define TYPEMASK          0xF0
  199.  
  200. #define IsSdm(Type)       ((Type & BASEMASK) == MSGTYPE_SDM)
  201. #define IsMsg(Type)       ((Type & BASEMASK) == MSGTYPE_SDM)
  202. #define IsSquish(Type)    ((Type & BASEMASK) == MSGTYPE_SQUISH)
  203. #define IsHudson(Type)    ((Type & BASEMASK) == MSGTYPE_HUDSON)
  204. #define IsQbbs(Type)      ((Type & BASEMASK) == MSGTYPE_QBBS)
  205. #define IsPassth(Type)    ((Type & BASEMASK) == MSGTYPE_PASSTH)
  206. #define IsEcho(Type)      ((Type & TYPEMASK) == MSGTYPE_ECHO)
  207. #define IsLocal(Type)     ((Type & TYPEMASK) == MSGTYPE_LOCAL)
  208. #define IsNet(Type)       ((Type & TYPEMASK) == MSGTYPE_NET)
  209.  
  210.  
  211. /* -------------------------------------------------------------------- */
  212. /*  Exit Errorlevels & Error Messages                                   */
  213. /* -------------------------------------------------------------------- */
  214.  
  215. #define E_NOERR              0       /* no error                     */
  216. #define E_CRDIR              238     /* Error creating directory     */
  217. #define E_ELOCK              239     /* File locking error           */
  218. #define E_AOPEN              240     /* Error opening IMAIL.AX       */
  219. #define E_BOPEN              241     /* Error opening IMAIL.BX       */
  220. #define E_NOIDX              242     /* Index file missing/corrupt   */
  221. #define E_NOCFG              243     /* IMAIL.CF not found           */
  222. #define E_NOARE              244     /* IMAIL.AR not found           */
  223. #define E_NONOD              245     /* IMAIL.ND not found           */
  224. #define E_BADCF              246     /* Error in IMAIL.CF            */
  225. #define E_BADVR              247     /* Bad version of IMAIL.CF      */
  226. #define E_EOPEN              248     /* Error opening file           */
  227. #define E_EREAD              249     /* Error reading file           */
  228. #define E_EWRIT              250     /* Error writing file           */
  229. #define E_CMDPR              251     /* Command Line Parameter error */
  230. #define E_FILNF              252     /* File not found               */
  231. #define E_MEMRY              253     /* Memory Allocation error      */
  232. #define E_DISKF              254     /* Insufficient disk space      */
  233. #define E_UNKWN              255     /* Unknown error                */
  234.  
  235. /* === ERRORLEVELs returned by TOSS and/or SCAN === */
  236.  
  237. #define T_NOMAIL             0x00    /* no mail processed            */
  238. #define T_NET                0x01    /* Net mail                     */
  239. #define T_ECHO               0x02    /* Echo mail                    */
  240. #define T_BAD                0x04    /* Bad and/or dupe mail         */
  241. #define T_QBBS               0x08    /* Qbbs message base changed    */
  242. #define T_MSG                0x10    /* *.MSG message base changed   */
  243. #define T_SQUISH             0x20    /* Squish message base changed  */
  244. #define T_PERS               0x40    /* Mail to Sysop received       */
  245.  
  246. /* -------------------------------------------------------------------- */
  247. /*  Time-out for semaphore "wait" (in seconds)                          */
  248. /* -------------------------------------------------------------------- */
  249.  
  250. #define IM_SEM_WAIT          120
  251.  
  252. /* -------------------------------------------------------------------- */
  253. /*  Special values for 'ALL'                                            */
  254. /* -------------------------------------------------------------------- */
  255.  
  256. #define ZONE_ALL             56685u
  257. #define NET_ALL              56685u
  258. #define NODE_ALL             56685u
  259. #define POINT_ALL            56685u
  260.  
  261. /* -------------------------------------------------------------------- */
  262. /*  Misc other definitions required                                     */
  263. /* -------------------------------------------------------------------- */
  264.  
  265. #define FA_ANYFILE FA_RDONLY+FA_HIDDEN+FA_SYSTEM+FA_ARCH
  266.  
  267. #define TRUE                1
  268. #define FALSE                0
  269. #define BLANK              ' '
  270.  
  271. typedef char str255[256];
  272. typedef char str35[36];
  273. typedef char str16[16];
  274.  
  275. typedef char pktdate[20];
  276.  
  277. typedef struct array512 {
  278.   word         len;
  279.   char         longstring[512];
  280. } array512;
  281.  
  282. /* define some simple keyword replacements */
  283.  
  284. #define strdelete(s,p,num) strcpy(s+p-1,s+p+num)
  285.  
  286. #define STRSIZ               255   /* default string length */
  287.  
  288. /* -------------------------------------------------------------------- */
  289. /*  In case your compiler doesn't have these ...                        */
  290. /* -------------------------------------------------------------------- */
  291.  
  292. #ifndef MAXPATH
  293.   #define MAXPATH            80
  294. #endif
  295. #ifndef MAXDRIVE
  296.   #define MAXDRIVE           3
  297. #endif
  298. #ifndef MAXDIR
  299.   #define MAXDIR             66
  300. #endif
  301. #ifndef MAXFILE
  302.   #define MAXFILE            9
  303. #endif
  304. #ifndef MAXEXT
  305.   #define MAXEXT             5
  306. #endif
  307.  
  308.  
  309. /* -------------------------------------------------------------------- */
  310. /*                                                                      */
  311. /*                 QuickBBS Structures                                  */
  312. /*                                                                      */
  313. /* -------------------------------------------------------------------- */
  314.  
  315. typedef byte flagtype[4];
  316.  
  317. typedef struct userrecord {   /*  Used in the USERS.BBS File  */
  318.   char         name[36];
  319.   char         city[26];
  320.   char         pwd[16];
  321.   char         dataphone[13];
  322.   char         homephone[13];
  323.   char         lasttime[6];
  324.   char         lastdate[9];
  325.   byte         attrib;
  326.   flagtype     flags;
  327.   integer      credit;
  328.   integer      pending;
  329.   integer      timesposted;
  330.   integer      highmsgread;
  331.   integer      seclvl;
  332.   integer      times;
  333.   integer      ups;
  334.   integer      downs;
  335.   integer      upk;
  336.   integer      downk;
  337.   integer      todayk;
  338.   integer      elapsed;
  339.   integer      len;
  340.   byte         extraspace[8];
  341. } userrecord;
  342.  
  343. /* --- Attrib: -----------------------------------------------------
  344.  
  345.     Bit 0: Deleted
  346.     Bit 1: Screen Clear Codes
  347.     Bit 2: More Prompt
  348.     Bit 3: ANSI
  349.     Bit 4: No-Kill
  350.     Bit 5: Ignore Download Hours
  351.     Bit 6: ANSI Full Screen Editor
  352.     Bit 7: [ Reserved ]
  353.  
  354.     ------------------------------------------------------------- */
  355.  
  356. /* -------------------------------------------------------------------- */
  357. /*  Message Records                                                     */
  358. /* -------------------------------------------------------------------- */
  359.  
  360. typedef struct inforecord {   /*  Used in the MSGINFO.BBS file  */
  361.   word         lowmsg;        /*  Lowest Message in File  */
  362.   word         highmsg;       /*  Highest Message in File  */
  363.   word         totalactive;   /*  Total Active Messages  */
  364.   word         activemsgs[200];
  365. } inforecord;
  366.  
  367. typedef struct idxrecord {    /*  Used in the MSGIDX.BBS file  */
  368.   word         msgnum;
  369.   byte         board;
  370. } idxrecord;
  371.  
  372. typedef struct hdrrecord {    /*  Used in the MSGHDR.BBS file  */
  373.   word         msgnum, replyto, seealsonum, tread;
  374.   word         startrec;
  375.   word         numrecs, destnet, destnode, orignet, orignode;
  376.   byte         destzone, origzone;
  377.   word         cost;
  378.   byte         msgattr, netattr, board;
  379.   char         posttime[6];
  380.   char         postdate[9];
  381.   char         whoto[36], whofrom[36];
  382.   char         subj[73];
  383. } hdrrecord;
  384.  
  385.  
  386. /* --- Msg Attributes: --------------------------------------------- */
  387.  
  388. #define QMSGDELTD   0x01      /* deleted message,          0000 0001 */
  389. #define QMSGOUTN    0x02      /* outgoing net message      0000 0010 */
  390. #define QMSGISNET   0x04      /* Is a net message          0000 0100 */
  391. #define QMSGPRIVATE 0x08      /* Private                   0000 1000 */
  392. #define QMSGREAD    0x10      /* Received                  0001 0000 */
  393. #define QMSGOUTE    0x20      /* Outgoing echo message     0010 0000 */
  394. #define QMSGLOCAL   0x40      /* Local                     0100 0000 */
  395. #define QMSGXX1     0x80      /* [reserved]                1000 0000 */
  396.  
  397. /* --- Net Attributes: --------------------------------------------- */
  398.  
  399. #define QNETKILL    0x01      /* Kill when sent            0000 0001 */
  400. #define QNETSENT    0x02      /* Sent                      0000 0010 */
  401. #define QNETFILE    0x04      /* File attach               0000 0100 */
  402. #define QNETCRASH   0x08      /* Crash Priority            0000 1000 */
  403. #define QNETRRQ     0x10      /* Request Receipt           0001 0000 */
  404. #define QNETARQ     0x20      /* Audit request             0010 0000 */
  405. #define QNETCPT     0x40      /* Is a return receipt       0100 0000 */
  406. #define QNETXX1     0x80      /* [reserved]                1000 0000 */
  407.  
  408. /* --------------------------------------------------------------------
  409.  
  410.     Each record in the MSGTOIDX.BBS file is of type String[35], each
  411.     entry is simply the name of the person the corresponding message
  412.     in MSGHDR.BBS is addressed to.
  413.  
  414.     Each record in the MSGTXT.BBS file is of type String[255], each
  415.     entry is used to store blocks of message text.  The variable
  416.     "StartRec" in the MSGHDR.BBS file contains the starting record
  417.     position for the text, the variable "NumRecs" indicates how many
  418.     consecutive blocks of text there are in the MSGTXT.BBS file.
  419.  
  420.    ----------------------------------------------------------------- */
  421.  
  422.  
  423. /* -------------------------------------------------------------------- */
  424. /*                                                                      */
  425. /*                Fido Packet Structures                                */
  426. /*                                                                      */
  427. /* -------------------------------------------------------------------- */
  428.  
  429.  
  430. /* -------------------------------------------------------------------- */
  431. /*  Normal Message Header  (*.MSG)                                      */
  432. /* -------------------------------------------------------------------- */
  433.  
  434. typedef struct f2normsghdr {
  435.   char         fromwho[36];       /*  From username         */
  436.   char         towho[36];         /*  To username           */
  437.   char         subj[72];          /*  Subject               */
  438.   char         date[20];          /*  date string           */
  439.   word         times;             /*  times read            */
  440.   word         destnode;          /*  destination node      */
  441.   word         orignode;          /*  origin node           */
  442.   word         cost;              /*  cost                  */
  443.   word         orignet;           /*  origin net            */
  444.   word         destnet;           /*  destination net       */
  445.   word         destzone;          /*  destination zone      */
  446.   word         origzone;          /*  origin zone           */
  447.   word         destpoint;         /*  destination point     */
  448.   word         origpoint;         /*  origin point          */
  449.   word         reply;             /*  this is a reply to?   */
  450.   word         attr;              /*  Attribute             */
  451.   word         nextreply;         /*  reply to this msg...  */
  452. } f2normsghdr;
  453.  
  454.  
  455.  
  456. /*--------------------------------------------------------------------------*/
  457. /* Message attributes                                                       */
  458. /*--------------------------------------------------------------------------*/
  459. #define FMSGPRIVATE 0x0001  /* private message,          0000 0000 0000 0001 */
  460. #define FMSGCRASH   0x0002  /* accept for forwarding     0000 0000 0000 0010 */
  461. #define FMSGREAD    0x0004  /* read by addressee         0000 0000 0000 0100 */
  462. #define FMSGSENT    0x0008  /* sent OK (remote)          0000 0000 0000 1000 */
  463. #define FMSGFILE    0x0010  /* file attached to msg      0000 0000 0001 0000 */
  464. #define FMSGFWD     0x0020  /* being forwarded           0000 0000 0010 0000 */
  465. #define FMSGORPHAN  0x0040  /* unknown dest node         0000 0000 0100 0000 */
  466. #define FMSGKILL    0x0080  /* kill after mailing        0000 0000 1000 0000 */
  467. #define FMSGLOCAL   0x0100  /* FidoNet vs. local         0000 0001 0000 0000 */
  468. #define FMSGHOLD    0x0200  /*                           0000 0010 0000 0000 */
  469. #define FMSGXX1     0x0400  /* STRIPPED by FidoNet<tm>   0000 0100 0000 0000 */
  470. #define FMSGFRQ     0x0800  /* file request              0000 1000 0000 0000 */
  471. #define FMSGRRQ     0x1000  /* receipt requested         0001 0000 0000 0000 */
  472. #define FMSGCPT     0x2000  /* is a return receipt       0010 0000 0000 0000 */
  473. #define FMSGARQ     0x4000  /* audit trail requested     0100 0000 0000 0000 */
  474. #define FMSGURQ     0x8000  /* update request            1000 0000 0000 0000 */
  475.  
  476. #define BUNDLE_VER 2        /* IFNA Bundle Version                           */
  477. #define CAP_TYPE2   0x0001  /* Can make Type 2 bundles                       */
  478. #define CAP_STONAGE 0x0000  /* No particular capabailties, Type 2 assumed    */
  479.  
  480. /* -------------------------------------------------------------------- */
  481. /*  Header for Message Bundles (Bundle Type 2+)                         */
  482. /* -------------------------------------------------------------------- */
  483.  
  484. typedef struct f2pktmsghdr {
  485.    word orignode,        /* originating node */
  486.         destnode,        /* destination node */
  487.         year,            /* 1990 - nnnnn     */
  488.         month,
  489.         day,
  490.         hour,
  491.         minute,
  492.         second,
  493.         rate,            /* unused */
  494.         ver,             /* 2 */
  495.         orignet,         /* originating net */
  496.         destnet;         /* destination net */
  497.     byte
  498.         prod_lo,         /* product code */
  499.         rev_major,       /* revision level, major */
  500.         password[8];     /* packet level password */
  501.     word
  502.         qm_origzone,     /* QMail wants orig.zone here */
  503.         qm_destzone;     /* QMail wants dest.zone here */
  504.     byte
  505.         trash[2];        /* junk[8] */
  506.     word
  507.         cap_valid;       /* Cap. validity, byte swapped */
  508.     byte
  509.         prod_hi,         /* product code, hi byte */
  510.         rev_minor;       /* revision level, minor */
  511.     word
  512.         capability,      /* bundling capability */
  513.         origzone,        /* originating zone */
  514.         destzone,        /* destination zone */
  515.         origpoint,       /* originating point */
  516.         destpoint;       /* destination point */
  517.     long
  518.         junk;            /* junk */
  519. } f2pktmsghdr;
  520.  
  521.     /* --- Note ----------------------------------------------------
  522.  
  523.     (*) In the original FSC-0001 specification, these fields
  524.     were part of the Filler, and so may not be recognized
  525.     by all software.
  526.  
  527.     ------------------------------------------------------------- */
  528.  
  529.  
  530. /* -------------------------------------------------------------------- */
  531. /*  Packeted Message Header (Bundle Type 2+)                            */
  532. /* -------------------------------------------------------------------- */
  533.  
  534. typedef struct f2msghdr {
  535.   word         ver;               /*  Version (=2)          */
  536.   word         orignode;          /*  Originate Node        */
  537.   word         destnode;          /*  Destination Node      */
  538.   word         orignet;           /*  Originate Net         */
  539.   word         destnet;           /*  Destination Net       */
  540.   word         attr;              /*  Attribute             */
  541.   word         cost;              /*  Cost                  */
  542.   pktdate      date;              /*  Date String           */
  543. /*
  544.   char         towho[36];             To username
  545.   char         fromwho[36];           From username
  546.   char         subject[72];           Subject
  547. */
  548. } f2msghdr;
  549.  
  550.     /* --- Note ----------------------------------------------------
  551.  
  552.     The last three fields are variable length; they are
  553.     shown above for reference, but are not part of the
  554.     structure.
  555.  
  556.     ------------------------------------------------------------- */
  557.  
  558.  
  559. /* -------------------------------------------------------------------- */
  560. /*  Structs used in IMAIL Configuration files                           */
  561. /* -------------------------------------------------------------------- */
  562.  
  563. typedef struct naddress {        // std node number ...
  564.   word         zone;             /*  Zone Number             */
  565.   word         net;              /*  Net Number              */
  566.   word         node;             /*  Node Number             */
  567.   word         point;            /*  Point Number            */
  568. } naddress;
  569.  
  570. typedef struct expt {
  571.   word         zone;
  572.   word         net;
  573.   word         node;
  574.   word         point;
  575.   boolean      doexpt;
  576. } expt;
  577.  
  578. typedef struct pack_struct {                // used in pack routing ...
  579.   struct naddress dst;                      /* pack via this node          */
  580.   struct naddress nodes[MAXVIA];            /* nodes to pack               */
  581.   struct naddress except[MAXEXCEPT];        /* exceptions                  */
  582. } pack_struct;
  583.  
  584. typedef struct eaddress {                   // used in Area Manager ...
  585.   struct naddress dstn;                     /* node number                 */
  586.   bit             exp_only:1;               /* export only flag            */
  587.   bit             imp_only:1;               /* import only flag            */
  588.   bit             paused:1;                 /* echo mail paused            */
  589.   bit             rsvd1:5;                  /* reserved                    */
  590. } eaddress;
  591.  
  592. typedef struct fwd_link {                   // used for forward request nodes ...
  593.   char         areasfile[MAXFILE+MAXEXT];   /* name of areas file          */
  594.   char         toprogram[10];               /* name of area manager        */
  595.   char         password[21];                /* area manager password       */
  596.   struct naddress uplink;                   /* address of uplink           */
  597. } fwd_link;
  598.  
  599. typedef struct dom {
  600.   char         domain[21];                  /* name of domain              */
  601.   char         outbound[MAXPATH];           /* root outbound path          */
  602.   word         zones[ZONESDOM];             /* Zones in this domain        */
  603.   byte         akas[MAXAKAS];               /* =my= AKAs in this domain    */
  604. } dom;
  605.  
  606. typedef struct im_stats {                   // Used mainly by IUTIL
  607.   word         th_day;                      /* this day                    */
  608.   word         la_day;                      /* last day                    */
  609.   word         th_week;                     /* this week                   */
  610.   word         la_week;                     /* last week                   */
  611.   word         th_month;                    /* this month                  */
  612.   word         la_month;                    /* last month                  */
  613.   word         th_year;                     /* this year                   */
  614.   word         la_year;                     /* last year                   */
  615. } im_stats;
  616.  
  617.  
  618. /* -------------------------------------------------------------------- */
  619. /*  IMAIL.CF Structure                                                  */
  620. /* -------------------------------------------------------------------- */
  621.  
  622. typedef struct im_config_type {
  623.   byte         im_ver_maj;                  /* Major Version               */
  624.   byte         im_ver_min;                  /* Minor Version               */
  625.   char         sysop[MAXNAME];              /* name of sysop               */
  626.   byte         rsvd1;                       /* reserved                    */
  627.   byte         rsvd2;                       /* reserved                    */
  628.   byte         rsvd3;                       /* resreved                    */
  629.   struct naddress aka[MAXAKAS];             /* the AKAs                    */
  630.   struct dom   domains[MAXAKAS];            /* domain names & zones        */
  631.   byte         prod[10];                    /* Type2+ product codes        */
  632.   byte         rsvd4;                       /* reserved                    */
  633.   byte         rsvd5;                       /* reserved                    */
  634.   byte         rsvd6;                       /* reserved                    */
  635.   char         netmail[MAXPATH];            /* net mail subdirectory       */
  636.   char         netfile[MAXPATH];            /* inbound files directory     */
  637.   char         in_pkt[MAXPATH];             /* Directory for inbound PKTs  */
  638.   char         out_pkt[MAXPATH];            /* Directory for outbound PKTs */
  639.   char         outbound[MAXPATH];           /* outbound directory          */
  640.   char         quickbbs[MAXPATH];           /* QuickBBS system directory   */
  641.   char         rsvd7[MAXPATH];              /* reserved                    */
  642.   char         rsvd8[MAXPATH];              /* reserved                    */
  643.   char         rsvd9[MAXPATH];              /* reserved                    */
  644.   char         semaphor[MAXPATH];           /* Semaphor directory          */
  645.   char         logfilename[MAXPATH];        /* Log file name               */
  646.   char         alnk_help[MAXFILE+MAXEXT];   /* AreaLink help text          */
  647.   char         new_areas[MAXFILE+MAXEXT];   /* name of file for new areas  */
  648.   word         pwd_expire_days;             /* days before pwd expr'd      */
  649.   word         max_pkt_size;                /* max size of pkt to create   */
  650.   word         max_dupes;                   /* max dupes kept in dbase     */
  651.   byte         log_level;                   /* logging level               */
  652.   bit          rtnrecpt:1;                  /* True if to send rtn recpt   */
  653.   bit          rsvd_1:1;                    /* reserved                    */
  654.   bit          ARCmail06:1;                 /* ARCmail 0.6 compatibility   */
  655.   bit          environment:1;               /* FroDo or Binkley            */
  656.   bit          pkt_open:1;                  /* Keep PKT files open         */
  657.   bit          auto_add:1;                  /* Auto-add unknown areas      */
  658.   bit          multi_tasking:1;             /* TRUE if multi-tasking       */
  659.   bit          forward_for:1;               /* forward PKTs not for us     */
  660.   bit          singleextract:1;             /* extract 1 bundle at a time  */
  661.   bit          trunc_sent:1;                /* 1 = Trunc 0 = Delete        */
  662.   bit          keep_alnk_answ:1;            /* keep arealink answer        */
  663.   bit          prod_names:1;                /* use the FTSC product list   */
  664.   bit          swap_ems:1;                  /* swap to EMS                 */
  665.   bit          swap_ext:1;                  /* swap to extended memory     */
  666.   bit          newarea_passth:1;            /* set new areas to passth     */
  667.   bit          unlink_autoadded:1;          /* allow unlink of new areas   */
  668.   bit          direct_video:1;              /* use direct screen writing   */
  669.   bit          forward_req:1;               /* Execute forward link req.   */
  670.   bit          auto_add_nodes:1;            /* Autoadd unkown nodes        */
  671.   bit          bit_rsvd:5;                  /* reserved                    */
  672.   char         newarea_group;               /* new areas default group     */
  673.   char         dflt_origin[MAXORIGIN];      /* default origin line         */
  674.   char         before_toss[MAXPATH];        /* call before proc. PKTs      */
  675.   long         last_run;                    /* last run of IUTIL STAT      */
  676.   byte         sem_timeout;                 /* timeout waiting for IMBUSY  */
  677.   byte         via_line;                    /* add Via Line to netmails    */
  678.   byte         dupe_ring;                   /* Check for possible d-rings  */
  679.   char         no_import[MAXNOIMPT][38];    /* ignore when importing       */
  680.   char         packers[MAXPACKERS][MAXPACKNAME]; /* Packer defintions        */
  681.   char         arcunpak[MAXPACKNAME];         /* cmd to de-arc .ARC files    */
  682.   char         arjunpak[MAXPACKNAME];         /* cmd to de-arc .ARJ files    */
  683.   char         pkpakunpak[MAXPACKNAME];       /* cmd to de-arc .PKA files    */
  684.   char         pkzipunpak[MAXPACKNAME];       /* cmd to de-arc .ZIP files    */
  685.   char         lharcunpak[MAXPACKNAME];       /* cmd to de-arc .LZH files    */
  686.   char         zoounpak[MAXPACKNAME];         /* cmd to de-arc .ZOO files    */
  687.   char         pakunpak[MAXPACKNAME];         /* cmd to de-arc .PAK files    */
  688.   char         sqzunpak[MAXPACKNAME];         /* cmd to de-arc .SQZ files    */
  689.   char         unkunpak[MAXPACKNAME];         /* cmd to de-arc unknown files */
  690.   struct pack_struct pack[MAXPACK];           /* default PACK routing        */
  691.   struct fwd_link fwd[MAXFWDLINK];            /* forward link requests       */
  692.   byte         unlink_req;                    /* Unlink areas without dlink  */
  693.   char         semaphor_net[MAXFILE+MAXEXT];  /* Netmail rescan semaphor file*/
  694.   char         maint_help[MAXFILE+MAXEXT];    /* Alnk Remote Maint. Helpfile */
  695.   byte         pers_mail;                     /* use personal mail feature   */
  696.   byte         keep_alnk_req;                 /* keep arealink request       */
  697.   word         max_arcmail_size;              /* max size of arcmail bundles */
  698.   byte         max_msg_size;                  /* max size of netmail (split) */
  699.   char         filler[126];                   /* reserved                    */
  700. } im_config_type;
  701.  
  702.     /* --- Note ----------------------------------------------------
  703.  
  704.     The information about the badmail-area, the dupe-area
  705.     and the personalmail-area has been moved to IMAIL.AR,
  706.     see there for detailed information.
  707.  
  708.     ------------------------------------------------------------- */
  709.  
  710. /* -------------------------------------------------------------------- */
  711. /*  IMAIL.AR Structure                                                  */
  712. /* -------------------------------------------------------------------- */
  713.  
  714. typedef struct areas_record_type {
  715.   char         aname[MAXTAG];                 /* area name                   */
  716.   char         comment[61];                   /* area comment                */
  717.   char         origin[MAXORIGIN];             /* origin line to use          */
  718.   char         group;                         /* area group                  */
  719.   char         o_addr;                        /* address for origin          */
  720.   char         use_akas[MAXAKAS];             /* addresses for seen-bys      */
  721.   byte         msg_base_type;                 /* message base type           */
  722.   byte         brd;                           /* board number                */
  723.   char         msg_path[MAXPATH];             /* MSG/Squish path             */
  724.   bit          active:1;                      /* flag area active            */
  725.   bit          zone_gate:1;                   /* Zone-gate stripping         */
  726.   bit          tiny_seen:1;                   /* tiny seen-by flag           */
  727.   bit          secure:1;                      /* secure flag                 */
  728.   bit          keep_seen:1;                   /* keep seen-by flag           */
  729.   bit          deleted:1;                     /* flag deleted area           */
  730.   bit          auto_added:1;                  /* flag auto-added record      */
  731.   bit          mandatory:1;                   /* area is mandatory           */
  732.   bit          read_only:1;                   /* area is read only           */
  733.   bit          unlinked:1;                    /* area has been unlinked      */
  734.   bit          ulnk_req:1;                    /* perform unlinked requests?  */
  735.   bit          hidden:1;                      /* area is hidden              */
  736.   bit          to_link:1;                     /* should by processed by LINK */
  737.   bit          rsvd:3;                        /* reserved                    */
  738.   byte         iutil_bits;                    /* bits for IUTIL              */
  739.   byte         user_bits;                     /* 8 user-available bits       */
  740.   byte         days;                          /* days to keep messages       */
  741.   word         msgs;                          /* num messages to keep        */
  742.   struct im_stats t_stats;                    /* TOSS stats                  */
  743.   struct im_stats s_stats;                    /* SCAN stats                  */
  744.   struct im_stats d_stats;                    /* dupe statistics             */
  745.   time_t       creation;                      /* date/time of creation       */
  746.   time_t       update;                        /* last update by STAT         */
  747.   time_t       marked;                        /* used by IUTIL               */
  748.   char         filler[10];
  749.   struct eaddress export[MAXEXPORT];          /* export list                 */
  750. } areas_record_type;
  751.  
  752.     /* --- Notes --------------------------------------------------
  753.  
  754.     1) The entries in 'o_addr' and 'use_akas' are indexes into
  755.        the list of AKAs in IMAIL.CF, minus 1. eg:
  756.           im_config.aka[o_addr-1]
  757.        A value of 0 means 'no address'
  758.     2) the 'user_bits' entry allows third-part software to store
  759.        extra information in IMAIL.AR. Their meaning is program-
  760.        specific, so be careful when making use of them!
  761.  
  762.     3) IMAIL.AR knows three predefined areatags:
  763.  
  764.         BADMAIL       for the IMAIL badmail area,
  765.         DUPES         for the IMAIL dupe area and
  766.         PERSMAIL      for the IMAIL personal mail area.
  767.  
  768.        All three boards are treated as local areas and
  769.        the BADMAIL area must be present and non-passthru
  770.        otherwise IMAIL will not run.
  771.  
  772.     ------------------------------------------------------------- */
  773.  
  774.  
  775. /* -------------------------------------------------------------------- */
  776. /*  IMAIL.AX & IMAIL.BX Structures                                      */
  777. /* -------------------------------------------------------------------- */
  778.  
  779.     /* --- Notes ---------------------------------------------------
  780.  
  781.     1) These are "true" index files, created by BTree routines;
  782.        they cannot be used unless you have the BTree source
  783.        code as implemented in IMAIL.
  784.  
  785.     ------------------------------------------------------------- */
  786.  
  787. /* -------------------------------------------------------------------- */
  788. /*  IMAIL.ND Structure                                                  */
  789. /* -------------------------------------------------------------------- */
  790.  
  791. typedef struct node_record_type {
  792.   struct naddress dstn;                       /* Node to pack for            */
  793.   char         sysop[MAXNAME];                /* name of sysop               */
  794.   char         domain;                        /* index to domain             */
  795.   char         pwd[21];                       /* AreaLink password           */
  796.   char         status;                        /* Status of file attach msg   */
  797.   char         program;                       /* packer to use ("packers")   */
  798.   char         groups[MAXGROUPS+1];           /* groups node can request     */
  799.   word         capability;                    /* capability word for node    */
  800.   bit          allow_remote:1;                /* allow remote maint.         */
  801.   bit          direct:1;                      /* Mark ARCmail as direct      */
  802.   bit          auto_cap:1;                    /* TRUE = auto-detect capability */
  803.   bit          auto_added:1;                  /* record added by IMAIL       */
  804.   bit          newarea_add:1;                 /* auto add to new areas       */
  805.   bit          newarea_create:1;              /* create new areas?           */
  806.   bit          rescan_ok:1;                   /* allow node to rescan        */
  807.   bit          notify:1;                      /* Send notify messages?       */
  808.   bit          security:2;                    /* Define security handling    */
  809.   bit          forward_req:1;                 /* Forward ALNK requests?      */
  810.   bit          uplink:1;                      /* Is this system an uplink?   */
  811.   bit          fsc_comp:1;                    /* Is a FSC-0057 arealink used?*/
  812.   bit          rsvd:3;                        /* reserved bits               */
  813.   word         user_bits;                     /* 16 user-available bits      */
  814.   char         newarea_group;                 /* new areas default group     */
  815.   char         pkt_pwd[9];                    /* PKT password                */
  816.   long         last_pwd_change;               /* time ALNK pwd last changed  */
  817.   char         toprogram[10];                 /* name of area manager        */
  818.   char         filler[10];
  819.   struct node_record_type *next_node;
  820.   struct node_record_type *prev_node;
  821. } node_record_type;
  822.  
  823.  
  824.     /* --- Notes ---------------------------------------------------
  825.  
  826.     1) The last 2 fields are not saved to IMAIL.ND
  827.     2) the 'user_bits' entry allows third-part software to store
  828.        extra information in IMAIL.ND. Their meaning is program-
  829.        specific, so be careful when making use of them!
  830.  
  831.     ------------------------------------------------------------- */
  832.  
  833.  
  834. /* -------------------------------------------------------------------- */
  835. /*  IMAIL.GR Structure                                                  */
  836. /* -------------------------------------------------------------------- */
  837.  
  838. typedef struct group_record_type {
  839.   char         grp_desc[27];             /* Group description           */
  840.   byte         msg_base_type;            /* message base type           */
  841.   char         msg_path[MAXPATH];        /* MSG/Squish path             */
  842.   bit          active:1;                 /* flag area active            */
  843.   bit          zone_gate:1;              /* Zone-gate stripping         */
  844.   bit          tiny_seen:1;              /* tiny seen-by flag           */
  845.   bit          secure:1;                 /* secure flag                 */
  846.   bit          keep_seen:1;              /* keep seen-by flag           */
  847.   bit          mandatory:1;              /* area is mandatory           */
  848.   bit          read_only:1;              /* area is read only           */
  849.   bit          ulnk_req:1;               /* perform unlinked requests?  */
  850.   bit          hidden:1;                 /* area is hidden              */
  851.   bit          rsvd:7;                   /* reserved                    */
  852.   byte         days;                     /* days to keep messages       */
  853.   word         msgs;                     /* num messages to keep        */
  854.   char         filler[20];               /* reserved                    */
  855. } group_record_type;
  856.  
  857.  
  858. /* -------------------------------------------------------------------- */
  859. /*  IMAIL.DP/IMAIL.DPI Structure                                        */
  860. /* -------------------------------------------------------------------- */
  861.  
  862.     /* --- Notes ---------------------------------------------------------
  863.  
  864.     1) The dupe database consists simply of a series of word-sized values,
  865.        which are a 32-bit CRC of (in order) the following data:
  866.           Addressee's name
  867.           Sender's name
  868.           Date
  869.           Subject
  870.           Address in MSGID (if any)
  871.  
  872.     -------------------------------------------------------------------- */
  873.