home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / sqdev200.zip / samples / sstat2.h < prev    next >
C/C++ Source or Header  |  1994-05-23  |  3KB  |  107 lines

  1. /*
  2.   EBNF structure for SQUISH.STT, replacing the old SQUISH.STA:
  3.  
  4.     file:       { block }*
  5.  
  6.     block:      _thdr blockdata
  7.  
  8.     blockdata:  _tpkt
  9.              |  _tarea { tnode }*
  10.              |  _tdupe
  11.              |  _tstamp
  12. */
  13.  
  14.  
  15. #ifndef __SSTAT2_H_DEFINED
  16. #define __SSTAT2_H_DEFINED
  17.  
  18. #include <time.h>
  19.  
  20.  
  21.  
  22.  
  23. /* Tag header */
  24.  
  25. struct _thdr
  26. {
  27.   word type;    /* Record type.  See TYPE_XXXX below */
  28.   word len;     /* Length of the following record */
  29. };
  30.  
  31.  
  32. #define TYPE_PKT    0x0001    /* _tpkt follows */
  33. #define TYPE_AREA   0x0002    /* _tarea follows */
  34. #define TYPE_DUPE   0x0003    /* _tdupe follows */
  35. #define TYPE_BEGIN  0x0004    /* _tstamp follows.  Beginning of execution */
  36. #define TYPE_BTOSS  0x0005    /* 0-length, marks toss from bad_msgs */
  37. #define TYPE_END    0x0006    /* _tstamp follows.  End of execution */
  38.  
  39. /* If thdr.type has a value other than the above, the record should         *
  40.  * be ignored!  Simply skip ahead by thdr.len bytes and read the next       *
  41.  * thdr structure.                                                          */
  42.  
  43.  
  44. /* Maximum length of an area tag written to SQUISH.STT */
  45.  
  46. #define AH_TAGLEN   30
  47.  
  48.  
  49. /* Structure written when a packet is received */
  50.  
  51. struct _tpkt
  52. {
  53.   NETADDR orig;           /* Origination address of packet */
  54.   char pktname[14];       /* Packet filename */
  55.   dword size;             /* Size of packet */
  56.   SCOMBO proc_time;       /* Time at which packet was processed */
  57. };
  58.  
  59. /* Structure written once for every area received in every packet.          *
  60.  * An array of _tnode structures always follows this, as defined by         *
  61.  * the n_nodes field in this structure.                                     */
  62.  
  63. struct _tarea
  64. {
  65.   char tag[AH_TAGLEN];
  66.   dword in_msgs;
  67.   dword in_bytes;
  68.  
  69.   word n_nodes;           /* Number of _tnode structs following this one */
  70.   word taflag;
  71. };
  72.  
  73. #define TAFLAG_PASSTHRU   0x01 /* This echo is a passthru area */
  74.  
  75.  
  76. /* Record for each node exported to, for each area.  Zero or more _tnode    *
  77.  * structures follow each _tarea structure.                                 */
  78.  
  79. struct _tnode
  80. {
  81.   NETADDR node;
  82.   dword out_msgs;
  83.   dword out_bytes;
  84. };
  85.  
  86.  
  87. /* Duplicate messages received in the specified echo.  Comes at the end     *
  88.  * of each packet, after any _tnode and _tarea structures, but before       *
  89.  * the next _tpkt.                                                          */
  90.  
  91. struct _tdupe
  92. {
  93.   char tag[AH_TAGLEN];
  94.   word n_dupes;
  95. };
  96.  
  97.  
  98. /* Timestamp - for both TYPE_BEGIN and TYPE_END */
  99.  
  100. struct _tstamp
  101. {
  102.   time_t date;      /* as returned by time(NULL) */
  103. };
  104.  
  105. #endif /* !__SSTAT2_H_DEFINED */
  106.  
  107.