Sun Microsystems Logo
Products and Services
 
Support and Training
 
 

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
 
Headersnetdb(3HEAD)


NAME

 netdb - definitions for network database operations

SYNOPSIS

 
#include <netdb.h> 

DESCRIPTION

 

The <netdb.h> header defines the type in_port_t and the type in_addr_t as described in in(3HEAD).

The <netdb.h> header defines the hostent structure that includes the following members:

char*h_nameOfficial name of the host.
char**h_aliasesA pointer to an array of pointers to alternative host names, terminated by a null pointer.
inth_addrtypeAddress type.
inth_lengthThe length, in bytes, of the address.
char**h_addr_listA 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 the following members:

char*n_nameOfficial, fully-qualified (including the domain) name of the network.
char**n_aliasesA pointer to an array of pointers to alternative network names, terminated by a null pointer.
intn_addrtypeThe address type of the network.
in_addr_tn_netThe network number, in host byte order.

The <netdb.h> header defines the protoent structure that includes the following members:

char*p_nameOfficial name of the protocol.
char**p_aliasesA pointer to an array of pointers to alternative protocol names, terminated by a null pointer.
intp_protoThe protocol number.

The <netdb.h> header defines the servent structure that includes the following members:

char*s_nameOfficial name of the service.
char**s_aliasesA pointer to an array of pointers to alternative service names, terminated by a null pointer.
ints_portThe port number at which the service resides, in network byte order.
char*s_protoThe name of the protocol to use when contacting the service.

The <netdb.h> header defines the macro IPPORT_RESERVED with the value of the highest reserved Internet port number.

The <netdb.h> header provides a declaration for h_errno:

extern int h_errno;

The <netdb.h> header defines the following macros for use as error values for gethostbyaddr() and gethostbyname():

HOST_NOT_FOUNDNO_DATA
NO_RECOVERYTRY_AGAIN

Inclusion of the <netdb.h> header may also make visible all symbols from in(3HEAD).

Default

 

For applications that do not require standard-conforming behavior (those that use the socket interfaces described in section 3N of the reference manual; see Intro(3) and standards(5)), the following are declared as functions and can also be defined as macros:

intendhostent(void);
intendnetent(void);
intendprotoent(void);
intendservent(void);
struct hostent*gethostbyaddr(const void *addr, int len, int type);
struct hostent*gethostbyname(const char *name);
struct hostent*gethostent(void);
struct netent*getnetbyaddr(long 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);
intsethostent(int stayopen);
intsetnetent(int stayopen);
intsetprotoent(int stayopen);
intsetservent(int stayopen);

Standard conforming

 

For applications that require standard-conforming behavior (those that use the socket interfaces described in section 3XN of the reference manual; see Intro(3) and standards(5)), the following are declared as functions and can also be defined as macros:

voidendhostent(void);
voidendnetent(void);
voidendprotoent(void);
voidendservent(void);
struct hostent*gethostbyaddr(const void *addr, size_t len, int type);
struct hostent*gethostbyname(const char *name);
struct hostent*gethostent(void);
struct netent*getnetbyaddr(in_addr_t 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);
voidsethostent(int stayopen);
voidsetnetent(int stayopen);
voidsetprotoent(int stayopen);
voidsetservent(int stayopen);

SEE ALSO

 

Intro(3), endhostent(3NSL), endhostent(3XNET), endnetent(3SOCKET), endnetent(3XNET), endprotoent(3SOCKET), endprotoent(3XNET), endservent(3SOCKET), endservent(3XNET), in(3HEAD), standards(5)



SunOS 5.9Go To TopLast Changed 13 Aug 1998


Updated: 2004-01-16, 17:49