net_db.cc File Reference
#include "squid.h"
#include "CachePeer.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 "SquidConfig.h"
#include "SquidTime.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
 

Macros

#define NETDB_REQBUF_SZ   4096
 

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 *foo)
 
static void netdbReloadState (void)
 
static void netdbFreeNetdbEntry (void *data)
 
static void netdbFreeNameEntry (void *data)
 
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 netdbFreeMemory (void)
 
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)
 
CachePeernetdbClosestParent (PeerSelector *ps)
 

Variables

static hash_tableaddr_table = NULL
 
static hash_tablehost_table = NULL
 
static IPH netdbSendPing
 
static FREE netdbFreeNameEntry
 
static FREE netdbFreeNetdbEntry
 
static STCB netdbExchangeHandleReply
 
static wordlistpeer_names = NULL
 

Macro Definition Documentation

◆ NETDB_REQBUF_SZ

#define NETDB_REQBUF_SZ   4096

Definition at line 52 of file net_db.cc.

Enumeration Type Documentation

◆ netdb_conn_state_t

Enumerator
STATE_NONE 
STATE_HEADER 
STATE_BODY 

Definition at line 54 of file net_db.cc.

Function Documentation

◆ CBDATA_CLASS_INIT()

CBDATA_CLASS_INIT ( netdbExchangeState  )

◆ netdbAdd()

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

◆ netdbBinaryExchange()

void netdbBinaryExchange ( StoreEntry s)

Definition at line 1180 of file net_db.cc.

Referenced by internalStart().

◆ netdbClosestParent()

CachePeer* netdbClosestParent ( PeerSelector ps)

Definition at line 1308 of file net_db.cc.

Referenced by PeerSelector::selectSomeNeighbor().

◆ netdbDeleteAddrNetwork()

void netdbDeleteAddrNetwork ( Ip::Address addr)

Definition at line 1165 of file net_db.cc.

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

◆ netdbDump()

void netdbDump ( StoreEntry sentry)

Definition at line 970 of file net_db.cc.

Referenced by netdbInit().

◆ netdbExchangeHandleReply()

◆ netdbExchangeStart()

void netdbExchangeStart ( void *  data)

Definition at line 1270 of file net_db.cc.

Referenced by peerDNSConfigure().

◆ netdbExchangeUpdatePeer()

void netdbExchangeUpdatePeer ( Ip::Address addr,
CachePeer e,
double  rtt,
double  hops 
)

Definition at line 1123 of file net_db.cc.

Referenced by netdbExchangeHandleReply().

◆ netdbFreeMemory()

void netdbFreeMemory ( void  )

Definition at line 955 of file net_db.cc.

Referenced by SquidShutdown().

◆ netdbFreeNameEntry()

static void netdbFreeNameEntry ( void *  data)
static

Definition at line 679 of file net_db.cc.

◆ netdbFreeNetdbEntry()

static void netdbFreeNetdbEntry ( void *  data)
static

Definition at line 671 of file net_db.cc.

References netdbEntry::peers, and safe_free.

◆ netdbHandlePingReply()

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

Definition at line 925 of file net_db.cc.

Referenced by IcmpSquid::Recv().

◆ netdbHashDelete()

static void netdbHashDelete ( const char *  key)
static

Definition at line 130 of file net_db.cc.

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

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 
)

Definition at line 1067 of file net_db.cc.

Referenced by htcpTstReply().

◆ netdbHostDelete()

static void netdbHostDelete ( const net_db_name x)
static

◆ netdbHostHops()

int netdbHostHops ( const char *  host)

Definition at line 1037 of file net_db.cc.

Referenced by PeerSelector::checkNetdbDirect(), and doV2Query().

◆ netdbHostInsert()

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

Definition at line 154 of file net_db.cc.

References assert, hash_join(), hash_lookup(), net_db_name::net_db_name(), and NULL.

Referenced by netdbReloadState(), and netdbSendPing().

◆ netdbHostRtt()

int netdbHostRtt ( const char *  host)

◆ netdbInit()

void netdbInit ( void  )

Definition at line 885 of file net_db.cc.

Referenced by serverConnectionsOpen().

◆ netdbLookupAddr()

◆ netdbLookupHost()

static netdbEntry * netdbLookupHost ( const char *  key)
static

◆ netdbLRU()

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

Definition at line 212 of file net_db.cc.

Referenced by netdbPurgeLRU().

◆ netdbPeerAdd()

◆ netdbPeerByName()

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

Definition at line 409 of file net_db.cc.

References i, netdbEntry::n_peers, NULL, p, net_db_peer::peername, and netdbEntry::peers.

Referenced by netdbExchangeUpdatePeer(), and netdbUpdatePeer().

◆ netdbPeerName()

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

Definition at line 658 of file net_db.cc.

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

Referenced by netdbPeerAdd().

◆ netdbPingSite()

void netdbPingSite ( const char *  hostname)

◆ netdbPurgeLRU()

static void netdbPurgeLRU ( void  )
static

◆ netdbRelease()

◆ netdbReloadState()

◆ netdbSaveState()

◆ netdbSendPing()

◆ netdbUpdatePeer()

void netdbUpdatePeer ( const AnyP::Uri url,
CachePeer e,
int  irtt,
int  ihops 
)

◆ networkFromInaddr()

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

◆ sortByRtt()

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

Definition at line 395 of file net_db.cc.

Referenced by netdbDump().

◆ sortPeerByRtt()

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

Definition at line 458 of file net_db.cc.

References net_db_peer::rtt.

Referenced by netdbExchangeUpdatePeer(), and netdbUpdatePeer().

Variable Documentation

◆ addr_table

hash_table* addr_table = NULL
static

Definition at line 94 of file net_db.cc.

◆ host_table

hash_table* host_table = NULL
static

Definition at line 95 of file net_db.cc.

◆ netdbExchangeHandleReply

STCB netdbExchangeHandleReply
static

Definition at line 112 of file net_db.cc.

Referenced by netdbExchangeHandleReply(), and netdbExchangeStart().

◆ netdbFreeNameEntry

FREE netdbFreeNameEntry
static

Definition at line 110 of file net_db.cc.

Referenced by netdbFreeMemory().

◆ netdbFreeNetdbEntry

FREE netdbFreeNetdbEntry
static

Definition at line 111 of file net_db.cc.

Referenced by netdbFreeMemory().

◆ netdbSendPing

IPH netdbSendPing
static

Definition at line 109 of file net_db.cc.

Referenced by netdbPingSite().

◆ peer_names

wordlist* peer_names = NULL
static

Definition at line 118 of file net_db.cc.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors