KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Address Database

Network Address Database Functionality More...

Topics

 addrinfo ai_flags
 Flags for ai_flags in struct addrinfo
 
 getaddrinfo() Error Values
 Errors for the getaddrinfo() function
 
 h_errno Error Values
 Error values for the h_errno variable
 

Files

file  netdb.h
 Network address database functionality.
 

Data Structures

struct  hostent
 Network host entry. More...
 
struct  addrinfo
 Network address information structure. More...
 

Functions

void freeaddrinfo (struct addrinfo *ai)
 Free an address information structure returned by getaddrinfo().
 
int getaddrinfo (const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
 Get information about a specified address.
 
struct hostentgethostbyname (const char *name)
 Look up a host by its name.
 
struct hostentgethostbyname2 (const char *name, int af)
 Look up a host by its name and address family.
 

Variables

int h_errno
 Error value for gethostbyname().
 

Detailed Description

Network Address Database Functionality

Function Documentation

◆ freeaddrinfo()

void freeaddrinfo ( struct addrinfo * ai)

Free an address information structure returned by getaddrinfo().

This function cleans up any memory associated with the specified struct addrinfo, which was returned previously by a call to getaddrinfo().

Parameters
aiThe struct addrinfo to clean up.

◆ getaddrinfo()

int getaddrinfo ( const char * nodename,
const char * servname,
const struct addrinfo * hints,
struct addrinfo ** res )

Get information about a specified address.

This function translates the name of a host and service into a set of socket addresses and related information to be used in creating a socket. This includes potentially looking up the host information in the network address database (and thus in DNS possibly as well).

Parameters
nodenameThe host to look up.
servnameThe service to look up.
hintsHints used in aiding lookup.
resThe resulting address information.
Returns
0 on success, non-zero error code on failure.
See also
getaddrinfo() Error Values

◆ gethostbyname()

struct hostent * gethostbyname ( const char * name)

Look up a host by its name.

This function queries the network address database (possibly recursively) for the network address of the specified hostname. This will first search any local databases before querying remote databases (such as a DNS server) for the host specified.

Parameters
nameThe hostname to look up.
Returns
A pointer to a host entry on success or NULL on failure. h_errno is set on failure to indicate the error that occurred.
Note
This function is non-reentrant. getaddrinfo() should (in general) be used instead of this function.

◆ gethostbyname2()

struct hostent * gethostbyname2 ( const char * name,
int af )

Look up a host by its name and address family.

This function queries the network address database (possibly recursively) for the network address of the specified hostname. This will first search any local databases before querying remote databases (such as a DNS server) for the host specified.

This function allows you to specify the address family that you wish the returned hostent to contain. This function is a GNU extension and has not been specified by any POSIX specification.

Parameters
nameThe hostname to look up.
afThe address family to use for lookups (AF_INET or AF_INET6).
Returns
A pointer to a host entry on success or NULL on failure. h_errno is set on failure to indicate the error that occurred.
Note
This function is non-reentrant. getaddrinfo() should (in general) be used instead of this function.

Variable Documentation

◆ h_errno

int h_errno
extern

Error value for gethostbyname().

See also
h_errno Error Values