home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / WWIV2.ZIP / NET.H < prev    next >
C/C++ Source or Header  |  1992-12-03  |  10KB  |  233 lines

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