home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / internet / tcpipsrc / h / if / netdb < prev    next >
Text File  |  1994-08-29  |  3KB  |  84 lines

  1. /*-
  2.  * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that: (1) source distributions retain this entire copyright
  7.  * notice and comment, and (2) distributions including binaries display
  8.  * the following acknowledgement:  ``This product includes software
  9.  * developed by the University of California, Berkeley and its contributors''
  10.  * in the documentation or other materials provided with the distribution
  11.  * and in all advertising materials mentioning features or use of this
  12.  * software. Neither the name of the University nor the names of its
  13.  * contributors may be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *    @(#)netdb.h    5.11 (Berkeley) 5/21/90
  20.  */
  21.  
  22. #define    _PATH_HEQUIV    "/etc/hosts.equiv"
  23. #define    _PATH_HOSTS    "/etc/hosts"
  24. #define    _PATH_NETWORKS    "/etc/networks"
  25. #define    _PATH_PROTOCOLS    "/etc/protocols"
  26. #define    _PATH_SERVICES    "/etc/services"
  27.  
  28. /*
  29.  * Structures returned by network data base library.  All addresses are
  30.  * supplied in host order, and returned in network order (suitable for
  31.  * use in system calls).
  32.  */
  33. struct mx_data {
  34.   int preference;
  35.   char *host;
  36.   };
  37.  
  38. struct    hostent {
  39.     char    *h_name;    /* official name of host */
  40.     char    **h_aliases;    /* alias list */
  41.     int    h_addrtype;    /* host address type */
  42.     int    h_length;    /* length of address */
  43.     char    **h_addr_list;    /* list of addresses from name server */
  44.     struct    mx_data **h_mx;  /* list of mail exchange hosts */
  45. #define    h_addr    h_addr_list[0]    /* address, for backward compatiblity */
  46. };
  47.  
  48. /*
  49.  * Assumption here is that a network number
  50.  * fits in 32 bits -- probably a poor one.
  51.  */
  52. struct    netent {
  53.     char        *n_name;    /* official name of net */
  54.     char        **n_aliases;    /* alias list */
  55.     int        n_addrtype;    /* net address type */
  56.     unsigned long    n_net;        /* network # */
  57. };
  58.  
  59. struct    servent
  60. {
  61.   char    *s_name;     /* official service name */
  62.   char    **s_aliases; /* alias list */
  63.   int    s_port;      /* port # */
  64.   char    *s_proto;    /* protocol to use */
  65. };
  66.  
  67. struct    protoent {
  68.     char    *p_name;    /* official protocol name */
  69.     char    **p_aliases;    /* alias list */
  70.     int    p_proto;    /* protocol # */
  71. };
  72.  
  73. struct hostent    *gethostbyname(char *, int);
  74. struct hostent    *gethostbyaddr(unsigned int, int, int);
  75.  
  76. /* Error return codes from gethostbyname() and gethostbyaddr()
  77.    (left in extern int h_errno).*/
  78.  
  79. #define    HOST_NOT_FOUND    1 /* Authoritative Answer Host not found */
  80. #define    TRY_AGAIN    2 /* Non-Authoritive Host not found, or SERVERFAIL */
  81. #define    NO_RECOVERY    3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  82. #define    NO_DATA        4 /* Valid name, no data record of requested type */
  83. #define    NO_ADDRESS    NO_DATA        /* no address, look for MX record */
  84.