home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / ns2tab / part01 / res.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-04  |  2.6 KB  |  111 lines

  1. /*
  2.  *******************************************************************************
  3.  *
  4.  *  res.h --
  5.  *
  6.  *    Definitions used by modules of the name server lookup program.
  7.  *
  8.  *    Copyright (c) 1985
  9.  *    Andrew Cherenson
  10.  *    U.C. Berkeley
  11.  *    CS298-26  Fall 1985
  12.  * 
  13.  *******************************************************************************
  14.  */
  15.  
  16. #define TRUE    1
  17. #define FALSE    0
  18. typedef int Boolean;
  19.  
  20. /*
  21.  *  Define return statuses in addtion to the ones defined in namserv.h
  22.  *   let SUCCESS be a synonym for NOERROR
  23.  *
  24.  *    TIME_OUT    - a socket connection timed out.
  25.  *    NO_INFO        - the server didn't find any info about the host.
  26.  *    ERROR        - one of the following types of errors:
  27.  *               dn_expand, res_mkquery failed
  28.  *               bad command line, socket operation failed, etc.
  29.  *    NONAUTH        - the server didn't have the desired info but
  30.  *              returned the name(s) of some servers who should.
  31.  *    NO_RESPONSE    - the server didn't respond.
  32.  *
  33.  */
  34.  
  35. #define  SUCCESS        0
  36. #define  TIME_OUT        -1
  37. #define  NO_INFO        -2
  38. #define  ERROR            -3
  39. #define  NONAUTH        -4
  40. #define  NO_RESPONSE        -5
  41.  
  42. /*
  43.  *  Define additional options for the resolver state structure.
  44.  *
  45.  *   RES_DEBUG2        more verbose debug level
  46.  */
  47.  
  48. #define RES_DEBUG2    0x80000000
  49.  
  50. /*
  51.  *  Maximum length of server, host and file names.
  52.  */
  53.  
  54. #define NAME_LEN 256
  55.  
  56.  
  57. /*
  58.  * Modified struct hostent from <netdb.h>
  59.  *
  60.  * "Structures returned by network data base library.  All addresses
  61.  * are supplied in host order, and returned in network order (suitable
  62.  * for use in system calls)."
  63.  */
  64.  
  65. typedef struct    {
  66.     char    *name;        /* official name of host */
  67.     char    **domains;    /* domains it serves */
  68.     char    **addrList;    /* list of addresses from name server */
  69. } ServerInfo;
  70.  
  71. typedef struct    {
  72.     char    *name;        /* official name of host */
  73.     char    **aliases;    /* alias list */
  74.     char    **addrList;    /* list of addresses from name server */
  75.     int    addrType;    /* host address type */
  76.     int    addrLen;    /* length of address */
  77.     ServerInfo **servers;
  78. } HostInfo;
  79.  
  80.  
  81. /*
  82.  *  FilePtr is used for directing listings to a file.
  83.  *  It is global so the Control-C handler can close it.
  84.  */
  85.  
  86. extern FILE *filePtr;
  87.  
  88. /*
  89.  * TCP/UDP port of server.
  90.  */
  91. extern unsigned short nsport;
  92.  
  93. /*
  94.  *  External routines:
  95.  */
  96.  
  97. extern Boolean IsAddr();
  98. extern int  Print_query();
  99. extern char *Print_cdname();
  100. extern char *Print_cdname2();    /* fixed width */
  101. extern char *Print_rr();
  102. extern char *DecodeType();    /* descriptive version of p_type */
  103. extern char *DecodeError();
  104. extern void NsError();
  105. extern void PrintServer();
  106. extern void PrintHostInfo();
  107. extern void ShowOptions();
  108. extern void FreeHostInfoPtr();
  109. extern FILE *OpenFile();
  110. extern char *res_skip();
  111.