Public Member Functions | Data Fields

DNSHandler Struct Reference

One DNSHandler is allocated to handle all DNS traffic by polling a UDP port. More...

#include <P_DNSProcessor.h>

Inherits Continuation.

Collaboration diagram for DNSHandler:
Collaboration graph
[legend]

Public Member Functions

void received_one (int i)
void sent_one ()
bool failover_now (int i)
bool failover_soon (int i)
void recv_dns (int event, Event *e)
int startEvent (int event, Event *e)
 Initial state of the DNSHandler.
int startEvent_sdns (int event, Event *e)
 Initial state of the DSNHandler.
int mainEvent (int event, Event *e)
 Main event for the DNSHandler.
void open_con (sockaddr const *addr, bool failed=false, int icon=0)
 Open (and close) connections as necessary and also assures that the epoll fd struct is properly updated.
void failover ()
 Fail over to another name server.
void rr_failure (int ndx)
 Mark one of the nameservers as down.
void recover ()
void retry_named (int ndx, ink_hrtime t, bool reopen=true)
void try_primary_named (bool reopen=true)
void switch_named (int ndx)
uint16_t get_query_id ()
void release_query_id (uint16_t qid)
void set_query_id_in_use (uint16_t qid)
bool query_id_in_use (uint16_t qid)
 DNSHandler ()

Data Fields

IpEndpoint ip
 This is used as the target if round robin isn't set.
IpEndpoint local_ipv6
 Local V6 address if set.
IpEndpoint local_ipv4
 Local V4 address if set.
int ifd [MAX_NAMED]
int n_con
DNSConnection con [MAX_NAMED]
int options
Queue< DNSEntryentries
Queue< DNSConnectiontriggered
int in_flight
int name_server
int in_write_dns
HostEnthostent_cache
int ns_down [MAX_NAMED]
int failover_number [MAX_NAMED]
int failover_soon_number [MAX_NAMED]
ink_hrtime crossed_failover_number [MAX_NAMED]
ink_hrtime last_primary_retry
ink_hrtime last_primary_reopen
ink_res_state m_res
int txn_lookup_timeout
InkRand generator
uint64_t qid_in_flight [(USHRT_MAX+1)/64]

Detailed Description

One DNSHandler is allocated to handle all DNS traffic by polling a UDP port.

Definition at line 203 of file P_DNSProcessor.h.


Constructor & Destructor Documentation

TS_INLINE DNSHandler::DNSHandler (  ) 

Member Function Documentation

void DNSHandler::failover (  ) 
bool DNSHandler::failover_now ( int  i  )  [inline]
bool DNSHandler::failover_soon ( int  i  )  [inline]
uint16_t DNSHandler::get_query_id (  ) 

Definition at line 917 of file DNS.cc.

References Error, generator, qid_in_flight, query_id_in_use(), InkRand::random(), and set_query_id_in_use().

Referenced by write_dns_event().

int DNSHandler::mainEvent ( int  event,
Event e 
)
void DNSHandler::open_con ( sockaddr const *  addr,
bool  failed = false,
int  icon = 0 
)

Open (and close) connections as necessary and also assures that the epoll fd struct is properly updated.

Definition at line 412 of file DNS.cc.

References ats_ip_copy(), ats_ip_nptop(), DNSConnection::close(), con, Debug, dns_ns_rr, DNSConnection::eio, Error, failover(), get_PollDescriptor(), ip, local_ipv4, local_ipv6, NO_FD, ns_down, DNSConnection::num, rr_failure(), IpEndpoint::sa, EventIO::stop(), and DNSProcessor::thread.

Referenced by failover(), retry_named(), startEvent(), startEvent_sdns(), and try_primary_named().

bool DNSHandler::query_id_in_use ( uint16_t  qid  )  [inline]

Definition at line 286 of file P_DNSProcessor.h.

References qid_in_flight.

Referenced by get_query_id().

void DNSHandler::received_one ( int  i  )  [inline]

Definition at line 234 of file P_DNSProcessor.h.

References crossed_failover_number, failover_number, and failover_soon_number.

Referenced by recv_dns(), and switch_named().

void DNSHandler::recover (  ) 

