home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / netdb.h < prev    next >
C/C++ Source or Header  |  1990-07-25  |  3KB  |  103 lines

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