netdb(5) netdb(5)
NAME
netdb - definitions for network database operations
SYNOPSIS
#include <netdb.h>
DESCRIPTION
The <netdb.h> header defines the type inportt and the type inaddrt
as defined in <netinet/in.h>.
The <netdb.h> header defines the hostent structure that includes at
least the following members:
char *hname Official name of the host
char **haliases A pointer to an array of pointers to alternative
host names, terminated by a null pointer.
int haddrtype Address type.
int hlength The length, in bytes, of the address.
char **haddrlist A pointer to an array of pointers to network
addresses (in network byte order) for the host,
terminated by a null pointer.
The <netdb.h> header defines the netent structure that includes at
least the following members:
char *nname Official, fully-qualified (including the domain)
name of the host.
char **naliases A pointer to an array of pointers to alternative
network names, terminated by a null pointer.
int naddrtype The address type of the network.
inaddrt nnet The network number, in host byte order.
The <netdb.h> header defines the protoent structure that includes at
least the following members:
char *pname Official name of the protocol.
char **paliases A pointer to an array of pointers to alternative
protocol names, terminated by a null pointer.
int pproto The protocol number.
Page 1 Reliant UNIX 5.44 Printed 11/98
netdb(5) netdb(5)
The <netdb.h> header defines the servent structure that includes at
least the following members:
char *sname Official name of the service.
char **saliases A pointer to an array of pointers to alternative
service names, terminated by a null pointer.
int sport The port number at which the service resides, in
network byte order.
char *sproto The name of the protocol to use when contacting
the service.
The <netdb.h> header defines the macro IPPORTRESERVED with the value
of the highest reserved Internet port number.
The <netdb.h> header provides a declaration for herrno:
extern int herrno;
The <netdb.h> header defines the following macros for use as error
values for gethostbyaddr and gethostbyname:
HOSTNOTFOUND
NODATA
NORECOVERY
TRYAGAIN
Page 2 Reliant UNIX 5.44 Printed 11/98
netdb(5) netdb(5)
The following are declared as functions, and may also be defined as
macros:
void endhostent(void);
void endnetent(void);
void endprotoent(void);
void endservent(void);
struct hostent *gethostbyaddr(const void *addr, sizet len, int type);
struct hostent *gethostbyname(const char *name);
struct hostent *gethostent(void);
struct netent *getnetbyaddr(inaddrt net, int type);
struct netent *getnetbyname(const char *name);
struct netent *getnetent(void);
struct protoent *getprotobyname(const char *name);
struct protoent *getprotobynumber(int proto);
struct protoent *getprotoent(void);
struct servent *getservbyname(const char *name, const char *proto);
struct servent *getservbyport(int port, const char *proto);
struct servent *getservent(void);
void sethostent(int stayopen);
void setnetent(int stayopen);
void setprotoent(int stayopen);
void setservent(int stayopen)
Inclusion of the <netdb.h> header may also make visible all symbols
from <netinet/in.h>.
SEE ALSO
gethostent(3N-xs), getnetent(3N-xs), getprotoent(3N-xs),
getservent(3N-xs).
Page 3 Reliant UNIX 5.44 Printed 11/98