home *** CD-ROM | disk | FTP | other *** search
/ Merciful 3 / Merciful_Release_3.bin / software / c / crashmailv1.22reg.lha / CrashMail / StatsFormat.doc < prev    next >
Text File  |  1995-12-15  |  11KB  |  216 lines

  1.                   CrashMail Statistics file format 1.1
  2.  
  3.                               15-Dec-95
  4.  
  5. Introduction
  6. ============
  7. In this file, the format of CrashMail's statistics file is described.
  8. With this text and a little programming knowledge, you can easily make
  9. your own programs that uses the stats file. You can for example make
  10. a better replacement for CrashStats or a program that calculates how
  11. much each node has to pay if you are a node that uses cost-sharing
  12. baes on how much echomail the nodes get from you.
  13.  
  14. There are two basic rules that you should obey:
  15.  
  16. 1) Do NOT alter the file!
  17. 2) If the file isn't in the expected format, warn the user and
  18.    quit the program nicely.
  19.  
  20. The new format
  21. ==============
  22. As of CrashMail 1.2, CrashMail uses a new format for its statistics file.
  23. The main reason for the change is that CrashMail now keeps the number of
  24. messages arrived in each area for the last 7 days. Things like the aka
  25. and group of the area have also been added to the statistics file to
  26. make it possible to make better external programs that read the file.
  27. The node statistics have not been changed at all.
  28.  
  29. File format
  30. ===========
  31.  
  32. Basic file format
  33. -----------------
  34.  
  35.  +---------+--------------------------------------------------------+
  36.  | Size    | Description                                            |
  37.  +---------+--------------------------------------------------------+
  38.  | 4 bytes | Always the string "CST2". These four characters tell   |
  39.  |         | you what kind of file it is. If the these four         |
  40.  |         | characters aren't "CST2", your program should give an  |
  41.  |         | error and quit nicely.                                 |
  42.  +---------+--------------------------------------------------------+
  43.  | 4 bytes | A longword that contains the day the statistics file   |
  44.  |         | was written. This is stored as days since Jan. 1, 1978 |
  45.  |         | which is the same way AmigaDOS stores the  date in     |
  46.  |         | datestamps        .                                    |
  47.  +---------+--------------------------------------------------------+
  48.  | 4 bytes | A longword that tells you how many areas there are in  |
  49.  |         | this file.                                             |
  50.  +---------+--------------------------------------------------------+
  51.  | ???     | The statistics for the areas. The format of these      |
  52.  |         | sections are described below. There are as many        |
  53.  |         | structures as specified with the previous four bytes.  |
  54.  +---------+--------------------------------------------------------+
  55.  | 4 bytes | A longword that tells you how many nodes there are in  |
  56.  |         | this file.                                             |
  57.  +---------+--------------------------------------------------------+
  58.  | ???     | The statistics for the nodes. The format of these      |
  59.  |         | sections are described below. There are as many        |
  60.  |         | structures as specified with the previous four bytes.  |
  61.  +---------+--------------------------------------------------------+
  62.  
  63. Area statistics format
  64. ----------------------
  65.  
  66.  +-----------+--------------------------------------------------------+
  67.  | Size      | Description                                            |
  68.  +-----------+--------------------------------------------------------+
  69.  | 80 bytes  | The tagname of the area                                |
  70.  +-----------+--------------------------------------------------------+
  71.  | 2 bytes   | A word that contains the zone number of the aka        |
  72.  +-----------+--------------------------------------------------------+
  73.  | 2 bytes   | A word that contains the net number of the aka         |
  74.  +-----------+--------------------------------------------------------+
  75.  | 2 bytes   | A word that contains the node number of the aka        |
  76.  +-----------+--------------------------------------------------------+
  77.  | 2 bytes   | A word that contains the point number of the aka       |
  78.  +-----------+--------------------------------------------------------+
  79.  | 1 byte    | The group of the area ("A"-"Z") or zero if no group    |
  80.  |           | is specified for this areas.                           |
  81.  +-----------+--------------------------------------------------------+
  82.  | 1 byte    | Not used. This byte exists to make sure that the next  |
  83.  |           | item is on an even offset in the file to make it       |
  84.  |           | easier to read this file when programming in C         |
  85.  +-----------+--------------------------------------------------------+
  86.  | 4 bytes   | A longword that contains the total number of texts you |
  87.  |           | have received in this area. (Dupes are excluded)       |
  88.  +-----------+--------------------------------------------------------+
  89.  | 8*2 bytes | 8 words that contain the number of messages that have  |
  90.  |           | arrived in this area for the last 8 days. The first    |
  91.  |           | word contains the number of messages that had arrived  |
  92.  |           | so far the day the file was written, the second word   |
  93.  |           | contains the number of  messages that had  arrived the |
  94.  |           | day before that etc.                                   |
  95.  +-----------+--------------------------------------------------------+
  96.  | 4 bytes   | A longword that contains the total number of dupes     |
  97.  |           | that CrashMail has found in this area.                 |
  98.  +-----------+--------------------------------------------------------+
  99.  | 4 bytes   | A longword that contains the day since Jan. 1, 1978    |
  100.  |           | that you first received messages in this area.         |
  101.  +-----------+--------------------------------------------------------+
  102.  | 4 bytes   | A longword that contains the minutes since midnight    |
  103.  |           | the first time you received messages in this area.     |
  104.  +-----------+--------------------------------------------------------+
  105.  | 4 bytes   | A longword that contains the "ticks" (50 ticks are     |
  106.  |           | one second) since the last whole minute the first time |
  107.  |           | you received messages in this area. The three last     |
  108.  |           | fields together are a normal AmigaDOS datestamp.       |
  109.  +-----------+--------------------------------------------------------+
  110.  | 4 bytes   | A longword that contains the last date you received    |
  111.  |           | messages in this area. This is stored as days since    |
  112.  |           | Jan. 1, 1978 which is the same way AmigaDOS stores the |
  113.  |           | date in datestamps.                                    |
  114.  +-----------+--------------------------------------------------------+
  115.  
  116. struct DiskAreaStats
  117. {
  118.  
  119.    ULONG TotalTexts;
  120.    UWORD Last8Days[8];
  121.    ULONG Dupes;
  122.  
  123.    struct DateStamp FirstTime;
  124.    ULONG LastDay;
  125. };
  126.  
  127. Node statistics format
  128. ----------------------
  129.  
  130.  +----------+--------------------------------------------------------+
  131.  | Size     | Description                                            |
  132.  +----------+--------------------------------------------------------+
  133.  | 2 bytes  | A word that contains the zone number of the node       |
  134.  +----------+--------------------------------------------------------+
  135.  | 2 bytes  | A word that contains the net number of the node        |
  136.  +----------+--------------------------------------------------------+
  137.  | 2 bytes  | A word that contains the node number of the node       |
  138.  +----------+--------------------------------------------------------+
  139.  | 2 bytes  | A word that contains the point number of the node      |
  140.  +----------+--------------------------------------------------------+
  141.  | 4 bytes  | A longword that contains the total number of netmails  |
  142.  |          | you have received from this node.                      |
  143.  +----------+--------------------------------------------------------+
  144.  | 4 bytes  | A longword that contains the total size of all the     |
  145.  |          | netmails you have received from this node.             |
  146.  +----------+--------------------------------------------------------+
  147.  | 4 bytes  | A longword that contains the total number of netmails  |
  148.  |          | you have sent to this node.                            |
  149.  +----------+--------------------------------------------------------+
  150.  | 4 bytes  | A longword that contains the total size of all the     |
  151.  |          | netmails you have sent to this node.                   |
  152.  +----------+--------------------------------------------------------+
  153.  | 4 bytes  | A longword that contains the total number of echomails |
  154.  |          | you have received from this node.                      |
  155.  +----------+--------------------------------------------------------+
  156.  | 4 bytes  | A longword that contains the total size of all the     |
  157.  |          | echomails you have received from this node.            |
  158.  +----------+--------------------------------------------------------+
  159.  | 4 bytes  | A longword that contains the total number of echomails |
  160.  |          | you have sent to this node.                            |
  161.  +----------+--------------------------------------------------------+
  162.  | 4 bytes  | A longword that contains the total size of all the     |
  163.  |          | echomails you have sent to this node.                  |
  164.  +----------+--------------------------------------------------------+
  165.  | 4 bytes  | A longword that contains the total number of dupes     |
  166.  |          | you have received from this node.                      |
  167.  +----------+--------------------------------------------------------+
  168.  | 4 bytes  | A longword that contains the first date you received   |
  169.  |          | anything from this node or sent anything to this node. |
  170.  |          | This is stored as days since Jan. 1, 1978 which is the |
  171.  |          | same way AmigaDOS stores the date in datestamps.       |
  172.  +----------+--------------------------------------------------------+
  173.  
  174.  
  175. Structures for C programmers
  176. ============================
  177. Here they are, ready to be used! You have to include exec/types.h
  178. to get the ULONG/UBYTE definitions.
  179.  
  180. struct DiskAreaStats
  181. {
  182.    UBYTE Tagname[80];
  183.    struct Node4D Aka;
  184.  
  185.    UBYTE Group;
  186.    UBYTE fill_to_make_even; /* Just ignore this one */
  187.  
  188.    ULONG TotalTexts;
  189.    UWORD Last8Days[8];
  190.    ULONG Dupes;
  191.  
  192.    struct DateStamp FirstTime;
  193.    ULONG LastDay;
  194. };
  195.  
  196. struct Node4D
  197. {
  198.    UWORD Zone,Net,Node,Point;
  199. };
  200.  
  201. struct DiskNodeStats
  202. {
  203.    struct Node4D Node;
  204.    ULONG GotNetmails;
  205.    ULONG GotNetmailBytes;
  206.    ULONG SentNetmails;
  207.    ULONG SentNetmailBytes;
  208.    ULONG GotEchomails;
  209.    ULONG GotEchomailBytes;
  210.    ULONG SentEchomails;
  211.    ULONG SentEchomailBytes;
  212.    ULONG Dupes;
  213.    ULONG FirstDay;
  214. };
  215.  
  216.