net_db.cc File Reference
#include "squid.h"
#include "CachePeer.h"
#include "CachePeers.h"
#include "cbdata.h"
#include "event.h"
#include "fde.h"
#include "fs_io.h"
#include "FwdState.h"
#include "HttpReply.h"
#include "icmp/net_db.h"
#include "internal.h"
#include "ip/Address.h"
#include "log/File.h"
#include "MemObject.h"
#include "mgr/Registration.h"
#include "mime_header.h"
#include "neighbors.h"
#include "PeerSelectState.h"
#include "sbuf/SBuf.h"
#include "SquidConfig.h"
#include "Store.h"
#include "StoreClient.h"
#include "tools.h"
#include "wordlist.h"
#include "icmp/IcmpSquid.h"
#include "ipcache.h"
Include dependency graph for net_db.cc:

Go to the source code of this file.

Classes

class  netdbExchangeState
 

Enumerations

enum  netdb_conn_state_t {
  STATE_NONE ,
  STATE_HEADER ,
  STATE_BODY
}
 

Functions

 CBDATA_CLASS_INIT (netdbExchangeState)
 
Ip::Address networkFromInaddr (const Ip::Address &a)
 
static void netdbRelease (netdbEntry *n)
 
static void netdbHashInsert (netdbEntry *n, Ip::Address &addr)
 
static void netdbHashDelete (const char *key)
 
static void netdbHostInsert (netdbEntry *n, const char *hostname)
 
static void netdbHostDelete (const net_db_name *x)
 
static void netdbPurgeLRU (void)
 
static netdbEntrynetdbLookupHost (const char *key)
 
static net_db_peernetdbPeerByName (const netdbEntry *n, const char *)
 
static net_db_peernetdbPeerAdd (netdbEntry *n, CachePeer *e)
 
static const char * netdbPeerName (const char *name)
 
static int netdbLRU (const void *A, const void *B)
 
static netdbEntrynetdbLookupAddr (const Ip::Address &addr)
 
static netdbEntrynetdbAdd (Ip::Address &addr)
 
static void netdbSendPing (const ipcache_addrs *ia, const Dns::LookupDetails &, void *data)
 
static int sortByRtt (const void *A, const void *B)
 
static int sortPeerByRtt (const void *A, const void *B)
 
static void netdbSaveState (void *)
 
static void netdbReloadState (void)
 
static void netdbExchangeHandleReply (void *data, StoreIOBuffer receivedData)
 
void netdbInit (void)
 
void netdbPingSite (const char *hostname)
 
void netdbHandlePingReply (const Ip::Address &from, int hops, int rtt)
 
void netdbDump (StoreEntry *sentry)
 
int netdbHostHops (const char *host)
 
int netdbHostRtt (const char *host)
 
void netdbHostData (const char *host, int *samp, int *rtt, int *hops)
 
void netdbUpdatePeer (const AnyP::Uri &url, CachePeer *e, int irtt, int ihops)
 
void netdbExchangeUpdatePeer (Ip::Address &addr, CachePeer *e, double rtt, double hops)
 
void netdbDeleteAddrNetwork (Ip::Address &addr)
 
void netdbBinaryExchange (StoreEntry *s)
 
void netdbExchangeStart (void *data)
 
static CachePeerfindUsableParentAtHostname (PeerSelector *ps, const char *const hostname, const HttpRequest &request)
 
CachePeernetdbClosestParent (PeerSelector *ps)
 

Variables

static hash_tableaddr_table = nullptr
 
static hash_tablehost_table = nullptr
 
static IPH netdbSendPing
 
static STCB netdbExchangeHandleReply
 
static wordlistpeer_names = nullptr
 

Enumeration Type Documentation

◆ netdb_conn_state_t

Enumerator
STATE_NONE 
STATE_HEADER 
STATE_BODY 

Definition at line 53 of file net_db.cc.

Function Documentation

◆ CBDATA_CLASS_INIT()

CBDATA_CLASS_INIT ( netdbExchangeState  )

◆ findUsableParentAtHostname()

static CachePeer * findUsableParentAtHostname ( PeerSelector ps,
const char *const  hostname,
const HttpRequest request 
)
static

a netdbClosestParent() helper to find the first usable parent CachePeer responsible for the given hostname

Definition at line 1235 of file net_db.cc.

References CurrentCachePeers(), neighborType(), PEER_PARENT, peerHTTPOkay(), and HttpRequest::url.

Referenced by netdbClosestParent().

◆ netdbAdd()

static netdbEntry * netdbAdd ( Ip::Address addr)
static

◆ netdbBinaryExchange()

◆ netdbClosestParent()

◆ netdbDeleteAddrNetwork()

void netdbDeleteAddrNetwork ( Ip::Address addr)

Definition at line 1090 of file net_db.cc.

References debugs, netdbLookupAddr(), netdbRelease(), and netdbEntry::network.

Referenced by Comm::ConnOpener::sendAnswer().

◆ netdbDump()

◆ netdbExchangeHandleReply()

◆ netdbExchangeStart()

◆ netdbExchangeUpdatePeer()

◆ netdbHandlePingReply()

void netdbHandlePingReply ( const Ip::Address from,
int  hops,
int  rtt 
)

◆ netdbHashDelete()

static void netdbHashDelete ( const char *  key)
static

Definition at line 126 of file net_db.cc.

References addr_table, debug_trap(), hash_lookup(), and hash_remove_link().

Referenced by netdbRelease().

◆ netdbHashInsert()

static void netdbHashInsert ( netdbEntry n,
Ip::Address addr 
)
static

◆ netdbHostData()

void netdbHostData ( const char *  host,
int samp,
int rtt,
int hops 
)

◆ netdbHostDelete()

static void netdbHostDelete ( const net_db_name x)
static

◆ netdbHostHops()

int netdbHostHops ( const char *  host)

◆ netdbHostInsert()

static void netdbHostInsert ( netdbEntry n,
const char *  hostname 
)
static

Definition at line 150 of file net_db.cc.

References assert, hash_join(), hash_lookup(), and host_table.

Referenced by netdbReloadState(), and netdbSendPing().

◆ netdbHostRtt()

int netdbHostRtt ( const char *  host)

◆ netdbInit()

◆ netdbLookupAddr()

◆ netdbLookupHost()

static netdbEntry * netdbLookupHost ( const char *  key)
static

◆ netdbLRU()

static int netdbLRU ( const void *  A,
const void *  B 
)
static

Definition at line 208 of file net_db.cc.

References A, and B.

Referenced by netdbPurgeLRU().

◆ netdbPeerAdd()

◆ netdbPeerByName()

static net_db_peer * netdbPeerByName ( const netdbEntry n,
const char *  peername 
)
static

Definition at line 402 of file net_db.cc.

References netdbEntry::n_peers, net_db_peer::peername, and netdbEntry::peers.

Referenced by netdbExchangeUpdatePeer(), and netdbUpdatePeer().

◆ netdbPeerName()

static const char * netdbPeerName ( const char *  name)
static

Definition at line 651 of file net_db.cc.

References wordlist::key, wordlist::next, peer_names, and wordlistAdd().

Referenced by netdbPeerAdd().

◆ netdbPingSite()

void netdbPingSite ( const char *  hostname)

◆ netdbPurgeLRU()

static void netdbPurgeLRU ( void  )
static

◆ netdbRelease()

◆ netdbReloadState()

◆ netdbSaveState()

◆ netdbSendPing()

◆ netdbUpdatePeer()

◆ networkFromInaddr()

Ip::Address networkFromInaddr ( const Ip::Address a)

◆ sortByRtt()

static int sortByRtt ( const void *  A,
const void *  B 
)
static

Definition at line 388 of file net_db.cc.

References A, and B.

Referenced by netdbDump().

◆ sortPeerByRtt()

static int sortPeerByRtt ( const void *  A,
const void *  B 
)
static

Definition at line 451 of file net_db.cc.

References A, B, and net_db_peer::rtt.

Referenced by netdbExchangeUpdatePeer(), and netdbUpdatePeer().

Variable Documentation

◆ addr_table

◆ host_table

hash_table* host_table = nullptr
static

Definition at line 93 of file net_db.cc.

Referenced by netdbHostDelete(), netdbHostInsert(), netdbInit(), netdbLookupHost(), and netdbSendPing().

◆ netdbExchangeHandleReply

STCB netdbExchangeHandleReply
static

Definition at line 108 of file net_db.cc.

Referenced by netdbExchangeHandleReply(), and netdbExchangeStart().

◆ netdbSendPing

IPH netdbSendPing
static

Definition at line 107 of file net_db.cc.

Referenced by netdbPingSite().

◆ peer_names

wordlist* peer_names = nullptr
static

Definition at line 114 of file net_db.cc.

Referenced by netdbPeerName().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors