cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

getaddrinfo.c File Reference
#include <platform.h>
Include dependency graph for getaddrinfo.c:

Go to the source code of this file.

Macros

#define SMB_MALLOC(s)   malloc(s)
 
#define SMB_STRDUP(s)   strdup(s)
 
#define HOST_NAME_MAX   255
 

Functions

static int check_hostent_err (struct hostent *hp)
 
static char * canon_name_from_hostent (struct hostent *hp, int *perr)
 
static char * get_my_canon_name (int *perr)
 
static char * get_canon_name_from_addr (struct in_addr ip, int *perr)
 
static struct addrinfo * alloc_entry (const struct addrinfo *hints, struct in_addr ip, unsigned short port)
 
static int getaddr_info_single_addr (const char *service, uint32_t addr, const struct addrinfo *hints, struct addrinfo **res)
 
static int getaddr_info_name (const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
 
int getaddrinfo (const char *node, const char *service, const struct addrinfo *hintp, struct addrinfo **res)
 
void freeaddrinfo (struct addrinfo *res)
 
const char * gai_strerror (int errcode)
 
static int gethostnameinfo (const struct sockaddr *sa, char *node, size_t nodelen, int flags)
 
static int getservicenameinfo (const struct sockaddr *sa, char *service, size_t servicelen, int flags)
 
int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *node, socklen_t nodelen, char *service, socklen_t servicelen, int flags)
 

Macro Definition Documentation

◆ HOST_NAME_MAX

#define HOST_NAME_MAX   255

Definition at line 57 of file getaddrinfo.c.

◆ SMB_MALLOC

#define SMB_MALLOC (   s)    malloc(s)

Definition at line 49 of file getaddrinfo.c.

◆ SMB_STRDUP

#define SMB_STRDUP (   s)    strdup(s)

Definition at line 53 of file getaddrinfo.c.

Function Documentation

◆ alloc_entry()

static struct addrinfo* alloc_entry ( const struct addrinfo *  hints,
struct in_addr  ip,
unsigned short  port 
)
static

Definition at line 120 of file getaddrinfo.c.

References free(), NULL, and SMB_MALLOC.

Referenced by getaddr_info_name(), and getaddr_info_single_addr().

◆ canon_name_from_hostent()

static char* canon_name_from_hostent ( struct hostent *  hp,
int *  perr 
)
static

Definition at line 83 of file getaddrinfo.c.

References check_hostent_err(), NULL, and SMB_STRDUP.

Referenced by get_canon_name_from_addr(), and get_my_canon_name().

◆ check_hostent_err()

static int check_hostent_err ( struct hostent *  hp)
static

Definition at line 60 of file getaddrinfo.c.

Referenced by canon_name_from_hostent(), getaddr_info_name(), and gethostnameinfo().

◆ freeaddrinfo()

void freeaddrinfo ( struct addrinfo *  res)

◆ gai_strerror()

◆ get_canon_name_from_addr()

static char* get_canon_name_from_addr ( struct in_addr  ip,
int *  perr 
)
static

Definition at line 112 of file getaddrinfo.c.

References canon_name_from_hostent().

Referenced by getaddr_info_single_addr().

◆ get_my_canon_name()

static char* get_my_canon_name ( int *  perr)
static

Definition at line 99 of file getaddrinfo.c.

References canon_name_from_hostent(), HOST_NAME_MAX, and NULL.

Referenced by getaddr_info_single_addr().

◆ getaddr_info_name()

static int getaddr_info_name ( const char *  node,
const char *  service,
const struct addrinfo *  hints,
struct addrinfo **  res 
)
static

Definition at line 209 of file getaddrinfo.c.

References alloc_entry(), check_hostent_err(), freeaddrinfo(), NULL, and SMB_STRDUP.

Referenced by getaddrinfo().

◆ getaddr_info_single_addr()

static int getaddr_info_single_addr ( const char *  service,
uint32_t  addr,
const struct addrinfo *  hints,
struct addrinfo **  res 
)
static

◆ getaddrinfo()

int getaddrinfo ( const char *  node,
const char *  service,
const struct addrinfo *  hintp,
struct addrinfo **  res 
)

◆ gethostnameinfo()

static int gethostnameinfo ( const struct sockaddr *  sa,
char *  node,
size_t  nodelen,
int  flags 
)
static

Definition at line 398 of file getaddrinfo.c.

References check_hostent_err(), and NULL.

Referenced by getnameinfo().

◆ getnameinfo()

int getnameinfo ( const struct sockaddr *  sa,
socklen_t  salen,
char *  node,
socklen_t  nodelen,
char *  service,
socklen_t  servicelen,
int  flags 
)

◆ getservicenameinfo()

static int getservicenameinfo ( const struct sockaddr *  sa,
char *  service,
size_t  servicelen,
int  flags 
)
static

Definition at line 442 of file getaddrinfo.c.

Referenced by getnameinfo().