Defines | Functions | Variables

DNS.cc File Reference

A brief file description. More...

#include "P_DNS.h"
#include <ts/ink_inet.h>
Include dependency graph for DNS.cc:

Go to the source code of this file.

Defines

#define SRV_COST   (RRFIXEDSZ+0)
#define SRV_WEIGHT   (RRFIXEDSZ+2)
#define SRV_PORT   (RRFIXEDSZ+4)
#define SRV_SERVER   (RRFIXEDSZ+6)
#define SRV_FIXEDSZ   (RRFIXEDSZ+6)

Functions

static bool dns_process (DNSHandler *handler, HostEnt *buf, int len)
 Decode the reply from "named".
static DNSEntryget_dns (DNSHandler *h, uint16_t id)
 Find a DNSEntry by id.
static void dns_result (DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry)
 We have a result for an entry, return it to the user or retry if it is a retry-able and we have retries left.
static void write_dns (DNSHandler *h)
 Write up to dns_max_dns_in_flight entries.
static bool write_dns_event (DNSHandler *h, DNSEntry *e)
 Construct and Write the request for a single entry (using send(3N)).
static char * strnchr (char *s, char c, int len)
static uint16_t ink_get16 (const uint8_t *src)
void make_ipv4_ptr (in_addr_t addr, char *buffer)
void make_ipv6_ptr (in6_addr const *addr, char *buffer)
int ink_dn_expand (const u_char *msg, const u_char *eom, const u_char *comp_dn, u_char *exp_dn, int length)
 Inter-OS portability for dn_expand.
static int _ink_res_mkquery (ink_res_state res, char *qname, int qtype, char *buffer)
static unsigned int get_rcode (char *buff)
static unsigned int get_rcode (HostEnt *ent)
static bool good_rcode (char *buff)
static DNSEntryget_entry (DNSHandler *h, char *qname, int qtype)
 Find a DNSEntry by query name and type.
void ink_dns_init (ModuleVersion v)

Variables

EventType ET_DNS = ET_CALL
int dns_timeout = DEFAULT_DNS_TIMEOUT
int dns_retries = DEFAULT_DNS_RETRIES
int dns_search = DEFAULT_DNS_SEARCH
int dns_failover_number = DEFAULT_FAILOVER_NUMBER
int dns_failover_period = DEFAULT_FAILOVER_PERIOD
int dns_failover_try_period = DEFAULT_FAILOVER_TRY_PERIOD
int dns_max_dns_in_flight = MAX_DNS_IN_FLIGHT
int dns_validate_qname = 0
unsigned int dns_handler_initialized = 0
int dns_ns_rr = 0
int dns_ns_rr_init_down = 1
char * dns_ns_list = NULL
char * dns_resolv_conf = NULL
char * dns_local_ipv6 = NULL
char * dns_local_ipv4 = NULL
int dns_thread = 0
int dns_prefer_ipv6 = 0
DNSProcessor dnsProcessor
ClassAllocator< DNSEntrydnsEntryAllocator ("dnsEntryAllocator")
ClassAllocator< HostEntdnsBufAllocator ("dnsBufAllocator", 2)
static int try_servers = 0
static int local_num_entries = 1
static int attempt_num_entries = 1
char try_server_names [DEFAULT_NUM_TRY_SERVER][MAXDNAME]
RecRawStatBlockdns_rsb

Detailed Description

A brief file description.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file DNS.cc.


Define Documentation

#define SRV_COST   (RRFIXEDSZ+0)

Definition at line 31 of file DNS.cc.

Referenced by dns_process().

#define SRV_FIXEDSZ   (RRFIXEDSZ+6)

Definition at line 35 of file DNS.cc.

#define SRV_PORT   (RRFIXEDSZ+4)

Definition at line 33 of file DNS.cc.

Referenced by dns_process().

#define SRV_SERVER   (RRFIXEDSZ+6)

Definition at line 34 of file DNS.cc.

Referenced by dns_process().

#define SRV_WEIGHT   (RRFIXEDSZ+2)

Definition at line 32 of file DNS.cc.

Referenced by dns_process().


Function Documentation

static int _ink_res_mkquery ( ink_res_state  res,
char *  qname,
int  qtype,
char *  buffer 
) [inline, static]
static bool dns_process ( DNSHandler handler,
HostEnt buf,
int  len 
) [static]
static void dns_result ( DNSHandler h,
DNSEntry e,
HostEnt ent,
bool  retry 
) [static]
static DNSEntry * get_dns ( DNSHandler h,
uint16_t  id 
) [inline, static]

Find a DNSEntry by id.

Definition at line 847 of file DNS.cc.

References DNSHandler::entries, and DLL< C, L >::head.

Referenced by dns_process().

static DNSEntry* get_entry ( DNSHandler h,
char *  qname,
int  qtype 
) [inline, static]

Find a DNSEntry by query name and type.

Definition at line 866 of file DNS.cc.

References DNSHandler::entries, and DLL< C, L >::head.

Referenced by DNSEntry::mainEvent().

static unsigned int get_rcode ( HostEnt ent  )  [inline, static]

Definition at line 716 of file DNS.cc.

References get_rcode().

static unsigned int get_rcode ( char *  buff  )  [inline, static]

Definition at line 712 of file DNS.cc.

Referenced by get_rcode(), good_rcode(), and DNSHandler::recv_dns().

static bool good_rcode ( char *  buff  )  [static]

Definition at line 721 of file DNS.cc.

References get_rcode().

Referenced by DNSHandler::recv_dns().

int ink_dn_expand ( const u_char *  msg,
const u_char *  eom,
const u_char *  comp_dn,
u_char *  exp_dn,
int  length 
) [inline]

Inter-OS portability for dn_expand.

dn_expand() expands the compressed domain name comp_dn to a full domain name. Expanded names are converted to upper case. msg is a pointer to the beginning of the message, exp_dn is a pointer to a buffer of size length for the result. The size of compressed name is returned or -1 if there was an error.

Definition at line 336 of file DNS.cc.

Referenced by dns_process().

void ink_dns_init ( ModuleVersion  v  ) 
static uint16_t ink_get16 ( const uint8_t *  src  )  [inline, static]

Definition at line 100 of file DNS.cc.

References NS_GET16.

Referenced by dns_process().

void make_ipv4_ptr ( in_addr_t  addr,
char *  buffer 
)

Definition at line 112 of file DNS.cc.

References ink_strlcpy().

Referenced by DNSEntry::init().

void make_ipv6_ptr ( in6_addr const *  addr,
char *  buffer 
)

Definition at line 145 of file DNS.cc.

References ink_strlcpy(), and TS_IP6_SIZE.

Referenced by DNSEntry::init().

static char* strnchr ( char *  s,
char  c,
int  len 
) [inline, static]

Definition at line 93 of file DNS.cc.

Referenced by DNSEntry::mainEvent().

static void write_dns ( DNSHandler h  )  [static]
static bool write_dns_event ( DNSHandler h,
DNSEntry e 
) [static]

Variable Documentation

int attempt_num_entries = 1 [static]

Definition at line 89 of file DNS.cc.

Referenced by dns_process().

int dns_failover_number = DEFAULT_FAILOVER_NUMBER

Definition at line 45 of file DNS.cc.

Referenced by DNSHandler::sent_one(), and DNSProcessor::start().

int dns_failover_period = DEFAULT_FAILOVER_PERIOD

Definition at line 46 of file DNS.cc.

Referenced by DNSHandler::failover_now(), and DNSProcessor::start().

int dns_failover_try_period = DEFAULT_FAILOVER_TRY_PERIOD

Definition at line 47 of file DNS.cc.

Referenced by DNSHandler::failover_soon(), and DNSProcessor::start().

unsigned int dns_handler_initialized = 0

Definition at line 50 of file DNS.cc.

Referenced by DNSProcessor::open(), and DNSHandler::startEvent().

char* dns_local_ipv4 = NULL

Definition at line 56 of file DNS.cc.

Referenced by DNSProcessor::dns_init(), and DNSProcessor::start().

char* dns_local_ipv6 = NULL

Definition at line 55 of file DNS.cc.

Referenced by DNSProcessor::dns_init(), and DNSProcessor::start().

int dns_max_dns_in_flight = MAX_DNS_IN_FLIGHT

Definition at line 48 of file DNS.cc.

Referenced by DNSProcessor::start(), and write_dns().

char* dns_ns_list = NULL

Definition at line 53 of file DNS.cc.

Referenced by DNSProcessor::dns_init(), and DNSProcessor::start().

int dns_ns_rr = 0

Definition at line 52 of file DNS.cc.

Referenced by DNSHandler::rr_failure(), and DNSHandler::startEvent().

int dns_prefer_ipv6 = 0

Definition at line 58 of file DNS.cc.

char* dns_resolv_conf = NULL

Definition at line 54 of file DNS.cc.

Referenced by DNSProcessor::dns_init(), and DNSProcessor::start().

int dns_retries = DEFAULT_DNS_RETRIES

Definition at line 1602 of file DNS.cc.

int dns_search = DEFAULT_DNS_SEARCH

Definition at line 44 of file DNS.cc.

Referenced by DNSEntry::mainEvent(), and DNSProcessor::start().

int dns_thread = 0

Definition at line 57 of file DNS.cc.

Referenced by DNSProcessor::start().

int dns_timeout = DEFAULT_DNS_TIMEOUT

Definition at line 42 of file DNS.cc.

Referenced by DNSProcessor::start(), and write_dns_event().

Definition at line 49 of file DNS.cc.

Referenced by dns_process(), and DNSProcessor::start().

ClassAllocator<HostEnt> dnsBufAllocator("dnsBufAllocator", 2)
ClassAllocator<DNSEntry> dnsEntryAllocator("dnsEntryAllocator")

Definition at line 37 of file DNS.cc.

Referenced by HostDBProcessor::start(), DNSProcessor::start(), and TSContSchedule().

int local_num_entries = 1 [static]

Definition at line 88 of file DNS.cc.

Referenced by dns_process(), and DNSHandler::try_primary_named().

char try_server_names[DEFAULT_NUM_TRY_SERVER][MAXDNAME]
int try_servers = 0 [static]

Definition at line 87 of file DNS.cc.

Referenced by dns_process(), DNSHandler::retry_named(), and DNSHandler::try_primary_named().