home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / OPENDOOR / WRITEJAM.ZIP / JAM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-02  |  9.1 KB  |  236 lines

  1. /*
  2. **  JAM(mbp) - The Joaquim-Andrew-Mats Message Base Proposal
  3. **
  4. **  C API
  5. **
  6. **  Written by Joaquim Homrighausen.
  7. **
  8. **  ----------------------------------------------------------------------
  9. **
  10. **  jam.h (JAMmb)
  11. **
  12. **  Prototypes and definitions for the JAM message base format
  13. **
  14. **  Copyright 1993 Joaquim Homrighausen, Andrew Milner, Mats Birch, and
  15. **  Mats Wallin. ALL RIGHTS RESERVED.
  16. **
  17. **  93-06-28    JoHo
  18. **  Initial coding.
  19. */
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. #ifndef __JAM_H__
  25. #define __JAM_H__
  26.  
  27. #ifndef __JAMSYS_H__
  28. #include "jamsys.h"
  29. #endif
  30.  
  31. /*
  32. **  File extensions
  33. */
  34. #define EXT_HDRFILE     ".jhr"
  35. #define EXT_TXTFILE     ".jdt"
  36. #define EXT_IDXFILE     ".jdx"
  37. #define EXT_LRDFILE     ".jlr"
  38.  
  39. /*
  40. **  Revision level and header signature
  41. */
  42. #define CURRENTREVLEV   1
  43. #define HEADERSIGNATURE "JAM"
  44.  
  45. /*
  46. **  Header file information block, stored first in all .JHR files
  47. */
  48. typedef struct
  49.     {
  50.     CHAR8   Signature[4];              /* <J><A><M> followed by <NUL> */
  51.     UINT32  DateCreated;               /* Creation date */
  52.     UINT32  ModCounter;                /* Last processed counter */
  53.     UINT32  ActiveMsgs;                /* Number of active (not deleted) msgs */
  54.     UINT32  PasswordCRC;               /* CRC-32 of password to access */
  55.     UINT32  BaseMsgNum;                /* Lowest message number in index file */
  56.     CHAR8   RSRVD[1000];               /* Reserved space */
  57.     }
  58.     JAMHDRINFO, _JAMDATA * JAMHDRINFOptr;
  59.  
  60. /*
  61. **  Message status bits
  62. */
  63. #define MSG_LOCAL       0x00000001L    /* Msg created locally */
  64. #define MSG_INTRANSIT   0x00000002L    /* Msg is in-transit */
  65. #define MSG_PRIVATE     0x00000004L    /* Private */
  66. #define MSG_READ        0x00000008L    /* Read by addressee */
  67. #define MSG_SENT        0x00000010L    /* Sent to remote */
  68. #define MSG_KILLSENT    0x00000020L    /* Kill when sent */
  69. #define MSG_ARCHIVESENT 0x00000040L    /* Archive when sent */
  70. #define MSG_HOLD        0x00000080L    /* Hold for pick-up */
  71. #define MSG_CRASH       0x00000100L    /* Crash */
  72. #define MSG_IMMEDIATE   0x00000200L    /* Send Msg now, ignore restrictions */
  73. #define MSG_DIRECT      0x00000400L    /* Send directly to destination */
  74. #define MSG_GATE        0x00000800L    /* Send via gateway */
  75. #define MSG_FILEREQUEST 0x00001000L    /* File request */
  76. #define MSG_FILEATTACH  0x00002000L    /* File(s) attached to Msg */
  77. #define MSG_TRUNCFILE   0x00004000L    /* Truncate file(s) when sent */
  78. #define MSG_KILLFILE    0x00008000L    /* Delete file(s) when sent */
  79. #define MSG_RECEIPTREQ  0x00010000L    /* Return receipt requested */
  80. #define MSG_CONFIRMREQ  0x00020000L    /* Confirmation receipt requested */
  81. #define MSG_ORPHAN      0x00040000L    /* Unknown destination */
  82. #define MSG_ENCRYPT     0x00080000L    /* Msg text is encrypted */
  83. #define MSG_COMPRESS    0x00100000L    /* Msg text is compressed */
  84. #define MSG_ESCAPED     0x00200000L    /* Msg text is seven bit ASCII */
  85. #define MSG_FPU         0x00400000L    /* Force pickup */
  86. #define MSG_TYPELOCAL   0x00800000L    /* Msg is for local use only (not for export) */
  87. #define MSG_TYPEECHO    0x01000000L    /* Msg is for conference distribution */
  88. #define MSG_TYPENET     0x02000000L    /* Msg is direct network mail */
  89. #define MSG_NODISP      0x20000000L    /* Msg may not be displayed to user */
  90. #define MSG_LOCKED      0x40000000L    /* Msg is locked, no editing possible */
  91. #define MSG_DELETED     0x80000000L    /* Msg is deleted */
  92.  
  93. /*
  94. **  Message header
  95. */
  96. typedef struct
  97.     {
  98.     CHAR8   Signature[4];              /* <J><A><M> followed by <NUL> */
  99.     UINT16  Revision;                  /* CURRENTREVLEV */
  100.     UINT16  ReservedWord;              /* Reserved */
  101.     UINT32  SubfieldLen;               /* Length of subfields */
  102.     UINT32  TimesRead;                 /* Number of times message read */
  103.     UINT32  MsgIdCRC;                  /* CRC-32 of MSGID line */
  104.     UINT32  ReplyCRC;                  /* CRC-32 of REPLY line */
  105.     UINT32  ReplyTo;                   /* This msg is a reply to.. */
  106.     UINT32  Reply1st;                  /* First reply to this msg */
  107.     UINT32  ReplyNext;                 /* Next msg in reply chain */
  108.     UINT32  DateWritten;               /* When msg was written */
  109.     UINT32  DateReceived;              /* When msg was received/read */
  110.     UINT32  DateProcessed;             /* When msg was processed by packer */
  111.     UINT32  MsgNum;                    /* Message number (1-based) */
  112.     UINT32  Attribute;                 /* Msg attribute, see "Status bits" */
  113.     UINT32  Attribute2;                /* Reserved for future use */
  114.     UINT32  TxtOffset;                 /* Offset of text in text file */
  115.     UINT32  TxtLen;                    /* Length of message text */
  116.     UINT32  PasswordCRC;               /* CRC-32 of password to access msg */
  117.     UINT32  Cost;                      /* Cost of message */
  118.     }
  119.     JAMHDR, _JAMDATA * JAMHDRptr;
  120.  
  121. /*
  122. **  Message header subfield types
  123. */
  124. #define JAMSFLD_OADDRESS    0
  125. #define JAMSFLD_DADDRESS    1
  126. #define JAMSFLD_SENDERNAME  2
  127. #define JAMSFLD_RECVRNAME   3
  128. #define JAMSFLD_MSGID       4
  129. #define JAMSFLD_REPLYID     5
  130. #define JAMSFLD_SUBJECT     6
  131. #define JAMSFLD_PID         7
  132. #define JAMSFLD_TRACE       8
  133. #define JAMSFLD_ENCLFILE    9
  134. #define JAMSFLD_ENCLFWALIAS 10
  135. #define JAMSFLD_ENCLFREQ    11
  136. #define JAMSFLD_ENCLFILEWC  12
  137. #define JAMSFLD_ENCLINDFILE 13
  138. #define JAMSFLD_EMBINDAT    1000
  139. #define JAMSFLD_FTSKLUDGE   2000
  140. #define JAMSFLD_SEENBY2D    2001
  141. #define JAMSFLD_PATH2D      2002
  142. #define JAMSFLD_FLAGS       2003
  143. #define JAMSFLD_TZUTCINFO   2004
  144. #define JAMSFLD_UNKNOWN     0xffff
  145.  
  146.  
  147. /*
  148. ** Additional Message Header fields for Internet RFC822
  149. */
  150.  
  151. #define JAMSFLD_IFROM              3000   /* From:                */
  152. #define JAMSFLD_ISENDER            3001   /* Sender:              */
  153. #define JAMSFLD_ICOMMENT           3002   /* Comments:            */
  154. #define JAMSFLD_ITO                3003   /* To:                  */
  155. #define JAMSFLD_IRESENT_TO         3004   /* Resent-To:           */
  156. #define JAMSFLD_ICC                3005   /* cc:                  */
  157. #define JAMSFLD_IRESENT_CC         3006   /* Resent-cc:           */
  158. #define JAMSFLD_IBCC               3007   /* bcc:                 */
  159. #define JAMSFLD_IRECENT_BCC        3008   /* Resent-bcc:          */
  160. #define JAMSFLD_IMESSAGE_ID        3009   /* Message-ID:          */
  161. #define JAMSFLD_IRESENT_MESSAGE_ID 3010   /* Resent-Message-ID:   */
  162. #define JAMSFLD_IIN_REPLY_TO       3011   /* In-Reply-To:         */
  163. #define JAMSFLD_IREFERENCES        3012   /* References:          */
  164. #define JAMSFLD_IKEYWORDS          3013   /* Keywords:            */
  165. #define JAMSFLD_ISUBJECT           3014   /* Subject:             */
  166. #define JAMSFLD_IENCRYPTED         3015   /* Encrypted:           */
  167. #define JAMSFLD_IDATE              3016   /* Date:                */
  168. #define JAMSFLD_IREPLY_TO          3017   /* Reply-To:            */
  169. #define JAMSFLD_IRECEIVED          3018   /* Received:            */
  170. #define JAMSFLD_IRESENT_REPLY_TO   3019   /* Resent-Reply-To:     */
  171. #define JAMSFLD_IRESENT_FROM       3020   /* Resent-From:         */
  172. #define JAMSFLD_IRESENT_SENDER     3021   /* Resent-Sender:       */
  173. #define JAMSFLD_IRESENT_DATE       3022   /* Resent-Date:         */
  174. #define JAMSFLD_IRETURN_PATH       3023   /* Return-path:         */
  175. #define JAMSFLD_ILINES             3024   /* Lines:               */
  176.  
  177. /*  Unknown. Any header information not saved elsewhere
  178.  *  (concatenated fields)
  179.  */
  180. #define JAMSFLD_IUNKNOWN           3100   
  181.  
  182. /* Newsgroup Information
  183. #define JAMSFLD_INEWSGROUPS        3101   /* Newsgroups:          */
  184. #define JAMSFLD_IFOLLOW_UP         3102   /* Follow-Up:           */
  185.  
  186.  
  187. /*
  188. **  Message header subfield
  189. */
  190. typedef struct
  191.     {
  192.     UINT16  LoID;                      /* Field ID, 0 - 0xffff */
  193.     UINT16  HiID;                      /* Reserved for future use */
  194.     UINT32  DatLen;                    /* Length of buffer that follows */
  195.     CHAR8   Buffer[1];                 /* DatLen bytes of data */
  196.     }
  197.     JAMSUBFIELD, _JAMDATA * JAMSUBFIELDptr;
  198.  
  199. typedef struct
  200.     {
  201.     UINT16  LoID;                      /* Field ID, 0 - 0xffff */
  202.     UINT16  HiID;                      /* Reserved for future use */
  203.     UINT32  DatLen;                    /* Length of buffer that follows */
  204.     }
  205.     JAMBINSUBFIELD, _JAMDATA * JAMBINSUBFIELDptr;
  206.  
  207. /*
  208. **  Message index record
  209. */
  210. typedef struct
  211.     {
  212.     UINT32  UserCRC;                   /* CRC-32 of destination username */
  213.     UINT32  HdrOffset;                 /* Offset of header in .JHR file */
  214.     }
  215.     JAMIDXREC, _JAMDATA * JAMIDXRECptr;
  216.  
  217. /*
  218. **  Lastread structure, one per user
  219. */
  220. typedef struct
  221.     {
  222.     UINT32  UserCRC;                   /* CRC-32 of user name (lowercase) */
  223.     UINT32  UserID;                    /* Unique UserID */
  224.     UINT32  LastReadMsg;               /* Last read message number */
  225.     UINT32  HighReadMsg;               /* Highest read message number */
  226.     }
  227.     JAMLREAD, _JAMDATA * JAMLREADptr;
  228.  
  229. #endif /* __JAM_H__ */
  230.  
  231. #ifdef __cplusplus
  232. }
  233. #endif
  234.  
  235. /* end of file "jam.h" */
  236.