home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Entertainment / MacMud / Unix / netdb.h.43 < prev    next >
Encoding:
Text File  |  1989-02-22  |  2.2 KB  |  75 lines  |  [TEXT/????]

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)netdb.h 1.9 88/02/07 SMI from UCB 5.7 5/12/86
  7.  */
  8.  
  9. /*
  10.  * Structures returned by network
  11.  * data base library.  All addresses
  12.  * are supplied in host order, and
  13.  * returned in network order (suitable
  14.  * for use in system calls).
  15.  *
  16.  */
  17. struct    hostent {
  18.     char    *h_name;    /* official name of host */
  19.     char    **h_aliases;    /* alias list */
  20.     int    h_addrtype;    /* host address type */
  21.     int    h_length;    /* length of address */
  22.     char    **h_addr_list;    /* list of addresses from name server */
  23. #define    h_addr    h_addr_list[0]    /* address, for backward compatiblity */
  24. };
  25.  
  26. /*
  27.  * Assumption here is that a network number
  28.  * fits in 32 bits -- probably a poor one.
  29.  */
  30. struct    netent {
  31.     char        *n_name;    /* official name of net */
  32.     char        **n_aliases;    /* alias list */
  33.     int        n_addrtype;    /* net address type */
  34.     unsigned long    n_net;        /* network # */
  35. };
  36.  
  37. struct    servent {
  38.     char    *s_name;    /* official service name */
  39.     char    **s_aliases;    /* alias list */
  40.     int    s_port;        /* port # */
  41.     char    *s_proto;    /* protocol to use */
  42. };
  43.  
  44. struct    protoent {
  45.     char    *p_name;    /* official protocol name */
  46.     char    **p_aliases;    /* alias list */
  47.     int    p_proto;    /* protocol # */
  48. };
  49.  
  50. struct rpcent {
  51.     char    *r_name;    /* name of server for this rpc program */
  52.     char    **r_aliases;    /* alias list */
  53.     int    r_number;    /* rpc program number */
  54. };
  55.  
  56. struct hostent    *gethostbyname(), *gethostbyaddr(), *gethostent();
  57. struct netent    *getnetbyname(), *getnetbyaddr(), *getnetent();
  58. struct servent    *getservbyname(), *getservbyport(), *getservent();
  59. struct protoent    *getprotobyname(), *getprotobynumber(), *getprotoent();
  60. struct rpcent    *getrpcbyname(), *getrpcbynumber(), *getrpcent();
  61.  
  62. /*
  63.  * Error return codes from gethostbyname() and gethostbyaddr()
  64.  * (when using the resolver)
  65.  */
  66.  
  67. extern  int h_errno;    
  68.  
  69. #define    HOST_NOT_FOUND    1 /* Authoritive Answer Host not found */
  70. #define    TRY_AGAIN    2 /* Non-Authoritive Host not found, or SERVERFAIL */
  71. #define    NO_RECOVERY    3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  72. #define NO_ADDRESS    4 /* Valid host name, no address, look for MX record */
  73. /* compatability with 4.3 (lmo) */
  74. #define NO_DATA NO_ADDRESS
  75.