A brief file description. More...
#include "P_HostDB.h"
#include "I_Layout.h"
#include "Show.h"
#include "ink_apidefs.h"
Go to the source code of this file.
Data Structures | |
struct | HostDBTestRR |
struct | HostDBSyncer |
struct | HostDB_get_message |
struct | HostDB_put_message |
struct | ShowHostDB |
struct | HostDBTestReverse |
Defines | |
#define | _HOSTDB_CC_ |
#define | STR_LEN_EQ_PREFIX(_x, _l, _s) (!ptr_len_ncasecmp(_x,_l,_s,sizeof(_s)-1)) |
#define | HOSTDB_TEST_MAX_OUTSTANDING 100 |
#define | HOSTDB_TEST_LENGTH 100000 |
Typedefs | |
typedef int(ShowHostDB::* | ShowHostDBEventHandler )(int event, Event *data) |
typedef int(HostDBTestReverse::* | HostDBTestReverseHandler )(int, void *) |
Functions | |
static int | corrupt_debugging_callout (HostDBInfo *e, RebuildMC &r) |
static bool | is_addr_valid (uint8_t af, void *ptr) |
static void | ip_addr_set (sockaddr *ip, uint8_t af, void *ptr) |
static void | ip_addr_set (IpAddr &ip, uint8_t af, void *ptr) |
void | hostdb_cont_free (HostDBContinuation *cont) |
static bool | check_for_retry (HostDBMark &mark, HostResStyle style) |
char const * | string_for (HostDBMark mark) |
Convert a HostDB mark to a string. | |
static Action * | register_ShowHostDB (Continuation *c, HTTPHdr *h) |
void | make_md5 (INK_MD5 &md5, const char *hostname, int len, int port, char const *pDNSServers, HostDBMark mark) |
static bool | reply_to_cont (Continuation *cont, HostDBInfo *r, bool is_srv=false) |
HostResStyle | host_res_style_for (sockaddr const *ip) |
HostResStyle | host_res_style_for (HostDBMark mark) |
HostDBMark | db_mark_for (HostResStyle style) |
HostDBMark | db_mark_for (sockaddr const *ip) |
HostDBInfo * | probe (ProxyMutex *mutex, HostDBMD5 const &md5, bool ignore_timeout) |
static void | do_setby (HostDBInfo *r, HostDBApplicationInfo *app, const char *hostname, IpAddr const &ip, bool is_srv=false) |
static int | remove_round_robin (HostDBInfo *r, const char *hostname, IpAddr const &ip) |
static int | restore_info (HostDBInfo *r, HostDBInfo *old_r, HostDBInfo &old_info, HostDBRoundRobin *old_rr_data) |
void | get_hostinfo_ClusterFunction (ClusterHandler *ch, void *data, int) |
void | put_hostinfo_ClusterFunction (ClusterHandler *ch, void *data, int) |
void | ink_hostdb_init (ModuleVersion v) |
Variables | |
HostDBProcessor | hostDBProcessor |
int | hostdb_enable = true |
int | hostdb_migrate_on_demand = true |
int | hostdb_cluster = false |
int | hostdb_cluster_round_robin = false |
int | hostdb_lookup_timeout = 120 |
int | hostdb_insert_timeout = 160 |
int | hostdb_re_dns_on_reload = false |
int | hostdb_ttl_mode = TTL_OBEY |
unsigned int | hostdb_current_interval = 0 |
unsigned int | hostdb_ip_stale_interval = HOST_DB_IP_STALE |
unsigned int | hostdb_ip_timeout_interval = HOST_DB_IP_TIMEOUT |
unsigned int | hostdb_ip_fail_timeout_interval = HOST_DB_IP_FAIL_TIMEOUT |
unsigned int | hostdb_serve_stale_but_revalidate = 0 |
char | hostdb_filename [PATH_NAME_MAX+1] = DEFAULT_HOST_DB_FILENAME |
int | hostdb_size = DEFAULT_HOST_DB_SIZE |
int | hostdb_sync_frequency = 120 |
int | hostdb_srv_enabled = 0 |
int | hostdb_disable_reverse_lookup = 0 |
ClassAllocator < HostDBContinuation > | hostDBContAllocator ("hostDBContAllocator") |
HostDBCache | hostDB |
static Queue< HostDBContinuation > | remoteHostDBQueue [MULTI_CACHE_PARTITIONS] |
RecRawStatBlock * | hostdb_rsb |
A brief file description.
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 HostDB.cc.
#define HOSTDB_TEST_LENGTH 100000 |
Definition at line 2373 of file HostDB.cc.
Referenced by HostDBTestReverse::mainEvent().
#define HOSTDB_TEST_MAX_OUTSTANDING 100 |
Definition at line 2372 of file HostDB.cc.
Referenced by HostDBTestReverse::mainEvent().
#define STR_LEN_EQ_PREFIX | ( | _x, | ||
_l, | ||||
_s | ||||
) | (!ptr_len_ncasecmp(_x,_l,_s,sizeof(_s)-1)) |
Definition at line 2332 of file HostDB.cc.
Referenced by register_ShowHostDB().
typedef int(HostDBTestReverse::* HostDBTestReverseHandler)(int, void *) |
typedef int(ShowHostDB::* ShowHostDBEventHandler)(int event, Event *data) |
static bool check_for_retry | ( | HostDBMark & | mark, | |
HostResStyle | style | |||
) | [inline, static] |
Definition at line 139 of file HostDB.cc.
References HOST_RES_IPV4, HOST_RES_IPV6, HOSTDB_MARK_IPV4, and HOSTDB_MARK_IPV6.
Referenced by HostDBContinuation::dnsEvent(), and HostDBProcessor::getbyname_imm().
static int corrupt_debugging_callout | ( | HostDBInfo * | e, | |
RebuildMC & | r | |||
) | [inline, static] |
Definition at line 79 of file HostDB.cc.
References HostDBInfo::app, RebuildMC::data, Debug, HostDBApplicationInfo::application_data_rr::offset, RebuildMC::partition, and HostDBApplicationInfo::rr.
Referenced by HostDBCache::rebuild_callout().
HostDBMark db_mark_for | ( | HostResStyle | style | ) | [inline] |
Definition at line 605 of file HostDB.cc.
References HOST_RES_IPV4, HOST_RES_IPV4_ONLY, HOST_RES_IPV6, and HOST_RES_IPV6_ONLY.
Referenced by get_hostinfo_ClusterFunction(), HostDBProcessor::getbyname_imm(), put_hostinfo_ClusterFunction(), and HostDBProcessor::setby().
HostDBMark db_mark_for | ( | sockaddr const * | ip | ) | [inline] |
Definition at line 615 of file HostDB.cc.
References ats_is_ip6(), and HOSTDB_MARK_IPV6.
static void do_setby | ( | HostDBInfo * | r, | |
HostDBApplicationInfo * | app, | |||
const char * | hostname, | |||
IpAddr const & | ip, | |||
bool | is_srv = false | |||
) | [static] |
Definition at line 1006 of file HostDB.cc.
References HostDBApplicationInfo::allotment, HostDBInfo::app, HostDBApplicationInfo::application_data_allotment::application1, HostDBApplicationInfo::application_data_allotment::application2, HostDBInfo::data, Debug, HostDBRoundRobin::info, HostDBInfo::ip, HostDBInfo::is_srv, SRVInfo::key, makeHostHash(), HostDBInfo::reverse_dns, HostDBInfo::round_robin, HostDBInfo::rr(), HostDBRoundRobin::rrcount, HostDBInfo::srv, and HostDBInfo::srvname().
Referenced by HostDBProcessor::setby(), and HostDBContinuation::setbyEvent().
void get_hostinfo_ClusterFunction | ( | ClusterHandler * | ch, | |
void * | data, | |||
int | ||||
) |
Definition at line 2054 of file HostDB.cc.
References SplitDNSConfig::acquire(), HostDBContinuation::action, IpAddr::assign(), ats_ip_port_host_order(), MultiCacheHeader::buckets, HostDB_get_message::cont, HostDBMD5::db_mark, db_mark_for(), HostDBMD5::dns_server, dnsProcessor, fold_md5(), HostDBContinuation::from, HostDBContinuation::from_cont, get_hostinfo_ClusterFunction, SplitDNS::getDNSRecord(), HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, HostDBContinuation::Options::host_res_style, host_res_style_for(), hostDBContAllocator, HostDBContinuation::init(), HostDB_get_message::ip, HostDBMD5::ip, SplitDNSConfig::isSplitDNSEnabled(), MultiCacheBase::lock_for_bucket(), ClusterHandler::machine, HostDB_get_message::md5, Action::mutex, Continuation::mutex, HostDB_get_message::name, HostDB_get_message::namelen, HostDBMD5::port, HostDBContinuation::probeEvent(), SplitDNSConfig::release(), IpEndpoint::sa, EThread::schedule_imm(), SET_CONTINUATION_HANDLER, and DNSProcessor::thread.
HostResStyle host_res_style_for | ( | sockaddr const * | ip | ) | [inline] |
Definition at line 592 of file HostDB.cc.
References ats_is_ip6(), and HOST_RES_IPV6_ONLY.
Referenced by HostDBContinuation::do_dns(), get_hostinfo_ClusterFunction(), probe(), and put_hostinfo_ClusterFunction().
HostResStyle host_res_style_for | ( | HostDBMark | mark | ) | [inline] |
Definition at line 597 of file HostDB.cc.
References HOST_RES_IPV4_ONLY, HOST_RES_IPV6_ONLY, HOSTDB_MARK_IPV4, and HOSTDB_MARK_IPV6.
void hostdb_cont_free | ( | HostDBContinuation * | cont | ) | [inline] |
Definition at line 125 of file HostDB.cc.
References HostDBContinuation::action, Action::cancel(), hostDBContAllocator, Action::mutex, Continuation::mutex, and HostDBContinuation::pending_action.
Referenced by HostDBContinuation::clusterEvent(), HostDBContinuation::clusterResponseEvent(), HostDBContinuation::dnsEvent(), HostDBContinuation::dnsPendingEvent(), HostDBContinuation::do_dns(), HostDBContinuation::failed_cluster_request(), HostDBContinuation::probeEvent(), HostDBContinuation::removeEvent(), and HostDBContinuation::setbyEvent().
void ink_hostdb_init | ( | ModuleVersion | v | ) |
Definition at line 2442 of file HostDB.cc.
References checkModuleVersion(), hostdb_bytes_stat, HOSTDB_MODULE_VERSION, hostdb_re_dns_on_reload_stat, HostDB_Stat_Count, hostdb_total_entries_stat, hostdb_total_hits_stat, hostdb_total_lookups_stat, hostdb_ttl_expires_stat, hostdb_ttl_stat, ink_release_assert, RecAllocateRawStatBlock(), RECD_FLOAT, RECD_INT, RECP_NON_PERSISTENT, RECP_PERSISTENT, RecRawStatSyncAvg(), RecRawStatSyncCount(), RecRawStatSyncSum(), RecRegisterRawStat, RECT_PROCESS, and ts_host_res_global_init().
Referenced by main().
static void ip_addr_set | ( | IpAddr & | ip, | |
uint8_t | af, | |||
void * | ptr | |||
) | [inline, static] |
ip | Target storage. | |
af | Address format. | |
ptr | Raw address data |
Definition at line 111 of file HostDB.cc.
References IpAddr::invalidate().
static void ip_addr_set | ( | sockaddr * | ip, | |
uint8_t | af, | |||
void * | ptr | |||
) | [inline, static] |
ip | Target storage, sockaddr compliant. | |
af | Address format. | |
ptr | Raw address data |
Definition at line 98 of file HostDB.cc.
References ats_ip4_set(), ats_ip6_set(), and ats_ip_invalidate().
Referenced by HostDBContinuation::dnsEvent().
static bool is_addr_valid | ( | uint8_t | af, | |
void * | ptr | |||
) | [inline, static] |
af | Address family (format of data) | |
ptr | Raw address data (not a sockaddr variant!) |
Definition at line 87 of file HostDB.cc.
Referenced by HostDBContinuation::dnsEvent().
void make_md5 | ( | INK_MD5 & | md5, | |
const char * | hostname, | |||
int | len, | |||
int | port, | |||
char const * | pDNSServers, | |||
HostDBMark | mark | |||
) |
Definition at line 534 of file HostDB.cc.
References ink_code_incr_md5_final(), ink_code_incr_md5_init(), and ink_code_incr_md5_update().
Referenced by HostDBMD5::refresh().
HostDBInfo* probe | ( | ProxyMutex * | mutex, | |
HostDBMD5 const & | md5, | |||
bool | ignore_timeout | |||
) |
Definition at line 620 of file HostDB.cc.
References MultiCacheHeader::buckets, cluster_machine_at_depth(), Debug, MultiCache< C >::delete_block(), HostDBContinuation::do_dns(), HostDBInfo::failed(), fold_md5(), HostDBMD5::hash, HostDBInfo::hits, HostDBMD5::host_len, HostDBMD5::host_name, HostDBContinuation::Options::host_res_style, host_res_style_for(), hostdb_enable, HOSTDB_INCREMENT_DYN_STAT, hostdb_ttl_expires_stat, hostDBContAllocator, HostDBInfo::hostname(), HostDBContinuation::init(), ink_assert, HostDBInfo::ip, HostDBInfo::ip_interval(), HostDBInfo::ip_timeout_interval, HostDBInfo::ip_timestamp, HostDBInfo::is_deleted(), is_dotted_form_hostname(), HostDBInfo::is_ip_fail_timeout(), HostDBInfo::is_ip_stale(), HostDBInfo::is_ip_timeout(), MultiCacheHeader::levels, MultiCacheBase::lock_for_bucket(), MultiCache< C >::lookup_block(), master_hash(), HostDBInfo::md5_high, HostDBInfo::refresh_ip(), HostDBInfo::reverse_dns, HostDBInfo::round_robin, HostDBInfo::rr(), HostDBInfo::serve_stale_but_revalidate(), this_ethread(), and ProxyMutex::thread_holding.
Referenced by HostDBContinuation::dnsEvent(), HostDBProcessor::getbyname_imm(), HostDBProcessor::getSRVbyname_imm(), MakeHttpProxyAcceptor(), HostDBContinuation::probeEvent(), HostDBContinuation::removeEvent(), HostDBProcessor::setby(), and HostDBContinuation::setbyEvent().
void put_hostinfo_ClusterFunction | ( | ClusterHandler * | ch, | |
void * | data, | |||
int | ||||
) |
Definition at line 2100 of file HostDB.cc.
References IpAddr::assign(), ats_ip_port_host_order(), MultiCacheHeader::buckets, HostDBContinuation::clusterResponseEvent(), HostDB_put_message::cont, HostDBMD5::db_mark, db_mark_for(), dnsProcessor, fold_md5(), HostDBContinuation::from, HostDBContinuation::from_cont, HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, HostDBContinuation::Options::host_res_style, host_res_style_for(), hostDBContAllocator, HostDBContinuation::init(), HostDB_put_message::ip, HostDBMD5::ip, MultiCacheBase::lock_for_bucket(), ClusterHandler::machine, HostDB_put_message::md5, HostDB_put_message::missing, HostDBContinuation::missing, Continuation::mutex, HostDB_put_message::name, HostDB_put_message::namelen, HostDBMD5::port, put_hostinfo_ClusterFunction, HostDB_put_message::round_robin, HostDBContinuation::round_robin, IpEndpoint::sa, EThread::schedule_imm(), SET_CONTINUATION_HANDLER, DNSProcessor::thread, HostDB_put_message::ttl, and HostDBContinuation::ttl.
static Action * register_ShowHostDB | ( | Continuation * | c, | |
HTTPHdr * | h | |||
) | [static] |
Definition at line 2336 of file HostDB.cc.
References ShowCont::action, ats_ip_pton(), ats_strndup, ShowHostDB::force, ShowHostDB::ip, ShowHostDB::name, URL::path_get(), ptr_len_ncasecmp(), URL::query_get(), ShowCont::sarg, EThread::schedule_imm(), SET_CONTINUATION_HANDLER, ShowHostDB::showLookup(), ShowHostDB::showMain(), STR_LEN_EQ_PREFIX, this_ethread(), and HTTPHdr::url_get().
Referenced by HostDBProcessor::start().
static int remove_round_robin | ( | HostDBInfo * | r, | |
const char * | hostname, | |||
IpAddr const & | ip | |||
) | [static] |
Definition at line 1117 of file HostDB.cc.
References ats_ip_ntop(), Debug, MultiCache< C >::delete_block(), diags, HostDBRoundRobin::good, HostDBRoundRobin::info, HostDBInfo::ip, Note, Diags::on(), HostDBInfo::round_robin, HostDBInfo::rr(), and IpAddr::toString().
Referenced by HostDBContinuation::removeEvent().
static bool reply_to_cont | ( | Continuation * | cont, | |
HostDBInfo * | r, | |||
bool | is_srv = false | |||
) | [static] |
Definition at line 550 of file HostDB.cc.
References ats_ip_ntop(), Debug, MultiCache< C >::delete_block(), EVENT_HOST_DB_LOOKUP, EVENT_SRV_LOOKUP, HostDBInfo::failed(), HostDBInfo::full, HostDBRoundRobin::good, Continuation::handleEvent(), HostDBInfo::hostname(), ink_assert, HostDBInfo::ip, HostDBInfo::is_srv, HostDBInfo::reverse_dns, HostDBInfo::round_robin, HostDBInfo::rr(), HostDBRoundRobin::rrcount, and Warning.
Referenced by HostDBContinuation::clusterEvent(), HostDBContinuation::dnsEvent(), HostDBContinuation::do_dns(), and HostDBContinuation::probeEvent().
static int restore_info | ( | HostDBInfo * | r, | |
HostDBInfo * | old_r, | |||
HostDBInfo & | old_info, | |||
HostDBRoundRobin * | old_rr_data | |||
) | [static] |
Definition at line 1352 of file HostDB.cc.
References HostDBInfo::app, ats_ip_addr_eq(), HostDBRoundRobin::info, HostDBInfo::ip, and HostDBRoundRobin::rrcount.
Referenced by HostDBContinuation::dnsEvent().
char const* string_for | ( | HostDBMark | mark | ) |
int hostdb_cluster = false |
Definition at line 44 of file HostDB.cc.
Referenced by HostDBContinuation::do_get_response(), HostDBContinuation::do_put_response(), and HostDBProcessor::start().
int hostdb_cluster_round_robin = false |
Definition at line 45 of file HostDB.cc.
Referenced by HostDBContinuation::clusterResponseEvent(), HostDBContinuation::do_put_response(), and HostDBProcessor::start().
unsigned int hostdb_current_interval = 0 |
Definition at line 50 of file HostDB.cc.
Referenced by HostDBContinuation::backgroundEvent(), cmd_check_internal(), HostDBContinuation::insert(), HostDBInfo::ip_interval(), HostDBInfo::ip_time_remaining(), HostDBInfo::refresh_ip(), and HostDBProcessor::start().
int hostdb_disable_reverse_lookup = 0 |
Definition at line 59 of file HostDB.cc.
Referenced by HostDBProcessor::start().
int hostdb_enable = true |
Definition at line 42 of file HostDB.cc.
Referenced by HostDBProcessor::getbyname_imm(), HostDBProcessor::getSRVbyname_imm(), probe(), HostDBContinuation::probeEvent(), HostDBContinuation::removeEvent(), HostDBProcessor::setby(), HostDBProcessor::setby_srv(), and HostDBCache::start().
char hostdb_filename[PATH_NAME_MAX+1] = DEFAULT_HOST_DB_FILENAME |
Definition at line 55 of file HostDB.cc.
Referenced by HostDBCache::start().
int hostdb_insert_timeout = 160 |
Definition at line 47 of file HostDB.cc.
Referenced by HostDBContinuation::dnsEvent().
unsigned int hostdb_ip_fail_timeout_interval = HOST_DB_IP_FAIL_TIMEOUT |
Definition at line 53 of file HostDB.cc.
Referenced by HostDBInfo::is_ip_fail_timeout(), HostDBContinuation::lookup_done(), and HostDBProcessor::start().
unsigned int hostdb_ip_stale_interval = HOST_DB_IP_STALE |
Definition at line 51 of file HostDB.cc.
Referenced by HostDBInfo::is_ip_stale(), and HostDBProcessor::start().
unsigned int hostdb_ip_timeout_interval = HOST_DB_IP_TIMEOUT |
Definition at line 52 of file HostDB.cc.
Referenced by HostDBContinuation::lookup_done(), and HostDBProcessor::start().
int hostdb_lookup_timeout = 120 |
Definition at line 46 of file HostDB.cc.
Referenced by HostDBContinuation::do_dns(), and HostDBProcessor::start().
int hostdb_migrate_on_demand = true |
Definition at line 43 of file HostDB.cc.
Referenced by HostDBContinuation::clusterEvent(), HostDBContinuation::do_get_response(), and HostDBProcessor::start().
int hostdb_re_dns_on_reload = false |
Definition at line 48 of file HostDB.cc.
Referenced by HostDBProcessor::getbyname_imm(), HostDBProcessor::getbyname_re(), HostDBProcessor::getSRVbyname_imm(), and HostDBProcessor::start().
unsigned int hostdb_serve_stale_but_revalidate = 0 |
Definition at line 54 of file HostDB.cc.
Referenced by HostDBInfo::serve_stale_but_revalidate(), and HostDBProcessor::start().
int hostdb_size = DEFAULT_HOST_DB_SIZE |
Definition at line 56 of file HostDB.cc.
Referenced by HostDBCache::start().
int hostdb_srv_enabled = 0 |
Definition at line 58 of file HostDB.cc.
Referenced by HostDBCache::estimated_heap_bytes_per_entry(), HttpSM::init(), and HostDBCache::start().
int hostdb_sync_frequency = 120 |
Definition at line 57 of file HostDB.cc.
Referenced by MultiCacheSync::mcEvent(), HostDBProcessor::start(), MultiCacheHeapGC::startEvent(), and HostDBSyncer::wait_event().
int hostdb_ttl_mode = TTL_OBEY |
Definition at line 49 of file HostDB.cc.
Referenced by HostDBContinuation::lookup_done(), and HostDBProcessor::start().
ClassAllocator<HostDBContinuation> hostDBContAllocator("hostDBContAllocator") |
Definition at line 37 of file HostDB.cc.
Referenced by cmd_clear(), HttpSM::do_hostdb_lookup(), HttpSM::do_hostdb_reverse_lookup(), HttpSM::do_hostdb_update_if_necessary(), main(), HttpSM::process_hostdb_info(), TestProxy::startEvent(), HttpSM::state_hostdb_lookup(), and TSHostLookup().
Queue<HostDBContinuation > remoteHostDBQueue[MULTI_CACHE_PARTITIONS] [static] |