1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright (c) 1980,1983,1988 Regents of the University of California. 3*0Sstevel@tonic-gate * All rights reserved. 4*0Sstevel@tonic-gate * 5*0Sstevel@tonic-gate * Redistribution and use in source and binary forms are permitted 6*0Sstevel@tonic-gate * provided that this notice is preserved and that due credit is given 7*0Sstevel@tonic-gate * to the University of California at Berkeley. The name of the University 8*0Sstevel@tonic-gate * may not be used to endorse or promote products derived from this 9*0Sstevel@tonic-gate * software without specific prior written permission. This software 10*0Sstevel@tonic-gate * is provided ``as is'' without express or implied warranty. 11*0Sstevel@tonic-gate */ 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gate /* 14*0Sstevel@tonic-gate * Structures returned by network data base library. 15*0Sstevel@tonic-gate * All addresses are supplied in host order, and 16*0Sstevel@tonic-gate * returned in network order (suitable for use in system calls). 17*0Sstevel@tonic-gate */ 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate #ifndef _netdb_h 20*0Sstevel@tonic-gate #define _netdb_h 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gate /* from UCB 5.9 4/5/88 */ 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate #define _PATH_HEQUIV "/etc/hosts.equiv" 27*0Sstevel@tonic-gate #define _PATH_HOSTS "/etc/hosts" 28*0Sstevel@tonic-gate #define _PATH_NETWORKS "/etc/networks" 29*0Sstevel@tonic-gate #define _PATH_PROTOCOLS "/etc/protocols" 30*0Sstevel@tonic-gate #define _PATH_SERVICES "/etc/services" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate struct hostent { 33*0Sstevel@tonic-gate char *h_name; /* official name of host */ 34*0Sstevel@tonic-gate char **h_aliases; /* alias list */ 35*0Sstevel@tonic-gate int h_addrtype; /* host address type */ 36*0Sstevel@tonic-gate int h_length; /* length of address */ 37*0Sstevel@tonic-gate char **h_addr_list; /* list of addresses from name server */ 38*0Sstevel@tonic-gate #define h_addr h_addr_list[0] /* address, for backward compatiblity */ 39*0Sstevel@tonic-gate }; 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate /* 42*0Sstevel@tonic-gate * Assumption here is that a network number 43*0Sstevel@tonic-gate * fits in 32 bits -- probably a poor one. 44*0Sstevel@tonic-gate */ 45*0Sstevel@tonic-gate struct netent { 46*0Sstevel@tonic-gate char *n_name; /* official name of net */ 47*0Sstevel@tonic-gate char **n_aliases; /* alias list */ 48*0Sstevel@tonic-gate int n_addrtype; /* net address type */ 49*0Sstevel@tonic-gate unsigned long n_net; /* network # */ 50*0Sstevel@tonic-gate }; 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gate struct servent { 53*0Sstevel@tonic-gate char *s_name; /* official service name */ 54*0Sstevel@tonic-gate char **s_aliases; /* alias list */ 55*0Sstevel@tonic-gate int s_port; /* port # */ 56*0Sstevel@tonic-gate char *s_proto; /* protocol to use */ 57*0Sstevel@tonic-gate }; 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate struct protoent { 60*0Sstevel@tonic-gate char *p_name; /* official protocol name */ 61*0Sstevel@tonic-gate char **p_aliases; /* alias list */ 62*0Sstevel@tonic-gate int p_proto; /* protocol # */ 63*0Sstevel@tonic-gate }; 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate struct rpcent { 66*0Sstevel@tonic-gate char *r_name; /* name of server for this rpc program */ 67*0Sstevel@tonic-gate char **r_aliases; /* alias list */ 68*0Sstevel@tonic-gate int r_number; /* rpc program number */ 69*0Sstevel@tonic-gate }; 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent(); 72*0Sstevel@tonic-gate struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); 73*0Sstevel@tonic-gate struct servent *getservbyname(), *getservbyport(), *getservent(); 74*0Sstevel@tonic-gate struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); 75*0Sstevel@tonic-gate struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate /* 78*0Sstevel@tonic-gate * Error return codes from gethostbyname() and gethostbyaddr() 79*0Sstevel@tonic-gate * (when using the resolver) 80*0Sstevel@tonic-gate */ 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate extern int h_errno; 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ 85*0Sstevel@tonic-gate #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ 86*0Sstevel@tonic-gate #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ 87*0Sstevel@tonic-gate #define NO_DATA 4 /* Valid name, no data record of requested type */ 88*0Sstevel@tonic-gate #define NO_ADDRESS NO_DATA /* no address, look for MX record */ 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate #define MAXALIASES 35 91*0Sstevel@tonic-gate #define MAXADDRS 35 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate #endif /*!_netdb_h*/ 94