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

Replacement getaddrinfo functions. More...

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

Go to the source code of this file.

Macros

#define BUFFER_OVERFLOW   255
 
#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, int 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

◆ BUFFER_OVERFLOW

#define BUFFER_OVERFLOW   255

Definition at line 91 of file getaddrinfo.c.

◆ LOCAL_GETHOSTBYADDRR

#define LOCAL_GETHOSTBYADDRR   1

Definition at line 48 of file getaddrinfo.c.

◆ LOCAL_GETHOSTBYNAMERSTYLE

#define LOCAL_GETHOSTBYNAMERSTYLE   1

Definition at line 39 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 211 of file getaddrinfo.c.

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

◆ copy_hostent()

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

Definition at line 92 of file getaddrinfo.c.

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

◆ freeaddrinfo()

void freeaddrinfo ( struct addrinfo *  ai)

Definition at line 251 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 231 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 261 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 177 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 149 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 381 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 67 of file getaddrinfo.c.

◆ fr_hostbyaddr_mutex

pthread_mutex_t fr_hostbyaddr_mutex
static

Definition at line 68 of file getaddrinfo.c.

◆ fr_hostbyname

int fr_hostbyname = 0
static

Definition at line 62 of file getaddrinfo.c.

◆ fr_hostbyname_mutex

pthread_mutex_t fr_hostbyname_mutex
static

Definition at line 63 of file getaddrinfo.c.