The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Macros | Functions | Variables
getaddrinfo.c File Reference

Replacement getaddrinfo functions. More...

#include <ctype.h>
#include <pthread.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <netdb.h>
+ Include dependency graph for getaddrinfo.c:

Go to the source code of this file.

Macros

#define LOCAL_GETHOSTBYADDRR   1
 
#define LOCAL_GETHOSTBYNAMERSTYLE   1
 

Functions

static struct addrinfo * alloc_ai (uint16_t port, u_long addr, int socktype, int proto)
 
static int copy_hostent (struct hostent *from, struct hostent *to, char *buffer, size_t buflen, int *error)
 
void freeaddrinfo (struct addrinfo *ai)
 
char const * gai_strerror (int ecode)
 
int getaddrinfo (char const *hostname, char const *servname, struct addrinfo const *hints, struct addrinfo **res)
 
static struct hostent * gethostbyaddr_r (char const *addr, int len, int type, struct hostent *result, char *buffer, int buflen, int *error)
 
static struct hostent * gethostbyname_r (char const *hostname, struct hostent *result, char *buffer, int buflen, int *error)
 
int getnameinfo (struct sockaddr const *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, unsigned int flags)
 

Variables

static int fr_hostbyaddr = 0
 
static pthread_mutex_t fr_hostbyaddr_mutex
 
static int fr_hostbyname = 0
 
static pthread_mutex_t fr_hostbyname_mutex
 

Detailed Description

Replacement getaddrinfo functions.

These functions are defined and used only if the configure cannot detect the standard getaddrinfo(), freeaddrinfo(), gai_strerror() and getnameinfo(). This avoids sprinkling of ifdefs.

FIXME: getaddrinfo() & getnameinfo() should return all IPv4 addresses provided by DNS lookup.

Definition in file getaddrinfo.c.

Macro Definition Documentation

◆ LOCAL_GETHOSTBYADDRR

#define LOCAL_GETHOSTBYADDRR   1

Definition at line 52 of file getaddrinfo.c.

◆ LOCAL_GETHOSTBYNAMERSTYLE

#define LOCAL_GETHOSTBYNAMERSTYLE   1

Definition at line 43 of file getaddrinfo.c.

Function Documentation

◆ alloc_ai()

static struct addrinfo * alloc_ai ( uint16_t  port,
u_long  addr,
int  socktype,
int  proto 
)
static

Definition at line 256 of file getaddrinfo.c.

+ Here is the caller graph for this function:

◆ copy_hostent()

static int copy_hostent ( struct hostent *  from,
struct hostent *  to,
char *  buffer,
size_t  buflen,
int *  error 
)
static

Definition at line 95 of file getaddrinfo.c.

+ Here is the caller graph for this function:

◆ freeaddrinfo()

void freeaddrinfo ( struct addrinfo *  ai)

Definition at line 296 of file getaddrinfo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gai_strerror()

char const * gai_strerror ( int  ecode)

Definition at line 276 of file getaddrinfo.c.

+ Here is the caller graph for this function:

◆ getaddrinfo()

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

Definition at line 306 of file getaddrinfo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gethostbyaddr_r()

static struct hostent * gethostbyaddr_r ( char const *  addr,
int  len,
int  type,
struct hostent *  result,
char *  buffer,
int  buflen,
int *  error 
)
static

Definition at line 222 of file getaddrinfo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gethostbyname_r()

static struct hostent * gethostbyname_r ( char const *  hostname,
struct hostent *  result,
char *  buffer,
int  buflen,
int *  error 
)
static

Definition at line 194 of file getaddrinfo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getnameinfo()

int getnameinfo ( struct sockaddr const *  sa,
socklen_t  salen,
char *  host,
size_t  hostlen,
char *  serv,
size_t  servlen,
unsigned int  flags 
)

Definition at line 426 of file getaddrinfo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ fr_hostbyaddr

int fr_hostbyaddr = 0
static

Definition at line 71 of file getaddrinfo.c.

◆ fr_hostbyaddr_mutex

pthread_mutex_t fr_hostbyaddr_mutex
static

Definition at line 72 of file getaddrinfo.c.

◆ fr_hostbyname

int fr_hostbyname = 0
static

Definition at line 66 of file getaddrinfo.c.

◆ fr_hostbyname_mutex

pthread_mutex_t fr_hostbyname_mutex
static

Definition at line 67 of file getaddrinfo.c.