The Host Databse access interface. More...
#include <I_HostDBProcessor.h>
Inherits Processor.
Data Structures | |
struct | Options |
Optional parameters for getby... More... | |
Public Types | |
enum | { HOSTDB_DO_NOT_FORCE_DNS = 0, HOSTDB_ROUND_ROBIN = 0, HOSTDB_FORCE_DNS_RELOAD = 1, HOSTDB_FORCE_DNS_ALWAYS = 2, HOSTDB_DO_NOT_ROUND_ROBIN = 4 } |
Public Member Functions | |
HostDBProcessor () | |
inkcoreapi Action * | getbyname_re (Continuation *cont, const char *hostname, int len, Options const &opt=DEFAULT_OPTIONS) |
Action * | getSRVbyname_imm (Continuation *cont, process_srv_info_pfn process_srv_info, const char *hostname, int len, Options const &opt=DEFAULT_OPTIONS) |
Action * | getbyname_imm (Continuation *cont, process_hostdb_info_pfn process_hostdb_info, const char *hostname, int len, Options const &opt=DEFAULT_OPTIONS) |
Action * | getbyaddr_re (Continuation *cont, sockaddr const *aip) |
Lookup Hostinfo by addr. | |
void | setbyname_appinfo (char *hostname, int len, int port, HostDBApplicationInfo *app) |
Set the application information (fire-and-forget). | |
void | setbyaddr_appinfo (sockaddr const *addr, HostDBApplicationInfo *app) |
void | setbyaddr_appinfo (in_addr_t ip, HostDBApplicationInfo *app) |
int | start (int no_of_additional_event_threads=0, size_t stacksize=DEFAULT_STACKSIZE) |
Starts execution of the processor. | |
HostDBCache * | cache () |
void | setby (const char *hostname, int len, sockaddr const *aip, HostDBApplicationInfo *app) |
Set something. | |
void | setby_srv (const char *hostname, int len, const char *target, HostDBApplicationInfo *app) |
Static Public Attributes | |
static Options const | DEFAULT_OPTIONS |
Default options. | |
static int | hostdb_strict_round_robin = 0 |
Configuration. | |
static int | hostdb_timed_round_robin = 0 |
Friends | |
struct | HostDBSyncer |
The Host Databse access interface.
Definition at line 359 of file I_HostDBProcessor.h.
anonymous enum |
HOSTDB_DO_NOT_FORCE_DNS | |
HOSTDB_ROUND_ROBIN | |
HOSTDB_FORCE_DNS_RELOAD | |
HOSTDB_FORCE_DNS_ALWAYS | |
HOSTDB_DO_NOT_ROUND_ROBIN |
Definition at line 372 of file I_HostDBProcessor.h.
HostDBProcessor::HostDBProcessor | ( | ) | [inline] |
Definition at line 398 of file I_HostDBProcessor.h.
HostDBCache * HostDBProcessor::cache | ( | ) |
Definition at line 250 of file HostDB.cc.
Referenced by cmd_clear(), and HostDBSyncer::sync_event().
Action* HostDBProcessor::getbyaddr_re | ( | Continuation * | cont, | |
sockaddr const * | aip | |||
) | [inline] |
Lookup Hostinfo by addr.
Definition at line 415 of file I_HostDBProcessor.h.
References HOST_RES_NONE.
Referenced by HttpSM::do_hostdb_reverse_lookup(), HostDBTestReverse::mainEvent(), and ShowHostDB::showLookup().
Action * HostDBProcessor::getbyname_imm | ( | Continuation * | cont, | |
process_hostdb_info_pfn | process_hostdb_info, | |||
const char * | hostname, | |||
int | len, | |||
Options const & | opt = DEFAULT_OPTIONS | |||
) |
Definition at line 917 of file HostDB.cc.
References SplitDNSConfig::acquire(), HostDBContinuation::action, MultiCacheHeader::buckets, check_for_retry(), HostDBContinuation::Options::cont, HostDBMD5::db_mark, db_mark_for(), Debug, HostDBMD5::dns_server, HostDBInfo::failed(), HostDBProcessor::Options::flags, fold_md5(), HostDBContinuation::Options::force_dns, SplitDNS::getDNSRecord(), HostDBMD5::hash, HOST_DB_RETRY_PERIOD, HostDBMD5::host_len, HostDBMD5::host_name, HostDBContinuation::Options::host_res_style, HostDBProcessor::Options::host_res_style, hostdb_enable, HOSTDB_FORCE_DNS_ALWAYS, HOSTDB_FORCE_DNS_RELOAD, HOSTDB_INCREMENT_DYN_STAT, hostdb_re_dns_on_reload, hostdb_re_dns_on_reload_stat, hostdb_total_hits_stat, hostdb_total_lookups_stat, hostDBContAllocator, HostDBContinuation::init(), ink_assert, is_digit(), SplitDNSConfig::isSplitDNSEnabled(), MultiCacheBase::lock_for_bucket(), Thread::mutex, Continuation::mutex, MUTEX_LOCK, HostDBProcessor::Options::port, HostDBMD5::port, probe(), HostDBContinuation::probeEvent(), HostDBMD5::refresh(), SplitDNSConfig::release(), EThread::schedule_in(), SET_CONTINUATION_HANDLER, this_ethread(), HostDBContinuation::Options::timeout, and HostDBProcessor::Options::timeout.
Referenced by HttpSM::do_hostdb_lookup(), and HttpSM::state_hostdb_lookup().
Action * HostDBProcessor::getbyname_re | ( | Continuation * | cont, | |
const char * | hostname, | |||
int | len, | |||
Options const & | opt = DEFAULT_OPTIONS | |||
) |
Definition at line 824 of file HostDB.cc.
References HostDBProcessor::Options::flags, HostDBProcessor::Options::host_res_style, HOSTDB_FORCE_DNS_ALWAYS, HOSTDB_FORCE_DNS_RELOAD, HOSTDB_INCREMENT_DYN_STAT, hostdb_re_dns_on_reload, hostdb_re_dns_on_reload_stat, Thread::mutex, this_ethread(), and HostDBProcessor::Options::timeout.
Referenced by HostDBTestRR::mainEvent(), ShowHostDB::showLookup(), and TSHostLookup().
Action * HostDBProcessor::getSRVbyname_imm | ( | Continuation * | cont, | |
process_srv_info_pfn | process_srv_info, | |||
const char * | hostname, | |||
int | len, | |||
Options const & | opt = DEFAULT_OPTIONS | |||
) |
Definition at line 843 of file HostDB.cc.
References HostDBContinuation::action, MultiCacheHeader::buckets, HostDBContinuation::Options::cont, HostDBMD5::db_mark, Debug, dnsProcessor, HostDBProcessor::Options::flags, fold_md5(), HostDBContinuation::Options::force_dns, HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, hostdb_enable, HOSTDB_FORCE_DNS_ALWAYS, HOSTDB_FORCE_DNS_RELOAD, HOSTDB_INCREMENT_DYN_STAT, hostdb_re_dns_on_reload, hostdb_re_dns_on_reload_stat, hostdb_total_hits_stat, hostdb_total_lookups_stat, hostDBContAllocator, HostDBContinuation::init(), ink_assert, MultiCacheBase::lock_for_bucket(), Thread::mutex, Continuation::mutex, MUTEX_RETRY_DELAY, MUTEX_TRY_LOCK, HostDBMD5::port, probe(), HostDBContinuation::probeEvent(), HostDBMD5::refresh(), EThread::schedule_imm(), EThread::schedule_in(), SET_CONTINUATION_HANDLER, this_ethread(), DNSProcessor::thread, HostDBContinuation::Options::timeout, and HostDBProcessor::Options::timeout.
Referenced by HttpSM::do_hostdb_lookup().
void HostDBProcessor::setby | ( | const char * | hostname, | |
int | len, | |||
sockaddr const * | aip, | |||
HostDBApplicationInfo * | app | |||
) |
Set something.
aip can carry address and / or port information. If setting just by a port value, the address should be set to INADDR_ANY which is of type IPv4.
hostname | Hostname. | |
len | Length of hostname. | |
aip | Address and/or port. | |
app | I don't know. |
Definition at line 1044 of file HostDB.cc.
References HostDBApplicationInfo::allotment, HostDBContinuation::app, HostDBApplicationInfo::application_data_allotment::application1, HostDBApplicationInfo::application_data_allotment::application2, IpAddr::assign(), ats_ip_port_host_order(), MultiCacheHeader::buckets, HostDBMD5::db_mark, db_mark_for(), do_setby(), fold_md5(), HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, hostdb_enable, hostDBContAllocator, HostDBContinuation::init(), HostDBMD5::ip, MultiCacheBase::lock_for_bucket(), MUTEX_RETRY_DELAY, MUTEX_TRY_LOCK, HostDBMD5::port, probe(), HostDBMD5::refresh(), EThread::schedule_in(), SET_CONTINUATION_HANDLER, HostDBContinuation::setbyEvent(), and this_ethread().
Referenced by HttpSM::do_hostdb_update_if_necessary(), setbyaddr_appinfo(), and setbyname_appinfo().
void HostDBProcessor::setby_srv | ( | const char * | hostname, | |
int | len, | |||
const char * | target, | |||
HostDBApplicationInfo * | app | |||
) |
Definition at line 1080 of file HostDB.cc.
References HostDBApplicationInfo::allotment, HostDBContinuation::app, HostDBApplicationInfo::application_data_allotment::application1, HostDBApplicationInfo::application_data_allotment::application2, HostDBMD5::db_mark, eventProcessor, HostDBMD5::host_len, HostDBMD5::host_name, hostdb_enable, hostDBContAllocator, HostDBContinuation::init(), ink_strlcpy(), HostDBMD5::port, HostDBMD5::refresh(), EventProcessor::schedule_imm(), SET_CONTINUATION_HANDLER, HostDBContinuation::setbyEvent(), and HostDBContinuation::srv_target_name.
Referenced by HttpSM::do_hostdb_update_if_necessary(), and HttpSM::process_hostdb_info().
void HostDBProcessor::setbyaddr_appinfo | ( | in_addr_t | ip, | |
HostDBApplicationInfo * | app | |||
) | [inline] |
Definition at line 447 of file I_HostDBProcessor.h.
References ats_ip4_set(), ats_ip_sa_cast(), and setby().
void HostDBProcessor::setbyaddr_appinfo | ( | sockaddr const * | addr, | |
HostDBApplicationInfo * | app | |||
) | [inline] |
Definition at line 443 of file I_HostDBProcessor.h.
References setby().
void HostDBProcessor::setbyname_appinfo | ( | char * | hostname, | |
int | len, | |||
int | port, | |||
HostDBApplicationInfo * | app | |||
) | [inline] |
Set the application information (fire-and-forget).
Definition at line 436 of file I_HostDBProcessor.h.
References ats_ip4_set(), ats_ip_sa_cast(), and setby().
int HostDBProcessor::start | ( | int | number_of_threads = 0 , |
|
size_t | stacksize = DEFAULT_STACKSIZE | |||
) | [virtual] |
Starts execution of the processor.
Attempts to start the number of threads specified for the processor, initializes their states and sets them running. On failure it returns a negative value.
number_of_threads | Positive value indicating the number of threads to spawn for the processor. | |
stacksize | The thread stack size to use for this processor. |
Reimplemented from Processor.
Definition at line 444 of file HostDB.cc.
References MultiCacheBase::alloc_mutexes(), auto_clear_hostdb_flag, HostDBContinuation::backgroundEvent(), MultiCacheBase::clear(), ET_DNS, eventProcessor, HOST_DB_TIMEOUT_INTERVAL, hostdb_cluster, hostdb_cluster_round_robin, hostdb_current_interval, hostdb_disable_reverse_lookup, hostdb_ip_fail_timeout_interval, hostdb_ip_stale_interval, hostdb_ip_timeout_interval, hostdb_lookup_timeout, hostdb_migrate_on_demand, hostdb_re_dns_on_reload, hostdb_serve_stale_but_revalidate, HOSTDB_SET_DYN_COUNT, hostdb_strict_round_robin, hostdb_sync_frequency, hostdb_timed_round_robin, hostdb_total_entries_stat, hostdb_ttl_mode, hostDBContAllocator, ink_get_based_hrtime(), Continuation::mutex, new_ProxyMutex(), REC_EstablishStaticConfigInt32, REC_EstablishStaticConfigInt32U, StatPagesManager::register_http(), register_ShowHostDB(), EventProcessor::schedule_every(), EventProcessor::schedule_imm(), SET_CONTINUATION_HANDLER, HostDBCache::start(), statPagesManager, and MultiCacheHeader::totalelements.
Referenced by main().
friend struct HostDBSyncer [friend] |
Definition at line 361 of file I_HostDBProcessor.h.
HostDBProcessor::Options const HostDBProcessor::DEFAULT_OPTIONS [static] |
Default options.
Definition at line 396 of file I_HostDBProcessor.h.
int HostDBProcessor::hostdb_strict_round_robin = 0 [static] |
Configuration.
Definition at line 455 of file I_HostDBProcessor.h.
Referenced by HostDBRoundRobin::select_best_http(), and start().
int HostDBProcessor::hostdb_timed_round_robin = 0 [static] |
Definition at line 456 of file I_HostDBProcessor.h.
Referenced by HostDBRoundRobin::select_best_http(), and start().