home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / UUPC11XS.ZIP / LIB / HOSTABLE.H < prev    next >
C/C++ Source or Header  |  1992-11-27  |  5KB  |  105 lines

  1. /*
  2.    hostable.h
  3.  
  4.    routines included in hostable.c
  5.  
  6.    Copyright (c) 1989, 1990  Andrew H. Derbyshire
  7.  
  8.    Update History:
  9.  
  10.    18Mar90     Create from router.c                                  ahd
  11.  */
  12.  
  13. #ifndef __HOSTABLE
  14. #define __HOSTABLE
  15.  
  16. #ifndef __LIB
  17. #error Need "LIB.H"
  18. #endif
  19.  
  20. #define UUCPSHELL "uucp"         /* Shell for UUCP users                */
  21. #define ANONYMOUS_HOST "*anonymous" /* Anonymous systems                */
  22.  
  23. #define BADHOST NULL
  24.  
  25. #define HOSTLEN   8           /* max length of host name without '\0'   */
  26.  
  27. /*--------------------------------------------------------------------*/
  28. /*    Note in the following table that "fake" hosts must precede      */
  29. /*    "nocall" and "real" hosts must follow it.                       */
  30. /*--------------------------------------------------------------------*/
  31.  
  32. typedef enum
  33.                 { phantom = 0,      /* Entry not fully initialized      */
  34.                   localhost,        /* This entry is for ourselves      */
  35.                   gatewayed,        /* This entry is delivered to via   */
  36.                                     /* an external program on local sys */
  37.                   nocall,           /* real host, never called          */
  38.                   autodial,         /* Dialing the phone now            */
  39.                   invalid_device,   /* Invalid systems file             */
  40.                   nodevice,         /* Could not open device            */
  41.                   startup_failed,   /* Determined system, start failed  */
  42.                   inprogress,       /* Call now active                  */
  43.                   callback_req,     /* System must call us back         */
  44.                   dial_script_failed,
  45.                                     /* Modem initialize failed          */
  46.                   dial_failed,      /* Hardcoded auto-dial failed       */
  47.                   script_failed,    /* script in L.SYS failed           */
  48.                   max_retry,        /* Have given up calling this sys   */
  49.                   too_soon,         /* In retry mode, too soon to call  */
  50.                   succeeded,        /* self-explanatory                 */
  51.                   wrong_host,       /* Call out failed, wrong system    */
  52.                   unknown_host,     /* Call in failed, unknown system   */
  53.                   call_failed,      /* Connection aborted for various
  54.                                        reasons                          */
  55.                   wrong_time,       /* Unable to call because of time   */
  56.                   called,           /* success this run of UUCICO       */
  57.                   last_status }
  58.                         hostatus;
  59.  
  60. /*--------------------------------------------------------------------*/
  61. /*                          Status information                        */
  62. /*--------------------------------------------------------------------*/
  63.  
  64. struct HostStats {
  65.       time_t ltime;              /* Last time this host was called      */
  66.       time_t lconnect;           /* Last time we actually connected     */
  67.       unsigned long calls;       /* Total number of calls to host       */
  68.       unsigned long connect;     /* Total length of connections to host */
  69.       unsigned long fsent;       /* Total files sent to this host       */
  70.       unsigned long freceived;   /* Total files received from this host */
  71.       unsigned long bsent;       /* Total bytes sent to this host       */
  72.       unsigned long breceived;   /* Total bytes received from this host */
  73.       unsigned long errors;      /* Total transmission errors noted     */
  74.       unsigned long packets;     /* Total packets exchanged             */
  75.       hostatus save_hstatus;     /* host status, as defined by hostatus */
  76.    };
  77.  
  78. /*--------------------------------------------------------------------*/
  79. /*                          Master hostable                           */
  80. /*--------------------------------------------------------------------*/
  81.  
  82. struct  HostTable {
  83.       char  *hostname;           /* Name of the host in question        */
  84.       char  *via;                /* Host hostname is routed via         */
  85.       char  *realname;           /* Alias of this host name             */
  86.       struct HostStats *hstats;  /* Point to stats for real hosts only  */
  87.       struct HostSecurity *hsecure; /* Security Information, real hosts
  88.                                        only                             */
  89.       boolean anylogin;          /* TRUE = Can login with any generic
  90.                                     user id                             */
  91.       boolean  aliased;          /* TRUE = alias has been optimized     */
  92.       boolean  routed;           /* TRUE = route has been optimized     */
  93.       hostatus hstatus;          /* host status, as defined by hostatus */
  94.    };
  95.  
  96. struct HostTable *searchname(const char *name, const size_t namel);
  97.  
  98. struct HostTable *checkname(const char *name);
  99.  
  100. struct HostTable *checkreal(const char *name);
  101.  
  102. struct HostTable *nexthost( const boolean start );
  103.  
  104. #endif
  105.