reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
ares.h File Reference
#include "ares_nameser.h"
#include <sys/types.h>
#include <netinet/in.h>
#include "ares_socketfunc.h"

Go to the source code of this file.

Classes

struct  multiFamilyAddr
 
struct  ares_options
 

Macros

#define DNS__16BIT(p)   (((p)[0] << 8) | (p)[1])
 
#define DNS__32BIT(p)
 
#define DNS_HEADER_QDCOUNT(h)   DNS__16BIT((h) + 4)
 
#define DNS_HEADER_ANCOUNT(h)   DNS__16BIT((h) + 6)
 
#define DNS_HEADER_NSCOUNT(h)   DNS__16BIT((h) + 8)
 
#define DNS_HEADER_ARCOUNT(h)   DNS__16BIT((h) + 10)
 
#define DNS_RR_TYPE(r)   DNS__16BIT(r)
 
#define DNS_RR_LEN(r)   DNS__16BIT((r) + 8)
 
#define DNS_RR_TTL(r)   DNS__32BIT((r) + 4)
 
#define ARES_SUCCESS   0
 
#define ARES_ENODATA   1
 
#define ARES_EFORMERR   2
 
#define ARES_ESERVFAIL   3
 
#define ARES_ENOTFOUND   4
 
#define ARES_ENOTIMP   5
 
#define ARES_EREFUSED   6
 
#define ARES_EBADQUERY   7
 
#define ARES_EBADNAME   8
 
#define ARES_EBADFAMILY   9
 
#define ARES_EBADRESP   10
 
#define ARES_ECONNREFUSED   11
 
#define ARES_ETIMEOUT   12
 
#define ARES_EOF   13
 
#define ARES_EFILE   14
 
#define ARES_ENOMEM   15
 
#define ARES_EDESTRUCTION   16
 
#define ARES_FLAG_USEVC   (1 << 0)
 
#define ARES_FLAG_PRIMARY   (1 << 1)
 
#define ARES_FLAG_IGNTC   (1 << 2)
 
#define ARES_FLAG_NORECURSE   (1 << 3)
 
#define ARES_FLAG_STAYOPEN   (1 << 4)
 
#define ARES_FLAG_NOSEARCH   (1 << 5)
 
#define ARES_FLAG_NOALIASES   (1 << 6)
 
#define ARES_FLAG_NOCHECKRESP   (1 << 7)
 
#define ARES_FLAG_TRY_NEXT_SERVER_ON_RCODE3   (1 << 8) /* when rcode of 3 ('No such name') is recvd */
 
#define ARES_OPT_FLAGS   (1 << 0)
 
#define ARES_OPT_TIMEOUT   (1 << 1)
 
#define ARES_OPT_TRIES   (1 << 2)
 
#define ARES_OPT_NDOTS   (1 << 3)
 
#define ARES_OPT_UDP_PORT   (1 << 4)
 
#define ARES_OPT_TCP_PORT   (1 << 5)
 
#define ARES_OPT_SERVERS   (1 << 6)
 
#define ARES_OPT_DOMAINS   (1 << 7)
 
#define ARES_OPT_LOOKUPS   (1 << 8)
 
#define ARES_CAP_IPV6   (1 << 0)
 

Typedefs

typedef enum ares_poll_action ares_poll_action_t
 
typedef void() ares_poll_cb_func(void *cb_data, struct ares_channeldata *chan, int sockidx, int fd, int using_tcp, ares_poll_action_t act)
 
typedef struct ares_channeldata * ares_channel
 
typedef void(* ares_callback) (void *arg, int status, unsigned char *abuf, int alen)
 
typedef void(* ares_host_callback) (void *arg, int status, struct hostent *hostent)
 

Enumerations

enum  ares_poll_action {
  ARES_POLLACTION_NULL = (0) , ARES_POLLACTION_OPEN = (1) , ARES_POLLACTION_CLOSE = (2) , ARES_POLLACTION_WRITEON = (3) ,
  ARES_POLLACTION_WRITEOFF = (4)
}
 

Functions

int ares_init (ares_channel *channelptr)
 
int ares_init_with_socket_function (ares_channel *channelptr, socket_function_ptr)
 
int ares_capabilities (int capmask)
 
int ares_init_options (ares_channel *channelptr, struct ares_options *options, int optmask)
 
int ares_init_options_with_socket_function (ares_channel *channelptr, struct ares_options *options, int optmask, socket_function_ptr)
 
void ares_destroy (ares_channel channel)
 
void ares_destroy_suppress_callbacks (ares_channel channel)
 
void ares_destroy_internal (ares_channel channel, int suppressCallbacks)
 
void ares_send (ares_channel channel, const unsigned char *qbuf, int qlen, ares_callback callback, void *arg)
 
void ares_query (ares_channel channel, const char *name, int dnsclass, int type, ares_callback callback, void *arg)
 
void ares_search (ares_channel channel, const char *name, int dnsclass, int type, ares_callback callback, void *arg)
 
void ares_gethostbyname (ares_channel channel, const char *name, int family, ares_host_callback callback, void *arg)
 
void ares_gethostbyaddr (ares_channel channel, const void *addr, int addrlen, int family, ares_host_callback callback, void *arg)
 
int hostfile_lookup (const char *name, struct hostent **host)
 
int ares_fds (ares_channel channel, fd_set *read_fds, fd_set *write_fds)
 
struct timeval * ares_timeout (ares_channel channel, struct timeval *maxtv, struct timeval *tv)
 
void ares_process (ares_channel channel, fd_set *read_fds, fd_set *write_fds)
 
void ares_process_set_poll_cb (ares_channel channel, ares_poll_cb_func *cb_func, void *cb_data)
 
void ares_process_poll (ares_channel channel, int server_idx, int rdFd, int wrFd, time_t now)
 
int ares_mkquery (const char *name, int dnsclass, int type, unsigned short id, int rd, unsigned char **buf, int *buflen)
 
int ares_expand_name (const unsigned char *encoded, const unsigned char *abuf, int alen, char **s, long *enclen)
 
int ares_parse_a_reply (const unsigned char *abuf, int alen, struct hostent **host)
 
int ares_parse_ptr_reply (const unsigned char *abuf, int alen, const void *addr, int addrlen, int family, struct hostent **host)
 
void ares_free_string (char *str)
 
void ares_free_hostent (struct hostent *host)
 
const char * ares_strerror (int code)
 
void ares_free_errmem (char *mem)
 

Macro Definition Documentation

◆ ARES_CAP_IPV6

#define ARES_CAP_IPV6   (1 << 0)

Definition at line 125 of file ares.h.

◆ ARES_EBADFAMILY

#define ARES_EBADFAMILY   9

Definition at line 92 of file ares.h.

◆ ARES_EBADNAME

#define ARES_EBADNAME   8

Definition at line 91 of file ares.h.

◆ ARES_EBADQUERY

#define ARES_EBADQUERY   7

Definition at line 90 of file ares.h.

◆ ARES_EBADRESP

#define ARES_EBADRESP   10

Definition at line 93 of file ares.h.

◆ ARES_ECONNREFUSED

#define ARES_ECONNREFUSED   11

Definition at line 94 of file ares.h.

◆ ARES_EDESTRUCTION

#define ARES_EDESTRUCTION   16

Definition at line 99 of file ares.h.

◆ ARES_EFILE

#define ARES_EFILE   14

Definition at line 97 of file ares.h.

◆ ARES_EFORMERR

#define ARES_EFORMERR   2

Definition at line 83 of file ares.h.

◆ ARES_ENODATA

#define ARES_ENODATA   1

Definition at line 82 of file ares.h.

◆ ARES_ENOMEM

#define ARES_ENOMEM   15

Definition at line 98 of file ares.h.

◆ ARES_ENOTFOUND

#define ARES_ENOTFOUND   4

Definition at line 85 of file ares.h.

◆ ARES_ENOTIMP

#define ARES_ENOTIMP   5

Definition at line 86 of file ares.h.

◆ ARES_EOF

#define ARES_EOF   13

Definition at line 96 of file ares.h.

◆ ARES_EREFUSED

#define ARES_EREFUSED   6

Definition at line 87 of file ares.h.

◆ ARES_ESERVFAIL

#define ARES_ESERVFAIL   3

Definition at line 84 of file ares.h.

◆ ARES_ETIMEOUT

#define ARES_ETIMEOUT   12

Definition at line 95 of file ares.h.

◆ ARES_FLAG_IGNTC

#define ARES_FLAG_IGNTC   (1 << 2)

Definition at line 104 of file ares.h.

◆ ARES_FLAG_NOALIASES

#define ARES_FLAG_NOALIASES   (1 << 6)

Definition at line 108 of file ares.h.

◆ ARES_FLAG_NOCHECKRESP

#define ARES_FLAG_NOCHECKRESP   (1 << 7)

Definition at line 109 of file ares.h.

◆ ARES_FLAG_NORECURSE

#define ARES_FLAG_NORECURSE   (1 << 3)

Definition at line 105 of file ares.h.

◆ ARES_FLAG_NOSEARCH

#define ARES_FLAG_NOSEARCH   (1 << 5)

Definition at line 107 of file ares.h.

◆ ARES_FLAG_PRIMARY

#define ARES_FLAG_PRIMARY   (1 << 1)

Definition at line 103 of file ares.h.

◆ ARES_FLAG_STAYOPEN

#define ARES_FLAG_STAYOPEN   (1 << 4)

Definition at line 106 of file ares.h.

◆ ARES_FLAG_TRY_NEXT_SERVER_ON_RCODE3

#define ARES_FLAG_TRY_NEXT_SERVER_ON_RCODE3   (1 << 8) /* when rcode of 3 ('No such name') is recvd */

Definition at line 110 of file ares.h.

◆ ARES_FLAG_USEVC

#define ARES_FLAG_USEVC   (1 << 0)

Definition at line 102 of file ares.h.

◆ ARES_OPT_DOMAINS

#define ARES_OPT_DOMAINS   (1 << 7)

Definition at line 120 of file ares.h.

◆ ARES_OPT_FLAGS

#define ARES_OPT_FLAGS   (1 << 0)

Definition at line 113 of file ares.h.

◆ ARES_OPT_LOOKUPS

#define ARES_OPT_LOOKUPS   (1 << 8)

Definition at line 121 of file ares.h.

◆ ARES_OPT_NDOTS

#define ARES_OPT_NDOTS   (1 << 3)

Definition at line 116 of file ares.h.

◆ ARES_OPT_SERVERS

#define ARES_OPT_SERVERS   (1 << 6)

Definition at line 119 of file ares.h.

◆ ARES_OPT_TCP_PORT

#define ARES_OPT_TCP_PORT   (1 << 5)

Definition at line 118 of file ares.h.

◆ ARES_OPT_TIMEOUT

#define ARES_OPT_TIMEOUT   (1 << 1)

Definition at line 114 of file ares.h.

◆ ARES_OPT_TRIES

#define ARES_OPT_TRIES   (1 << 2)

Definition at line 115 of file ares.h.

◆ ARES_OPT_UDP_PORT

#define ARES_OPT_UDP_PORT   (1 << 4)

Definition at line 117 of file ares.h.

◆ ARES_SUCCESS

#define ARES_SUCCESS   0

Definition at line 79 of file ares.h.

◆ DNS__16BIT

#define DNS__16BIT (   p)    (((p)[0] << 8) | (p)[1])

Definition at line 45 of file ares.h.

◆ DNS__32BIT

#define DNS__32BIT (   p)
Value:
(((p)[0] << 24) | ((p)[1] << 16) | \
((p)[2] << 8) | (p)[3])

Definition at line 46 of file ares.h.

◆ DNS_HEADER_ANCOUNT

#define DNS_HEADER_ANCOUNT (   h)    DNS__16BIT((h) + 6)

Definition at line 49 of file ares.h.

◆ DNS_HEADER_ARCOUNT

#define DNS_HEADER_ARCOUNT (   h)    DNS__16BIT((h) + 10)

Definition at line 51 of file ares.h.

◆ DNS_HEADER_NSCOUNT

#define DNS_HEADER_NSCOUNT (   h)    DNS__16BIT((h) + 8)

Definition at line 50 of file ares.h.

◆ DNS_HEADER_QDCOUNT

#define DNS_HEADER_QDCOUNT (   h)    DNS__16BIT((h) + 4)

Definition at line 48 of file ares.h.

◆ DNS_RR_LEN

#define DNS_RR_LEN (   r)    DNS__16BIT((r) + 8)

Definition at line 53 of file ares.h.

◆ DNS_RR_TTL

#define DNS_RR_TTL (   r)    DNS__32BIT((r) + 4)

Definition at line 54 of file ares.h.

◆ DNS_RR_TYPE

#define DNS_RR_TYPE (   r)    DNS__16BIT(r)

Definition at line 52 of file ares.h.

Typedef Documentation

◆ ares_callback

typedef void(* ares_callback) (void *arg, int status, unsigned char *abuf, int alen)

Definition at line 172 of file ares.h.

◆ ares_channel

Definition at line 171 of file ares.h.

◆ ares_host_callback

typedef void(* ares_host_callback) (void *arg, int status, struct hostent *hostent)

Definition at line 174 of file ares.h.

◆ ares_poll_action_t

◆ ares_poll_cb_func

Definition at line 135 of file ares.h.

Enumeration Type Documentation

◆ ares_poll_action

Enumerator
ARES_POLLACTION_NULL 
ARES_POLLACTION_OPEN 
ARES_POLLACTION_CLOSE 
ARES_POLLACTION_WRITEON 
ARES_POLLACTION_WRITEOFF 

Definition at line 127 of file ares.h.

Function Documentation

◆ ares_capabilities()

int ares_capabilities ( int  capmask)
extern

Definition at line 94 of file ares_init.c.

◆ ares_destroy()

void ares_destroy ( ares_channel  channel)
extern

Definition at line 23 of file ares_destroy.c.

◆ ares_destroy_internal()

void ares_destroy_internal ( ares_channel  channel,
int  suppressCallbacks 
)
extern

Definition at line 33 of file ares_destroy.c.

◆ ares_destroy_suppress_callbacks()

void ares_destroy_suppress_callbacks ( ares_channel  channel)
extern

Definition at line 28 of file ares_destroy.c.

◆ ares_expand_name()

int ares_expand_name ( const unsigned char *  encoded,
const unsigned char *  abuf,
int  alen,
char **  s,
long *  enclen 
)
extern

Definition at line 83 of file ares_expand_name.c.

◆ ares_fds()

int ares_fds ( ares_channel  channel,
fd_set *  read_fds,
fd_set *  write_fds 
)
extern

Definition at line 22 of file ares_fds.c.

◆ ares_free_errmem()

void ares_free_errmem ( char *  mem)
extern

Definition at line 23 of file ares_free_errmem.c.

◆ ares_free_hostent()

void ares_free_hostent ( struct hostent *  host)
extern

Definition at line 24 of file ares_free_hostent.c.

◆ ares_free_string()

void ares_free_string ( char *  str)
extern

Definition at line 20 of file ares_free_string.c.

◆ ares_gethostbyaddr()

void ares_gethostbyaddr ( ares_channel  channel,
const void *  addr,
int  addrlen,
int  family,
ares_host_callback  callback,
void *  arg 
)
extern

Definition at line 55 of file ares_gethostbyaddr.c.

◆ ares_gethostbyname()

void ares_gethostbyname ( ares_channel  channel,
const char *  name,
int  family,
ares_host_callback  callback,
void *  arg 
)
extern

Definition at line 64 of file ares_gethostbyname.c.

◆ ares_init()

int ares_init ( ares_channel *  channelptr)
extern

Definition at line 104 of file ares_init.c.

◆ ares_init_options()

int ares_init_options ( ares_channel *  channelptr,
struct ares_options *  options,
int  optmask 
)
extern

Definition at line 114 of file ares_init.c.

◆ ares_init_options_with_socket_function()

int ares_init_options_with_socket_function ( ares_channel *  channelptr,
struct ares_options *  options,
int  optmask,
socket_function_ptr  socketFunc 
)
extern

Definition at line 120 of file ares_init.c.

◆ ares_init_with_socket_function()

int ares_init_with_socket_function ( ares_channel *  channelptr,
socket_function_ptr  socketFunc 
)
extern

Definition at line 109 of file ares_init.c.

◆ ares_mkquery()

int ares_mkquery ( const char *  name,
int  dnsclass,
int  type,
unsigned short  id,
int  rd,
unsigned char **  buf,
int *  buflen 
)
extern

Definition at line 77 of file ares_mkquery.c.

◆ ares_parse_a_reply()

int ares_parse_a_reply ( const unsigned char *  abuf,
int  alen,
struct hostent **  host 
)
extern

Definition at line 34 of file ares_parse_a_reply.c.

◆ ares_parse_ptr_reply()

int ares_parse_ptr_reply ( const unsigned char *  abuf,
int  alen,
const void *  addr,
int  addrlen,
int  family,
struct hostent **  host 
)
extern

Definition at line 35 of file ares_parse_ptr_reply.c.

◆ ares_process()

void ares_process ( ares_channel  channel,
fd_set *  read_fds,
fd_set *  write_fds 
)
extern

Definition at line 87 of file ares_process.c.

◆ ares_process_poll()

void ares_process_poll ( ares_channel  channel,
int  server_idx,
int  rdFd,
int  wrFd,
time_t  now 
)
extern

Definition at line 105 of file ares_process.c.

◆ ares_process_set_poll_cb()

void ares_process_set_poll_cb ( ares_channel  channel,
ares_poll_cb_func *  cb_func,
void *  cb_data 
)
extern

Definition at line 1015 of file ares_process.c.

◆ ares_query()

void ares_query ( ares_channel  channel,
const char *  name,
int  dnsclass,
int  type,
ares_callback  callback,
void *  arg 
)
extern

Definition at line 38 of file ares_query.c.

◆ ares_search()

void ares_search ( ares_channel  channel,
const char *  name,
int  dnsclass,
int  type,
ares_callback  callback,
void *  arg 
)
extern

Definition at line 45 of file ares_search.c.

◆ ares_send()

void ares_send ( ares_channel  channel,
const unsigned char *  qbuf,
int  qlen,
ares_callback  callback,
void *  arg 
)
extern

Definition at line 33 of file ares_send.c.

◆ ares_strerror()

const char * ares_strerror ( int  code)
extern

Definition at line 19 of file ares_strerror.c.

◆ ares_timeout()

struct timeval * ares_timeout ( ares_channel  channel,
struct timeval *  maxtv,
struct timeval *  tv 
)
extern

Definition at line 24 of file ares_timeout.c.

◆ hostfile_lookup()

int hostfile_lookup ( const char *  name,
struct hostent **  host 
)
extern

Definition at line 227 of file ares_gethostbyname.c.