home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / bss / pup.arc / PUPPY.H < prev    next >
C/C++ Source or Header  |  1987-12-11  |  6KB  |  206 lines

  1. /*
  2.     Puppy's include file
  3.     T. Jennings 17 Nov 87
  4.  
  5. "Fido" is a trademark of Tom Jennings. It you utter it send me a dollar.
  6. "FidoNet" is a also registered trademark of Tom Jennings. If you even think 
  7. it send me two dollars. If you use both, send me ten dollars and your first
  8. born child. All rights reserved. So there.
  9.  
  10.  
  11. Puppy (k) All Rights Reversed
  12.  
  13.     Fido Software
  14.     164 Shipley
  15.     San Francisco CA 94107
  16.     (415)-764-1629, FidoSW BBS
  17.     (415)-882-9835, ch@os, one day will be known as 1:125/164
  18. */
  19.  
  20. /* These are my assumptions as to data element sizes for the source here. You
  21. will need to change these if the following assumptions arent right:
  22.  
  23. char            8 bits or more, signed or not
  24. int             more than 8 bits, though 8 will work 99% of the time
  25.             (that last 1% if left as an exercise for the programmer)
  26.  
  27. long            more than 16 bits, preferably 32. Note as above
  28.  
  29. FLAG            at least one bit long; set to 0 or 1, and tested
  30.             for != 0
  31. BYTE            8 bits long. You can define as necessary.
  32. WORD            16 bits. Ditto
  33. LONG            32 bits. Ditto Ditto
  34.  
  35. BYTE, WORD and LONG are used for two reasons: to take advantage of the word
  36. length in modulo arithmetic (ie. XMODEM block numbers, 0...255) or because
  37. they are an interface to other code, ie. WORD baud rates passed to the 
  38. drivers. Changing these assumptions may not be trivial, since they are
  39. frequently buried into the algorithms. (Check out XMODEM.C for a classic
  40. example of this.) */
  41.  
  42. #define FLAG char    /* just a boolean */
  43. #define BYTE char    /* Lattice chars are 8 bit */
  44. #define WORD unsigned    /* Lattice unsigneds are 16 bits */
  45. #define LONG long    /* Lattice ... */
  46.  
  47.  
  48. /* Absolute Truths (current version ...) */
  49.  
  50. #define SS 80                /* standard, universal, string size */
  51. #define TSYNC 0xae            /* FidoNet sync character */
  52.  
  53. /* Fancy numbers for protocol module. */
  54.  
  55. #define TELINK 1            /* file transmission modes, */
  56. #define MODEM7 2
  57. #define XMODEM 3
  58. #define KERMIT 4
  59. #define ZMODEM 5
  60.  
  61. #define NULL 0                /* nothing */
  62.  
  63. #define MINS_HR    60            /* minutes in an hour */
  64. #define DAYS_WK 7            /* days in a week */
  65. #define MINS_DAY (24 * 60)        /* minutes in an hour */
  66. #define MINS_WK (MINS_DAY * DAYS_WK)
  67.  
  68. /* Standard node structure used throughout Fido. This is buried within all
  69. the other major structures. */
  70.  
  71. struct _node {
  72.     int zone;        /* zone number */
  73.     int net;        /* net number */
  74.     int number;        /* node number */
  75. };
  76.  
  77. /* This is the structure in which system routines return the current time
  78. and date. This structure is buried in some other structures. Its only
  79. six bytes, why mess with it? */
  80.  
  81. struct _time {
  82.     BYTE year;
  83.     BYTE month;
  84.     BYTE day;
  85.     BYTE hour;
  86.     BYTE minute;
  87.     BYTE second;
  88. };
  89.  
  90. /* These are all in the "library", MS-C.C and MS-ASM.ASM. */
  91.  
  92. char *str_node();
  93. char *skip_delim();
  94. char *next_arg();
  95. char *strip_path();
  96. char *getarg();
  97.  
  98. /* These are in the msg base mostly */
  99.  
  100. struct _msg *getmsg();
  101. struct _msg *newmsg();
  102.  
  103. /* These are elsewhere */
  104.  
  105. long lseek();
  106. char *getmem();
  107.  
  108.  
  109. /* Message header structure: the headers are contained in a single file;
  110. the message bodies are contained in another. The headers are kept in
  111. memory at all times. */
  112.  
  113. struct _msg {
  114.     char from[36];        /* who from, */
  115.     char to[36];        /* who to, */
  116.     char subj[36];        /* message subject, */
  117.     struct _time time;    /* message creation time */
  118.     WORD attr;        /* attribute bits (see below) */
  119.     WORD topic;        /* topic selection(s) */
  120.     WORD topic_map;        /* shared topics */
  121. };
  122.  
  123. /* Message attribute bits */
  124.  
  125. #define MSGEXISTS 1        /* message slot occupied */
  126. #define MSGREAD 2        /* read by addressee */
  127. #define MSGSENT 4        /* sent OK (remote) */
  128. #define MSGTAG 8        /* general purpose tag bit */            
  129.  
  130.  
  131. #define SCHEDS 35        /* size of scheduler event table */
  132.  
  133. /* Scheduler event structure within PUP.SYS. Tags defined:
  134.  
  135. A - W        FIDONET events
  136. X        ERRORLEVEL event
  137. all others    RESERVED
  138. */
  139.  
  140. struct _sched {
  141.     char bits;        /* see below */
  142.     char tag;        /* event type, above, */
  143.     char hr;        /*   hour, */
  144.     char min;        /*   minute, */
  145.     int len;        /* event length, or ERRORLEVEL for tag X */
  146. };
  147.  
  148. #define SCHED_OPTIONAL 1    /* this event may be skipped */
  149. #define SCHED_COMPLETE 2    /* this event already run */
  150.  
  151. /* PUPPY.SYS: This is where Puppy keeps its shit together. */
  152.  
  153. struct _pup {
  154.     long callers;        /* number of callers to the system */
  155.     long quote_pos;        /* quote file position */
  156.     struct _node id;    /* our node ID */
  157.     int nlimit;        /* normal callers limit, */
  158.     int klimit;        /* K byte limit, */
  159.     int top;        /* current top of the pile */
  160.     unsigned msgnbr;    /* current highest message number */
  161.  
  162.     int messages;        /* total messages allowed */
  163.     int msgsize;        /* size of each message body record */
  164.     struct {
  165.         char name[8];    /* topic name, */
  166.         char desc[24];    /* its description */
  167.     } topic[16];        /* 16 of 'em */
  168.  
  169.     int maxbaud;        /* maximum baud rate */
  170.     char mdmstr[SS];    /* modem initialization string */
  171.     WORD cd_bit;        /* bit to test for Carrier Detect, */
  172.     int iodev;        /* default serial channel number */    
  173.  
  174.     int connect_tries;    /* attempt with connect limit */
  175.     int dial_tries;        /* dial attempts */
  176.  
  177.     struct _sched sched[SCHEDS]; /* the schedulers event table */
  178.  
  179.     char filepref[SS];    /* file upload & download prefix */
  180. };
  181.  
  182.  
  183. /* This is the structure used to make getinfo() calls, and both returns
  184. the desired information and stores information needed by the getinfo()
  185. function itself between interations. The first half is the interface part;
  186. Pup code depends on those fields being there. The lower half is used by
  187. the getinfo() function itself. Change as you see fit. */
  188.  
  189. struct _fileinfo {
  190.  
  191.     char name[13];        /* REQUIRED filename (no path, drive, etc) */
  192.     long size;        /* REQUIRED file size */
  193.     struct _time time;    /* REQUIRED creation time (may be zero's) */
  194.  
  195. /* This is the block of shit that getinfo() uses internally. */
  196.  
  197.     struct {
  198.         char s_attrib;    /* Search attribute */
  199.         char x[21];
  200.         WORD time;    /* MSDOS packed time */
  201.         WORD date;    /* MSDOS packed date */
  202.         long fsize;    /* MSDOS file size */
  203.         char name[13];    /* MSDOS packed name */
  204.     } xfbuf;
  205. };
  206.