home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / UTIL / WWIVE / NET.H < prev    next >
C/C++ Source or Header  |  1991-04-23  |  10KB  |  248 lines

  1. #ifndef _NET_H_
  2. #define _NET_H_
  3.  
  4.  
  5. /*****************************************************************************
  6.  
  7.                 WWIV Version 4
  8.                     Copyright (C) 1988-1991 by Wayne Bell
  9.  
  10. Distribution of the source code for WWIV, in any form, modified or unmodified,
  11. without PRIOR, WRITTEN APPROVAL by the author, is expressly prohibited.
  12. Distribution of compiled versions of WWIV is limited to copies compiled BY
  13. THE AUTHOR.  Distribution of any copies of WWIV not compiled by the author
  14. is expressly prohibited.
  15.  
  16.  
  17. *****************************************************************************/
  18.  
  19. typedef struct {
  20.     unsigned short    tosys,        /* destination system */
  21.             touser,        /* destination user */
  22.             fromsys,    /* originating system */
  23.             fromuser;    /* originating user */
  24.     unsigned short    main_type,    /* main message type */
  25.             minor_type;    /* minor message type */
  26.     unsigned short    list_len;    /* # of entries in system list */
  27.     unsigned long    daten;        /* date/time sent */
  28.     unsigned long    length;        /* # of bytes of msg after header */
  29.     unsigned short    method;        /* method of compression */
  30. } net_header_rec;
  31.  
  32. /* All network nodes except the destination will only look at:
  33.  *   tosys - the destination system.  Is 0 if more than one system
  34.  *   list_len - if (tosys==0) then list_len is the number of destination
  35.  *     systems in a list immediately after the header.  NOTE this list will
  36.  *     be 2*list_len bytes long, since each system entry is 2 bytes.
  37.  *   length - is the overall length of the message, not including the header
  38.  *     or the system ist length.  Thus the overall length of a message in
  39.  *     the net will be (sizeof(net_header_rec) + 2*list_len + length)
  40.  */
  41.  
  42.  
  43.  
  44. /*
  45.  * Please note that not all of these are used yet, some will probably never
  46.  * be used, but sounded like a good idea at the time.
  47.  */
  48.  
  49. #define main_type_net_info 0x0001
  50.   /* Here, minor_type will tell what type of net info this contains, such as
  51.    * a new list of nodes, mail to the sysop, or whatever
  52.    */
  53. #define main_type_email 0x0002
  54.   /* Here, minor_type will be zero
  55.    */
  56. #define main_type_post 0x0003
  57.   /* Here, minor_type will contain the sub type of the post.  It will tell
  58.    * the BBS what subboard to post the message on
  59.    */
  60. #define main_type_file 0x0004
  61.   /* I don't know if this will be used, but if it is, minor_type will contain
  62.    * the dir type of the dir the file will go on
  63.    */
  64. #define main_type_pre_post 0x0005
  65.   /* this is like a post, but for this type, the post needs to be sent out to
  66.    * a few other systems when the destination system receives it.
  67.    */
  68. #define main_type_external 0x0006
  69.   /* This is reserved for use by programs external to WWIV
  70.    */
  71. #define main_type_email_name 0x0007
  72.   /* used in sending email to a user's name on another system
  73.    */
  74. #define main_type_net_edit 0x0008
  75.   /* used by the net editor program
  76.    */
  77. #define main_type_sub_list 0x0009
  78.   /* used for sending updates of the sub list
  79.    */
  80. #define main_type_extra_data 0x000a
  81.   /* used for sending net info not necessarily from @1
  82.    */
  83. #define main_type_group_bbslist 0x000b
  84.   /* used for sending out bbslist.net entries for a group - goes to
  85.    * bbslist.[group number].  Minor type is group number.
  86.    */
  87. #define main_type_group_connect 0x000c
  88.   /* used for sending out connect.net entries for a group - goes to
  89.    * connect.[group number].  Minor type is group number.
  90.    */
  91. #define main_type_group_info 0x000e
  92.   /* used for sending out group info, such as mail-to-all-sysops in
  93.    * a group
  94.    */
  95.  
  96. typedef struct {
  97.     unsigned short    systemnumber,    /* System number of the contact */
  98.             numcontacts,    /* number of contacts with system */
  99.             numfails;    /* number of consec failed calls out */
  100.     unsigned long    firstcontact,    /* time of first contact with system */
  101.             lastcontact,    /* time of most recent contact */
  102.             lastcontactsent,/* time of last contact with data sent */
  103.             lasttry,    /* time of last try to connect */
  104.             bytes_received,    /* bytes received from system */
  105.             bytes_sent,    /* bytes sent to system */
  106.             bytes_waiting;    /* bytes waiting to be sent */
  107. } net_contact_rec;
  108.  
  109. /* Each system will hold a file of these records.  Each record will hold the
  110.  * data pertaining to all contacts with other systems.
  111.  *
  112.  * systemnumber tells what other system this data is for.
  113.  * numcontacts tells how many times a connection has been made with
  114.  *   that system.
  115.  * numfails tells how many times this system has tried to call this other
  116.  *   system but failed.  This is consecutive times, and is zeroed out
  117.  *   when a successful connection is made by calling out.
  118.  * firstcontact is time in unix format of the last time that system has been
  119.  *   contacted on the net.
  120.  * lastcontact is the time the last contact with that system was made.
  121.  * lastcontactsent is the last time data was SENT to that system.
  122.  * lasttry is the last time we tried to call out to that system.
  123.  * bytes_received is number of bytes received from that system.
  124.  * bytes_sent is number of bytes sent to that system.
  125.  * bytes_waiting is the number of bytes waiting to be sent out to that
  126.  *   system.
  127.  *
  128.  * This data is maintained so that the BBS can decide which other system to
  129.  * attempt connection with next.
  130.  */
  131.  
  132.  
  133. typedef struct {
  134.     unsigned int    sysnum;        /* system number of the system */
  135.     char        phone[13],    /* phone number of system */
  136.                         name[40];       /* name of system */
  137.         unsigned char   group;          /* group of the system */
  138.     unsigned int    speed,        /* max baud rate of system */
  139.             other,        /* other info about sys (bit-mapped)*/
  140.             forsys;        /* how to get there */
  141.     int        numhops;    /* how long to get there */
  142.         union {
  143.           unsigned int    rout_fact;    /* routing factor */
  144.           float           cost;         /* cost factor */
  145.         } xx;
  146. } net_system_list_rec;
  147.  
  148. /* This data is all read in from a text file which holds info about all of
  149.  * the systems in the network.  This text file doesn't hold connection info
  150.  * between the systems.  The purpose of all records should be obvious.
  151.  */
  152.  
  153. #define other_fido 0x0001           /* \ */
  154.  
  155. /* modem type designators */
  156. #define other_Telebit_19200 0x0002  /* | */
  157. #define other_USR_9600 0x0004       /* < */
  158. #define other_Hayes_9600 0x0008     /* > */
  159. #define other_V32 0x0020            /* ! */
  160. #define other_V42 0x0040            /* $ */
  161. #define other_compucom 0x0400       /* / */
  162. #define other_FAX 0x1000            /* ? */
  163.  
  164. /* system type designators */
  165. #define other_coordinator 0x0010    /* ^ */
  166. #define other_group_coord 0x0100    /* % */
  167. #define other_net_coord   0x0200    /* & */
  168.  
  169. #define other_net_server 0x0800     /* + */
  170. #define other_PCP 0x0080            /* = */
  171.  
  172.  
  173. typedef struct {
  174.     unsigned int    sysnum,        /* outward calling system */
  175.             numsys;        /* num systems it can call */
  176.     unsigned int    *connect;    /* list of numsys systems */
  177.     float        *cost;        /* list of numsys costs */
  178. } net_interconnect_rec;
  179.  
  180. /* This data is also read in from a text file.  It tells how much it costs for
  181.  * sysnum to call out to other systems.
  182.  *
  183.  * numsys - is the number of systems that sysnum can call out to
  184.  * connect[] - points to an array of numsys integers that tell which
  185.  *   other systems sysnum can connect to
  186.  * cost[] - points to an array of numsys floating point numbers telling
  187.  *   how much it costs to connect to that system, per minute.  ie, it would
  188.  *   cost (cost[1]) dollars per minute for sysnum to call out to system
  189.  *   number (connect[1]).
  190.  */
  191.  
  192.  
  193. typedef struct {
  194.     unsigned int    sysnum;        /* system to contact */
  195.     unsigned char    macnum;        /* macro/script to use */
  196.     unsigned int    options;    /* bit mapped */
  197.     unsigned char    call_anyway;    /* num days between calls */
  198.         char            min_hr,
  199.                         max_hr;         /* calling hours */
  200.     char        password[20];    /* password for that system */
  201.         unsigned char   times_per_day;  /* num times should call per day */
  202. } net_call_out_rec;
  203.  
  204. /* This record holds info about other systems that the sysop has determined
  205.  * that we can call out to.
  206.  *
  207.  * sysnum - system number that we can call
  208.  * macnum - macro/script number to use to call that system.  This is set
  209.  *   to zero if we just dial it directly.
  210.  * options - bit mapped.  See #define's below.
  211.  * call_anyway - if non-zero, then the minimum number of days between calls
  212.  *   to that system, even if there is nothing waiting to be sent there.  This
  213.  *   should only be non-zero if options_sendback is also set for this system.
  214.  * password - is the password used for connection to this system.
  215.  */
  216.  
  217.  
  218. #define options_sendback 0x0001
  219.   /* Set if, when we call that system, they can send data back to us.
  220.    */
  221. #define options_ATT_night 0x0002
  222.   /* Set if we can only call that system at AT&T nighttime hours, which
  223.    * includes weekends.
  224.    */
  225. #define options_PCP_night 0x0004
  226.   /* Set if we can only call that system during PC Pursuit hours.
  227.    */
  228. #define options_no_call 0x0008
  229.   /* Set if we don't call out to that system, but that system will call us
  230.    * with sendback allowed.  Thus, we can direct stuff to that system, even
  231.    * though we won't ever directly call it.
  232.    */
  233. #define options_receive_only 0x0010
  234.   /* Set if we will receive things but won't xmit them */
  235. #define options_once_per_day 0x0020
  236.   /* Set if we have to wait 20 hours between calls */
  237. #define options_compress 0x0040
  238.   /* set if we want to use WWIVnet compression with this node */
  239.  
  240. typedef struct {
  241.     unsigned int    sysnum;        /* system number we can call */
  242.     int        nument;        /* number of entries in list */
  243.     unsigned int    *list;        /* list of systems */
  244. } sys_for_rec;
  245.  
  246.  
  247. #endif
  248.