Contained Within
Find More Documentation
Featured Support Resources
| Download this book in PDF
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(5).
- The <netdb.h> header defines the hostent structure that includes the following members:
-
-
char * h_name Official name of the net.
char ** h_aliases A pointer to an array of pointers to alternative host names,
terminated by a null pointer.
int h_addrtype Address type.
int h_length The length, in bytes, of the address.
char ** h_addr_list 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 the following members:
-
-
char * n_name Official, fully-qualified (including the domain) name of the host.
char ** n_aliases A pointer to an array of pointers to alternative network names,
terminated by a null pointer.
int n_addrtype The address type of the network.
in_addr_t n_net The network number, in host byte order.
- The <netdb.h> header defines the protoent structure that includes the following members:
-
-
char * p_name Official name of the protocol.
char ** p_aliases A pointer to an array of pointers to alternative protocol names,
terminated by a null pointer.
int p_proto The protocol number.
- The <netdb.h> header defines the servent structure that includes the following members:
-
-
char * s_name Official name of the service.
char ** s_aliases A pointer to an array of pointers to alternative service names,
terminated by a null pointer.
int s_port The port number at which the service resides, in network byte order.
char * s_proto The 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_FOUND NO_DATA
NO_RECOVERY TRY_AGAIN
- Inclusion of the <netdb.h> header may also make visible all symbols from in(5).
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 may also be defined as macros:
-
-
int endhostent(void);
int endnetent(void);
int endprotoent(void);
int endservent(void);
struct hostent * gethostbyaddr(constvoid * addr, int len, int type);
struct hostent * gethostbyname(constchar * name);
struct hostent * gethostent(void);
struct netent * getnetbyaddr(longnet, int type);
struct netent * getnetbyname(constchar * name);
struct netent * getnetent(void);
struct protoent * getprotobyname(constchar * name);
struct protoent * getprotobynumber(intproto);
struct protoent * getprotoent(void);
struct servent * getservbyname(constchar * name, const char * proto);
struct servent * getservbyport(intport, const char * proto);
struct servent * getservent(void);
int sethostent(int stayopen);
int setnetent(int stayopen);
int setprotoent(int stayopen);
int setservent(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 may also be defined as macros:
-
-
void endhostent(void);
void endnetent(void);
void endprotoent(void);
void endservent(void);
struct hostent * gethostbyaddr(constvoid * addr, size_t len, int type);
struct hostent * gethostbyname(constchar * name);
struct hostent * gethostent(void);
struct netent * getnetbyaddr(in_addr_tnet, int type);
struct netent * getnetbyname(constchar * name);
struct netent * getnetent(void);
struct protoent * getprotobyname(constchar * name);
struct protoent * getprotobynumber(intproto);
struct protoent * getprotoent(void);
struct servent * getservbyname(constchar * name, const char * proto);
struct servent * getservbyport(intport, const char * proto);
struct servent * getservent(void);
-
-
void sethostent(int stayopen);
void setnetent(int stayopen);
void setprotoent(int stayopen);
void setservent(int stayopen);
SEE ALSO
-
Intro(3), endhostent(3N), endhostent(3XN), endnetent(3N), endnetent(3XN), endprotoent(3N), endprotoent(3XN), endservent(3N), endservent(3XN), in(5), standards(5)
|
|