|
ginnOS
The reference: libc, the libraries and the kernel
|
names of hosts and services: getaddrinfo and the older calls. More...
Go to the source code of this file.
Data Structures | |
| struct | addrinfo |
| struct | hostent |
| struct | servent |
Macros | |
| #define | AI_PASSIVE 0x0001 |
| #define | AI_CANONNAME 0x0002 |
| #define | AI_NUMERICHOST 0x0004 |
| #define | AI_V4MAPPED 0x0008 |
| #define | AI_ALL 0x0010 |
| #define | AI_ADDRCONFIG 0x0020 |
| #define | AI_NUMERICSERV 0x0400 |
| #define | EAI_BADFLAGS -1 |
| #define | EAI_NONAME -2 |
| #define | EAI_AGAIN -3 |
| #define | EAI_FAIL -4 |
| #define | EAI_FAMILY -6 |
| #define | EAI_SOCKTYPE -7 |
| #define | EAI_SERVICE -8 |
| #define | EAI_MEMORY -10 |
| #define | EAI_SYSTEM -11 |
| #define | EAI_OVERFLOW -12 |
| #define | NI_MAXHOST 1025 |
| #define | NI_MAXSERV 32 |
| #define | NI_NUMERICHOST 0x01 |
| #define | NI_NUMERICSERV 0x02 |
| #define | NI_NOFQDN 0x04 |
| #define | NI_NAMEREQD 0x08 |
| #define | NI_DGRAM 0x10 |
| #define | h_addr h_addr_list[0] |
| #define | HOST_NOT_FOUND 1 |
| #define | TRY_AGAIN 2 |
| #define | NO_RECOVERY 3 |
| #define | NO_DATA 4 |
| #define | h_errno (*__h_errno_location()) |
Functions | |
| int | getaddrinfo (const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) |
| the addresses for a host and a service. | |
| void | freeaddrinfo (struct addrinfo *res) |
| const char * | gai_strerror (int error) |
| the text of an EAI_ error. | |
| int | getnameinfo (const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags) |
| the host and service of an address: the name from /etc/hosts, else the address as text (there are no reverse DNS lookups); the service name from the table, else the number. | |
| int * | __h_errno_location (void) |
| struct hostent * | gethostbyname (const char *name) |
| the older lookup: the IPv4 addresses of a name, in a buffer of the calling thread. | |
| struct servent * | getservbyname (const char *name, const char *proto) |
| a service by name or by port (network byte order); proto "tcp", "udp" or NULL. | |
| struct servent * | getservbyport (int port, const char *proto) |
| const char * | hstrerror (int error) |
names of hosts and services: getaddrinfo and the older calls.
a host name is looked up in /etc/hosts first, then with DNS (the name servers in /etc/resolv.conf, which dhcp writes). only IPv4 addresses (A records). the service names are a built-in table of the common ones. the values are Linux's.
| #define AI_PASSIVE 0x0001 |
| #define AI_CANONNAME 0x0002 |
| #define AI_NUMERICHOST 0x0004 |
| #define AI_V4MAPPED 0x0008 |
| #define AI_ALL 0x0010 |
| #define AI_ADDRCONFIG 0x0020 |
| #define AI_NUMERICSERV 0x0400 |
| #define EAI_BADFLAGS -1 |
| #define EAI_NONAME -2 |
| #define EAI_AGAIN -3 |
| #define EAI_FAIL -4 |
| #define EAI_FAMILY -6 |
| #define EAI_SOCKTYPE -7 |
| #define EAI_SERVICE -8 |
| #define EAI_MEMORY -10 |
| #define EAI_SYSTEM -11 |
| #define EAI_OVERFLOW -12 |
| #define NI_MAXHOST 1025 |
| #define NI_MAXSERV 32 |
| #define NI_NUMERICHOST 0x01 |
| #define NI_NUMERICSERV 0x02 |
| #define NI_NOFQDN 0x04 |
| #define NI_NAMEREQD 0x08 |
| #define NI_DGRAM 0x10 |
| #define h_addr h_addr_list[0] |
| #define HOST_NOT_FOUND 1 |
| #define TRY_AGAIN 2 |
| #define NO_RECOVERY 3 |
| #define NO_DATA 4 |
| #define h_errno (*__h_errno_location()) |
| int getaddrinfo | ( | const char * | node, |
| const char * | service, | ||
| const struct addrinfo * | hints, | ||
| struct addrinfo ** | res ) |
the addresses for a host and a service.
| node | a host name or address; NULL for the local host, or with AI_PASSIVE the address that takes any. |
| service | a port number or name ("http"), or NULL for port 0. |
| hints | the family (AF_UNSPEC or AF_INET), the socket type (0 for both SOCK_STREAM and SOCK_DGRAM) and the AI_ flags; may be NULL. |
| res | receives a list; free it with freeaddrinfo. |
| void freeaddrinfo | ( | struct addrinfo * | res | ) |
| const char * gai_strerror | ( | int | error | ) |
the text of an EAI_ error.
| int getnameinfo | ( | const struct sockaddr * | addr, |
| socklen_t | addrlen, | ||
| char * | host, | ||
| socklen_t | hostlen, | ||
| char * | serv, | ||
| socklen_t | servlen, | ||
| int | flags ) |
the host and service of an address: the name from /etc/hosts, else the address as text (there are no reverse DNS lookups); the service name from the table, else the number.
| int * __h_errno_location | ( | void | ) |
| struct hostent * gethostbyname | ( | const char * | name | ) |
the older lookup: the IPv4 addresses of a name, in a buffer of the calling thread.
sets h_errno on an error.
| struct servent * getservbyname | ( | const char * | name, |
| const char * | proto ) |
a service by name or by port (network byte order); proto "tcp", "udp" or NULL.
in a buffer of the calling thread.
| struct servent * getservbyport | ( | int | port, |
| const char * | proto ) |
| const char * hstrerror | ( | int | error | ) |