home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / PPPBCKP / SRC / SRC20A01.ZIP / NET.H < prev    next >
C/C++ Source or Header  |  1999-03-11  |  15KB  |  305 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                             WWIV Version 4.3x                            */
  4. /*                Copyright (C) 1999 by WWIV Software Services              */
  5. /*                                                                          */
  6. /*      Distribution or publication of this source code, it's individual    */
  7. /*       components, or a compiled version thereof, whether modified or     */
  8. /*        unmodified, without PRIOR, WRITTEN APPROVAL of WWIV Software      */
  9. /*        Services is expressly prohibited.  Distribution of compiled       */
  10. /*            versions of WWIV is restricted to copies compiled by          */
  11. /*           WWIV Software Services.  Violators will be procecuted!         */
  12. /*                                                                          */
  13. /****************************************************************************/
  14.  
  15. #ifndef _NET_H_
  16. #define _NET_H_
  17.  
  18. /* Defining USE_FTS activates The File Transfer System */
  19. #define USE_FTS
  20.  
  21. /* All network nodes except the destination will only look at:
  22.  *   tosys - the destination system.  Is 0 if more than one system
  23.  *   list_len - if (tosys==0) then list_len is the number of destination
  24.  *     systems in a list immediately after the header.  NOTE this list will
  25.  *     be 2*list_len bytes long, since each system entry is 2 bytes.
  26.  *   length - is the overall length of the message, not including the header
  27.  *     or the system ist length.  Thus the overall length of a message in
  28.  *     the net will be (sizeof(net_header_rec) + 2*list_len + length)
  29.  */
  30.  
  31.  
  32. typedef struct {
  33.     unsigned short    tosys,        /* destination system */
  34.                     touser,     /* destination user */
  35.                     fromsys,    /* originating system */
  36.                     fromuser,   /* originating user */
  37.                     main_type,  /* main message type */
  38.                     minor_type, /* minor message type */
  39.                     list_len;   /* # of entries in system list */
  40.     unsigned long   daten,      /* date/time sent */
  41.                     length;     /* # of bytes of msg after header */
  42.     unsigned short    method;        /* method of compression */
  43. } net_header_rec;
  44.  
  45.  
  46. /*
  47.  * Please note that not all of these are used yet, some will probably never
  48.  * be used, but sounded like a good idea at the time.
  49.  */
  50.  
  51. #define main_type_net_info        0x0001  /* type 1 normal network updates */
  52. #define main_type_email           0x0002  /* type 2 email by user number */
  53. #define main_type_post            0x0003  /* type 3 post from sub host */
  54. #define main_type_file            0x0004  /* type 4 file transfer system */
  55. #define main_type_pre_post        0x0005  /* type 5 post to sub host */
  56. #define main_type_external        0x0006  /* type 6 external message */
  57. #define main_type_email_name      0x0007  /* type 7 email by user name */
  58. #define main_type_net_edit        0x0008  /* type 8 network editor packet */
  59. #define main_type_sub_list        0x0009  /* type 9 subs.lst update */
  60. #define main_type_extra_data      0x000a  /* type 10 unused */
  61. #define main_type_group_bbslist   0x000b  /* type 11 network update from GC */
  62. #define main_type_group_connect   0x000c  /* type 12 network update from GC */
  63. #define main_type_unsed_1         0x000d  /* type 13 unused */
  64. #define main_type_group_info      0x000e  /* type 14 misc update from GC */
  65. #define main_type_ssm             0x000f  /* type 15 so-and-so read your mail */
  66. #define main_type_sub_add_req     0x0010  /* type 16 add me to your subboard */
  67. #define main_type_sub_drop_req    0x0011  /* type 17 remove me from your subboard */
  68. #define main_type_sub_add_resp    0x0012  /* type 18 status of add, 0=ok */
  69. #define main_type_sub_drop_resp   0x0013  /* type 19 status of drop, 0=ok */
  70. #define main_type_sub_list_info   0x0014  /* type 20 info for subs.lst file */
  71.  
  72. #define main_type_new_post        0x001a  /* type 26 post by sub name */
  73. #define main_type_new_extern      0x001b  /* type 27 auto-processing external msgs */
  74. #define main_type_game_pack       0x001c  /* type 28 game packs */
  75.  
  76.  
  77. /* these are in main_type_sub_*_resp, as the first byte of the text */
  78. #define sub_adddrop_ok            0x00  /* you've been added/removed */
  79. #define sub_adddrop_not_host      0x01  /* don't host that sub */
  80. #define sub_adddrop_not_there     0x02  /* can't drop, you're not listed */
  81. #define sub_adddrop_not_allowed   0x03  /* not allowed to add/drop you */
  82. #define sub_adddrop_already_there 0x04  /* already in sub */
  83. #define sub_adddrop_error         0xff  /* internal error */
  84.  
  85. typedef struct {
  86.     unsigned short  systemnumber,       /* System number of the contact */
  87.                     numcontacts,        /* number of contacts with system */
  88.                     numfails;           /* number of consec failed calls out */
  89.     unsigned long   firstcontact,       /* time of first contact with system */
  90.                     lastcontact,        /* time of most recent contact */
  91.                     lastcontactsent,    /* time of last contact with data sent */
  92.                     lasttry,            /* time of last try to connect */
  93.                     bytes_received,     /* bytes received from system */
  94.                     bytes_sent,         /* bytes sent to system */
  95.                     bytes_waiting;      /* bytes waiting to be sent */
  96. } net_contact_rec;
  97.  
  98. /* Each system will hold a file of these records.  Each record will hold the
  99.  * data pertaining to all contacts with other systems.
  100.  *
  101.  * systemnumber tells what other system this data is for.
  102.  * numcontacts tells how many times a connection has been made with that system.
  103.  * numfails tells how many times this system has tried to call this other
  104.  *   system but failed.  This is consecutive times, and is zeroed out
  105.  *   when a successful connection is made by calling out.
  106.  * firstcontact is time in unix format of the last time that system has been
  107.  *   contacted on the net.
  108.  * lastcontact is the time the last contact with that system was made.
  109.  * lastcontactsent is the last time data was SENT to that system.
  110.  * lasttry is the last time we tried to call out to that system.
  111.  * bytes_received is number of bytes received from that system.
  112.  * bytes_sent is number of bytes sent to that system.
  113.  * bytes_waiting is the number of bytes waiting to be sent out to that
  114.  *   system.
  115.  *
  116.  * This data is maintained so that the BBS can decide which other system to
  117.  * attempt connection with next.
  118.  */
  119.  
  120.  
  121. typedef struct {
  122.     unsigned short  sysnum;         /* system number of the system */
  123.     char            phone[13],      /* phone number of system */
  124.                     name[40];       /* name of system */
  125.     unsigned char   group;          /* group of the system */
  126.     unsigned short  speed,          /* max baud rate of system */
  127.                     other,          /* other info about sys (bit-mapped)*/
  128.                     forsys;         /* how to get there */
  129.     short           numhops;        /* how long to get there */
  130.     union {
  131.         unsigned short  rout_fact;  /* routing factor */
  132.         float           cost;       /* cost factor */
  133.         long            temp;       /* temporary variable */
  134.     } xx;
  135. } net_system_list_rec;
  136.  
  137. /* This data is all read in from a text file which holds info about all of
  138.  * the systems in the network.  This text file doesn't hold connection info
  139.  * between the systems.  The purpose of all records should be obvious.
  140.  */
  141.  
  142.  
  143. /* BBSLIST designators
  144. *
  145. *  Reworked TJ - Modem identifiers have been obsolete for ages and were
  146. *  used nowhere in the BBS or network code.  Why not put them to good
  147. *  use?
  148. */
  149.  
  150. #define other_inet          0x0001  /* $ - System is PPP capable         */
  151. #define other_fido          0x0002  /* \ - System run Fido frontend      */
  152. #define other_telnet        0x0004  /* | - System is a telnet node       */
  153. #define other_no_links      0x0008  /* < - System refuses links          */
  154. #define other_fts_blt       0x0010  /* > - System uses FTS/BLT system    */
  155. #define other_direct        0x0020  /* ! - System accepts direct connects*/
  156. #define other_unregistered  0x0040  /* / - System is unregistered        */
  157. #define other_fax           0x0080  /* ? - System accepts faxes          */
  158. #define other_end_system    0x0100  /* _ - System is a dead end node     */
  159. #define other_net_server    0x0200  /* + - System is network server      */
  160. #define other_unused        0x0400  /* = - Unused identifier 2           */
  161.  
  162. /* system type designators */
  163. #define other_net_coord     0x0800  /* & - NC */
  164. #define other_group_coord   0x1000  /* % - GC */
  165. #define other_area_coord    0x2000  /* ^ - AC */
  166. #define other_subs_coord    0x4000  /* ~ - Sub Coordinator */
  167.  
  168.  
  169.  
  170. typedef struct {
  171.     unsigned short  sysnum,     /* outward calling system */
  172.                     numsys;     /* num systems it can call */
  173.     unsigned short  *connect;   /* list of numsys systems */
  174.     float           *cost;      /* list of numsys costs */
  175. } net_interconnect_rec;
  176.  
  177. /* This data is also read in from a text file.  It tells how much it costs for
  178.  * sysnum to call out to other systems.
  179.  *
  180.  * numsys - is the number of systems that sysnum can call out to
  181.  * connect[] - points to an array of numsys integers that tell which
  182.  *   other systems sysnum can connect to
  183.  * cost[] - points to an array of numsys floating point numbers telling
  184.  *   how much it costs to connect to that system, per minute.  ie, it would
  185.  *   cost (cost[1]) dollars per minute for sysnum to call out to system
  186.  *   number (connect[1]).
  187.  */
  188.  
  189.  
  190. typedef struct {
  191.     unsigned short  sysnum;         /* system number */
  192.     unsigned char   macnum;         /* macro/script to use */
  193.     unsigned short  options;        /* bit mapped */
  194.     unsigned char   call_anyway;    /* days between callouts */
  195.     char            min_hr,         /* callout min hour */
  196.                     max_hr;         /* callout max hour */
  197.     char            password[20];   /* password for system */
  198.     unsigned char   times_per_day;  /* number of calls per day */
  199.     unsigned char   call_x_days;    /* call only every x days */
  200.     unsigned short  min_k;          /* minimum # k before callout */
  201.     char *          opts;           /* options or NULL */
  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   /* & they can send data back */
  219. #define options_ATT_night     0x0002   /* - callout only at AT&T nigh hours */
  220. /* changed TJ */
  221. #define options_ppp           0x0004   /* _ transfer via PPP */
  222. #define options_no_call       0x0008   /* + don't call that system, it will call */
  223. #define options_receive_only  0x0010   /* ~ never send anything to the system */
  224. #define options_once_per_day  0x0020   /* ! only call once per day */
  225. #define options_compress      0x0040   /* ; compress data */
  226. #define options_hslink        0x0080   /* ^ use HSLINK if available */
  227. #define options_force_ac      0x0100   /* $ force area code on dial */
  228. /* added TJ */
  229. #define options_dial_ten      0x0200   /* * use ten digit dialing format */
  230. /* changed TJ */
  231. #define options_hide_pend     0x0400   /* = hide in pending display */
  232.  
  233. typedef struct {
  234.         unsigned short  sysnum;         /* system number we can call */
  235.         short           nument;         /* number of entries in list */
  236.         unsigned short  *list;          /* list of systems */
  237. } sys_for_rec;
  238.  
  239.  
  240. typedef struct {
  241.         unsigned char   type;           /* type of network */
  242.         char            name[16];       /* network name */
  243.         char            dir[69];        /* directory for net data */
  244.         unsigned short  sysnum;         /* system number */
  245.         net_call_out_rec far *con;      /* ptr to callout data */
  246.         net_contact_rec far *ncn;       /* ptr to contact info */
  247.         short           num_con;        /* number in array */
  248.         short           num_ncn;        /* number in array */
  249. } net_networks_rec;
  250.  
  251. #define net_type_wwivnet  0
  252. #define net_type_fidonet  1
  253. #define net_type_internet 2  /* added TJ - Need to change INIT */
  254.  
  255. /*************************/
  256. /* FTS System Structures */
  257. /*************************/
  258. #ifdef USE_FTS
  259. typedef struct {
  260.     char            filename[13];       /* name of file */
  261.     long            filesize;           /* size of file */
  262.     char            description[59];    /* description  */
  263.     unsigned long   crc32value;         /* crc value of file */
  264.     int             maintype,           /* fts maintype */
  265.                     fdltype,            /* fdl type */
  266.                     chunkcount,         /* number of this chunk */
  267.                     totalchunks;        /* total number of chunks */
  268.     char            sysname[60],        /* name of originating system */
  269.                     tonet[16];          /* destination network name */
  270.     int             tosys,              /* destination system */
  271.                     touser;             /* destination user */
  272.     char            fromnet[16];        /* originating network name */
  273.     int             fromsys,            /* originating system */
  274.                     fromuser,           /* originating user */
  275.                     ver,                /* version of fts system */
  276.                     info;               /* 1=key 2=sec'd file req  */
  277.     char            xtrastuff[16];      /*                                */
  278. } fts_header;
  279.  
  280. #define fdl_requestable 0x0001
  281. #define fdl_postable    0x0004
  282. #define fdl_wwivreg     0x0008
  283.  
  284. typedef struct {
  285.     char name[61];
  286.     int  fdl,
  287.          host;
  288.     long status;
  289.     char res[41];
  290. } fdlrec_rec;
  291.  
  292. typedef struct {
  293.     char name[61];
  294.     int  blt,
  295.          host;
  296.     long status;
  297.     char res[41];
  298. } bltrec_rec;
  299.  
  300. #endif
  301. /************************/
  302. /************************/
  303.  
  304. #endif
  305.