home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / IMAIL150.ZIP / IM_STRUC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-27  |  39.6 KB  |  1,161 lines

  1.  
  2. /* *
  3.  * *
  4.  * *   I M A I L   D E F I N I T I O N S   A N D   S T R U C T U R E S
  5.  * *
  6.  * */
  7.  
  8. /*
  9.  *
  10.  * Copyright (C) 1992-1994 by Andreas Klein. All rights reserved.
  11.  *
  12.  * The contents of this file are subject to change without notice!
  13.  * Fields marked reserved should NOT be used.
  14.  *
  15.  * It is an ERROR to write to any of the configuration files
  16.  * while IMAIL (or any of its companion programs) is running.
  17.  * 
  18.  */
  19.  
  20. #include <dir.h>
  21. #include <io.h>
  22. #include <time.h>
  23.  
  24. #define IMAIL_MAJ_VERSION     1
  25. #define IMAIL_MIN_VERSION     50
  26. #define IMAIL_MAJ_VERSION_STR "1"
  27. #define IMAIL_MIN_VERSION_STR "50"
  28. #define STRUCT_MAJ_VERSION    2
  29. #define STRUCT_MIN_VERSION    00
  30. #define IM_PRD_CODE           0x4B
  31.  
  32. /*
  33.  *
  34.  *  Data type definitions
  35.  *
  36.  */
  37.  
  38. #define byte                 unsigned char
  39. #define word                 unsigned short
  40. #define boolean              short
  41. #define integer              short
  42. typedef unsigned short       bit;
  43.  
  44. /*
  45.  *
  46.  *  Function definitions
  47.  *
  48.  */
  49.  
  50. #ifdef __OS2__
  51.   #define farmalloc    malloc
  52.   #define farcalloc    calloc
  53.   #define farfree      free
  54.   #define _fstrchr     strchr
  55.   #define _fstrstr     strstr
  56. #endif
  57.  
  58. /*
  59.  *
  60.  *  Internal limits
  61.  *
  62.  */
  63.  
  64. #define MAXAKAS              16      // Max # of addresses
  65. #define MAXPACKERS           11      // Max # of packer def
  66. #define MAXEXPORT           200      // Max export defs
  67. #define MAXVIA               40      // max nodes packed via
  68. #define MAXGROUPS            26      // max nodes packed via
  69. #define MAXEXCEPT            10      // max EXCEPT nodes
  70. #define MAXPACK              32      // max default pack cmd
  71. #define MAXFWDLINK           15      // max fwd link structs
  72. #define MAXNOIMPT            20      // max # names for IMPORT
  73. #define ZONESDOM             10      // zones per domain entry
  74. #define MAXTAG               51      // max areatag length
  75. #define MAXNAME              37      // max namefield lenght
  76. #define MAXPACKNAME          50      // max packer length
  77. #define MAXORIGIN            64      // max origin length
  78.  
  79. /*
  80.  *
  81.  *  Log Style Definitions
  82.  *
  83.  */
  84.  
  85. #define LOG_NORMAL           0                        // normal log level
  86. #define LOG_VERBOSE          1                        // verbose log level
  87.  
  88. #define LOG_LOG              252                      // Always, but to file
  89. #define LOG_SCREEN           253                      // Always, but to scrn
  90. #define LOG_ALL              254                      // Always log this
  91. #define LOG_ERROR            255                      // Force error logging
  92.  
  93. /*
  94.  *
  95.  *  Mailer Environment Type  (FrontDoor, Binkley or InterMail)
  96.  *
  97.  */
  98.  
  99. #define ENV_FRODO            0                        // FrontDoor
  100. #define ENV_BINK             1                        // Binkley
  101. #define ENV_IM               2                        // Intermail
  102.  
  103. /*
  104.  *
  105.  *  BBS Environment Type
  106.  *
  107.  */
  108.  
  109. #define BBS_RA2              0                        // Remote Access 2.0
  110. #define BBS_OTHER            1                        // Other
  111.  
  112. /*
  113.  *
  114.  *  File Attach Message Status (used in IMAIL.ND)
  115.  *
  116.  */
  117.  
  118. /*
  119. enum message_status{S_NORMAL, S_HOLD, S_CRASH, S_IMMEDIATE, S_DIRECT,
  120.                     S_NORMAL_DIR, S_HOLD_DIR, S_CRASH_DIR, S_IMMEDIATE_DIR};
  121. */
  122.  
  123. #define S_NORMAL             0
  124. #define S_HOLD               1
  125. #define S_CRASH              2
  126. #define S_IMMEDIATE          3
  127. #define S_DIRECT             4
  128. #define S_NORMAL_DIR         4
  129. #define S_HOLD_DIR           5
  130. #define S_CRASH_DIR          6
  131. #define S_IMMEDIATE_DIR      7
  132.  
  133.  
  134. /*
  135.  *
  136.  *  Message Base Types
  137.  *
  138.  */
  139.  
  140. #ifndef MSGTYPE_SDM
  141.   #define MSGTYPE_SDM     0x01
  142. #endif
  143. #ifndef MSGTYPE_SQUISH
  144.   #define MSGTYPE_SQUISH  0x02
  145. #endif
  146. #ifndef MSGTYPE_HUDSON
  147.   #define MSGTYPE_HUDSON  0x03
  148. #endif
  149. #ifndef MSGTYPE_JAM
  150.   #define MSGTYPE_JAM     0x04
  151. #endif
  152. #ifndef MSGTYPE_PASSTH
  153.   #define MSGTYPE_PASSTH  0x0F
  154. #endif
  155. #ifndef MSGTYPE_ECHO
  156.   #define MSGTYPE_ECHO    0x80
  157. #endif
  158. #ifndef MSGTYPE_LOCAL
  159.   #define MSGTYPE_LOCAL   0x90
  160. #endif
  161. #ifndef MSGTYPE_NET
  162.   #define MSGTYPE_NET     0xA0
  163. #endif
  164.  
  165. /*
  166.  *
  167.  *  Via Line Switches
  168.  *
  169.  */
  170.  
  171. #ifndef VIA_NONE
  172.   #define VIA_NONE        0x01
  173. #endif
  174. #ifndef VIA_EXP
  175.   #define VIA_EXP         0x02
  176. #endif
  177. #ifndef VIA_IMP
  178.   #define VIA_IMP         0x03
  179. #endif
  180. #ifndef VIA_BOTH
  181.   #define VIA_BOTH        0x04
  182. #endif
  183.  
  184. /*
  185.  *
  186.  *  Dupe ring check switches
  187.  *
  188.  */
  189.  
  190. #ifndef DUPE_NONE
  191.   #define DUPE_NONE        0x00
  192. #endif
  193. #ifndef DUPE_COPY
  194.   #define DUPE_COPY        0x01
  195. #endif
  196. #ifndef DUPE_KILL
  197.   #define DUPE_KILL        0x02
  198. #endif
  199. #ifndef DUPE_KILLCOPY
  200.   #define DUPE_KILLCOPY    0x03
  201. #endif
  202.  
  203. /*
  204.  *
  205.  *  Circular path detection switches
  206.  *
  207.  */
  208.  
  209. #ifndef CPD_NONE
  210.   #define CPD_NONE        0x00
  211. #endif
  212. #ifndef CPD_COPY
  213.   #define CPD_COPY        0x01
  214. #endif
  215. #ifndef CPD_KILL
  216.   #define CPD_KILL        0x02
  217. #endif
  218. #ifndef CPD_KILLCOPY
  219.   #define CPD_KILLCOPY    0x03
  220. #endif
  221.  
  222. /*
  223.  *
  224.  *  Unlink handling
  225.  *
  226.  */
  227.  
  228. #ifndef ULNK_NONE
  229.   #define ULNK_NONE        0x00
  230. #endif
  231. #ifndef ULNK_PASSTH
  232.   #define ULNK_PASSTH      0x01
  233. #endif
  234. #ifndef ULNK_ALL
  235.   #define ULNK_ALL         0x02
  236. #endif
  237.  
  238. /*
  239.  *
  240.  *  Personal Mail handling
  241.  *
  242.  */
  243.  
  244. #ifndef PERSM_NONE
  245.   #define PERSM_NONE       0x00
  246. #endif
  247. #ifndef PERSM_LOG
  248.   #define PERSM_LOG        0x01
  249. #endif
  250. #ifndef PERSM_MSG
  251.   #define PERSM_MSG        0x02
  252. #endif
  253. #ifndef PERSM_COPY
  254.   #define PERSM_COPY       0x03
  255. #endif
  256.  
  257. /*
  258.  *
  259.  *  AreaLink Request Handling
  260.  *
  261.  */
  262.  
  263. #ifndef KEEP_NONE
  264.   #define KEEP_NONE        0x00
  265. #endif
  266. #ifndef KEEP_MSG
  267.   #define KEEP_MSG         0x01
  268. #endif
  269. #ifndef KEEP_ALL
  270.   #define KEEP_ALL         0x02
  271. #endif
  272.  
  273. /*
  274.  *
  275.  *  PKTs not for us Handling
  276.  *
  277.  */
  278.  
  279. #ifndef PKT_TOSS
  280.   #define PKT_TOSS         0x00
  281. #endif
  282. #ifndef PKT_FORWARD
  283.   #define PKT_FORWARD      0x01
  284. #endif
  285. #ifndef PKT_RENAME
  286.   #define PKT_RENAME       0x02
  287. #endif
  288.  
  289. /*
  290.  *
  291.  *  Kill Dead selection
  292.  *
  293.  */
  294.  
  295. #ifndef KILL_NONE
  296.   #define KILL_NONE         0x00
  297. #endif
  298. #ifndef KILL_FWD
  299.   #define KILL_FWD         0x01
  300. #endif
  301. #ifndef KILL_ALL
  302.   #define KILL_ALL         0x02
  303. #endif
  304.  
  305. /*
  306.  *
  307.  *  Macros to make life easier
  308.  *
  309.  */
  310.  
  311. #define BASEMASK          0x0F
  312. #define TYPEMASK          0xF0
  313.  
  314. #define IsSdm(Type)       ((Type & BASEMASK) == MSGTYPE_SDM)
  315. #define IsMsg(Type)       ((Type & BASEMASK) == MSGTYPE_SDM)
  316. #define IsSquish(Type)    ((Type & BASEMASK) == MSGTYPE_SQUISH)
  317. #define IsHudson(Type)    ((Type & BASEMASK) == MSGTYPE_HUDSON)
  318. #define IsJam(Type)       ((Type & BASEMASK) == MSGTYPE_JAM)
  319. #define IsPassth(Type)    ((Type & BASEMASK) == MSGTYPE_PASSTH)
  320. #define IsEcho(Type)      ((Type & TYPEMASK) == MSGTYPE_ECHO)
  321. #define IsLocal(Type)     ((Type & TYPEMASK) == MSGTYPE_LOCAL)
  322. #define IsNet(Type)       ((Type & TYPEMASK) == MSGTYPE_NET)
  323.  
  324.  
  325. /*
  326.  *
  327.  *  Exit Errorlevels & Error Messages
  328.  *
  329.  */
  330.  
  331. #define E_NOERR              0            // no error
  332. #define E_CRDIR              238          // Error creating directory
  333. #define E_ELOCK              239          // File locking error
  334. #define E_AOPEN              240          // Error opening IMAIL.AX
  335. #define E_BOPEN              241          // Error opening IMAIL.BX
  336. #define E_NOIDX              242          // Index file missing/corrupt
  337. #define E_NOCFG              243          // IMAIL.CF not found
  338. #define E_NOARE              244          // IMAIL.AR not found
  339. #define E_NONOD              245          // IMAIL.ND not found
  340. #define E_BADCF              246          // Error in IMAIL.CF
  341. #define E_BADVR              247          // Bad version of IMAIL.CF
  342. #define E_EOPEN              248          // Error opening file
  343. #define E_EREAD              249          // Error reading file
  344. #define E_EWRIT              250          // Error writing file
  345. #define E_CMDPR              251          // Command Line Parameter error
  346. #define E_FILNF              252          // File not found
  347. #define E_MEMRY              253          // Memory Allocation error
  348. #define E_DISKF              254          // Insufficient disk space
  349. #define E_UNKWN              255          // Unknown error
  350.  
  351. /* === ERRORLEVELs returned by TOSS and/or SCAN === */
  352.  
  353. #define T_NOMAIL             0x00L         // no mail processed
  354. #define T_NET                0x01L         // Net mail
  355. #define T_ECHO               0x02L         // Echo mail
  356. #define T_BAD                0x04L         // Bad and/or dupe mail
  357. #define T_HUDSON             0x08L         // Hudson message base changed
  358. #define T_MSG                0x10L         // *.MSG message base changed
  359. #define T_SQUISH             0x20L         // Squish message base changed
  360. #define T_JAM                0x40L         // JAM message base changed
  361. #define T_PERS               0x80L         // Mail to Sysop received
  362. #define T_PERS               0x80L         // Mail to Sysop received
  363. #define T_NEWAREA            0x100L        // New echos have been created
  364.  
  365. /*
  366.  *
  367.  *  Special values for 'ALL'
  368.  *
  369.  */
  370.  
  371. #define ZONE_ALL             56685u
  372. #define NET_ALL              56685u
  373. #define NODE_ALL             56685u
  374. #define POINT_ALL            56685u
  375.  
  376. /*
  377.  *
  378.  *  Misc other definitions required
  379.  *
  380.  */
  381.  
  382. #define FA_ANYFILE FA_RDONLY+FA_HIDDEN+FA_SYSTEM+FA_ARCH
  383.  
  384. #define TRUE                1
  385. #define FALSE                0
  386. #define BLANK              ' '
  387.  
  388. typedef char str255[256];
  389. typedef char str35[36];
  390. typedef char str16[16];
  391.  
  392. typedef char pktdate[20];
  393.  
  394. typedef struct array512 {
  395.   word         len;
  396.   char         longstring[512];
  397. } array512;
  398.  
  399. /* define some simple keyword replacements */
  400.  
  401. #define strdelete(s,p,num) strcpy(s+p-1,s+p+num)
  402.  
  403. #define stoz(s, z) memmove(z, ((char *)(s))+1, (size_t)((byte)*(s)))
  404.  
  405. #define stozn(s, z, n) memmove(z, ((char *)(s))+1, (size_t)(((byte)*(s)<=n) ? (byte)*(s) : n))
  406.  
  407. #define ztos(z, s) memmove((char *)(s)+1, z, strlen(z)); *(s)=(char)strlen(z)
  408.  
  409. #define STRSIZ               255                  // default string length
  410.  
  411. #define NORM_FP(p) MK_FP(FP_SEG(p)+(FP_OFF(p)/0x10), FP_OFF(p)%0x10)
  412.  
  413. /*
  414.  *
  415.  *  In case your compiler doesn't have these ...
  416.  *
  417.  */
  418.  
  419. #ifndef MAXPATH
  420.   #define MAXPATH            80
  421. #endif
  422. #ifndef MAXDRIVE
  423.   #define MAXDRIVE           3
  424. #endif
  425. #ifndef MAXDIR
  426.   #define MAXDIR             66
  427. #endif
  428. #ifndef MAXFILE
  429.   #define MAXFILE            9
  430. #endif
  431. #ifndef MAXEXT
  432.   #define MAXEXT             5
  433. #endif
  434.  
  435.  
  436. /*
  437.  *
  438.  *                 QuickBBS structures
  439.  *
  440.  */
  441.  
  442. typedef byte flagtype[4];
  443.  
  444. typedef struct userrecord    /*  Used in the USERS.BBS File  */
  445. {
  446.   char         name[36];
  447.   char         city[26];
  448.   char         pwd[16];
  449.   char         dataphone[13];
  450.   char         homephone[13];
  451.   char         lasttime[6];
  452.   char         lastdate[9];
  453.   byte         attrib;
  454.   flagtype     flags;
  455.   integer      credit;
  456.   integer      pending;
  457.   integer      timesposted;
  458.   integer      highmsgread;
  459.   integer      seclvl;
  460.   integer      times;
  461.   integer      ups;
  462.   integer      downs;
  463.   integer      upk;
  464.   integer      downk;
  465.   integer      todayk;
  466.   integer      elapsed;
  467.   integer      len;
  468.   byte         extraspace[8];
  469. } userrecord;
  470.  
  471. /* --- Attrib: -----------------------------------------------------
  472.  
  473.     Bit 0: Deleted
  474.     Bit 1: Screen Clear Codes
  475.     Bit 2: More Prompt
  476.     Bit 3: ANSI
  477.     Bit 4: No-Kill
  478.     Bit 5: Ignore Download Hours
  479.     Bit 6: ANSI Full Screen Editor
  480.     Bit 7: [ Reserved ]
  481.  
  482.     ------------------------------------------------------------- */
  483.  
  484. typedef struct userrecord_ra2     /*  Used in the RA 2.00 USERS.BBS File  */
  485. {
  486.   char  name[36];
  487.   char  Location[26];
  488.   char  Organisation[51];
  489.   char  Address1[51];
  490.   char  Address2[51];
  491.   char  Address3[51];
  492.   char  Handle[36];
  493.   char  Comment[81];
  494.   long  PasswordCRC;
  495.   char  DataPhone[16];
  496.   char  VoicePhone[16];
  497.   char  LastTime[6];
  498.   char  LastDate[9];
  499.   byte  Attribute;
  500.   byte  Attribute2;
  501.   byte  Flags[4];
  502.   long  Credit;
  503.   long  Pending;
  504.   word  MsgsPosted;
  505.   word  Security;
  506.   long  LastRead;
  507.   long  NoCalls;
  508.   long  Uploads;
  509.   long  Downloads;
  510.   long  UploadsK;
  511.   long  DownloadsK;
  512.   long  TodayK;
  513.   short Elapsed;
  514.   word  ScreenLength;
  515.   byte  LastPwdChange;
  516.   word  Group;
  517.   word  CombinedInfo[200];
  518.   char  FirstDate[9];
  519.   char  BirthDate[9];
  520.   char  SubDate[9];
  521.   byte  ScreenWidth;
  522.   byte  Language;
  523.   byte  DateFormat;
  524.   char  ForwardTo[36];
  525.   word  MsgArea;
  526.   word  FileArea;
  527.   char  DefaultProtocol;
  528.   word  FileGroup;
  529.   byte  LastDOBCheck;
  530.   byte  Sex;
  531.   long  XIrecord;
  532.   word  MsgGroup;
  533.   byte  FreeSpace[48];
  534. } userrecord_ra2;
  535.  
  536. /* --- Attrib RA2: -----------------------------------------------------
  537.  
  538.     Attribute
  539.  
  540.       Bit 0 : Deleted
  541.       Bit 1 : Clear screen
  542.       Bit 2 : More prompt
  543.       Bit 3 : ANSI
  544.       Bit 4 : No-kill
  545.       Bit 5 : Xfer priority
  546.       Bit 6 : Full screen msg editor
  547.       Bit 7 : Quiet mode
  548.  
  549.     Attribute2
  550.  
  551.       Bit 0 : Hot-keys
  552.       Bit 1 : AVT/0
  553.       Bit 2 : Full screen message viewer
  554.       Bit 3 : Hidden from userlist
  555.       Bit 4 : Page priority
  556.       Bit 5 : No echomail in mailbox scan
  557.       Bit 6 : Guest account
  558.       Bit 7 : Post bill enabled
  559.  
  560.     ------------------------------------------------------------- */
  561.  
  562. /*
  563.  *
  564.  *  Message Records
  565.  *
  566.  */
  567.  
  568. typedef struct inforecord {                   //  Used in the MSGINFO.BBS file
  569.   word         lowmsg;                        //  Lowest Message in File
  570.   word         highmsg;                       //  Highest Message in File
  571.   word         totalactive;                   //  Total Active Messages
  572.   word         activemsgs[200];
  573. } inforecord;
  574.  
  575. typedef struct idxrecord {                    //  Used in the MSGIDX.BBS file
  576.   word         msgnum;
  577.   byte         board;
  578. } idxrecord;
  579.  
  580. typedef struct hdrrecord {                    //  Used in the MSGHDR.BBS file
  581.   word         msgnum, replyto, seealsonum, tread;
  582.   word         startrec;
  583.   word         numrecs, destnet, destnode, orignet, orignode;
  584.   byte         destzone, origzone;
  585.   word         cost;
  586.   byte         msgattr, netattr, board;
  587.   char         posttime[6];
  588.   char         postdate[9];
  589.   char         whoto[36], whofrom[36];
  590.   char         subj[73];
  591. } hdrrecord;
  592.  
  593.  
  594. /* --- Msg Attributes: --------------------------------------------- */
  595.  
  596. #define QMSGDELTD   0x01         // deleted message,          0000 0001
  597. #define QMSGOUTN    0x02         // outgoing net message      0000 0010
  598. #define QMSGISNET   0x04         // Is a net message          0000 0100
  599. #define QMSGPRIVATE 0x08         // Private                   0000 1000
  600. #define QMSGREAD    0x10         // Received                  0001 0000
  601. #define QMSGOUTE    0x20         // Outgoing echo message     0010 0000
  602. #define QMSGLOCAL   0x40         // Local                     0100 0000
  603. #define QMSGXX1     0x80         // [reserved]                1000 0000
  604.  
  605. /* --- Net Attributes: --------------------------------------------- */
  606.  
  607. #define QNETKILL    0x01         // Kill when sent            0000 0001
  608. #define QNETSENT    0x02         // Sent                      0000 0010
  609. #define QNETFILE    0x04         // File attach               0000 0100
  610. #define QNETCRASH   0x08         // Crash Priority            0000 1000
  611. #define QNETRRQ     0x10         // Request Receipt           0001 0000
  612. #define QNETARQ     0x20         // Audit request             0010 0000
  613. #define QNETCPT     0x40         // Is a return receipt       0100 0000
  614. #define QNETXX1     0x80         // [reserved]                1000 0000
  615.  
  616. /* --------------------------------------------------------------------
  617.  
  618.     Each record in the MSGTOIDX.BBS file is of type String[35], each
  619.     entry is simply the name of the person the corresponding message
  620.     in MSGHDR.BBS is addressed to.
  621.  
  622.     Each record in the MSGTXT.BBS file is of type String[255], each
  623.     entry is used to store blocks of message text.  The variable
  624.     "StartRec" in the MSGHDR.BBS file contains the starting record
  625.     position for the text, the variable "NumRecs" indicates how many
  626.     consecutive blocks of text there are in the MSGTXT.BBS file.
  627.  
  628.    ----------------------------------------------------------------- */
  629.  
  630.  
  631. /* *
  632.  * *
  633.  * *               Fido Packet structures
  634.  * *
  635.  * */
  636.  
  637.  
  638. /*
  639.  *
  640.  *  Normal Message Header  (*.MSG)
  641.  *
  642.  */
  643.  
  644. typedef struct f2normsghdr {
  645.   char         fromwho[36];                           //  From username
  646.   char         towho[36];                             //  To username
  647.   char         subj[72];                              //  Subject
  648.   char         date[20];                              //  date string
  649.   word         times;                                 //  times read
  650.   word         destnode;                              //  destination node
  651.   word         orignode;                              //  origin node
  652.   word         cost;                                  //  cost
  653.   word         orignet;                               //  origin net
  654.   word         destnet;                               //  destination net
  655.   word         destzone;                              //  destination zone
  656.   word         origzone;                              //  origin zone
  657.   word         destpoint;                             //  destination point
  658.   word         origpoint;                             //  origin point
  659.   word         reply;                                 //  this is a reply to?
  660.   word         attr;                                  //  Attribute
  661.   word         nextreply;                             //  reply to this msg...
  662. } f2normsghdr;
  663.  
  664.  
  665.  
  666. /*
  667.  *
  668.  * Message attributes
  669.  *
  670.  */
  671.  
  672. #define FMSGPRIVATE 0x0001   // private message,          0000 0000 0000 0001
  673. #define FMSGCRASH   0x0002   // accept for forwarding     0000 0000 0000 0010
  674. #define FMSGREAD    0x0004   // read by addressee         0000 0000 0000 0100
  675. #define FMSGSENT    0x0008   // sent OK (remote)          0000 0000 0000 1000
  676. #define FMSGFILE    0x0010   // file attached to msg      0000 0000 0001 0000
  677. #define FMSGFWD     0x0020   // being forwarded           0000 0000 0010 0000
  678. #define FMSGORPHAN  0x0040   // unknown dest node         0000 0000 0100 0000
  679. #define FMSGKILL    0x0080   // kill after mailing        0000 0000 1000 0000
  680. #define FMSGLOCAL   0x0100   // FidoNet vs. local         0000 0001 0000 0000
  681. #define FMSGHOLD    0x0200   //                           0000 0010 0000 0000
  682. #define FMSGXX1     0x0400   // STRIPPED by FidoNet<tm>   0000 0100 0000 0000
  683. #define FMSGFRQ     0x0800   // file request              0000 1000 0000 0000
  684. #define FMSGRRQ     0x1000   // receipt requested         0001 0000 0000 0000
  685. #define FMSGCPT     0x2000   // is a return receipt       0010 0000 0000 0000
  686. #define FMSGARQ     0x4000   // audit trail requested     0100 0000 0000 0000
  687. #define FMSGURQ     0x8000   // update request            1000 0000 0000 0000
  688.  
  689. #define BUNDLE_VER 2         // IFNA Bundle Version
  690. #define CAP_TYPE2   0x0001   // Can make Type 2 bundles
  691. #define CAP_STONAGE 0x0000   // No particular capabailties, Type 2 assumed
  692.  
  693. /*
  694.  *
  695.  *  Header for Message Bundles (Bundle Type 2+)
  696.  *
  697.  */
  698.  
  699. typedef struct f2pktmsghdr {
  700.    word orignode,              // originating node
  701.         destnode,              // destination node
  702.         year,                  // 1990 - nnnnn
  703.         month,
  704.         day,
  705.         hour,
  706.         minute,
  707.         second,
  708.         rate,                  // unused
  709.         ver,                   // 2
  710.         orignet,               // originating net
  711.         destnet;               // destination net
  712.     byte
  713.         prod_lo,               // product code
  714.         rev_major,             // revision level, major
  715.         password[8];           // packet level password
  716.     word
  717.         qm_origzone,           // QMail wants orig.zone here
  718.         qm_destzone;           // QMail wants dest.zone here
  719.     byte
  720.         trash[2];              // junk[8]
  721.     word
  722.         cap_valid;             // Cap. validity, byte swapped
  723.     byte
  724.         prod_hi,               // product code, hi byte
  725.         rev_minor;             // revision level, minor
  726.     word
  727.         capability,            // bundling capability
  728.         origzone,              // originating zone
  729.         destzone,              // destination zone
  730.         origpoint,             // originating point
  731.         destpoint;             // destination point
  732.     long
  733.         junk;                  // junk
  734. } f2pktmsghdr;
  735.  
  736.     /* --- Note ----------------------------------------------------
  737.  
  738.     (*) In the original FSC-0001 specification, these fields
  739.     were part of the Filler, and so may not be recognized
  740.     by all software.
  741.  
  742.     ------------------------------------------------------------- */
  743.  
  744.  
  745. /*
  746.  *
  747.  *  Packeted Message Header (Bundle Type 2+)
  748.  *
  749.  */
  750.  
  751. typedef struct f2msghdr {
  752.   word         ver;                //  Version (=2)
  753.   word         orignode;           //  Originate Node
  754.   word         destnode;           //  Destination Node
  755.   word         orignet;            //  Originate Net
  756.   word         destnet;            //  Destination Net
  757.   word         attr;               //  Attribute
  758.   word         cost;               //  Cost
  759.   pktdate      date;               //  Date String
  760. /*
  761.   char         towho[36];             To username
  762.   char         fromwho[36];           From username
  763.   char         subject[72];           Subject
  764. */
  765. } f2msghdr;
  766.  
  767.     /* --- Note ----------------------------------------------------
  768.  
  769.     The last three fields are variable length; they are
  770.     shown above for reference, but are not part of the
  771.     structure.
  772.  
  773.     ------------------------------------------------------------- */
  774.  
  775.  
  776. /*
  777.  *
  778.  *  Structs used in IMAIL Configuration files
  779.  *
  780.  */
  781.  
  782. typedef struct naddress {        // std node number ...
  783.   word         zone;             //  Zone Number
  784.   word         net;              //  Net Number
  785.   word         node;             //  Node Number
  786.   word         point;            //  Point Number
  787. } naddress;
  788.  
  789. typedef struct expt {
  790.   naddress     dest;
  791.   boolean      doexpt;
  792. } expt;
  793.  
  794. typedef struct eaddress {                   // used in Area Manager ...
  795.   struct naddress dstn;                     // node number
  796.   bit             exp_only:1;               // export only flag
  797.   bit             imp_only:1;               // import only flag
  798.   bit             paused:1;                 // echo mail paused
  799.   bit             rsvd1:5;                  // reserved
  800. } eaddress;
  801.  
  802. typedef struct fwd_link {                   // used for forward request nodes ...
  803.   char         areasfile[MAXFILE+MAXEXT];   // name of areas file
  804.   char         toprogram[10];               // name of area manager
  805.   char         password[21];                // area manager password
  806.   struct naddress uplink;                   // address of uplink
  807.   char         accessgrp;                   // accessgroup for forwarding
  808.   char         creategrp;                   // creategroup for forwarding
  809.   char         filler[10];                  // reserved
  810. } fwd_link;
  811.  
  812. typedef struct dom {
  813.   char         domain[21];                  // name of domain
  814.   char         outbound[MAXPATH];           // root outbound path
  815.   word         zones[ZONESDOM];             // Zones in this domain
  816.   byte         akas[MAXAKAS];               // =my= AKAs in this domain
  817. } dom;
  818.  
  819. typedef struct im_stats {                   // Used mainly by IUTIL
  820.   word         th_day;                      // this day
  821.   word         la_day;                      // last day
  822.   word         th_week;                     // this week
  823.   word         la_week;                     // last week
  824.   word         th_month;                    // this month
  825.   word         la_month;                    // last month
  826.   word         th_year;                     // this year
  827.   word         la_year;                     // last year
  828. } im_stats;
  829.  
  830.  
  831. /*
  832.  *
  833.  *  IMAIL.CF structure
  834.  *
  835.  */
  836.  
  837. typedef struct im_config_type {
  838.   byte         im_ver_maj;                    // Major Version
  839.   byte         im_ver_min;                    // Minor Version
  840.   byte         struct_maj;                    // reserved
  841.   byte         struct_min;                    // reserved
  842.   char         sysop[MAXNAME];                // name of sysop
  843.   struct naddress aka[MAXAKAS];               // the AKAs
  844.   struct dom   domains[MAXAKAS];              // domain names & zones
  845.   byte         prod[10];                      // Type2+ product codes
  846.   char         netmail[MAXPATH];              // net mail subdirectory
  847.   char         netfile[MAXPATH];              // inbound files directory
  848.   char         in_pkt[MAXPATH];               // Directory for inbound PKTs
  849.   char         out_pkt[MAXPATH];              // Directory for outbound PKTs
  850.   char         outbound[MAXPATH];             // outbound directory
  851.   char         quickbbs[MAXPATH];             // QuickBBS system directory
  852.   char         uns_netfile[MAXPATH];          // unsecured inbound files
  853.   char         echotoss[MAXPATH];             // name of echotoss.log
  854.   char         dupebase[MAXPATH];             // dupe data base directory
  855.   char         semaphor[MAXPATH];             // Semaphor directory
  856.   char         logfilename[MAXPATH];          // Log file name
  857.   char         before_toss[MAXPATH];          // call before proc. PKTs
  858.   char         semaphor_net[MAXFILE+MAXEXT];  // Netmail rescan semaphor file
  859.   char         alnk_help[MAXFILE+MAXEXT];     // AreaLink help text
  860.   char         maint_help[MAXFILE+MAXEXT];    // Alnk Remote Maint. Helptext
  861.   char         rsvd3[MAXFILE+MAXEXT];         // reserved
  862.   char         dflt_origin[MAXORIGIN];        // default origin line
  863.   bit          rtnrecpt:1;                    // True if to send rtn recpt
  864.   bit          del_empty_msg:1;               // delete empty netmails (TOSS)
  865.   bit          ARCmail06:1;                   // ARCmail 0.6 compatibility
  866.   bit          use_crc_names:1;               // use crc-names for auto-areas
  867.   bit          auto_add:1;                    // Auto-add unknown areas
  868.   bit          multi_tasking:1;               // TRUE if multi-tasking
  869.   bit          ignore_unknown:1;              // ALNK ignores unknown systems
  870.   bit          singleextract:1;               // extract 1 bundle at a time
  871.   bit          trunc_sent:1;                  // 1 = Trunc 0 = Delete
  872.   bit          keep_alnk_answ:1;              // keep arealink answer
  873.   bit          prod_names:1;                  // use the FTSC product list
  874.   bit          swap_ems:1;                    // swap to EMS
  875.   bit          swap_ext:1;                    // swap to extended memory
  876.   bit          forward_everything:1;          // forward req. not in fwd-lists
  877.   bit          direct_video:1;                // use direct screen writing
  878.   bit          forward_req:1;                 // Execute forward link req.
  879.   bit          compr_after_pkt:1;             // compress after each PKT?
  880.   bit          delete_bases:1;                // when removing an area,
  881.                                               // delete also squish/msg-base
  882.   bit          kill_on_fly:1;                 // use Squish 'kill on the fly'
  883.   bit          rsvd2:5;                       // reserved
  884.   long         last_run;                      // last maintenance run
  885.   word         rsvd3;                         // reserved
  886.   byte         rsvd4;                         // reserved
  887.   byte         rsvd5;                         // reserved
  888.   word         max_arcmail_size;              // max size of arcmail bundles
  889.   word         pwd_expire_days;               // days before pwd expr'd
  890.   word         max_pkt_size;                  // max size of pkt to create
  891.   byte         max_add_pkt;                   // PKTs to compress in one run
  892.   byte         pkt_not_for_us;                // how to handle PKTs not for us
  893.   byte         environment;                   // FroDo, Binkley or Intermail
  894.   byte         max_msg_size;                  // max size of netmail (split)
  895.   byte         via_line;                      // add Via Line to netmails
  896.   byte         dupe_ring;                     // Check for possible d-rings
  897.   byte         cpd_check;                     // circular path detection
  898.   byte         pers_mail;                     // use personal mail feature
  899.   byte         unlink_req;                    // Unlink areas without dlink
  900.   byte         keep_alnk_req;                 // keep arealink request
  901.   byte         log_level;                     // logging level
  902.   long         max_dupes;                     // max dupes kept in dbase
  903.   long         false_dupes;                   // false dupes found
  904.   char         bbs_system;                    // BBS software used
  905.   char         new_areas[MAXPATH];            // name of file for new areas
  906.   word         sp_before_unpack;              // min. diskspace required
  907.   word         sp_before_toss;                // before decompress, toss
  908.   word         sp_before_compress;            // and compress (in MB).
  909.   char         kill_dead;                     // Kill Dead Selection
  910.   char         no_import[MAXNOIMPT][38];      // ignore when importing
  911.   struct fwd_link fwd[MAXFWDLINK];            // forward link requests
  912.   char         filler[692];                   // reserved
  913. } im_config_type;
  914.  
  915.     /* --- Note ----------------------------------------------------
  916.  
  917.     The information about the badmail-area, the dupe-area
  918.     and the personalmail-area has been moved to IMAIL.AR,
  919.     see there for detailed information.
  920.  
  921.     ------------------------------------------------------------- */
  922.  
  923. /*
  924.  *
  925.  *  IMAIL.AR structure
  926.  *
  927.  */
  928.  
  929. typedef struct areas_record_type {
  930.   char         aname[MAXTAG];              // area name
  931.   char         comment[61];                // area comment
  932.   char         origin[MAXORIGIN];          // origin line to use
  933.   char         group;                      // area group
  934.   char         o_addr;                     // address for origin
  935.   char         use_akas[MAXAKAS];          // addresses for seen-bys
  936.   byte         msg_base_type;              // message base type
  937.   byte         brd;                        // board number
  938.   char         msg_path[MAXPATH];          // MSG/Squish path
  939.   bit          active:1;                   // flag area active
  940.   bit          zone_gate:1;                // Zone-gate stripping
  941.   bit          tiny_seen:1;                // tiny seen-by flag
  942.   bit          secure:1;                   // secure flag
  943.   bit          import_seen:1;              // import seen-by into base
  944.   bit          deleted:1;                  // flag deleted area
  945.   bit          auto_added:1;               // flag auto-added record
  946.   bit          mandatory:1;                // area is mandatory
  947.   bit          read_only:1;                // area is read only
  948.   bit          unlinked:1;                 // area has been unlinked
  949.   bit          ulnk_req:1;                 // perform unlinked requests?
  950.   bit          hidden:1;                   // area is hidden
  951.   bit          to_link:1;                  // should by processed by LINK
  952.   bit          check_dup:1;                // check for dupes in this area?
  953.   bit          no_pause:1;                 // %PAUSE not allowed in this echo?
  954.   bit          hide_seen:1;                // Hide seens when importing
  955.   bit          manual:1;                   // No changes via Arealink
  956.   bit          fwdreq_pending:1;           // Requested but yet not arrived
  957.   bit          rsvd:6;                     // reserved
  958.   byte         user_bits;                  // 8 user-available bits
  959.   byte         days;                       // days to keep messages
  960.   word         msgs;                       // num messages to keep
  961.   im_stats     t_stats;                    // TOSS stats
  962.   im_stats     s_stats;                    // SCAN stats
  963.   im_stats     d_stats;                    // dupe statistics
  964.   time_t       creation;                   // date/time of statistic start
  965.   time_t       update;                     // last update by midnight update
  966.   time_t       marked;                     // used by kill dead
  967.   byte         kill_dead;                  // kill echos without traffic
  968.   char         filler[50];
  969.   struct eaddress export[MAXEXPORT];       // export list
  970. } areas_record_type;
  971.  
  972.     /* --- Notes --------------------------------------------------
  973.  
  974.     1) The entries in 'o_addr' and 'use_akas' are indexes into
  975.        the list of AKAs in IMAIL.CF, minus 1. eg:
  976.           im_config.aka[o_addr-1]
  977.        A value of 0 means 'no address'
  978.     2) the 'user_bits' entry allows third-part software to store
  979.        extra information in IMAIL.AR. Their meaning is program-
  980.        specific, so be careful when making use of them!
  981.  
  982.     3) IMAIL.AR knows three predefined areatags:
  983.  
  984.         BADMAIL       for the IMAIL badmail area,
  985.         DUPES         for the IMAIL dupe area and
  986.         PERSMAIL      for the IMAIL personal mail area.
  987.  
  988.        All three boards are treated as local areas and
  989.        the BADMAIL area must be present and non-passthru
  990.        otherwise IMAIL will not run.
  991.  
  992.     ------------------------------------------------------------- */
  993.  
  994.  
  995. /*
  996.  *
  997.  *  IMAIL.AX & IMAIL.BX structures
  998.  *
  999.  */
  1000.  
  1001.     /* --- Notes ---------------------------------------------------
  1002.  
  1003.     1) These are "true" index files, created by BTree routines;
  1004.        they cannot be used unless you have the BTree source
  1005.        code as implemented in IMAIL.
  1006.  
  1007.     ------------------------------------------------------------- */
  1008.  
  1009. /*
  1010.  *
  1011.  *  IMAIL.ND structure
  1012.  *
  1013.  */
  1014.  
  1015. typedef struct node_record_type {
  1016.   naddress         dstn;                  // Node to pack for
  1017.   char             sysop[MAXNAME];        // name of sysop
  1018.   char             domain;                // index to domain
  1019.   char             pwd[21];               // AreaLink password
  1020.   char             att_status;            // Status of file attach msg
  1021.   char             program;               // packer to use ("packers")
  1022.   char             groups[MAXGROUPS+1];   // groups node can request
  1023.   word             capability;            // capability word for node
  1024.   bit              allow_remote:1;        // allow remote maint.
  1025.   bit              check_pkt_pwd:1;       // check PKT password
  1026.   bit              auto_cap:1;            // TRUE = auto-detect capability
  1027.   bit              rsvd2:1;               // reserved
  1028.   bit              newarea_add:1;         // auto add to new areas?
  1029.   bit              newarea_create:1;      // create new areas?
  1030.   bit              rescan_ok:1;           // allow node to rescan
  1031.   bit              notify:1;              // Send notify messages?
  1032.   bit              rsvd3:2;               // reserved
  1033.   bit              forward_req:1;         // Forward ALNK requests?
  1034.   bit              uplink:1;              // Is this system an uplink?
  1035.   bit              fsc_comp:1;            // Is a FSC-0057 arealink used?
  1036.   bit              change_packer:1;       // system may change packer
  1037.   bit              check_alnk:1;          // check for Arealink-Msg in echos
  1038.   bit              rsvd4:1;               // reserved
  1039.   word             user_bits;             // 16 user-available bits
  1040.   char             newarea_group;         // new areas default group
  1041.   char             pkt_pwd[9];            // PKT password
  1042.   long             last_pwd_change;       // time ALNK pwd last changed
  1043.   char             toprogram[11];         // name of area manager
  1044.   char             msg_status;            // Status of Alnk messages
  1045.   char             pkt_o_addr;            // Aka to use for this system
  1046.   long             msgs_in;               // nr of msgs received
  1047.   long             bytes_in;              // amount of msgs received
  1048.   long             msgs_out;              // nr of msgs sent
  1049.   long             bytes_out;             // amount of msgs sent
  1050.   long             lrdate;                // date/time of statistic start
  1051.   char             filler[46];
  1052.   node_record_type *next_node;
  1053.   node_record_type *prev_node;
  1054. } node_record_type;
  1055.  
  1056.  
  1057.     /* --- Notes ---------------------------------------------------
  1058.  
  1059.     1) The last 2 fields are not saved to IMAIL.ND
  1060.     2) the 'user_bits' entry allows third-part software to store
  1061.        extra information in IMAIL.ND. Their meaning is program-
  1062.        specific, so be careful when making use of them!
  1063.     3) The entry in 'pkt_o_addr' is an index into the list of AKAs
  1064.        in IMAIL.CF, minus 1. eg:
  1065.          im_config.aka[pkt_o_addr-1]
  1066.        A value of 0 means 'use o_addr of the echo'
  1067.  
  1068.     ------------------------------------------------------------- */
  1069.  
  1070.  
  1071. /*
  1072.  *
  1073.  *  IMAIL.GR structure
  1074.  *
  1075.  */
  1076.  
  1077. typedef struct group_record_type {
  1078.   char         grp_desc[27];             // Group description
  1079.   byte         msg_base_type;            // message base type
  1080.   char         msg_path[MAXPATH];        // MSG/Squish path
  1081.   bit          active:1;                 // flag area active
  1082.   bit          zone_gate:1;              // Zone-gate stripping
  1083.   bit          tiny_seen:1;              // tiny seen-by flag
  1084.   bit          secure:1;                 // secure flag
  1085.   bit          import_seen:1;            // import seen-by into base
  1086.   bit          mandatory:1;              // area is mandatory
  1087.   bit          read_only:1;              // area is read only
  1088.   bit          ulnk_req:1;               // perform unlinked requests?
  1089.   bit          hidden:1;                 // area is hidden
  1090.   bit          check_dup:1;              // check for dupes in this area?
  1091.   bit          no_pause:1;               // %PAUSE not allowed in this echo?
  1092.   bit          hide_seen:1;              // Hide seens when importing
  1093.   bit          rsvd:4;                   // reserved
  1094.   byte         days;                     // days to keep messages
  1095.   word         msgs;                     // num messages to keep
  1096.   char         o_addr;                   // address for origin
  1097.   char         use_akas[MAXAKAS];        // addresses for seen-bys
  1098.   byte         kill_dead;                // kill echos without traffic
  1099.   char         filler[50];                // reserved
  1100. } group_record_type;
  1101.  
  1102.  
  1103. /*
  1104.  *
  1105.  *  IMAIL.RO structure
  1106.  *
  1107.  */
  1108.  
  1109. typedef struct pack_routing_type {          // used in pack routing
  1110.   struct naddress dst;                      // pack via this node
  1111.   struct naddress nodes[MAXVIA];            // nodes to pack
  1112.   struct naddress except[MAXEXCEPT];        // exceptions
  1113. } pack_routing_type;
  1114.  
  1115.   // Note: In the current implementation, the pack routing has
  1116.   //       as much records as defined in MAXPACK.
  1117.  
  1118. /*
  1119.  *
  1120.  *  IMAIL.PP structure
  1121.  *
  1122.  */
  1123.  
  1124. typedef struct packers {
  1125.   char         packname[5];
  1126.   char         packer[MAXPACKNAME];
  1127. } packers;
  1128.  
  1129. typedef struct compression_type {
  1130.   packers      prg[MAXPACKERS];               // Packer defintions
  1131.   char         arcunpak[MAXPACKNAME];         // cmd to de-arc .ARC files
  1132.   char         arjunpak[MAXPACKNAME];         // cmd to de-arc .ARJ files
  1133.   char         pkpakunpak[MAXPACKNAME];       // cmd to de-arc .PKA files
  1134.   char         pkzipunpak[MAXPACKNAME];       // cmd to de-arc .ZIP files
  1135.   char         lharcunpak[MAXPACKNAME];       // cmd to de-arc .LZH files
  1136.   char         zoounpak[MAXPACKNAME];         // cmd to de-arc .ZOO files
  1137.   char         pakunpak[MAXPACKNAME];         // cmd to de-arc .PAK files
  1138.   char         sqzunpak[MAXPACKNAME];         // cmd to de-arc .SQZ files
  1139.   char         unkunpak[MAXPACKNAME];         // cmd to de-arc unknown files
  1140. } compression_type;
  1141.  
  1142.  
  1143. /*
  1144.  *
  1145.  *  IMAIL.DP/IMAIL.DPI structure
  1146.  *
  1147.  */
  1148.  
  1149.     /* --- Notes ---------------------------------------------------------
  1150.  
  1151.     1) The dupe database consists simply of a series of long-sized values,
  1152.        which are a two 32-bit CRC of (in order) the following data:
  1153.  
  1154.        CRC 1: Addressee's name
  1155.               Sender's name
  1156.               Date
  1157.               Subject
  1158.        CRC 2: Address and MSGID (if any otherwise 0L)
  1159.  
  1160.     -------------------------------------------------------------------- */
  1161.