home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / INTERNET / UPC2S1.ZIP / HOSTABLE.H < prev    next >
C/C++ Source or Header  |  1993-07-06  |  7KB  |  135 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    h  o s t a b l e . h                                            */
  3. /*                                                                    */
  4. /*    Routines included in hostable.c                                 */
  5. /*--------------------------------------------------------------------*/
  6.  
  7. /*--------------------------------------------------------------------*/
  8. /*    Changes Copyright (c) 1990-1993 by Kendra Electronic            */
  9. /*    Wonderworks.                                                    */
  10. /*                                                                    */
  11. /*    All rights reserved except those explicitly granted by the      */
  12. /*    UUPC/extended license agreement.                                */
  13. /*--------------------------------------------------------------------*/
  14.  
  15. /*--------------------------------------------------------------------*/
  16. /*                          RCS Information                           */
  17. /*--------------------------------------------------------------------*/
  18.  
  19.  /*
  20.   *   $Id: hostable.h 1.3 1993/07/06 10:57:42 ahd Exp $
  21.   *
  22.   *   $Log: hostable.h $
  23.  *     Revision 1.3  1993/07/06  10:57:42  ahd
  24.  *     Under Windows/NT pack structure to insure proper alignment
  25.  *
  26.   *    Revision 1.2  1992/12/30  12:52:31  dmwatt
  27.   *    Use shorts for table to insure compatiablity across 32 bit/16 bit OSes
  28.   *
  29.   *
  30.   *   18Mar90     Create from router.c
  31.   *   21Dec92     Make all "enum hostatus"'s into unsigned shorts for
  32.   *               NT portability
  33.   */
  34.  
  35. #ifndef __HOSTABLE
  36. #define __HOSTABLE
  37.  
  38. #ifndef __LIB
  39. #error Need "LIB.H"
  40. #endif
  41.  
  42. #define UUCPSHELL "uucp"         /* Shell for UUCP users                */
  43. #define ANONYMOUS_HOST "*anonymous" /* Anonymous systems                */
  44.  
  45. #define BADHOST NULL
  46.  
  47. #define HOSTLEN   8           /* max length of host name without '\0'   */
  48.  
  49. /*--------------------------------------------------------------------*/
  50. /*    Note in the following table that "fake" hosts must precede      */
  51. /*    "nocall" and "real" hosts must follow it.                       */
  52. /*--------------------------------------------------------------------*/
  53.  
  54. typedef enum
  55.                 { phantom = 0,      /* Entry not fully initialized      */
  56.                   localhost,        /* This entry is for ourselves      */
  57.                   gatewayed,        /* This entry is delivered to via   */
  58.                                     /* an external program on local sys */
  59.                   nocall,           /* real host, never called          */
  60.                   autodial,         /* Dialing the phone now            */
  61.                   invalid_device,   /* Invalid systems file             */
  62.                   nodevice,         /* Could not open device            */
  63.                   startup_failed,   /* Determined system, start failed  */
  64.                   inprogress,       /* Call now active                  */
  65.                   callback_req,     /* System must call us back         */
  66.                   dial_script_failed,
  67.                                     /* Modem initialize failed          */
  68.                   dial_failed,      /* Hardcoded auto-dial failed       */
  69.                   script_failed,    /* script in L.SYS failed           */
  70.                   max_retry,        /* Have given up calling this sys   */
  71.                   too_soon,         /* In retry mode, too soon to call  */
  72.                   succeeded,        /* self-explanatory                 */
  73.                   wrong_host,       /* Call out failed, wrong system    */
  74.                   unknown_host,     /* Call in failed, unknown system   */
  75.                   call_failed,      /* Connection aborted for various
  76.                                        reasons                          */
  77.                   wrong_time,       /* Unable to call because of time   */
  78.                   called,           /* success this run of UUCICO       */
  79.                   last_status }
  80.                         hostatus;
  81.  
  82. /*--------------------------------------------------------------------*/
  83. /*                          Status information                        */
  84. /*--------------------------------------------------------------------*/
  85.  
  86. #if defined(WIN32)
  87. #pragma pack(1)
  88. #endif
  89.  
  90. struct HostStats {
  91.       time_t ltime;              /* Last time this host was called      */
  92.       time_t lconnect;           /* Last time we actually connected     */
  93.       unsigned long calls;       /* Total number of calls to host       */
  94.       unsigned long connect;     /* Total length of connections to host */
  95.       unsigned long fsent;       /* Total files sent to this host       */
  96.       unsigned long freceived;   /* Total files received from this host */
  97.       unsigned long bsent;       /* Total bytes sent to this host       */
  98.       unsigned long breceived;   /* Total bytes received from this host */
  99.       unsigned long errors;      /* Total transmission errors noted     */
  100.       unsigned long packets;     /* Total packets exchanged             */
  101.       unsigned short save_hstatus;
  102.    };
  103.  
  104. #if defined(WIN32)
  105. #pragma pack()
  106. #endif
  107.  
  108. /*--------------------------------------------------------------------*/
  109. /*                          Master hostable                           */
  110. /*--------------------------------------------------------------------*/
  111.  
  112. struct  HostTable {
  113.       char  *hostname;           /* Name of the host in question        */
  114.       char  *via;                /* Host hostname is routed via         */
  115.       char  *realname;           /* Alias of this host name             */
  116.       struct HostStats *hstats;  /* Point to stats for real hosts only  */
  117.       struct HostSecurity *hsecure; /* Security Information, real hosts
  118.                                        only                             */
  119.       boolean anylogin;          /* TRUE = Can login with any generic
  120.                                     user id                             */
  121.       boolean  aliased;          /* TRUE = alias has been optimized     */
  122.       boolean  routed;           /* TRUE = route has been optimized     */
  123.       unsigned short hstatus;          /* host status, as defined by hostatus */
  124.    };
  125.  
  126. struct HostTable *searchname(const char *name, const size_t namel);
  127.  
  128. struct HostTable *checkname(const char *name);
  129.  
  130. struct HostTable *checkreal(const char *name);
  131.  
  132. struct HostTable *nexthost( const boolean start );
  133.  
  134. #endif
  135.