#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"
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 isascii | ( | c | ) | (!(c & 0200)) |
Definition at line 94 of file ink_res_init.cc.
Referenced by remap_parse_config_bti().
#define MATCH | ( | line, | ||
name | ||||
) |
(!strncmp(line, name, sizeof(name) - 1) && \ (line[sizeof(name) - 1] == ' ' || \ line[sizeof(name) - 1] == '\t'))
Referenced by ink_res_init().
int ink_res_getservers | ( | ink_res_state | statp, | |
sockaddr * | set, | |||
int | cnt | |||
) |
Definition at line 156 of file ink_res_init.cc.
References ats_ip_copy(), ts_imp_res_state::nsaddr_list, ts_imp_res_state::nscount, and IpEndpoint::sa.
int ink_res_init | ( | ink_res_state | statp, | |
IpEndpoint const * | pHostList, | |||
size_t | pHostListSize, | |||
const char * | pDefDomain, | |||
const char * | pSearchList, | |||
const char * | pResolvConf | |||
) |
statp | State object to update. | |
pHostList | Additional servers. | |
pHostListSize | # of entries in pHostList. | |
pDefDomain | Default domain (may be NULL). | |
pSearchList | Unknown | |
pResolvConf | Path to configuration file. |
Definition at line 297 of file ink_res_init.cc.
References ts_imp_res_state::_flags, ts_imp_res_state::_vcsock, ats_ip_copy(), ats_is_ip(), ts_imp_res_state::defdname, ts_imp_res_state::dnsrch, fp, ts_imp_res_state::id, INK_LOCALDOMAINPARTS, INK_MAXDFLSRCH, INK_MAXNS, INK_RES_DEBUG, ink_res_randomid(), ink_res_setoptions(), ink_res_setservers(), ink_strlcpy(), MATCH, ts_imp_res_state::ndots, ts_imp_res_state::nsaddr_list, ts_imp_res_state::nscount, ts_imp_res_state::options, ts_imp_res_state::pfcode, ts_imp_res_state::qhook, ts_imp_res_state::res_h_errno, ts_imp_res_state::retrans, ts_imp_res_state::retry, ts_imp_res_state::rhook, and IpEndpoint::sa.
Referenced by DNSProcessor::dns_init().
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] |
Definition at line 170 of file ink_res_init.cc.
References INK_RES_DEBUG, INK_RES_MAXNDOTS, INK_RES_MAXRETRANS, INK_RES_MAXRETRY, ts_imp_res_state::ndots, ts_imp_res_state::options, ts_imp_res_state::retrans, and ts_imp_res_state::retry.
Referenced by ink_res_init().
static void ink_res_setservers | ( | ink_res_state | statp, | |
IpEndpoint const * | set, | |||
int | cnt | |||
) | [static] |
Definition at line 130 of file ink_res_init.cc.
References ats_ip_copy(), ats_is_ip(), INK_MAXNS, ink_res_nclose(), ts_imp_res_state::nsaddr_list, ts_imp_res_state::nscount, and IpEndpoint::sa.
Referenced by ink_res_init().
void parse_host_res_preference | ( | char const * | value, | |
HostResPreferenceOrder | order | |||
) |
Parse a host resolution configuration string.
[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.
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().
{ 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().
Global (configurable) default.
Definition at line 103 of file ink_res_init.cc.
Referenced by HttpProxyPort::HttpProxyPort(), detail::HttpSessionAcceptOptions::HttpSessionAcceptOptions(), HttpProxyPort::print(), and ts_host_res_global_init().
char const* const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE] |
{ "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[] |
{ "invalid", "IPv4", "IPv4 only", "IPv6", "IPv6 only" }
Strings for host resolution styles.
Definition at line 109 of file ink_res_init.cc.