home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / lora299s.zip / BLUEWAVE.H < prev    next >
C/C++ Source or Header  |  1996-08-04  |  69KB  |  1,163 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /*           The Blue Wave Offline Mail System Packet Structures             */
  4. /*   Copyright 1990-1995 by Cutting Edge Computing.  All rights reserved.    */
  5. /*                        Created by George Hatchew                          */
  6. /*                                                                           */
  7. /*                      Version 3 - November 30, 1995                        */
  8. /*                                                                           */
  9. /*        ---------------------------------------------------------          */
  10. /*            DISTRIBUTION OF THIS FILE IS LIMITED BY THE TERMS              */
  11. /*           SPECIFIED IN THE BLUE WAVE STRUCTURE DOCUMENTATION!             */
  12. /*        ---------------------------------------------------------          */
  13. /*                                                                           */
  14. /*     These data structures should be usable with any C compiler that       */
  15. /*      supports the 1989 ANSI/ISO C language standard.  They are NOT        */
  16. /*    guaranteed to be usable with older compilers, which largely relied     */
  17. /*  on the definition of the language as specified in Kernighan & Ritchie's  */
  18. /*               _The C Programming Language (1st Edition)_.                 */
  19. /*                                                                           */
  20. /*****************************************************************************/
  21.  
  22. #ifndef __BLUEWAVE_H    /*  An extra safeguard to prevent this header from  */
  23. #define __BLUEWAVE_H    /*  being included twice in the same source file    */
  24.  
  25.  
  26. #define PACKET_LEVEL    3       /* The current mail packet revision level, */
  27.                                 /*   used in the "ver" field of the *.INF  */
  28.                                 /*   file header.                          */
  29.  
  30.  
  31. /*
  32. **  This header defines the data structures for the following files in the
  33. **  official Blue Wave offline mail specification:
  34. **
  35. **      Door:       *.INF       BBS and message area information
  36. **                  *.MIX       Quick index to *.FTI records
  37. **                  *.FTI       Information for all packet messages
  38. **                  *.DAT       Packet message text
  39. **
  40. **      Reader:     *.NET       NetMail reply message information
  41. **                  *.UPI       Information for all other reply messages
  42. **                  *.UPL       Reply message information
  43. **                                (alternative to *.NET and *.UPI)
  44. **                  *.REQ       List of files to download from BBS
  45. **                  *.PDQ       Offline door configuration information
  46. **                                (packet version 2 and earlier)
  47. **                  *.OLC       Offline door configuration information
  48. **                                (packet version 3 and later)
  49. **
  50. **      Misc:       *.MSG       Fido-style message header
  51. **                                  (used *only* in the *.NET structure)
  52. **                  *.XTI       Extended message packet information
  53. **                                  (not an official part of the Blue Wave
  54. **                                  packet specification; is used by the Blue
  55. **                                  Wave reader only)
  56. **
  57. **  The door files (plus individual files for BBS bulletins) comprise a Blue
  58. **  Wave message packet, and the reader files (plus individual files for each
  59. **  message) comprise a Blue Wave reply packet.
  60. **
  61. **  In order to cover ALL BASES, and to be able to say that you were warned,
  62. **  *ALL* unused fields should be set to ASCII NUL (0).  Any future
  63. **  implementation of reserved fields will rely on the premise that the field
  64. **  will be 0 if not implemented!  The same warning follows for BITMAPPED
  65. **  fields.  If a bit is not implemented or is not used, TURN IT OFF (0).
  66. **  (Clearing an entire structure can be easily accomplished via the memset()
  67. **  function.  Example: "memset(&ftirec, 0, sizeof(FTI_REC))".)
  68. */
  69.  
  70.  
  71. /*****************************************************************************/
  72. /* >>>>>>>>>>>>>>>>>>>>>>>  DATA TYPE DEFINITIONS  <<<<<<<<<<<<<<<<<<<<<<<<< */
  73. /*****************************************************************************/
  74.  
  75.  
  76. /*
  77. **  The data type definitions below help make these structures a little more
  78. **  universal between environments.  The 8-bit, 16-bit, and 32-bit data types
  79. **  defined below can be used as-is with virtually all MS-DOS and OS/2 C/C++
  80. **  compilers, but can be changed if necessary should your compiler define
  81. **  data types in a different fashion.  (Note that the tCHAR and tINT types
  82. **  are currently not used; they are included simply for completeness.)
  83. **
  84. **  If you are programming for a system that employs a CPU which stores multi-
  85. **  byte integers in a manner other than in Intel format (LSB-MSB, or "little
  86. **  endian"), simply #define BIG_ENDIAN before #including this header.  As
  87. **  shown below, this will define the data types as arrays of bytes; the
  88. **  drawback is that *YOU* will have to write functions to convert the data,
  89. **  since the Blue Wave packet specification requires the data to be in Intel-
  90. **  style little-endian format.
  91. **
  92. **  IMPORTANT NOTE ABOUT COMPILERS AND STRUCTURES:
  93. **  All structures *must* be "packed" (i.e., the compiler MUST NOT insert
  94. **  padding bytes between structure elements in order to force elements onto
  95. **  word boundaries).  The Blue Wave products expect them to be packed; if
  96. **  they aren't, you're bound to get some *very* interesting results.
  97. */
  98.  
  99. //#ifdef BIG_ENDIAN
  100.  
  101. //typedef signed char    tCHAR;     /* 8 bit signed values           */
  102. //typedef unsigned char  tBYTE;     /* 8 bit unsigned values         */
  103. //typedef unsigned char  tINT[2];   /* little-endian 16 bit signed   */
  104. //typedef unsigned char  tWORD[2];  /* little-endian 16 bit unsigned */
  105. //typedef unsigned char  tLONG[4];  /* little-endian 32 bit signed   */
  106. //typedef unsigned char  tDWORD[4]; /* little-endian 32 bit unsigned */
  107.  
  108. //#else
  109.  
  110. typedef signed char    tCHAR;     /* 8 bit signed values    */
  111. typedef unsigned char  tBYTE;     /* 8 bit unsigned values  */
  112. typedef signed short   tINT;      /* 16 bit signed values   */
  113. typedef unsigned short tWORD;     /* 16 bit unsigned values */
  114. typedef signed long    tLONG;     /* 32 bit signed values   */
  115. typedef unsigned long  tDWORD;    /* 32 bit unsigned values */
  116.  
  117. //#endif
  118.  
  119.  
  120. /*****************************************************************************/
  121. /* >>>>>>>>>>>>>>>>>>>>>  DOOR DATA FILE STRUCTURES  <<<<<<<<<<<<<<<<<<<<<<< */
  122. /*****************************************************************************/
  123.  
  124.  
  125. /*
  126. **  Name of file:   *.INF
  127. **
  128. **  Description:    The *.INF file is the source of information for just about
  129. **                  everything from the host BBS, as well as definitions for
  130. **                  all of the message areas that are available to the user
  131. **                  and their status (Local, EchoMail, NetMail, Read Only,
  132. **                  etc.).
  133. **
  134. **  File format:    INF_HEADER          { only included one time!        }
  135. **                  INF_AREA_INFO       { repeated for as many msg bases }
  136. **                  INF_AREA_INFO       { as are available to the user   }
  137. **                  ...
  138. */
  139.  
  140. /*  Bit-masks for INF_HEADER.UFLAGS field  */
  141.  
  142. #define INF_HOTKEYS     0x0001      /* User uses "hotkeys" in door prompts   */
  143. #define INF_XPERT       0x0002      /* Short menus displayed in door         */
  144. #define INF_RES1        0x0004      /* RESERVED -- DO NOT USE!               */
  145. #define INF_GRAPHICS    0x0008      /* Enable ANSI control sequences in door */
  146. #define INF_NOT_MY_MAIL 0x0010      /* Do not bundle mail from user          */
  147. #define INF_EXT_INFO    0x0020      /* Download extended info with messages  */
  148.                                     /*   (* VERSION 3 AND LATER ONLY *)      */
  149. #define INF_NUMERIC_EXT 0x0040      /* Use numeric extensions on packets     */
  150.                                     /*   (* VERSION 3 AND LATER ONLY *)      */
  151.  
  152. /*  Bit-masks for INF_HEADER.NETMAIL_FLAGS field  */
  153.  
  154. #define INF_CAN_CRASH   0x0002      /* Allow Crash status          */
  155. #define INF_CAN_ATTACH  0x0010      /* Allow File Attach messages  */
  156. #define INF_CAN_KSENT   0x0080      /* Allow Kill/Sent status      */
  157. #define INF_CAN_HOLD    0x0200      /* Allow Hold status           */
  158. #define INF_CAN_IMM     0x0400      /* Allow Immediate status      */
  159. #define INF_CAN_FREQ    0x0800      /* Allow File Request messages */
  160. #define INF_CAN_DIRECT  0x1000      /* Allow Direct status         */
  161.  
  162. /*  Bit-masks for INF_HEADER.CTRL_FLAGS field  */
  163.  
  164. #define INF_NO_CONFIG   0x0001      /* Do not allow offline configuration */
  165. #define INF_NO_FREQ     0x0002      /* Do not allow file requesting       */
  166.  
  167. /*  Values for INF_HEADER.FILE_LIST_TYPE field  */
  168.  
  169. #define INF_FLIST_NONE      0       /* Door does not generate a list file  */
  170. #define INF_FLIST_TEXT      1       /* Door generates plain text list file */
  171. #define INF_FLIST_ANSI      2       /* Door generates ANSI list file       */
  172.  
  173. typedef struct      /*  INF_HEADER  */
  174. {
  175.     tBYTE ver;                  /* Packet version type (currently 2)        */
  176.     tBYTE readerfiles[5][13];   /* Files to be displayed by reader          */
  177.     tBYTE regnum[9];            /* User's registration number               */
  178.     tBYTE mashtype;             /* Currently unused (door fills with 0)     */
  179.                                 /*   Reserved for Blue Wave reader to store */
  180.                                 /*   the compression type the packet uses.  */
  181.     tBYTE loginname[43];        /* Name user types at BBS login             */
  182.     tBYTE aliasname[43];        /* User's "other" name                      */
  183.     tBYTE password[21];         /* Password                                 */
  184.                                 /*   All bytes should be the actually ASCII */
  185.                                 /*   value plus 10.  Lame security, yes,    */
  186.                                 /*   but it does prevent "TYPE *.INF" from  */
  187.                                 /*   showing the password.                  */
  188.     tBYTE passtype;             /* Password type                            */
  189.                                 /*   0=none 1=door 2=reader 3=both          */
  190.     tWORD zone;                 /* Main network address of host BBS         */
  191.     tWORD net;                  /*   (zone:net/node.point)                  */
  192.     tWORD node;
  193.     tWORD point;
  194.     tBYTE sysop[41];            /* Name of SysOp of host BBS                */
  195.     tWORD ctrl_flags;           /* Flags to control reader capabilities     */
  196.                                 /*   (* VERSION 3 AND LATER ONLY *)         */
  197.     tBYTE systemname[65];       /* Name of host BBS                         */
  198.     tBYTE maxfreqs;             /* Max number of file requests allowed      */
  199.     tWORD is_QWK;               /* Whether *.INF belongs to a QWK packet    */
  200.     tBYTE obsolete2[4];         /* OBSOLETE -- DO NOT USE!                  */
  201.     tWORD uflags;               /* Bit-mapped door options/toggles          */
  202.     tBYTE keywords[10][21];     /* User's entire set of door keywords       */
  203.     tBYTE filters[10][21];      /* User's entire set of door filters        */
  204.     tBYTE macros[3][80];        /* User's door bundling command macros      */
  205.     tWORD netmail_flags;        /* Bit-mapped NetMail options               */
  206.     tWORD credits;              /* NetMail credits                          */
  207.     tWORD debits;               /* NetMail debits                           */
  208.     tBYTE can_forward;          /* 0=Message forwarding not allowed         */
  209.     tWORD inf_header_len;       /* Size of INF_HEADER structure             */
  210.     tWORD inf_areainfo_len;     /* Size of INF_AREA_INFO structure          */
  211.     tWORD mix_structlen;        /* Size of MIX_REC structure                */
  212.     tWORD fti_structlen;        /* Size of FTI_REC structure                */
  213.     tBYTE uses_upl_file;        /* If this field is not zero, the door that */
  214.                                 /*   created this packet can receive reply  */
  215.                                 /*   packets in the new *.UPL file format.  */
  216.                                 /*   Otherwise, the old *.UPI and *.NET     */
  217.                                 /*   files must be used.                    */
  218.     tBYTE from_to_len;          /* The maximum length of the FROM: and TO:  */
  219.                                 /*   fields that the host BBS can support.  */
  220.                                 /*   If this value is 0 or is greater than  */
  221.                                 /*   35, then 35 must be used (the upload   */
  222.                                 /*   file formats only allow for a maximum  */
  223.                                 /*   of 35 characters).                     */
  224.     tBYTE subject_len;          /* The maximum length of the SUBJECT: field */
  225.                                 /*   that the host BBS can support.  If     */
  226.                                 /*   this value is 0 or is greater than 71, */
  227.                                 /*   then 71 must be used (the upload file  */
  228.                                 /*   formats only allow for a maximum of 71 */
  229.                                 /*   characters).                           */
  230.     tBYTE packet_id[9];         /* Original root name of the mail packet,   */
  231.                                 /*   as specified by the mail door.  All    */
  232.                                 /*   files in the packet that are created   */
  233.                                 /*   by the mail door will use this root    */
  234.                                 /*   name, as will the reader when creating */
  235.                                 /*   the upload files.  Thus, even if the   */
  236.                                 /*   packets themselves are renamed to      */
  237.                                 /*   something completely different, the    */
  238.                                 /*   mail doors and readers will still be   */
  239.                                 /*   able to work with the proper files.    */
  240.     tBYTE file_list_type;       /* New file listing type                    */
  241.                                 /* (* VERSION 3 AND LATER ONLY *)           */
  242.                                 /*   Specifies the type of new file list    */
  243.                                 /*   that is generated by the door (see     */
  244.                                 /*   INF_FLIST_xxx, above).  This field is  */
  245.                                 /*   intended for use with offline config.  */
  246.     tBYTE auto_macro[3];        /* Auto-macro indicator flags               */
  247.                                 /* (* VERSION 3 AND LATER ONLY *)           */
  248.                                 /*   Specifies which macros are auto macros */
  249.                                 /*   (i.e. execute automatically after mail */
  250.                                 /*   is scanned).                           */
  251.     tINT max_packet_size;       /* Maximum size of uncompressed packet      */
  252.                                 /* (* VERSION 3 AND LATER ONLY *)           */
  253.                                 /*   Specifies, in K, the maximum size of   */
  254.                                 /*   an uncompressed mail packet.  A value  */
  255.                                 /*   of 0 indicates no maximum length.      */
  256.                                 /*   This field is intended for use with    */
  257.                                 /*   offline config.                        */
  258.     tBYTE reserved[228];        /* RESERVED FOR FUTURE USE                  */
  259.                                 /*   This field MUST be filled with ASCII   */
  260.                                 /*   NUL (0x00) characters in order for     */
  261.                                 /*   future additional features to work     */
  262.                                 /*   properly!                              */
  263. }
  264. INF_HEADER;
  265.  
  266. /*
  267. **  Notes about the INF_HEADER.XXXXX_LEN fields, above:
  268. **
  269. **  Door authors should take the few extra lines of code to fill in the
  270. **  structure lengths defined above.  Doing so will make the Blue Wave data
  271. **  structures extensible and adaptable to almost any kind of file change that
  272. **  may be required in the future.  The readers that use this mail packet
  273. **  format should contain code to handle a structure length that is longer or
  274. **  shorter than they expect.
  275. **
  276. **  Reader authors need to take the time to code for possible extensions to
  277. **  this file format.  If the data fields are LONGER than expected, simply do
  278. **  a seek to move to the next record, and ignore the extra information.  If
  279. **  the data fields are SHORTER than expected, a simple "Please upgrade your
  280. **  reader" should suffice. <grin>  However, you should never encounter a
  281. **  record size smaller than the ones defined here.  Any extra information
  282. **  that is sent in the packets probably would not be crucial, and you may be
  283. **  able to continue with reading the packet anyway.
  284. **
  285. **  It should be noted that all current Blue Wave doors set these fields to 0,
  286. **  as this extensibility was not added until recently.  If the structure
  287. **  sizes are 0, the reader will assume that all records are of the sizes
  288. **  defined here.  (Blue Wave readers below version 2.10 do NOT allow for
  289. **  extensible data files.  Version 2.10, and all subsequent versions, WILL
  290. **  handle them properly.)  DO NOT EXTEND THESE STRUCTURE FORMATS WITHOUT
  291. **  NOTIFYING CUTTING EDGE COMPUTING FIRST!  If the extended information will
  292. **  benefit programs/users, it will be officially added to the packet format.
  293. **
  294. **  The original values for the INF_HEADER.XXXXX_LEN structures are as below,
  295. **  defined as macros which you can use in your programs.  Remember, if the
  296. **  value in INF_HEADER.XXXXX_LEN is 0, you must use these values instead!
  297. */
  298.  
  299. #define ORIGINAL_INF_HEADER_LEN     1230    /* Original *.INF header len   */
  300. #define ORIGINAL_INF_AREA_LEN       80      /* Original *.INF area rec len */
  301. #define ORIGINAL_MIX_STRUCT_LEN     14      /* Original *.MIX record len   */
  302. #define ORIGINAL_FTI_STRUCT_LEN     186     /* Original *.FTI record len   */
  303.  
  304. /*
  305. **  Below is some sample C code for reading in the variable length *.INF
  306. **  structure, which is the most "difficult" one to do.  Note the sections of
  307. **  code which use the ORIGINAL_XXXXX_LEN macros; these are the sections that
  308. **  determine the proper structure length.  (Comments are preceeded by "#"
  309. **  signs, since using C comment symbols would make most compilers think that
  310. **  nested comments are in use, a practice which normally is not allowed.)
  311. **
  312. **  int read_inf_file(void)
  313. **  {
  314. **      INF_HEADER    inf_header;
  315. **      INF_AREA_INFO inf_info;
  316. **      FILE          *inf_file=NULL;
  317. **      tWORD         record_num=0u;
  318. **      tWORD         inf_header_slen, inf_area_slen;
  319. **      tLONG         seek_pos=0L;
  320. **
  321. **      inf_file = fopen("WILDBLUE.INF", "rb");
  322. **      if (inf_file == NULL)
  323. **          return 0;
  324. **
  325. **      fread(&inf_header, sizeof(INF_HEADER), 1, inf_file);
  326. **      puts(inf_header.loginname);
  327. **      puts(inf_header.aliasname);
  328. **
  329. **      # Test and verify the validity of the structure lengths.
  330. **
  331. **      if (inf_header.inf_header_len < ORIGINAL_INF_HEADER_LEN)
  332. **          inf_header_slen = ORIGINAL_INF_HEADER_LEN;
  333. **      else
  334. **          inf_header_slen = inf_header.inf_header_len;
  335. **
  336. **      if (inf_header.inf_areainfo_len < ORIGINAL_INF_AREA_LEN)
  337. **          inf_area_slen = ORIGINAL_INF_AREA_LEN;
  338. **      else
  339. **          inf_area_slen = inf_header.inf_areainfo_len;
  340. **
  341. **      # now, move to the END of the header, since it may be longer
  342. **      # than we expect it to be.  Use fseek()...
  343. **
  344. **      fseek(inf_file, (long)inf_header_slen, SEEK_SET);
  345. **
  346. **      record_num = 0U;
  347. **      while(fread(&inf_info, sizeof(INF_AREA_INFO), 1, inf_file))
  348. **      {
  349. **          puts(inf_info.title);
  350. **          record_num++;
  351. **
  352. **          # we need to seek past the header, and then [record_num]
  353. **          # number of recs.
  354. **
  355. **          seek_pos = (long)(inf_header_slen+(record_num*inf_area_slen));
  356. **          fseek(inf_file, seek_pos, SEEK_SET);
  357. **      }
  358. **
  359. **      fclose(inf_file);
  360. **      return 1;
  361. **  }
  362. */
  363.  
  364. /*  Bit-masks for INF_AREA_INFO.AREA_FLAGS field  */
  365.  
  366. #define INF_SCANNING    0x0001  /* On=User is active for area               */
  367. #define INF_ALIAS_NAME  0x0002  /* On=Alias name, Off=Login name            */
  368.                                 /*   If ON, use INF_HEADER.ALIASNAME when   */
  369.                                 /*   addressing new mail or replies for the */
  370.                                 /*   message area.  If OFF, the reader uses */
  371.                                 /*   the INF_HEADER.LOGINNAME for this      */
  372.                                 /*   purpose.                               */
  373. #define INF_ANY_NAME    0x0004  /* On=Allow any name to be entered          */
  374.                                 /*   If ON, any name can be entered in the  */
  375.                                 /*   From: field when addressing new mail   */
  376.                                 /*   or replies for the message area.  If   */
  377.                                 /*   OFF, the normal rules apply.           */
  378. #define INF_ECHO        0x0008  /* On=Network mail, Off=Local mail          */
  379. #define INF_NETMAIL     0x0010  /* On=E-mail, Off=Conference mail           */
  380.                                 /*   Refer to the chart below (the values   */
  381.                                 /*   for the NETWORK_TYPE field) for info   */
  382.                                 /*   on how these two flags should be set   */
  383.                                 /*   for message areas.                     */
  384. #define INF_POST        0x0020  /* On=User can post, Off=User CANNOT post   */
  385. #define INF_NO_PRIVATE  0x0040  /* On=Private messages are NOT allowed      */
  386. #define INF_NO_PUBLIC   0x0080  /* On=Public messages are NOT allowed       */
  387. #define INF_NO_TAGLINE  0x0100  /* On=Taglines are not allowed              */
  388. #define INF_NO_HIGHBIT  0x0200  /* On=ASCII 1-127 only, Off=ASCII 1-255     */
  389.                                 /*   If ON, only ASCII values 1 to 127 are  */
  390.                                 /*   allowed in messages.  If OFF, all      */
  391.                                 /*   values from 1 to 255 are allowed.  Due */
  392.                                 /*   to the fact that ASCII value 0 is used */
  393.                                 /*   in C as a string terminator, the value */
  394.                                 /*   0 should not be allowed in messages at */
  395.                                 /*   all.                                   */
  396. #define INF_NOECHO      0x0400  /* On=User can prevent messages from being  */
  397.                                 /*   sent through the network               */
  398. #define INF_HASFILE     0x0800  /* On=User can attach files to messages     */
  399. #define INF_PERSONAL    0x1000  /* On=User is downloading only personal     */
  400.                                 /*   msgs in this message area.  The flag   */
  401.                                 /*   INF_SCANNING also needs to be ON.      */
  402.                                 /*   (* VERSION 3 AND LATER ONLY *)         */
  403. #define INF_TO_ALL      0x2000  /* On=User is downloading messages to "All" */
  404.                                 /*   and personal messages only in this     */
  405.                                 /*   area.  The flag INF_SCANNING also      */
  406.                                 /*   needs to be ON.  INF_PERSONAL should   */
  407.                                 /*   *not* be set, as this flag implies the */
  408.                                 /*   downloading of personal messages also. */
  409.                                 /*   (* VERSION 3 AND LATER ONLY *)         */
  410.  
  411. /*  Values for INF_AREA_INFO.NETWORK_TYPE field  */
  412.  
  413. #define INF_NET_FIDONET     0   /* FidoNet-style E-mail and conferences     */
  414.                                 /*   Local     = INF_ECHO=off, NETMAIL=off  */
  415.                                 /*   EchoMail  = INF_ECHO=on,  NETMAIL=off  */
  416.                                 /*   GroupMail = INF_ECHO=on,  NETMAIL=off  */
  417.                                 /*   NetMail   = INF_ECHO=on,  NETMAIL=on   */
  418. #define INF_NET_INTERNET    1   /* Internet E-mail and Usenet newsgroups    */
  419.                                 /*   Local     = INF_ECHO=off, NETMAIL=off  */
  420.                                 /*   Newsgroup = INF_ECHO=on,  NETMAIL=off  */
  421.                                 /*   E-mail    = INF_ECHO=on,  NETMAIL=on   */
  422.  
  423. typedef struct      /*  INF_AREA_INFO  */
  424. {
  425.     tBYTE areanum[6];       /* Area number this record corresponds to  */
  426.     tBYTE echotag[21];      /* Area tag name (*.BRD name for Telegard) */
  427.     tBYTE title[50];        /* Area description/title                  */
  428.     tWORD area_flags;       /* Bit-mapped area options                 */
  429.     tBYTE network_type;     /* Network mail type (see above)           */
  430. }
  431. INF_AREA_INFO;
  432.  
  433. /*---------------------------------------------------------------------------*/
  434.  
  435. /*
  436. **  Name of file:   *.MIX
  437. **
  438. **  Description:    The *.MIX file is a very small file, with one record for
  439. **                  every message area that was scanned.  It contains the
  440. **                  information to get into the *.FTI file.
  441. **
  442. **  File format:    MIX_REC     { repeated for each message area scanned }
  443. **                  MIX_REC
  444. **                  ...
  445. */
  446.  
  447. typedef struct      /*  MIX_REC  */
  448. {
  449.     tBYTE areanum[6];   /* Area number this record corresponds to         */
  450.                         /*   This is the ASCII representation of the      */
  451.                         /*   actual area number shown on the host BBS.    */
  452.     tWORD totmsgs;      /* Total number of messages for this area         */
  453.     tWORD numpers;      /* Total number of personal messages in this area */
  454.     tLONG msghptr;      /* Pointer to first message header in *.FTI file  */
  455. }
  456. MIX_REC;
  457.  
  458. /*---------------------------------------------------------------------------*/
  459.  
  460. /*
  461. **  Name of file:   *.FTI
  462. **
  463. **  Description:    The *.FTI file contains the information for each message
  464. **                  in the packet.  Each record includes all of the
  465. **                  information about the message, including the pointer to
  466. **                  the actual message text in the *.DAT file.
  467. **
  468. **                  NOTE:   Messages in the *.FTI file will ALWAYS be in area
  469. **                          number order.  That is to say, if the MIX_REC
  470. **                          indicates there are 100 messages for this area,
  471. **                          all 100 messages will follow in sequential order.
  472. **
  473. **  File format:    FTI_REC     { repeated for as many messages }
  474. **                  FTI_REC     { as obtained from the host BBS }
  475. **                  ...
  476. */
  477.  
  478. /*  Bit-masks for FTI_REC.FLAGS field  */
  479.  
  480. #define FTI_MSGPRIVATE      0x0001  /* Private = For addressee ONLY         */
  481. #define FTI_MSGCRASH        0x0002  /* Crash = High priority mail           */
  482. #define FTI_MSGREAD         0x0004  /* Read = Message read by addressee     */
  483. #define FTI_MSGSENT         0x0008  /* Sent = Message sent                  */
  484. #define FTI_MSGFILE         0x0010  /* File Attach = Send file(s)           */
  485. #define FTI_MSGFWD          0x0020  /* Forward = Message to/from others     */
  486. #define FTI_MSGORPHAN       0x0040  /* Orphan = Message destination unknown */
  487. #define FTI_MSGKILL         0x0080  /* Kill/Sent = Delete after sending     */
  488. #define FTI_MSGLOCAL        0x0100  /* Local = Message originated here      */
  489. #define FTI_MSGHOLD         0x0200  /* Hold = Hold for pickup, don't send   */
  490. #define FTI_MSGIMMEDIATE    0x0400  /* Immediate = Send message NOW         */
  491. #define FTI_MSGFRQ          0x0800  /* File Request = Request file(s)       */
  492. #define FTI_MSGDIRECT       0x1000  /* Direct = Send direct, no routing     */
  493. #define FTI_MSGUNUSED1      0x2000  /*                                      */
  494. #define FTI_MSGUNUSED2      0x4000  /*                                      */
  495. #define FTI_MSGURQ          0x8000  /* Update Request = Req updated file(s) */
  496.  
  497. typedef struct      /*  FTI_REC  */
  498. {
  499.     tBYTE from[36];         /* Person message is from                       */
  500.     tBYTE to[36];           /* Person message is to                         */
  501.     tBYTE subject[72];      /* Subject/title of message                     */
  502.     tBYTE date[20];         /* Origin date of message                       */
  503.                             /*   Depending on the host BBS's date storage   */
  504.                             /*   format, the EXACT format of this field     */
  505.                             /*   will change.  Some will take all 19 bytes, */
  506.                             /*   others may take only 10.                   */
  507.     tWORD msgnum;           /* Number of THIS message on BBS                */
  508.     tWORD replyto;          /* "This is a reply to #xx"                     */
  509.                             /*   Not used for every message.  When non-     */
  510.                             /*   zero, there is a previous message in       */
  511.                             /*   the thread.                                */
  512.     tWORD replyat;          /* "There is a reply at #xx"                    */
  513.                             /*   Not used for every message.  When non-     */
  514.                             /*   zero, there is a reply to this message.    */
  515.     tLONG msgptr;           /* Offset to start of message in *.DAT file     */
  516.                             /*   Seek to this exact offset in the *.DAT     */
  517.                             /*   file, then read "msglength" bytes from     */
  518.                             /*   the file to load the entire message text.  */
  519.     tLONG msglength;        /* Length of message text (in bytes)            */
  520.     tWORD flags;            /* Bit-mapped message status flags              */
  521.     tWORD orig_zone;        /* Origin address of message                    */
  522.                             /*   These three fields will most likely be 0,  */
  523.                             /*   unless the current message belongs to a    */
  524.                             /*   NetMail message base.                      */
  525.     tWORD orig_net;
  526.     tWORD orig_node;
  527. }
  528. FTI_REC;
  529.  
  530. /*---------------------------------------------------------------------------*/
  531.  
  532. /*
  533. **  Name of file:   *.DAT
  534. **
  535. **  Description:    The *.DAT file is an unstructured file which contains the
  536. **                  text of every message obtained from the host BBS.
  537. **                  Valid messages begin with an ASCII space (0x20) character
  538. **                  (which is NOT to be considered part of the message!)
  539. **                  followed by zero or more bytes which constitute the
  540. **                  message text.  The pointer to the text for each message is
  541. **                  stored in FTI_REC.MSGPTR, and the length of the text for
  542. **                  each message is stored in FTI_REC.MSGLENGTH.
  543. **
  544. **  File format:    Unstructured
  545. */
  546.  
  547.  
  548. /*****************************************************************************/
  549. /* >>>>>>>>>>>>>>>>>  MISCELLANEOUS DATA FILE STRUCTURES  <<<<<<<<<<<<<<<<<< */
  550. /*****************************************************************************/
  551.  
  552.  
  553. /*
  554. **  Name of file:   *.MSG
  555. **
  556. **  Description:    The Fido *.MSG message (named for the BBS program on which
  557. **                  it originated) has become a de-facto standard among BBS
  558. **                  implementations, due to the sheer number of utilities
  559. **                  available that operate with *.MSG messages.  It is as
  560. **                  close to a universal message format as one can get in
  561. **                  FidoNet (and FidoNet-style networks), and is the reason
  562. **                  why it is used here (well, the *.MSG header, anyway).
  563. **
  564. **                  NOTE:   Most of the fields in the FTI_REC structure (shown
  565. **                          above) correspond to similar fields in MSG_REC.
  566. **                          This was done deliberately, in order to make
  567. **                          *.FTI file processing a little more intuitive for
  568. **                          programmers.  Also note that MSG_REC is only used
  569. **                          by the NET_REC structure, which will soon become
  570. **                          obsolete (replaced by UPL_REC).
  571. **
  572. **  File format:    MSG_REC         { only included one time!                }
  573. **                  message text    { text can be terminated by an ASCII NUL }
  574. **                                  { character (0x00), or by an ASCII CR,   }
  575. **                                  { LF, NUL (0x0D 0x0A 0x00) sequence      }
  576. */
  577.  
  578. /*  Bit-masks for MSG_REC.ATTR field  */
  579.  
  580. #define MSG_NET_PRIVATE     0x0001  /* Private                */
  581. #define MSG_NET_CRASH       0x0002  /* Crash mail             */
  582. #define MSG_NET_RECEIVED    0x0004  /* Received               */
  583. #define MSG_NET_SENT        0x0008  /* Sent                   */
  584. #define MSG_NET_FATTACH     0x0010  /* File attached          */
  585. #define MSG_NET_INTRANSIT   0x0020  /* In-transit             */
  586. #define MSG_NET_ORPHAN      0x0040  /* Orphaned               */
  587. #define MSG_NET_KILL        0x0080  /* Kill after sending     */
  588. #define MSG_NET_LOCAL       0x0100  /* Local message          */
  589. #define MSG_NET_HOLD        0x0200  /* Hold for pickup        */
  590. #define MSG_NET_RESERVED    0x0400  /* RESERVED               */
  591. #define MSG_NET_FREQ        0x0800  /* File request           */
  592. #define MSG_NET_RREQ        0x1000  /* Return receipt request */
  593. #define MSG_NET_RECEIPT     0x2000  /* Return receipt message */
  594. #define MSG_NET_AREQ        0x4000  /* Audit request          */
  595. #define MSG_NET_FUREQ       0x8000  /* File update request    */
  596.  
  597. typedef struct      /*  MSG_REC (will soon be obsolete)  */
  598. {
  599.     tBYTE from[36];     /* Person message is from                           */
  600.     tBYTE to[36];       /* Person message is to                             */
  601.     tBYTE subj[72];     /* Subject/title of message                         */
  602.     tBYTE date[20];     /* Creation date/time                               */
  603.                         /*   This date/time is usually in either of the     */
  604.                         /*   Fido-sanctioned formats "DD MMM YY  HH:MM:SS"  */
  605.                         /*   or "WWW DD MMM YY HH:MM", but due to the       */
  606.                         /*   chaotic nature of FidoNet-compatible software, */
  607.                         /*   this CANNOT be relied upon!                    */
  608.     tWORD times;        /* Number of times read (fairly obsolete)           */
  609.     tWORD dest;         /* Destination node (of net/node)                   */
  610.     tWORD orig;         /* Origin node (of net/node)                        */
  611.     tWORD cost;         /* Cost of sending message (usually in US cents)    */
  612.     tWORD orig_net;     /* Origin net (of net/node)                         */
  613.     tWORD destnet;      /* Destination net (of net/node)                    */
  614.     tLONG unused1;      /* Undefined                                        */
  615.     tLONG unused2;      /*   Some software (Opus and Maximus, for example)  */
  616.                         /*   uses these fields to store the sent/received   */
  617.                         /*   date/time as bit-packed fields, using the same */
  618.                         /*   format used in MS-DOS directory entries.       */
  619.     tWORD reply;        /* Message # that this message replies to           */
  620.     tWORD attr;         /* Message attributes and behavior flags            */
  621.     tWORD up;           /* Message # that replies to this message           */
  622. }
  623. MSG_REC;
  624.  
  625. /*---------------------------------------------------------------------------*/
  626.  
  627. /*
  628. **  Name of file:   *.XTI
  629. **
  630. **  Description:    The *.XTI file contains extended information for each
  631. **                  message in the packet.  The number of records in the *.XTI
  632. **                  file will always equal the number of messages in the
  633. **                  packet, with each record corresponding to a record in the
  634. **                  *.FTI file (i.e. record #1 in the *.XTI file corresponds
  635. **                  to record #1 in the *.FTI file, and so on).
  636. **
  637. **                  NOTE:   This file is currently created ONLY by the Blue
  638. **                          Wave reader, and is not a part of the official
  639. **                          Blue Wave packet specification; it is merely
  640. **                          documented here for third party programmers to use
  641. **                          if they so desire.  How other readers store which
  642. **                          messages have been read/replied-to/marked is left
  643. **                          as an option to be implemented by the individual
  644. **                          reader authors.  You may use this method if you so
  645. **                          desire; however, PLEASE do not name any external
  646. **                          files not conforming to this specification as
  647. **                          <packet-ID>.XTI, due to the fact that the Blue
  648. **                          Wave reader will expect the file to be in the
  649. **                          format described.  If it's not in the expected
  650. **                          format, things will get interesting. :-)
  651. **
  652. **  File format:    XTI_REC     { repeated for as many messages }
  653. **                  XTI_REC     { as obtained from the host BBS }
  654. **                  ...
  655. */
  656.  
  657. /*  Bit-masks for XTI_REC.FLAGS field  */
  658.  
  659. #define XTI_HAS_READ        0x01    /* Message has been read            */
  660. #define XTI_HAS_REPLIED     0x02    /* Message has been replied to      */
  661. #define XTI_IS_PERSONAL     0x04    /* Message is personal              */
  662. #define XTI_IS_TAGGED       0x08    /* Message has been 'tagged'        */
  663. #define XTI_HAS_SAVED       0x10    /* Message has been saved           */
  664. #define XTI_HAS_PRINTED     0x20    /* Message has been printed         */
  665.  
  666. /*  Bit-masks for XTI_REC.MARKS field  */
  667.  
  668. #define XTI_MARK_SAVE       0x01    /* Message marked for saving   */
  669. #define XTI_MARK_REPLY      0x02    /* Message marked for replying */
  670. #define XTI_MARK_PRINT      0x04    /* Message marked for printing */
  671. #define XTI_MARK_DELETE     0x08    /* Message marked for deletion */
  672.  
  673. typedef struct      /*  XTI_REC  */
  674. {
  675.     tBYTE flags;    /* Bit-mapped message flags   */
  676.     tBYTE marks;    /* Bit-mapped message markers */
  677. }
  678. XTI_REC;
  679.  
  680.  
  681. /*****************************************************************************/
  682. /* >>>>>>>>>>>>>>>>>>>>  READER DATA FILE STRUCTURES  <<<<<<<<<<<<<<<<<<<<<< */
  683. /*****************************************************************************/
  684.  
  685.  
  686. /*
  687. **  Name of file:   *.NET
  688. **
  689. **  Description:    The *.NET file is created ONLY when there is NetMail to be
  690. **                  sent.  It contains the FULL header of the Fido-style *.MSG
  691. **                  structure plus the fields defined below (which aren't part
  692. **                  of the standard *.MSG structure yet required by the door).
  693. **
  694. **                  NOTE:   Readers should only generate a *.NET file if
  695. **                          INF_HEADER.USES_UPL_FILE is not set *AND* the
  696. **                          mail packet format is version 2 or earlier.
  697. **                          Doors should process *.NET files *ONLY* in cases
  698. **                          where a *.UPL file is not present.
  699. **
  700. **  File format:    NET_REC     { repeated for as many NetMail    }
  701. **                  NET_REC     { messages as exist in the packet }
  702. **                  ...
  703. */
  704.  
  705. typedef struct      /*  NET_REC  */
  706. {
  707.     MSG_REC msg;            /* The Fido-style *.MSG header                */
  708.     tBYTE fname[13];        /* Filename the message text is in            */
  709.     tBYTE echotag[21];      /* NetMail area tag (*.BRD name for Telegard) */
  710.     tWORD zone;             /* Destination zone (of zone:net/node.point)  */
  711.     tWORD point;            /* Destination point (of zone:net/node.point) */
  712.     tLONG unix_date;        /* Date/time of message                       */
  713.                             /*   This Unix-style date/time value (number  */
  714.                             /*   of seconds since 01/01/70) is converted  */
  715.                             /*   to the date/time storage method used by  */
  716.                             /*   the host BBS.                            */
  717. }
  718. NET_REC;
  719.  
  720. /*---------------------------------------------------------------------------*/
  721.  
  722. /*
  723. **  Name of file:   *.UPI
  724. **
  725. **  Description:    The *.UPI file contains the information for each message
  726. **                  in the reply packet, as well as information on the reader
  727. **                  version and registration numbers.  Each record includes
  728. **                  all of the information about the message.
  729. **
  730. **                  NOTE:   Readers should only generate a *.UPI file if
  731. **                          INF_HEADER.USES_UPL_FILE is not set *AND* the
  732. **                          mail packet format is version 2 or earlier.
  733. **                          Doors should process *.UPI files *ONLY* in cases
  734. **                          where a *.UPL file is not present.
  735. **
  736. **  File format:    UPI_HEADER      { only included one time!        }
  737. **                  UPI_REC         { repeated for as many msg bases }
  738. **                  UPI_REC         { as are available to the user   }
  739. **                  ...
  740. */
  741.  
  742. typedef struct      /*  UPI_HEADER  */
  743. {
  744.     tBYTE regnum[9];    /* Reader registration number                   */
  745.     tBYTE vernum[13];   /* Reader version number                        */
  746.                         /*   All bytes should be the actually ASCII     */
  747.                         /*   value plus 10.  Lame security, yes, but it */
  748.                         /*   does prevent "TYPE *.UPI" from showing the */
  749.                         /*   version number.                            */
  750.     tBYTE future[33];   /* RESERVED FOR FUTURE USE                      */
  751. #ifdef PAD_SIZES_EVEN
  752.     tBYTE evenpad;      /* If your compiler pads structures out to even */
  753.                         /*   numbered sizes, define PAD_SIZES_EVEN      */
  754.                         /*   before including this header.  When the    */
  755.                         /*   *.UPI file is written, be sure to write    */
  756.                         /*   sizeof(UPI_HEADER) - 1 bytes, otherwise    */
  757.                         /*   your compiler may insert an extra byte not */
  758.                         /*   explicitly specified here.                 */
  759. #endif
  760. }
  761. UPI_HEADER;
  762.  
  763. /*  Bit-masks for UPI_REC.FLAGS field  */
  764.  
  765. #define UPI_RES1        0x01    /* RESERVED FOR FUTURE USE                   */
  766. #define UPI_RES2        0x02    /* RESERVED FOR FUTURE USE                   */
  767. #define UPI_RES3        0x04    /* RESERVED FOR FUTURE USE                   */
  768. #define UPI_RES4        0x08    /* RESERVED FOR FUTURE USE                   */
  769. #define UPI_RES5        0x10    /* RESERVED FOR FUTURE USE                   */
  770. #define UPI_RES6        0x20    /* RESERVED FOR FUTURE USE                   */
  771. #define UPI_PRIVATE     0x40    /* Message is PRIVATE                        */
  772. #define UPI_NO_ECHO     0x80    /* Message is NOT to be echoed               */
  773.                                 /*   This feature is not yet implemented in  */
  774.                                 /*   the Blue Wave reader or doors, as none  */
  775.                                 /*   of the currently supported BBS software */
  776.                                 /*   has support for this feature.           */
  777.  
  778. typedef struct      /*  UPI_REC  */
  779. {
  780.     tBYTE from[36];     /* Person message is from                     */
  781.     tBYTE to[36];       /* Person message is to                       */
  782.     tBYTE subj[72];     /* Subject/title of message                   */
  783.     tLONG unix_date;    /* Date/time of message                       */
  784.                         /*   This Unix-style date/time value (number  */
  785.                         /*   of seconds since 01/01/70) is converted  */
  786.                         /*   to the date/time storage method used by  */
  787.                         /*   the host BBS.                            */
  788.     tBYTE fname[13];    /* Filename the message text is in            */
  789.     tBYTE echotag[21];  /* Area tag name (*.BRD name for Telegard)    */
  790.     tBYTE flags;        /* Bit-mapped flags                           */
  791.     tBYTE reedit;       /* INTERNAL USE ONLY!                         */
  792.                         /*   This flag is used internally by the Blue */
  793.                         /*   Wave reader.  Doors should ignore this   */
  794.                         /*   field during reply packet processing.    */
  795. }
  796. UPI_REC;
  797.  
  798. /*---------------------------------------------------------------------------*/
  799.  
  800. /*
  801. **  Name of file:   *.UPL
  802. **
  803. **  Description:    The *.UPL file contains the information for each message
  804. **                  in the reply packet, as well as information on the reader
  805. **                  version and registration numbers.  Each record includes
  806. **                  all of the information about the message.
  807. **
  808. **                  NOTE:   Readers should only generate a *.UPL file if
  809. **                          INF_HEADER.USES_UPL_FILE is set *AND/OR* the mail
  810. **                          packet format is version 3 or later.  Doors should
  811. **                          process *.UPL files in all cases where one is
  812. **                          present.
  813. **
  814. **  File format:    UPL_HEADER      { only included one time!       }
  815. **                  UPL_REC         { repeated for as many messages }
  816. **                  UPL_REC         { as are included in the packet }
  817. **                  ...
  818. */
  819.  
  820. typedef struct      /*  UPL_HEADER  */
  821. {
  822.     tBYTE regnum[10];       /* Reader registration number (if desired)      */
  823.     tBYTE vernum[20];       /* Reader version number as a string.           */
  824.                             /*   All bytes should be the actually ASCII     */
  825.                             /*   value plus 10.  Lame security, yes, but it */
  826.                             /*   does prevent "TYPE *.UPL" from showing the */
  827.                             /*   version number.                            */
  828.                             /*   Examples:  "2.10a Beta"                    */
  829.                             /*              "2.11"                          */
  830.     tBYTE reader_major;     /* Major version of the reader (number to the   */
  831.                             /*   left of the decimal point)                 */
  832.     tBYTE reader_minor;     /* Minor version of the reader (number to the   */
  833.                             /*   right of the decimal point)                */
  834.     tBYTE reader_name[80];  /* String containing name of the reader, such   */
  835.                             /*   as "The Blue Wave Offline Mail Reader".    */
  836.                             /*   This is provided for door programmers that */
  837.                             /*   wish to display the name of the reader     */
  838.                             /*   that created the reply packet.  (Filling   */
  839.                             /*   it is mandatory but using it is optional.) */
  840.     tWORD upl_header_len;   /* Size of UPL_HEADER structure                 */
  841.     tWORD upl_rec_len;      /* Size of UPL_REC structure                    */
  842.                             /*   NOTE:  Refer to the INF_HEADER section for */
  843.                             /*          more information on using the size  */
  844.                             /*          fields.                             */
  845.     tBYTE loginname[44];    /* Name found in INF_HEADER.LOGINNAME.  This is */
  846.                             /*   provided for door authors as a security    */
  847.                             /*   measure to implement as they wish.         */
  848.     tBYTE aliasname[44];    /* Name found in INF_HEADER.ALIASNAME           */
  849.     tBYTE reader_tear[16];  /* String containing abbreviated name of the    */
  850.                             /*   reader, such as "Blue Wave", "Q-Blue",     */
  851.                             /*   "Wave Rider", etc.  This is provided for   */
  852.                             /*   doors programmers that wish to add to the  */
  853.                             /*   tear line the name of the reader that      */
  854.                             /*   created the reply packet.  (Filling it is  */
  855.                             /*   mandatory but using it is optional.)  If   */
  856.                             /*   this field is blank, the tear line to be   */
  857.                             /*   generated is left to the discretion of the */
  858.                             /*   door author.                               */
  859.     tBYTE compress_type;    /* Compression type required for mail packet    */
  860.                             /*   The Blue Wave reader uses this internally  */
  861.                             /*   to store the compression type required for */
  862.                             /*   this particular mail packet.               */
  863.     tBYTE flags;            /* Reader processing flags                      */
  864.                             /*   The Blue Wave reader uses this internally  */
  865.                             /*   to store flags required for later          */
  866.                             /*   processing.                                */
  867.                             /*     0x01 = Was a .QWK packet.                */
  868.                             /*     0x02 = Host requires a *.UPI file        */
  869.     tBYTE not_registered;   /* Reader is not registered to user             */
  870.                             /*   If this byte is set to a non-zero value,   */
  871.                             /*   the Blue Wave doors will assume that the   */
  872.                             /*   user's reader was not registered, and will */
  873.                             /*   place "[NR]" at the end of the tear line.  */
  874.                             /*   Third-party doors may use this flag for    */
  875.                             /*   the same purpose; its use is optional by   */
  876.                             /*   mail readers (especially if you don't care */
  877.                             /*   whether or not "[NR]" shows up on the tear */
  878.                             /*   line <grin>).                              */
  879.     tBYTE pad[33];          /* RESERVED FOR FUTURE USE, and to pad struct   */
  880.                             /*   out to a 'nice' 256 bytes                  */
  881. }
  882. UPL_HEADER;
  883.  
  884. /*  Bit-masks for UPL_REC.MSG_ATTR field  */
  885.  
  886. #define UPL_INACTIVE    0x0001  /* Message is INACTIVE                       */
  887.                                 /*   Doors should NOT attempt to import this */
  888.                                 /*   message.                                */
  889. #define UPL_PRIVATE     0x0002  /* Message is PRIVATE                        */
  890. #define UPL_NO_ECHO     0x0004  /* Message is NOT to be echoed               */
  891.                                 /*   This feature is not yet implemented in  */
  892.                                 /*   the Blue Wave reader or doors, as none  */
  893.                                 /*   of the currently supported BBS software */
  894.                                 /*   has support for this feature.           */
  895. #define UPL_HAS_FILE    0x0008  /* Message has file "attached" to it         */
  896.                                 /*   It is up to the door to check the       */
  897.                                 /*   validity of this flag.  If the file is  */
  898.                                 /*   contained in the mail packet, great.    */
  899.                                 /*   If not, the door should probably prompt */
  900.                                 /*   the user to begin uploading the file    */
  901.                                 /*   after importing the messages.  (Not yet */
  902.                                 /*   implemented in the Blue Wave reader.)   */
  903. #define UPL_NETMAIL     0x0010  /* Message is network mail                   */
  904.                                 /*   Indicates NetMail/E-mail message.  The  */
  905.                                 /*   NETWORK_TYPE field (see below) will     */
  906.                                 /*   indicate which fields should be used    */
  907.                                 /*   for addressing the message.             */
  908. #define UPL_IS_REPLY    0x0020  /* Indicates that the message is a reply to  */
  909.                                 /*   an existing message, rather than being  */
  910.                                 /*   a completely new message.               */
  911. #define UPL_MRES7       0x0040  /* RESERVED FOR FUTURE USE                   */
  912. #define UPL_MRES8       0x0080  /* RESERVED FOR FUTURE USE                   */
  913.                                 /* All of the other 8 bits of this field are */
  914.                                 /*   also reserved for future use.  This     */
  915.                                 /*   should provide for plenty of expansion  */
  916.                                 /*   for future development.                 */
  917.  
  918. /*  Bit-masks for UPL_REC.NETMAIL_ATTR field  */
  919.  
  920. #define UPL_NRES1           0x0001  /* RESERVED FOR FUTURE USE             */
  921. #define UPL_NETCRASH        0x0002  /* Crash = High priority mail          */
  922. #define UPL_NRES2           0x0004  /* RESERVED FOR FUTURE USE             */
  923. #define UPL_NRES3           0x0008  /* RESERVED FOR FUTURE USE             */
  924. #define UPL_NETFILE         0x0010  /* File Attach = Send file(s) listed   */
  925.                                     /*   in Subject field                  */
  926. #define UPL_NRES4           0x0020  /* RESERVED FOR FUTURE USE             */
  927. #define UPL_NRES5           0x0040  /* RESERVED FOR FUTURE USE             */
  928. #define UPL_NETKILL         0x0080  /* Kill/Sent = Delete after sending    */
  929. #define UPL_NETLOCAL        0x0100  /* Local = Message originated here     */
  930. #define UPL_NETHOLD         0x0200  /* Hold = Hold for pickup, do not send */
  931. #define UPL_NETIMMEDIATE    0x0400  /* Immediate = Send message NOW        */
  932. #define UPL_NETFRQ          0x0800  /* File Request = Request file(s)      */
  933.                                     /*   listed in Subject field           */
  934. #define UPL_NETDIRECT       0x1000  /* Direct = Send direct, no routing    */
  935. #define UPL_NRES6           0x2000  /* RESERVED FOR FUTURE USE             */
  936. #define UPL_NRES7           0x4000  /* RESERVED FOR FUTURE USE             */
  937. #define UPL_NETURQ          0x8000  /* Update Request = Request updated    */
  938.                                     /*   file(s) listed in Subject field   */
  939.  
  940. /*  Values for UPL_REC.NETWORK_TYPE field  */
  941.  
  942. #define UPL_NET_FIDONET     0   /* FidoNet-style E-mail and conferences     */
  943.                                 /*   UPL_NETMAIL=off - Local, Echo, Group   */
  944.                                 /*   UPL_NETMAIL=on  - NetMail              */
  945. #define UPL_NET_INTERNET    1   /* Internet E-mail and Usenet newsgroups    */
  946.                                 /*   UPL_NETMAIL=off - Local, Newsgroup     */
  947.                                 /*   UPL_NETMAIL=on  - E-mail               */
  948.  
  949. typedef struct      /*  UPL_REC  */
  950. {
  951.     tBYTE from[36];         /* Person message is from                        */
  952.                             /*   NOTE: Doors should validate this field!     */
  953.     tBYTE to[36];           /* Person message is to (non-Internet)           */
  954.                             /*   For Internet E-mail, the NET_DEST field     */
  955.                             /*   should be used to store the destination     */
  956.                             /*   name/address, leaving this field blank.     */
  957.                             /*   For Usenet newsgroups, this field should be */
  958.                             /*   left blank, as newsgroups don't use a "To:" */
  959.                             /*   field.                                      */
  960.     tBYTE subj[72];         /* Subject/Title of message                      */
  961.     tWORD destzone;         /* Destination address (FidoNet only)            */
  962.                             /*   If the message is not a FidoNet NetMail     */
  963.                             /*   message, this field (and the subsequent     */
  964.                             /*   three fields as well) should be set to      */
  965.                             /*   zero.                                       */
  966.     tWORD destnet;
  967.     tWORD destnode;
  968.     tWORD destpoint;
  969.     tWORD msg_attr;         /* Bit-mapped message attributes                 */
  970.     tWORD netmail_attr;     /* Bit-mapped NetMail attributes (FidoNet only)  */
  971.                             /*   If the message is not a FidoNet NetMail     */
  972.                             /*   message, this field should not be used.     */
  973.     tLONG unix_date;        /* Date/time of message                          */
  974.                             /*   This Unix-style date/time value (number     */
  975.                             /*   of seconds since 01/01/70) is converted to  */
  976.                             /*   the date/time storage method used by the    */
  977.                             /*   host BBS.                                   */
  978.     tDWORD replyto;         /* This unsigned long word stores the message #  */
  979.                             /*   that this message is a reply to.  This      */
  980.                             /*   should be the same as FTI.MSGNUM.  Note,    */
  981.                             /*   however, that FTI.MSGNUM is a word.  C      */
  982.                             /*   programmers especially will need to         */
  983.                             /*   properly typecast the value (i.e.           */
  984.                             /*   upl.replyto=(tDWORD)fti.msgnum).  As        */
  985.                             /*   messaging/BBS systems become more complex,  */
  986.                             /*   FTI.MSGNUM may become obsolete, and a       */
  987.                             /*   tDWORD variable may be used in its place.   */
  988.     tBYTE filename[13];     /* Filename the message text is in               */
  989.                             /*   If this file does not exist in the upload   */
  990.                             /*   packet then doors should consider this an   */
  991.                             /*   invalid record.                             */
  992.     tBYTE echotag[21];      /* Area tag the message goes in                  */
  993.                             /*   This must correspond exactly to the         */
  994.                             /*   INF_AREA_INFO.ECHOTAG field for the message */
  995.                             /*   area this message belongs to.  Simple area  */
  996.                             /*   number matching has proven not to work      */
  997.                             /*   simply because sysops are finicky people,   */
  998.                             /*   and seem to constantly renumber/change the  */
  999.                             /*   message area numbers on the host BBS.       */
  1000.                             /*   Using an echotag helps to alleviate this    */
  1001.                             /*   problem.  C_ECHO will be C_ECHO on the BBS, */
  1002.                             /*   whether it is msg area 17 on the host BBS   */
  1003.                             /*   or whether it is area 207. Doors should do  */
  1004.                             /*   a case-INSENSITIVE compare on this field to */
  1005.                             /*   find where the message belongs.             */
  1006.     tWORD area_flags;       /* The Blue Wave Offline Mail Reader uses this   */
  1007.                             /*   word internally to store the same value as  */
  1008.                             /*   in INF_AREA_INFO.AREA_FLAGS.  The purpose   */
  1009.                             /*   of this word is to hold the original        */
  1010.                             /*   information about the message area so that  */
  1011.                             /*   later message editing processes can be      */
  1012.                             /*   controlled properly.  For example, if a     */
  1013.                             /*   user later wanted to edit this message, the */
  1014.                             /*   reader would know instantly whether this is */
  1015.                             /*   a NETMAIL area, whether PVT messages are    */
  1016.                             /*   allowed, etc.  This allows re-editing of    */
  1017.                             /*   the message, even when there is not a       */
  1018.                             /*   corresponding *.INF file laying around, or  */
  1019.                             /*   the area is not listed in the *.INF file    */
  1020.                             /*   you currently have to work with.  DOOR      */
  1021.                             /*   AUTHORS SHOULD IGNORE THIS FIELD WHEN       */
  1022.                             /*   IMPORTING MESSAGES!                         */
  1023.     tBYTE f_attach[13];     /* If the UPL_HAS_FILE flag is set, this field   */
  1024.                             /*   will contain the file name that is attached */
  1025.                             /*   to the message.                             */
  1026.     tBYTE user_area[6];     /* User-defined storage.  Doors should ignore    */
  1027.                             /*   this field, and reader authors should feel  */
  1028.                             /*   free to utilize this field for their own    */
  1029.                             /*   internal use, if necessary.                 */
  1030.     tBYTE network_type;     /* Indicates the network type.  This field must  */
  1031.                             /*   hold the same value as the NETWORK_TYPE     */
  1032.                             /*   field in INF_AREA_INFO, allowing doors and  */
  1033.                             /*   readers to properly handle the message.     */
  1034.                             /*   (Values duplicated as UPL_NET_xxx, above.)  */
  1035.                             /*   For FidoNet NetMail and Internet E-mail, it */
  1036.                             /*   also indicates which fields should be used  */
  1037.                             /*   for addressing and status information (as   */
  1038.                             /*   indicated in comments above and below).     */
  1039.     tBYTE net_dest[100];    /* Network destination address (non-FidoNet)     */
  1040.                             /*   Internet E-mail messages should use this    */
  1041.                             /*   field to store the destination address.     */
  1042. }
  1043. UPL_REC;
  1044.  
  1045. /*---------------------------------------------------------------------------*/
  1046.  
  1047. /*
  1048. **  Name of file:   *.REQ
  1049. **
  1050. **  Description:    The *.REQ file is simply a list of filenames the user
  1051. **                  wants to request from the host BBS.  Wildcard characters
  1052. **                  ("*" and "?" under MS-DOS) are allowed, but are not
  1053. **                  guaranteed to produce accurate results on all door
  1054. **                  implementations.
  1055. **
  1056. **                  NOTE:   Current Blue Wave doors do not accept wildcard
  1057. **                          characters in filenames, and will consider any
  1058. **                          filenames which contain them as being invalid.
  1059. **                          Additionally, if there are more than 10 entries in
  1060. **                          the *.REQ file, current Blue Wave doors will read
  1061. **                          the first 10 and discard the rest.  These are
  1062. **                          limitations of the Blue Wave doors, not of the
  1063. **                          Blue Wave format itself.
  1064. **
  1065. **  File format:    REQ_REC     { repeated for as many files as }
  1066. **                  REQ_REC     { requested from the host BBS   }
  1067. **                  ...
  1068. */
  1069.  
  1070. typedef struct      /*  REQ_REC  */
  1071. {
  1072.     tBYTE filename[13];     /* Name of file to request */
  1073. }
  1074. REQ_REC;
  1075.  
  1076. /*---------------------------------------------------------------------------*/
  1077.  
  1078. /*
  1079. **  Name of file:   *.PDQ
  1080. **
  1081. **  Description:    The *.PDQ file contains the information used for the
  1082. **                  offline configuration feature of the mail door.  After the
  1083. **                  header is a series of records which indicate the message
  1084. **                  areas to enable for scanning the next time a mail packet
  1085. **                  is requested.
  1086. **
  1087. **                  NOTE:   Readers should generate a *.PDQ file *ONLY* if
  1088. **                          the mail packet format is version 2 or earlier;
  1089. **                          otherwise, a *.OLC file should be generated.
  1090. **                          Doors should process *.PDQ files *ONLY* in cases
  1091. **                          where a *.OLC file is not present.
  1092. **
  1093. **                          If the AREA_CHANGES flag in PDQ_HEADER.FLAGS is
  1094. **                          set, the door should process the offline
  1095. **                          configuration as well as changes to the list of
  1096. **                          areas the user wants to download.  In the Blue
  1097. **                          Wave door, this is done by first turning OFF all
  1098. **                          message areas that were active, then turning ON
  1099. **                          the ones specified in the *.PDQ file.  This seems
  1100. **                          to be the simplest, most straight-forward method
  1101. **                          of accomplishing this task, though other, more
  1102. **                          complex schemes could easily have been devised.
  1103. **
  1104. **  File format:    PDQ_HEADER      { only included one time!
  1105. **                  PDQ_REC         { repeated for as many message areas }
  1106. **                  PDQ_REC         { as the user wishes to enable       }
  1107. **                  ...
  1108. */
  1109.  
  1110. /*  Bit-masks for PDQ_HEADER.FLAGS field  */
  1111.  
  1112. #define PDQ_HOTKEYS         0x0001  /* Toggle "hotkeys" in prompts        */
  1113. #define PDQ_XPERT           0x0002  /* Toggle expert mode (menu displays) */
  1114. #define PDQ_AREA_CHANGES    0x0004  /* Change active message areas        */
  1115. #define PDQ_GRAPHICS        0x0008  /* Toggle IBM 8-bit ASCII characters  */
  1116. #define PDQ_NOT_MY_MAIL     0x0010  /* Toggle bundling mail from user     */
  1117.  
  1118. typedef struct      /*  PDQ_HEADER  */
  1119. {
  1120.     tBYTE keywords[10][21];     /* User's entire set of door keywords  */
  1121.     tBYTE filters[10][21];      /* User's entire set of door filters   */
  1122.     tBYTE macros[3][78];        /* User's door bundling command macros */
  1123.     tBYTE password[21];         /* Password                            */
  1124.     tBYTE passtype;             /* Password type                       */
  1125.                                 /*   0=none 1=door 2=reader 3=both     */
  1126.     tWORD flags;                /* Bit-mapped flags                    */
  1127. }
  1128. PDQ_HEADER;
  1129.  
  1130. typedef struct      /*  PDQ_REC  */
  1131. {
  1132.     tBYTE echotag[21];      /* Echo tag of message area to activate    */
  1133.                             /*   With Telegard systems, this should    */
  1134.                             /*   be the name of the *.BRD file, rather */
  1135.                             /*   than the actual echo tag.             */
  1136. }
  1137. PDQ_REC;
  1138.  
  1139. /*---------------------------------------------------------------------------*/
  1140.  
  1141. /*
  1142. **  Name of file:   *.OLC
  1143. **
  1144. **  Description:    The *.OLC file contains the information used for the
  1145. **                  offline configuration feature of the mail door.
  1146. **
  1147. **                  NOTE:   Readers should generate a *.OLC file *ONLY* if
  1148. **                          the mail packet format is version 3 or later;
  1149. **                          otherwise, a *.PDQ file should be generated.
  1150. **                          Doors should process *.OLC files in all cases
  1151. **                          where one is present.
  1152. **
  1153. **  File format:    ASCII text (lines terminated with CRLF)
  1154. **
  1155. **  Comments:       Refer to the Blue Wave Developer's Kit documentation
  1156. **                  for details on the exact format of the *.OLC file.
  1157. */
  1158.  
  1159. /*---------------------------------------------------------------------------*/
  1160.  
  1161. #endif      /*  __BLUEWAVE_H  */
  1162.  
  1163.