home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FAQSYS18.ZIP / FAQS.DAT / BWSTRUCT.DOC < prev    next >
Text File  |  1996-01-04  |  52KB  |  1,044 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.                        The Blue Wave Offline Mail System
  13.                           Mail Packet File Structures
  14.                                 Revision Level 2
  15.  
  16.                  Copyright 1990-1994 by Cutting Edge Computing
  17.                               All Rights Reserved
  18.  
  19.                            Created by George Hatchew
  20.  
  21.                Documentation by Martin Pollard and George Hatchew
  22.                         Revision 2.01 - January 18, 1994
  23.  
  24.  
  25.  
  26.                               ===================
  27.                                TABLE OF CONTENTS
  28.                               ===================
  29.  
  30.      Introduction ...................................................... 3
  31.      Filename Conventions .............................................. 3
  32.      Files in Blue Wave Packets ........................................ 4
  33.      Byte Ordering in File Structures .................................. 6
  34.      Using the File Structures ......................................... 6
  35.      Unused and Reserved Structure Fields .............................. 7
  36.      The *.INF File (INF_HEADER & INF_AREA_INFO) ....................... 8
  37.      The *.MIX File (MIX_REC) .......................................... 10
  38.      The *.FTI File (FTI_REC) .......................................... 11
  39.      The *.DAT File .................................................... 12
  40.      The *.XTI File (XTI_REC) .......................................... 12
  41.      The *.UPL File (UPL_HEADER & UPL_REC) ............................. 12
  42.      The *.UPI (UPI_REC) and *.NET (NET_REC) Files ..................... 14
  43.      The *.REQ File (REQ_REC) .......................................... 14
  44.      The *.PDQ File (PDQ_HEADER & PDQ_REC) ............................. 14
  45.      Appendix A - How to Create a Blue Wave Mail Packet ................ 15
  46.      Appendix B - How to Create a Blue Wave Reply Packet ............... 16
  47.      Appendix C - The Blue Wave Structures and Turbo Pascal ............ 16
  48.      Appendix D - Serial Numbers in Mail and Reply Packets ............. 18
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.                           ============================
  58.                            COPYRIGHT AND RESTRICTIONS
  59.                           ============================
  60.  
  61.      The  Blue Wave packet structures were created by George  Hatchew,  and
  62.      are the copyrighted property of Cutting Edge Computing.  Permission is
  63.      granted  for third parties to use these structures in their  own  pro-
  64.      grams,  without  any  royalties or licenses  required.   Cutting  Edge
  65.      Computing reserves the right to make any changes to these  structures,
  66.      at  any  time.  As such, third parties are requested not to  make  any
  67.      unauthorized changes to these structures, as Cutting Edge Computing is
  68.      not  bound  to follow these changes.  Any proposed changes  should  be
  69.      brought to the attention of Cutting Edge Computing, where they may  be
  70.      included in future revisions of the structures.
  71.  
  72.      Authors  that  use these structures are allowed to  claim  that  their
  73.      programs are "Blue Wave compatible".  However, to avoid confusion  and
  74.      complications, authors are NOT allowed to use "Blue Wave" as any  part
  75.      of the name of their programs (as "Blue Wave" is a product line  from,
  76.      as well as a trademark of, Cutting Edge Computing).
  77.  
  78.  
  79.  
  80.                               ===================
  81.                                TRADEMARK NOTICES
  82.                               ===================
  83.  
  84.      The  following are products, trademarks, or registered  trademarks  of
  85.      the following individuals and/or companies:
  86.  
  87.           ARC - System Enhancement Associates
  88.           Blue Wave - George Hatchew and Cutting Edge Computing
  89.           FidoNet - Tom Jennings and Fido Software
  90.           MegaReader - Kip Compton
  91.           MS-DOS - Microsoft Corp.
  92.           PKZIP - PKWARE Inc.
  93.           QWK - Mark "Sparky" Herring
  94.           Silver Xpress - Hector Santos and Santronics Software
  95.           Turbo Pascal, Borland Pascal - Borland International
  96.           XRS - Michael Y. Ratledge
  97.  
  98.      Any omissions from this list are purely unintentional.
  99.             Blue Wave Mail Packet File Structures - Revision Level 2
  100.  
  101.  
  102.      INTRODUCTION
  103.      ============
  104.  
  105.      The world of offline mail has virtually exploded since the late 1980s,
  106.      due mostly to the ever-increasing interest in electronic mail networks
  107.      (such  as FidoNet and the Internet).  As the flow of  mail  increased,
  108.      more and more users became aware of the benefits of downloading  mail,
  109.      reading it offline, and uploading replies at a later date, thus  maxi-
  110.      mizing efficiency and minimizing the time spent online.
  111.  
  112.      Several  competing formats for storage of offline mail have come  into
  113.      existence during this period, with the minimalist QWK format  emerging
  114.      as the dominant one due to its open specifications.  (The  MegaReader,
  115.      Silver Xpress, and XRS, formats also exist, but never really  achieved
  116.      "critical mass" due to the proprietary nature of their file  formats.)
  117.      QWK  enjoys widespread popularity, but its technical limitations  make
  118.      it less than suitable for handling the wide variety of electronic mail
  119.      that currently exists (and which will appear in the coming years).
  120.  
  121.      The  Blue Wave format was designed as a superior method  of  providing
  122.      offline  mail  capabilities, particularly for networks  based  on  the
  123.      FidoNet  standard (which means full support for FidoNet-style  private
  124.      mail,  or  NetMail).  Its design is simple enough that  virtually  any
  125.      programmer can create a Blue Wave-compatible product in a short amount
  126.      of  time,  yet flexible enough to provide plenty of  room  for  future
  127.      needs (such as FAX capabilities).  It also has basic support for  non-
  128.      FidoNet  style  mail, such as that required by Internet  mail,  Usenet
  129.      newsgroups, and QWK-based network mail.
  130.  
  131.      NOTE THAT THIS IS A REFERENCE DOCUMENT, NOT A PROGRAMMING TUTORIAL.  A
  132.      tutorial  on programming is beyond the scope of this document.   Thus,
  133.      we do not recommend the use of these structures by the novice.
  134.  
  135.  
  136.      FILENAME CONVENTIONS
  137.      ====================
  138.  
  139.      The Blue Wave format was originally designed for the Blue Wave  series
  140.      of  offline mail readers and doors running on an  Intel-compatible  PC
  141.      using MS-DOS (or a DOS-compatible operating system).  This means  that
  142.      filenames  are limited to the DOS standard "8.3" format (up  to  eight
  143.      characters, optionally followed by a period and a one to three charac-
  144.      ter  extension, with no distinction made between upper and lower  case
  145.      letters).   For  maximum  compatibility  across  different  platforms,
  146.      programs utilizing the Blue Wave format should limit filenames to  the
  147.      DOS format as well.
  148.  
  149.      Additionally,  DOS allows for some non-alphanumeric characters  to  be
  150.      used  in  filenames.  These characters, while suitable  for  DOS,  may
  151.      cause  problems on non-DOS platforms.  Therefore, it would be wise  to
  152.      restrict  the allowable characters in filenames to  uppercase  letters
  153.      ("A" to "Z") and digits ("0" to "9").
  154.  
  155.  
  156.  
  157.                                    - Page 3 -
  158.             Blue Wave Mail Packet File Structures - Revision Level 2
  159.  
  160.  
  161.      FILES IN BLUE WAVE PACKETS
  162.      ==========================
  163.  
  164.      There  are two main components to the Blue Wave system: mail  packets,
  165.      which  consist  of messages obtained from the host system (such  as  a
  166.      BBS), and reply packets, which consist of messages written by the user
  167.      via  an offline mail reader (such as the reader that bears  its  name,
  168.      the Blue Wave Offline Mail Reader).  Each type of packet contains  its
  169.      own set of unique files.
  170.  
  171.      Blue  Wave  mail and reply packet filenames are based around  what  is
  172.      called  a  "packet  ID".  The packet ID is a one  to  eight  character
  173.      string that uniquely identifies a particular host system, and is  used
  174.      as  the basis for all packet files.  "Packets", as defined  here,  are
  175.      groups of files contained in an archive file, which uses the packet ID
  176.      as the base filename and is created using a file archive utility (such
  177.      as ARC or PKZIP, or the equivalent for non-DOS platforms).  The three-
  178.      character  extension for a mail packet is comprised of the  first  two
  179.      letters  of  the  day of the week, followed by a digit from  0  to  9.
  180.      FidoNet  SysOps  will recognize this as the same scheme used  for  the
  181.      extensions on EchoMail packets.  (An alternate scheme is to use a pure
  182.      numerical  extension, i.e. "001" through "999".)  The extension for  a
  183.      reply packet is "NEW".  (Note that door implementations should include
  184.      code  to  keep track of the last mail packet extension used,  so  that
  185.      multiple  mail  packets created on the same day won't  have  the  same
  186.      filename.)   Examples of packet archive names and internal  filenames,
  187.      based around the packet ID, are given below (after the list of files).
  188.  
  189.      A mail packet consists of, at minimum, the following files:
  190.  
  191.           *.INF          Information about the host system and its  message
  192.                          areas,  as well as information about the user  who
  193.                          obtained the mail packet.
  194.  
  195.           *.FTI          The  headers for each message in the mail  packet.
  196.                          The  headers consist of such things as the  From:,
  197.                          To:,  and Subject: fields, and the  date/time  the
  198.                          message was written.
  199.  
  200.           *.MIX          An index file that points to the messages for each
  201.                          message area, designed for quick access to messag-
  202.                          es.
  203.  
  204.           *.DAT          The text for all messages in the mail packet.
  205.  
  206.      Optional  text/ANSI  files may also be included in  the  archive.   In
  207.      addition  to the "reader" files specified in the *.INF  header,  there
  208.      are  two other types of files, not defined in the *.INF  header,  that
  209.      may  be included.  The first, a list of new files available for  down-
  210.      load,  can be included as "NEWFILES.*" (any extension is valid).   The
  211.      second, system bulletins, can be included as "BLT*.*" (any filename is
  212.      valid, as long as it begins with "BLT").  The methods used to  display
  213.      these bulletins is implementation dependent.
  214.  
  215.  
  216.                                    - Page 4 -
  217.             Blue Wave Mail Packet File Structures - Revision Level 2
  218.  
  219.  
  220.      A reply packet consists of, at minimum, the following files:
  221.  
  222.           *.UPL          Contains  the information (name, network  address,
  223.                          message  attributes,  filename  of  message  text,
  224.                          etc.) for each reply message.  Replaces the  *.UPI
  225.                          and  *.NET  files (see below) used in  older  Blue
  226.                          Wave implementations.
  227.  
  228.           *.UPI          Contains  the information (name, network  address,
  229.                          message  attributes,  filename  of  message  text,
  230.                          etc.)  for each non-NetMail reply  message.   This
  231.                          file has been obsoleted by the *.UPL file, but  is
  232.                          documented  here  for compatibility  purposes  (as
  233.                          some older systems are not yet compatible with the
  234.                          *.UPL file).
  235.  
  236.           *.NET          Contains  the information (name, network  address,
  237.                          message  attributes,  filename  of  message  text,
  238.                          etc.)  for each NetMail reply message.  This  file
  239.                          has  been  obsoleted  by the *.UPL  file,  but  is
  240.                          documented  here  for compatibility  purposes  (as
  241.                          some older systems are not yet compatible with the
  242.                          *.UPL file).
  243.  
  244.           *.REQ          An optional file that specifies the information on
  245.                          file requests made through the offline mail  read-
  246.                          er.
  247.  
  248.           *.PDQ          An optional file that specifies the information on
  249.                          remote configuration (such as adding and  dropping
  250.                          message  areas)  made  through  the  offline  mail
  251.                          reader.
  252.  
  253.      To  clarify, let's say a BBS is using the packet ID of "WILDBLUE".   A
  254.      mail  packet from that BBS would contain (at minimum) the files  WILD-
  255.      BLUE.INF,  WILDBLUE.FTI,  WILDBLUE.MIX,  and  WILDBLUE.DAT,  and  when
  256.      archived,  would be called "WILDBLUE.SU1" (the extension  may  differ,
  257.      depending  on  the criteria described above).  Consequently,  a  reply
  258.      packet  destined  for that BBS would contain (at  minimum)  the  files
  259.      WILDBLUE.UPL, WILDBLUE.NET and WILDBLUE.UPI (for compatibility),  plus
  260.      the individual files that comprise reply messages, and when  archived,
  261.      would be called "WILDBLUE.NEW".
  262.  
  263.      The  text of each reply message is stored in individual files  in  the
  264.      reply  packet.  Each *.UPL record contains the name of the  text  file
  265.      corresponding to the particular reply message.  The naming  convention
  266.      used to assign names to each text file is up to the programmer.   (The
  267.      Blue  Wave reader uses "xxx.yyy", which stands for "message  'xxx'  in
  268.      area  'yyy',  but you are not limited to this format as  long  as  the
  269.      filename is properly stored in the *.UPL, *.UPI, or *.NET record.)
  270.  
  271.  
  272.  
  273.  
  274.  
  275.                                    - Page 5 -
  276.             Blue Wave Mail Packet File Structures - Revision Level 2
  277.  
  278.  
  279.      BYTE ORDERING IN FILE STRUCTURES
  280.      ================================
  281.  
  282.      Since  the Blue Wave packet structures were initially written for  IBM
  283.      PCs  and compatible systems, the format for multi-byte fields  in  the
  284.      data  structures  is expected to be in Intel format  (i.e.  the  least
  285.      significant  byte  first, followed by the most  significant  byte[s]).
  286.      Some  CPUs, particularly the Motorola 68000 series,  store  multi-byte
  287.      fields as most significant byte first.  If you are writing a Blue Wave
  288.      compatible program for a system that does not store data in the  Intel
  289.      format,  you will have to write a routine that will convert data  bet-
  290.      ween the two formats.
  291.  
  292.  
  293.      USING THE FILE STRUCTURES
  294.      =========================
  295.  
  296.      The file structures, as presented here, are provided as a header  file
  297.      for  use  with the C programming language.  Simply  use  the  #include
  298.      statement in your program source code to incorporate the header file:
  299.  
  300.           #include "bluewave.h"
  301.  
  302.      Each  file structure is defined as a data structure  ("struct")  using
  303.      the "typedef" feature, making it easy to define variables.  For  exam-
  304.      ple, to define a variable used to store the *.INF file header,  simply
  305.      use:
  306.  
  307.           INF_HEADER infhdr;
  308.  
  309.      in your program.
  310.  
  311.      To make the structures as compatible across platforms as possible, all
  312.      data types used in the structures are user-defined via "typedef".  For
  313.      example,  to use a 16-bit unsigned integer, the data type  "tWORD"  is
  314.      used instead of "unsigned int".  This way, data fields are  guaranteed
  315.      to be the same size across platforms.  (For more information, refer to
  316.      the information contained in the BLUEWAVE.H file.)
  317.  
  318.      Also,  if your program is being written for a CPU that does not  store
  319.      data in Intel format (as described earlier), you should insert:
  320.  
  321.           #define BIG_ENDIAN
  322.  
  323.      before  you  include the BLUEWAVE.H file.  This will define  the  data
  324.      types  as  arrays of bytes, making it easier to create  routines  that
  325.      will convert data fields between Intel format and the format native to
  326.      your  CPU.   (Refer  to "Byte Ordering in File  Structures"  for  more
  327.      information.)
  328.  
  329.      Several  of  the  file structures -- the *.INF and  *.UPL  headers  --
  330.      include  fields that define the lengths of the other  file  structures
  331.      used in mail and reply packet files.  These fields are used to  ensure
  332.  
  333.  
  334.                                    - Page 6 -
  335.             Blue Wave Mail Packet File Structures - Revision Level 2
  336.  
  337.  
  338.      that  programs can use future releases of the file structures  without
  339.      breaking... as long as programs are coded to use them, that is.
  340.  
  341.      Door  authors should take the few extra lines of code to fill  in  the
  342.      structure length fields.  Reader authors need to take the time to code
  343.      for  possible extensions to this file format.  If the data fields  are
  344.      LONGER than expected, simply do a seek to move to the next record, and
  345.      ignore  the extra information.  (If the data fields are  SHORTER  than
  346.      expected,  a  simple  "please upgrade  your  reader"  should  suffice.
  347.      However,  you  should never encounter a record size smaller  than  the
  348.      ones defined here.)  Any extra information that is sent in the packets
  349.      probably  would not be crucial, and you may be able to  continue  with
  350.      reading the packet anyway.
  351.  
  352.      (It should be noted that all Blue Wave doors earlier than the  version
  353.      3.0 series set these fields to 0, as this extensibility was not  added
  354.      until  recently.  If the structure sizes are 0, readers should  assume
  355.      that  all records are of the sizes defined in the header file  as  the
  356.      "ORIGINAL_XXXX_LEN"  macros,  and should use these macros  when  field
  357.      lengths of 0 are encountered.  There is no definition for the original
  358.      length  of the *.UPL structures, as the older doors did not  recognize
  359.      the *.UPL file.)
  360.  
  361.      To  see an example of how to use these structure length fields,  refer
  362.      to the comments in the BLUEWAVE.H file.  There, you will see a C  code
  363.      snippet  that  not  only  demonstrates  the  length  fields,  but  the
  364.      ORIGINAL_XXXX_LEN macros as well.
  365.  
  366.      IMPORTANT  NOTE:   All  Blue Wave file structures must  be  stored  in
  367.      "packed"  format  (i.e. the compiler must not insert  padding  between
  368.      fields in order to force fields onto word boundaries).  Most compilers
  369.      default  to  "packed" mode, but if yours does not, you  must  use  the
  370.      appropriate settings or preprocessor directives to set "packed"  mode.
  371.      Failure to do so will all but guarantee that your program will  gener-
  372.      ate incompatible Blue Wave packets!
  373.  
  374.  
  375.      UNUSED AND RESERVED STRUCTURE FIELDS
  376.      ====================================
  377.  
  378.      Some  fields  and  flags in the Blue Wave structures  are  either  not
  379.      defined, or are marked as being reserved for future use.  THESE  AREAS
  380.      ARE  NOT TO BE USED BY PROGRAMMERS, unless otherwise indicated.   They
  381.      are  reserved  for future expansion and enhancement of the  Blue  Wave
  382.      packet structures, and if you use them for your own purposes, you  run
  383.      the  risk of making your program incompatible with future  updates  of
  384.      the file structures.
  385.  
  386.      Furthermore,  future structure updates will assume that  these  unused
  387.      areas  are  "garbage-free" (i.e. they are filled with 0  values).   In
  388.      order  to cover all bases, then, all unused areas should be set to  0.
  389.      This  can be easily done with the standard C function  memset().   For
  390.      example, using:
  391.  
  392.  
  393.                                    - Page 7 -
  394.             Blue Wave Mail Packet File Structures - Revision Level 2
  395.  
  396.  
  397.           memset(&infhdr, 0, sizeof(INF_HEADER));
  398.  
  399.      before you begin adding information to the *.INF header structure will
  400.      ensure  that  all  unused fields are set to 0.  This  should  be  done
  401.      before adding information to *ANY* Blue Wave file structure.
  402.  
  403.  
  404.      THE *.INF FILE (INF_HEADER & INF_AREA_INFO)
  405.      ===========================================
  406.  
  407.      The  *.INF  file  consists of two "parts": a  header,  which  contains
  408.      information  about the host system and the user to whom the packet  is
  409.      intended, and a series of records that contain the information on  all
  410.      message bases available on the host system.  (The latter is used in  a
  411.      reader  both  for  posting replies and  offline  configuration.)   The
  412.      header  structure is known as INF_HEADER, and the record structure  is
  413.      known as INF_AREA_INFO.
  414.  
  415.      Most of the fields in INF_HEADER are self-explanatory.  The  following
  416.      fields, however, deserve extra attention:
  417.  
  418.           ver                 Packet  version  level.  This  is  a  crucial
  419.                               field,  as  it allows doors  and  readers  to
  420.                               determine  the  revision level  of  the  file
  421.                               structures  used to create the packet.   Pro-
  422.                               grams should check this field to insure  that
  423.                               they  can properly handle the  packet;  doors
  424.                               should store in this field the current packet
  425.                               revision  level,  shown at the  top  of  this
  426.                               document.
  427.  
  428.           readerfiles         Files  that can be displayed by  the  reader.
  429.                               These are usually bulletins, sign-on banners,
  430.                               etc.  Up to five files can be specified.
  431.  
  432.           keywords            Specifies  the keywords used  while  bundling
  433.                               messages.  Door authors that wish to  provide
  434.                               keyword support should refer to the Blue Wave
  435.                               user documentation for more information.
  436.  
  437.           filters             Same as above, but specifies the filters used
  438.                               while bundling messages.
  439.  
  440.           macros              Same as above, but specifies the macros  used
  441.                               in  the  door  to  specify  message  bundling
  442.                               operations.
  443.  
  444.           can_forward         Indicates that the user can forward  messages
  445.                               to other message areas from within a reader.
  446.  
  447.           inf_header_len      Length  of  INF_HEADER used in  mail  packet.
  448.                               Door authors are required to fill this field;
  449.                               reader  authors  should  use  this  field  to
  450.  
  451.  
  452.                                    - Page 8 -
  453.             Blue Wave Mail Packet File Structures - Revision Level 2
  454.  
  455.  
  456.                               properly  parse the *.INF file.  The  current
  457.                               crop  of Blue Wave doors properly  fill  this
  458.                               field, but older versions may not.  Refer  to
  459.                               the header file for more information on using
  460.                               this field.
  461.  
  462.           inf_areainfo_len    Same  as above, but specifies the  length  of
  463.                               the INF_AREA_INFO structure.
  464.  
  465.           mix_structlen       Same  as above, but specifies the  length  of
  466.                               the *.MIX file structure (MIX_REC).
  467.  
  468.           fti_structlen       Same  as above, but specifies the  length  of
  469.                               the *.FTI file structure (FTI_REC).
  470.  
  471.           uses_upl_file       A non-zero value in this field indicates that
  472.                               the  door  which create the mail  packet  can
  473.                               process  reply  packets stored in  the  *.UPL
  474.                               format.   If zero, the door can  only  handle
  475.                               reply  packets stored in the older *.UPI  and
  476.                               *.NET formats.  (These formats are  discussed
  477.                               later.)
  478.  
  479.           packet_id           The packet ID used by the host system,  which
  480.                               can  be  used by readers to  properly  access
  481.                               mail  packet control files even if  the  mail
  482.                               packet  itself  has been renamed.   (If  this
  483.                               field  is not filled, readers  should  assume
  484.                               that the root name of the mail packet is  the
  485.                               packet ID.)
  486.  
  487.      The INF_AREA_INFO structure fields are defined as follows:
  488.  
  489.           areanum             The area number on the host system for  which
  490.                               the  record  defines, specified as  an  ASCII
  491.                               string.   This field will correspond  to  the
  492.                               similar  field in the *.MIX  structure  (dis-
  493.                               cussed  later).   This does  not  necessarily
  494.                               have  to be a number, so  A  CASE-INSENSITIVE
  495.                               MATCH  SHOULD  BE PERFORMED  WHEN  DOING  ANY
  496.                               COMPARISONS USING THIS FIELD.
  497.  
  498.           echotag             The  area tag name for which the  record  de-
  499.                               fines.   This  field  is used  in  the  reply
  500.                               packet to link reply messages to the destina-
  501.                               tion  areas on the host system, and  must  be
  502.                               unique  (i.e.  there cannot be  two  or  more
  503.                               identical area tags).
  504.  
  505.           title               The message area description.
  506.  
  507.           area_flags          Specifies  the unique characteristics of  the
  508.                               message  area for which the  record  defines.
  509.  
  510.  
  511.                                    - Page 9 -
  512.             Blue Wave Mail Packet File Structures - Revision Level 2
  513.  
  514.  
  515.                               Most  of the flags are  self-explanatory,  as
  516.                               specified  in  the header file;  the  network
  517.                               area  flags, however, need to  be  clarified.
  518.                               If  the  message area is part  of  a  network
  519.                               (i.e.  FidoNet), the INF_ECHO flag should  be
  520.                               set;  this  will allow a reader  to  properly
  521.                               handle  network  mail.  If the  area  is  for
  522.                               private  network mail, the  INF_NETMAIL  flag
  523.                               should also be set.
  524.  
  525.           network_type        Specifies  the  network type  for  which  the
  526.                               defined message area belongs.  Note that  the
  527.                               network  type  is specified as  a  full  byte
  528.                               value,  NOT as a bit flag.  (If the  INF_ECHO
  529.                               flag  is  not set, the network  type  can  be
  530.                               ignored, obviously.)
  531.  
  532.  
  533.      THE *.MIX FILE (MIX_REC)
  534.      ========================
  535.  
  536.      Each  record in the *.MIX file points to the beginning of the area  in
  537.      the *.FTI file that contains the header information for messages  that
  538.      were obtained from each message area.  Note that *ONLY* the areas  for
  539.      which messages were extracted will have a corresponding *.MIX  record.
  540.  
  541.      Each structure field is defined as follows:
  542.  
  543.           areanum             Corresponds  to  the identical field  in  the
  544.                               *.INF record for the particular message area.
  545.                               It  is used by the reader to  coordinate  the
  546.                               information  between  the  *.INF  and   *.MIX
  547.                               records.  Again, CASE-INSENSITIVE COMPARISONS
  548.                               SHOULD BE PERFORMED WHEN USING THIS FIELD, as
  549.                               this field does not have to contain a numeri-
  550.                               cal value.
  551.  
  552.           totmsgs             Total number of messages in this area.  Up to
  553.                               65,535  messages  per area are  allowed  (the
  554.                               limit of an unsigned 16-bit integer).
  555.  
  556.           numpers             Total  number of messages in this  area  that
  557.                               are  directed  specifically to the  user  who
  558.                               bundled  the  mail  packet.   This  value  is
  559.                               usually  obtained during message bundling  by
  560.                               comparing the name in the "To:" field to  the
  561.                               user name for every message, and incrementing
  562.                               a counter if they match.  (Reader authors can
  563.                               feel free to disregard this value and perform
  564.                               their own search for personal messages,  once
  565.                               the packet is loaded into the program.)
  566.  
  567.  
  568.  
  569.  
  570.                                    - Page 10 -
  571.             Blue Wave Mail Packet File Structures - Revision Level 2
  572.  
  573.  
  574.           msghptr             Pointer to the first record in the *.FTI file
  575.                               that corresponds to this message area.   Note
  576.                               that this specifies the byte offset into  the
  577.                               *.FTI  file, *NOT* the record  number;  thus,
  578.                               programmers  can  use the seek()  or  lseek()
  579.                               functions  to  quickly point  to  the  proper
  580.                               section of the *.FTI file.
  581.  
  582.  
  583.      THE *.FTI FILE (FTI_REC)
  584.      ========================
  585.  
  586.      The *.FTI record specifies the header information for messages in  the
  587.      mail  packet, along with additional information such as the length  of
  588.      the  message and the pointer to the message stored in the *.DAT  file.
  589.      These records are stored sequentially in the *.FTI file, with all  the
  590.      headers  for  the  first message area stored first,  followed  by  the
  591.      headers for the second message area, and so forth.
  592.  
  593.      Most  of  the fields are self-explanatory, with the  following  fields
  594.      described in more detail:
  595.  
  596.           msgnum              The  message  number AS STORED  ON  THE  HOST
  597.                               SYSTEM.  This provides an "absolute"  message
  598.                               number for use with message threading.
  599.  
  600.           replyto             Indicates  the  absolute message  number  for
  601.                               which this message is a reply (the "previous"
  602.                               message).   If  zero, there  is  no  previous
  603.                               message.
  604.  
  605.           replyat             Indicates  the absolute message number  of  a
  606.                               reply  to this message (the "next"  message).
  607.                               If zero, there is no next message.
  608.  
  609.           msgptr              Pointer  to the start of the message text  in
  610.                               the *.DAT file.  This is a byte offset,  thus
  611.                               a  programmer can use the seek()  or  lseek()
  612.                               functions  to  quickly point  to  the  proper
  613.                               position in the *.DAT file.
  614.  
  615.           msglength           Length of the message text (in bytes) plus 1.
  616.                               The  addition of 1 is done to compensate  for
  617.                               the required space character in front of  the
  618.                               message text (described below).
  619.  
  620.           flags               Bit-mapped  message status flags.  Note  that
  621.                               for FidoNet network messages, these flags are
  622.                               *NOT*  stored  in  the exact  same  order  as
  623.                               specified in the FidoNet technical standards,
  624.                               even though they are identical in function.
  625.  
  626.  
  627.  
  628.  
  629.                                    - Page 11 -
  630.             Blue Wave Mail Packet File Structures - Revision Level 2
  631.  
  632.  
  633.      THE *.DAT FILE
  634.      ==============
  635.  
  636.      The  *.DAT  file contains the text of all messages obtained  from  the
  637.      host system.  Valid messages begin with an ASCII space character (" ",
  638.      decimal  32,  hexadecimal 20), followed by the  message  text  itself.
  639.      Note that the space character is *NOT* to be considered a part of  the
  640.      message  text; it is simply a marker used to indicate the start  of  a
  641.      valid block of text, and *MUST* be present for each message  specified
  642.      in  the  *.FTI file (even if there is no message text  at  all).   The
  643.      messages in the *.DAT file should be in the same order as specified in
  644.      the *.FTI file, though this is not a requirement (due to the fact that
  645.      the *.DAT file is unstructured).
  646.  
  647.  
  648.      THE *.XTI FILE (XTI_REC)
  649.      ========================
  650.  
  651.      Each  record  in the *.XTI file corresponds to a record in  the  *.FTI
  652.      file, and specifies extended status information for each message  (the
  653.      "save",  "reply",  "print", and "delete" flags used by the  Blue  Wave
  654.      reader).  Note that this file is *NOT* created by any Blue Wave  door;
  655.      it  is  created on-the-fly by the Blue Wave reader.  (The  fields  and
  656.      flags  used  in XTI_REC are self-explanatory, thus they  will  not  be
  657.      explained here.)
  658.  
  659.      NOTE:     The  *.XTI  file is not an official part of  the  Blue  Wave
  660.                specification.  It is documented here solely for the benefit
  661.                of  third-party authors who might wish to create  a  similar
  662.                file for their own applications.  If so, authors should  NOT
  663.                use  the "XTI" extension on their own files if  they  differ
  664.                from  the XTI_REC format, as this extension is used  on  the
  665.                file  created  by the Blue Wave offline mail  reader  (which
  666.                expects  the file to use the XTI_REC format).  On the  other
  667.                hand,  authors  CAN use the "XTI" extension AS LONG  AS  THE
  668.                XTI_REC FORMAT IS USED.
  669.  
  670.  
  671.      THE *.UPL FILE (UPL_HEADER & UPL_REC)
  672.      =====================================
  673.  
  674.      The  *.UPL  file  consists of two "parts": a  header,  which  contains
  675.      information  about the reader used to create the reply packet,  and  a
  676.      series  of records that contain the information on all  messages  con-
  677.      tained in the reply packet.
  678.  
  679.      Most  of the fields in the *.UPL file are self-explanatory.  The  fol-
  680.      lowing, however, deserve extra attention, starting with UPL_HEADER:
  681.  
  682.           upl_header_len      Length  of  UPL_HEADER  used  in  the   reply
  683.                               packet.  Reader authors are required to  fill
  684.                               this  field;  door authors  should  use  this
  685.                               field  to  properly  parse  the  *.UPL  file.
  686.  
  687.  
  688.                                    - Page 12 -
  689.             Blue Wave Mail Packet File Structures - Revision Level 2
  690.  
  691.  
  692.                               Refer   to   the  header  file   (under   the
  693.                               INF_HEADER  section) for more information  on
  694.                               using this field.
  695.  
  696.           upl_rec_len         Same  as above, but specifies the  length  of
  697.                               the UPL_REC structure.
  698.  
  699.           reader_tear         Contains  the abbreviated name of the  reader
  700.                               that  created  the reply packet  (i.e.  "Blue
  701.                               Wave",  "Q-Blue", "Wave Rider", etc.).   This
  702.                               text  can be used by the door to append  tear
  703.                               lines  and other reader-identifying lines  to
  704.                               the message text, if desired.  (Door  authors
  705.                               should  take steps to use alternate  text  in
  706.                               case this field is not filled; using the name
  707.                               of the door is usually a good alternative.)
  708.  
  709.      Likewise,  here is additional detail on several fields in the  UPL_REC
  710.      structure:
  711.  
  712.           unix_date           The  date/time  that the  reply  message  was
  713.                               written,  specified as the number of  seconds
  714.                               since  01/01/1970 (i.e. "Unix-style").   This
  715.                               value can easily be obtained by C programmers
  716.                               via  the  time() function; in  addition,  the
  717.                               ANSI  C standard library contains  additional
  718.                               functions  to  manipulate a  Unix-style  time
  719.                               field,  enough to satisfy most  any  require-
  720.                               ment  (provided  your  compiler  has  support
  721.                               for them, though any compiler that claims  to
  722.                               be  ANSI C compliant will contain  all  those
  723.                               functions and more).
  724.  
  725.           filename            The  name of the file that contains the  text
  726.                               of  the message.  There is no requirement  on
  727.                               how  this file is to be named;  such  schemes
  728.                               are  left to the individual.  (The Blue  Wave
  729.                               reader  uses  "xxx.yyy", where "xxx"  is  the
  730.                               area  number  -- derived from  the  "areanum"
  731.                               field  in  INF_AREA_INFO -- and  "yyy"  is  a
  732.                               unique  number for each message  that  corre-
  733.                               sponds to that area.  Note that this is  only
  734.                               provided as an example; you are not  required
  735.                               to use this scheme, so long as the  filenames
  736.                               are properly specified.)
  737.  
  738.           area_flags          This  field  is used internally by  the  Blue
  739.                               Wave  reader; as such, it *MUST NOT* be  used
  740.                               by any other application.
  741.  
  742.           net_dest            Used to specify the destination address, as a
  743.                               text  string, on messages destined  for  non-
  744.                               FidoNet  networks.   (FidoNet  addresses  are
  745.  
  746.  
  747.                                    - Page 13 -
  748.             Blue Wave Mail Packet File Structures - Revision Level 2
  749.  
  750.  
  751.                               specified   by  the  "destzone",   "destnet",
  752.                               "destnode",   and   "destpoint"   fields   in
  753.                               UPL_REC.)   The  format of  the  address  is,
  754.                               naturally, dependent on the network in  ques-
  755.                               tion.  If the message is for a  non-networked
  756.                               message area, this field is ignored.
  757.  
  758.  
  759.      THE *.UPI (UPI_REC) AND *.NET (NET_REC) FILES
  760.      =============================================
  761.  
  762.      The *.UPI and *.NET files are similar to the *.UPL file, in that  they
  763.      specify  the information for all messages in the reply  packet  (*.UPI
  764.      for  non-NetMail  messages,  *.NET for NetMail  messages  only).   The
  765.      fields in these files are similar in form and function to those in the
  766.      *.UPL file, thus they will not be elaborated upon here.
  767.  
  768.      *.UPI  and *.NET were used in older versions of the Blue Wave  reader,
  769.      and  have  effectively  been replaced by  the  more  informative  (and
  770.      flexible)  *.UPL  file.  However, some older Blue  Wave  doors  cannot
  771.      handle  the  new *.UPL file; for this reason, authors  should  provide
  772.      support for *.UPI and *.NET, as well as *.UPL.  Readers should  create
  773.      all  three files, and doors should include code to process  all  three
  774.      (giving  preferential  treatment to *.UPL,  of  course).   Eventually,
  775.      *.UPI and *.NET will be phased out altogether.
  776.  
  777.  
  778.      THE *.REQ FILE (REQ_REC)
  779.      ========================
  780.  
  781.      The  *.REQ  file  is simply a list of files that the  user  wishes  to
  782.      obtain (download) from the host system.  The implementation of such  a
  783.      feature is left to the individual programmer.
  784.  
  785.      NOTE:     Current  Blue  Wave doors do not allow  wildcard  characters
  786.                ("*" and "?") in filenames, nor do they provide support  for
  787.                requesting more than 10 files.  These are limitations of the
  788.                Blue  Wave  doors themselves, *NOT* of the  Blue  Wave  file
  789.                specifications.   This  information is provided  merely  for
  790.                informational  purposes;  authors should not feel  bound  by
  791.                these restrictions in their own programs.
  792.  
  793.  
  794.      THE *.PDQ FILE (PDQ_HEADER & PDQ_REC)
  795.      =====================================
  796.  
  797.      The  *.PDQ file is used to perform offline configuration of  the  door
  798.      via  the  reader.  This file consists of two parts:  a  header,  which
  799.      contains  non-message area configuration information, and a series  of
  800.      records that indicate the message areas to enable for scanning.
  801.  
  802.      The fields in both PDQ_HEADER and PDQ_REC are mostly self-explanatory,
  803.      though  the process of selecting message areas needs elaboration.   If
  804.  
  805.  
  806.                                    - Page 14 -
  807.             Blue Wave Mail Packet File Structures - Revision Level 2
  808.  
  809.  
  810.      the PDQ_AREA_CHANGES flag is set (in the "flags" field of PDQ_HEADER),
  811.      the  door  should enable all the message areas (specified  in  PDQ_REC
  812.      records) that follow the header.  This is most easily accomplished  by
  813.      first turning OFF all message areas that were active, then turning  ON
  814.      each  area  indicated by the PDQ_REC records (provided  the  user  has
  815.      access  to  them on the host system, of course).  This is  the  method
  816.      used  by  the Blue Wave doors, as it seems to be the  easiest  way  to
  817.      accomplish the task.
  818.  
  819.      NOTE:     This method of performing offline configuration WILL  change
  820.                in a subsequent revision of the Blue Wave specifications, so
  821.                be ready for it!
  822.  
  823.  
  824.      APPENDIX A - HOW TO CREATE A BLUE WAVE MAIL PACKET
  825.      ==================================================
  826.  
  827.      The following steps outline the basic method for creating a Blue  Wave
  828.      mail  packet.   Note  that this outline  is  HIGHLY  generalized;  the
  829.      details  of such a process are left to the programmer to implement  as
  830.      desired.
  831.  
  832.      1.   Open  the  *.INF, *.MIX, *.FTI, and *.DAT files for  writing;  if
  833.           they currently exist, they should be truncated and overwritten.
  834.  
  835.      2.   Fill the INF_HEADER structure and write it to the *.INF file.
  836.  
  837.      3.   Obtain  the  information  for the first message  area,  fill  the
  838.           INF_AREA_INFO structure, and writing it to the *.INF file.
  839.  
  840.      4.   Repeat step 3 for all remaining message areas.
  841.  
  842.      5.   Scan  through  the  messages  for  the  first  message  area  and
  843.           determine how many messages need to be packed.  If messages  need
  844.           to  be  packed, fill the MIX_REC structure and write  it  to  the
  845.           *.MIX file, then perform the following steps:
  846.  
  847.           a.   Read the next new message from the message area.
  848.  
  849.           b.   Fill the FTI_REC structure and write it to the *.FTI file.
  850.  
  851.           c.   Write the message text to the *.DAT file.
  852.  
  853.           d.   Repeat steps a through c until all messages are packed.
  854.  
  855.      6.   Repeat step 5 for all remaining message areas.
  856.  
  857.           NOTE:     An alternate method for the actions described in  steps
  858.                     5  and 6 is to scan through the message base and  write
  859.                     the  FTI_REC  records and the *.DAT  text  first,  then
  860.                     write  the MIX_REC.  As mentioned above,  however,  the
  861.                     method you use is entirely up to you.
  862.  
  863.  
  864.  
  865.                                    - Page 15 -
  866.             Blue Wave Mail Packet File Structures - Revision Level 2
  867.  
  868.  
  869.      7.   Use  an archiving utility (ARC, PKZIP, etc.) to pack  the  *.INF,
  870.           *.MIX,  *.FTI,  and *.DAT files into an archive file.   The  file
  871.           should  be  named according to the  naming  convention  specified
  872.           earlier in this document.
  873.  
  874.      Note that these steps do not take into account such things as bulletin
  875.      files,  keywords, filters, macros, and so forth, but again, these  are
  876.      the details which are left to the programmer to implement.
  877.  
  878.  
  879.      APPENDIX B - HOW TO CREATE A BLUE WAVE REPLY PACKET
  880.      ===================================================
  881.  
  882.      Unlike creating a mail packet, the creation of a reply packet is not a
  883.      linear process; there is no outline that can be followed.   Basically,
  884.      when  the reader creates a reply message, a UPL_REC record  is  filled
  885.      and written to the *.UPL file for each reply created by the reader; if
  886.      the  *.UPL file doesn't exist, then it will have to be created  (natu-
  887.      rally)  by filling and writing a UPL_HEADER to the *.UPL  file  before
  888.      adding UPL_REC records.  This process is performed on-the-fly, at  the
  889.      time  the user creates reply messages.
  890.  
  891.      The reply archive itself is created by an archive utility (ARC, PKZIP,
  892.      etc.), using the filename conventions specified earlier in this  docu-
  893.      ment.  In order to prevent "orphaned" files -- messages deleted by the
  894.      reader -- from showing up in the reply archive, reader authors  should
  895.      delete the archive before running the archive utility; this will force
  896.      a "fresh" file, free from excess clutter, to be created from scratch.
  897.  
  898.  
  899.      APPENDIX C - THE BLUE WAVE STRUCTURES AND TURBO PASCAL
  900.      ======================================================
  901.  
  902.      The  Blue Wave packet structures are provided as a header file  for  C
  903.      compilers,  since the Blue Wave Offline Mail Reader and the Blue  Wave
  904.      Offline  Mail  Doors  from Cutting Edge Computing are  written  in  C.
  905.      However,  for the convenience of programmers who write programs  using
  906.      Borland's Pascal compilers (Turbo Pascal and Borland Pascal), a header
  907.      file  for use in Pascal programs (BLUEWAVE.INC) is  provided.   Please
  908.      note  the following changes and restrictions from the C header  imple-
  909.      mentation:
  910.  
  911.      1.   As  implemented,  the Pascal header is to be  included  within  a
  912.           source file, i.e.:
  913.  
  914.                {$I bluewave.inc}
  915.  
  916.           Industrious  Pascal  programmers can easily convert  this  header
  917.           file to a unit if so desired.
  918.  
  919.      2.   The structure names and constants remain identical, i.e. MIX_REC,
  920.           FTI_REC,  and  so  on, and are defined as  "record"  data  types.
  921.           Thus,  defining a structure is similar to any other  Pascal  data
  922.  
  923.  
  924.                                    - Page 16 -
  925.             Blue Wave Mail Packet File Structures - Revision Level 2
  926.  
  927.  
  928.           type, i.e.:
  929.  
  930.                var infheader : INF_HEADER;
  931.                    infrec    : INF_AREA_INFO;
  932.                    mixrec    : MIX_REC;
  933.                    ftirec    : FTI_REC;
  934.  
  935.           Also  note that unlike C, Pascal is not case-sensitive  with  re-
  936.           gards  to variable and type names.  Thus, INF_HEADER can also  be
  937.           accessed as "inf_header", "Inf_Header", or even "InF_HeAdEr".
  938.  
  939.      3.   Due  to a conflict with reserved keywords in Pascal,  the  "from"
  940.           and  "to" fields in FTI_REC, MSG_REC, UPI_REC, and  UPL_REC  have
  941.           been  renamed  to "mfrom" and "mto".  All other field  names  are
  942.           identical between the C and Pascal headers.
  943.  
  944.      4.   Bit  flags are defined as sets in the Pascal header, and are  set
  945.           and reset using the Pascal set operators (+ and -).  For example,
  946.           to  set the INF_ECHO and INF_NETMAIL flags, the following  state-
  947.           ment:
  948.  
  949.                infrec.area_flags := infrec.area_flags + [INF_ECHO,
  950.                                         INF_NETMAIL];
  951.  
  952.           can be used.
  953.  
  954.      5.   With  one exception, data types in Pascal are stored  identically
  955.           to  their C counterparts (i.e. Pascal "longint" and C "long  int"
  956.           are  stored,  identically, in 4 bytes.).  The lone  exception  is
  957.           strings.   In  C, strings are stored as a  series  of  characters
  958.           terminated  with  a 0 byte.  In Pascal, strings are stored  as  a
  959.           length  byte followed by the characters that make up the  string.
  960.           Since  the  Blue Wave format is centered around the  C  language,
  961.           Pascal  programmers  will have to convert strings between  C  and
  962.           Pascal  formats.  To aid in this endeavor, strings in the  Pascal
  963.           header  are  defined as arrays of bytes  (i.e.  "array[1..43]  of
  964.           byte"), but YOU will have to devise your own routines to  convert
  965.           strings between the two formats.
  966.  
  967.      There are undoubtedly other areas where C and Pascal differ, but  this
  968.      should get you started in the right direction.
  969.  
  970.      PLEASE  NOTE THAT CUTTING EDGE COMPUTING DOES NOT PROVIDE SUPPORT  FOR
  971.      PASCAL  PROGRAMMERS  USING  THESE STRUCTURES.  The  Pascal  header  is
  972.      provided solely for your convenience; other than that, you are on your
  973.      own.   Thus, it is recommended that only Pascal programmers with  some
  974.      experience  in using data created by (and expected by) C programs  use
  975.      these structures, as handling the differences between the languages is
  976.      not something that is easily handled by the novice.
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.                                    - Page 17 -
  984.             Blue Wave Mail Packet File Structures - Revision Level 2
  985.  
  986.  
  987.      APPENDIX D - SERIAL NUMBERS IN MAIL AND REPLY PACKETS
  988.      =====================================================
  989.  
  990.      The serial number fields in the *.INF, *.UPI, and *.UPL structures are
  991.      used  mainly by the Blue Wave reader and doors from Cutting Edge  Com-
  992.      puting (using what is, naturally, a proprietary algorithm to determine
  993.      the  actual serial numbers).  Authors are free to use these fields  as
  994.      they  see  fit, though the values in the fields  will  undoubtedly  be
  995.      meaningless  to other Blue Wave-compatible programs.  In fact,  unless
  996.      you're  creating  your own series of Blue  Wave-compatible  doors  and
  997.      readers,  the serial number fields are practically useless  to  third-
  998.      party authors.
  999.  
  1000.      (As an example, the Blue Wave doors will examine the reader name field
  1001.      in the *.UPL header to determine if a reply packet was created by  the
  1002.      Blue Wave reader.  If it was, then the serial number is used to deter-
  1003.      mine  if "[NR]" should be added to the tear line.  On the other  hand,
  1004.      if  the packet was created by a different reader, the Blue Wave  doors
  1005.      will ignore the serial number and never put "[NR]" in the tear line.)
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.                                    - Page 18 -
  1043.  
  1044.