Definition at line 549 of file DNS.cc.

References ats_ip_ntop(), ip, name_server, IpEndpoint::sa, switch_named(), and Warning.

Referenced by recv_dns().

void DNSHandler::recv_dns ( int  event,
Event e 
)
void DNSHandler::release_query_id ( uint16_t  qid  )  [inline]

Definition at line 278 of file P_DNSProcessor.h.

References qid_in_flight.

Referenced by dns_result(), and write_dns_event().

void DNSHandler::retry_named ( int  ndx,
ink_hrtime  t,
bool  reopen = true 
)
void DNSHandler::rr_failure ( int  ndx  ) 
void DNSHandler::sent_one (  )  [inline]
void DNSHandler::set_query_id_in_use ( uint16_t  qid  )  [inline]

Definition at line 282 of file P_DNSProcessor.h.

References qid_in_flight.

Referenced by get_query_id().

int DNSHandler::startEvent ( int  event,
Event e 
)
int DNSHandler::startEvent_sdns ( int  event,
Event e 
)

Initial state of the DSNHandler.

Can reinitialize the running DNS hander to a new nameserver.

Definition at line 526 of file DNS.cc.

References Debug, DNS_PERIOD, Event::ethread, EThread::id, ip, mainEvent(), n_con, open_con(), IpEndpoint::sa, Event::schedule_every(), and SET_HANDLER.

void DNSHandler::switch_named ( int  ndx  ) 

Definition at line 609 of file DNS.cc.

References dns_retries, entries, DLL< C, L >::head, in_flight, and received_one().

Referenced by failover(), and recover().

void DNSHandler::try_primary_named ( bool  reopen = true  ) 

Field Documentation

Definition at line 223 of file P_DNSProcessor.h.

Referenced by DNSHandler(), failover_now(), failover_soon(), received_one(), and sent_one().

Definition at line 221 of file P_DNSProcessor.h.

Referenced by DNSHandler(), received_one(), and sent_one().

Definition at line 222 of file P_DNSProcessor.h.

Referenced by DNSHandler(), failover_soon(), mainEvent(), and received_one().

Definition at line 230 of file P_DNSProcessor.h.

Referenced by get_query_id().

Definition at line 218 of file P_DNSProcessor.h.

Referenced by recv_dns().

int DNSHandler::ifd[MAX_NAMED]

Definition at line 209 of file P_DNSProcessor.h.

Referenced by DNSHandler().

Definition at line 217 of file P_DNSProcessor.h.

Referenced by write_dns().

This is used as the target if round robin isn't set.

Definition at line 206 of file P_DNSProcessor.h.

Referenced by DNSHandler(), failover(), DNSProcessor::open(), open_con(), recover(), startEvent_sdns(), and try_primary_named().

Definition at line 225 of file P_DNSProcessor.h.

Referenced by retry_named(), and try_primary_named().

Definition at line 224 of file P_DNSProcessor.h.

Referenced by mainEvent(), and try_primary_named().

Local V4 address if set.

Definition at line 208 of file P_DNSProcessor.h.

Referenced by DNSProcessor::open(), and open_con().

Local V6 address if set.

Definition at line 207 of file P_DNSProcessor.h.

Referenced by DNSProcessor::open(), and open_con().

Definition at line 210 of file P_DNSProcessor.h.

Referenced by failover(), mainEvent(), startEvent(), and startEvent_sdns().

int DNSHandler::ns_down[MAX_NAMED]

Definition at line 220 of file P_DNSProcessor.h.

Referenced by DNSHandler(), mainEvent(), open_con(), recv_dns(), rr_failure(), and write_dns().

Definition at line 212 of file P_DNSProcessor.h.

Referenced by DNSProcessor::open().

uint64_t DNSHandler::qid_in_flight[(USHRT_MAX+1)/64]

Definition at line 214 of file P_DNSProcessor.h.

Referenced by recv_dns(), and DNSConnection::trigger().

Definition at line 228 of file P_DNSProcessor.h.

Referenced by DNSEntry::init(), DNSEntry::mainEvent(), and write_dns_event().


The documentation for this struct was generated from the following files: