Defines | Functions | Variables

ink_res_init.cc File Reference

#include "ink_platform.h"
#include "ink_defs.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <arpa/nameser_compat.h>
#include <stdio.h>
#include <ctype.h>
#include <resolv.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "ink_string.h"
#include "ink_resolver.h"
#include "ink_inet.h"
#include "Tokenizer.h"
Include dependency graph for ink_res_init.cc:

Go to the source code of this file.

Defines

#define isascii(c)   (!(c & 0200))
#define MATCH(line, name)

Functions

static void ink_res_nclose (ink_res_state statp)
static void ink_res_setservers (ink_res_state statp, IpEndpoint const *set, int cnt)
int ink_res_getservers (ink_res_state statp, sockaddr *set, int cnt)
static void ink_res_setoptions (ink_res_state statp, const char *options, const char *source ATS_UNUSED)
static u_int ink_res_randomid (void)
int ink_res_init (ink_res_state statp, IpEndpoint const *pHostList, size_t pHostListSize, const char *pDefDomain, const char *pSearchList, const char *pResolvConf)
void parse_host_res_preference (char const *value, HostResPreferenceOrder order)
 Parse a host resolution configuration string.
int ts_host_res_order_to_string (HostResPreferenceOrder const &order, char *out, int size)
 Generate a string representation of a host resolution preference ordering.

Variables

HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER
 Global, hard wired default value for preference ordering.
HostResPreferenceOrder host_res_default_preference_order
 Global (configurable) default.
char const *const HOST_RES_PREFERENCE_STRING [N_HOST_RES_PREFERENCE]
 String versions of FamilyPreference.
char const *const HOST_RES_STYLE_STRING []
 Strings for host resolution styles.

Define Documentation

#define isascii (   c  )     (!(c & 0200))

Definition at line 94 of file ink_res_init.cc.

Referenced by remap_parse_config_bti().

#define MATCH (   line,
  name 
)
Value:
(!strncmp(line, name, sizeof(name) - 1) &&    \
   (line[sizeof(name) - 1] == ' ' ||            \
    line[sizeof(name) - 1] == '\t'))

Referenced by ink_res_init().


Function Documentation

int ink_res_getservers ( ink_res_state  statp,
sockaddr *  set,
int  cnt 
)
int ink_res_init ( ink_res_state  statp,
IpEndpoint const *  pHostList,
size_t  pHostListSize,
const char *  pDefDomain,
const char *  pSearchList,
const char *  pResolvConf 
)
static void ink_res_nclose ( ink_res_state  statp  )  [static]

Definition at line 121 of file ink_res_init.cc.

References ts_imp_res_state::_flags, ts_imp_res_state::_vcsock, and INK_RES_F_VC.

Referenced by ink_res_setservers().

static u_int ink_res_randomid ( void   )  [static]

Definition at line 266 of file ink_res_init.cc.

Referenced by ink_res_init().

static void ink_res_setoptions ( ink_res_state  statp,
const char *  options,
const char *source  ATS_UNUSED 
) [static]
static void ink_res_setservers ( ink_res_state  statp,
IpEndpoint const *  set,
int  cnt 
) [static]
void parse_host_res_preference ( char const *  value,
HostResPreferenceOrder  order 
)

Parse a host resolution configuration string.

Parameters:
[in] value Configuration string.
[out] order Order to update.

Definition at line 582 of file ink_res_init.cc.

References HOST_RES_PREFER_IPV4, HOST_RES_PREFER_IPV6, HOST_RES_PREFER_NONE, HOST_RES_PREFERENCE_STRING, Tokenizer::Initialize(), N_HOST_RES_PREFERENCE, and N_HOST_RES_PREFERENCE_ORDER.

Referenced by HttpProxyPort::processFamilyPreference(), and ts_host_res_global_init().

int ts_host_res_order_to_string ( HostResPreferenceOrder const &  order,
char *  out,
int  size 
)

Generate a string representation of a host resolution preference ordering.

Returns:
The length of the string.
Parameters:
order order to print
out Target buffer for string.
size Size of buffer.

Definition at line 630 of file ink_res_init.cc.

References HOST_RES_PREFER_NONE, HOST_RES_PREFERENCE_STRING, and N_HOST_RES_PREFERENCE_ORDER.

Referenced by HttpProxyPort::print().


Variable Documentation

Initial value:
 {
  HOST_RES_PREFER_IPV4,
  HOST_RES_PREFER_IPV6,
  HOST_RES_PREFER_NONE
}

Global, hard wired default value for preference ordering.

Definition at line 97 of file ink_res_init.cc.

Referenced by ts_host_res_global_init().

Initial value:
 {
    "only", "client", "ipv4", "ipv6"
}

String versions of FamilyPreference.

Definition at line 105 of file ink_res_init.cc.

Referenced by parse_host_res_preference(), HttpProxyPort::processOptions(), and ts_host_res_order_to_string().

char const* const HOST_RES_STYLE_STRING[]
Initial value:
 {
  "invalid", "IPv4", "IPv4 only", "IPv6", "IPv6 only"
}

Strings for host resolution styles.

Definition at line 109 of file ink_res_init.cc.