htcp.cc File Reference
#include "squid.h"
#include "AccessLogEntry.h"
#include "acl/Acl.h"
#include "acl/FilledChecklist.h"
#include "CachePeer.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/Loops.h"
#include "comm/UdpOpenDialer.h"
#include "compat/xalloc.h"
#include "globals.h"
#include "htcp.h"
#include "http.h"
#include "http/ContentLengthInterpreter.h"
#include "HttpRequest.h"
#include "icmp/net_db.h"
#include "ip/tools.h"
#include "md5.h"
#include "mem/forward.h"
#include "MemBuf.h"
#include "refresh.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
#include "store_key_md5.h"
#include "StoreClient.h"
#include "tools.h"
Include dependency graph for htcp.cc:

Go to the source code of this file.

Classes

struct  _Countstr
 
struct  _htcpHeader
 
struct  _htcpDataHeaderSquid
 
struct  _htcpDataHeader
 
struct  _htcpAuthHeader
 
class  htcpSpecifier
 
class  htcpDetail
 
class  htcpStuff
 

Macros

#define N_QUERIED_KEYS   8192
 

Typedefs

typedef struct _Countstr Countstr
 
typedef struct _htcpHeader htcpHeader
 
typedef struct _htcpDataHeader htcpDataHeader
 
typedef struct _htcpDataHeaderSquid htcpDataHeaderSquid
 
typedef struct _htcpAuthHeader htcpAuthHeader
 

Enumerations

enum  {
  HTCP_NOP,
  HTCP_TST,
  HTCP_MON,
  HTCP_SET,
  HTCP_CLR,
  HTCP_END
}
 
enum  {
  AUTH_REQUIRED,
  AUTH_FAILURE,
  OPCODE_UNIMPLEMENTED,
  MAJOR_VERSION_UNSUPPORTED,
  MINOR_VERSION_UNSUPPORTED,
  INVALID_OPCODE
}
 
enum  {
  RR_REQUEST,
  RR_RESPONSE
}
 

Functions

static void htcpIncomingConnectionOpened (const Comm::ConnectionPointer &conn, int errNo)
 
static ssize_t htcpBuildPacket (char *buf, size_t buflen, htcpStuff *stuff)
 
static htcpDetailhtcpUnpackDetail (char *buf, int sz)
 
static ssize_t htcpBuildAuth (char *buf, size_t buflen)
 
static ssize_t htcpBuildCountstr (char *buf, size_t buflen, const char *s, size_t len)
 
static ssize_t htcpBuildData (char *buf, size_t buflen, htcpStuff *stuff)
 
static ssize_t htcpBuildDetail (char *buf, size_t buflen, htcpStuff *stuff)
 
static ssize_t htcpBuildOpData (char *buf, size_t buflen, htcpStuff *stuff)
 
static ssize_t htcpBuildSpecifier (char *buf, size_t buflen, htcpStuff *stuff)
 
static ssize_t htcpBuildTstOpData (char *buf, size_t buflen, htcpStuff *stuff)
 
static void htcpHandleMsg (char *buf, int sz, Ip::Address &from)
 
static void htcpLogHtcp (Ip::Address &, const int, const LogTags_ot, const char *, AccessLogEntryPointer)
 
static void htcpHandleTst (htcpDataHeader *, char *buf, int sz, Ip::Address &from)
 
static void htcpRecv (int fd, void *data)
 
static void htcpSend (const char *buf, int len, Ip::Address &to)
 
static void htcpTstReply (htcpDataHeader *, StoreEntry *, htcpSpecifier *, Ip::Address &)
 
static void htcpHandleTstRequest (htcpDataHeader *, char *buf, int sz, Ip::Address &from)
 
static void htcpHandleTstResponse (htcpDataHeader *, char *, int, Ip::Address &)
 
static void htcpSyncAle (AccessLogEntryPointer &al, const Ip::Address &caddr, const int opcode, const char *url)
 
static void htcpHexdump (const char *tag, const char *s, int sz)
 
static ssize_t htcpBuildClrOpData (char *buf, size_t buflen, htcpStuff *stuff)
 
static htcpSpecifier::Pointer htcpUnpackSpecifier (char *buf, int sz)
 
static bool htcpAccessAllowed (acl_access *acl, const htcpSpecifier::Pointer &s, Ip::Address &from)
 
static void htcpClrReply (htcpDataHeader *dhdr, int purgeSucceeded, Ip::Address &from)
 
static void htcpClrStoreEntry (StoreEntry *e)
 
static int htcpClrStore (const htcpSpecifier::Pointer &s)
 
static void htcpHandleClr (htcpDataHeader *hdr, char *buf, int sz, Ip::Address &from)
 
static void htcpForwardClr (char *buf, int sz)
 
void htcpOpenPorts (void)
 
int htcpQuery (StoreEntry *e, HttpRequest *req, CachePeer *p)
 
void htcpClear (StoreEntry *e, const char *uri, HttpRequest *req, const HttpRequestMethod &, CachePeer *p, htcp_clr_reason reason)
 
void htcpSocketShutdown (void)
 
void htcpClosePorts (void)
 

Variables

static const char *const htcpOpcodeStr []
 
static uint32_t msg_id_counter = 0
 
static Comm::ConnectionPointer htcpOutgoingConn = NULL
 
static Comm::ConnectionPointer htcpIncomingConn = NULL
 
static uint32_t queried_id [N_QUERIED_KEYS]
 
static cache_key queried_keys [N_QUERIED_KEYS][SQUID_MD5_DIGEST_LENGTH]
 
static Ip::Address queried_addr [N_QUERIED_KEYS]
 
static int old_squid_format = 0
 

Macro Definition Documentation

◆ N_QUERIED_KEYS

#define N_QUERIED_KEYS   8192

Definition at line 237 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

Typedef Documentation

◆ Countstr

typedef struct _Countstr Countstr

Definition at line 40 of file htcp.cc.

◆ htcpAuthHeader

Definition at line 48 of file htcp.cc.

◆ htcpDataHeader

Definition at line 44 of file htcp.cc.

◆ htcpDataHeaderSquid

Definition at line 46 of file htcp.cc.

◆ htcpHeader

typedef struct _htcpHeader htcpHeader

Definition at line 42 of file htcp.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HTCP_NOP 
HTCP_TST 
HTCP_MON 
HTCP_SET 
HTCP_CLR 
HTCP_END 

Definition at line 194 of file htcp.cc.

◆ anonymous enum

anonymous enum
Enumerator
AUTH_REQUIRED 
AUTH_FAILURE 
OPCODE_UNIMPLEMENTED 
MAJOR_VERSION_UNSUPPORTED 
MINOR_VERSION_UNSUPPORTED 
INVALID_OPCODE 

Definition at line 215 of file htcp.cc.

◆ anonymous enum

anonymous enum
Enumerator
RR_REQUEST 
RR_RESPONSE 

Definition at line 227 of file htcp.cc.

Function Documentation

◆ htcpAccessAllowed()

static bool htcpAccessAllowed ( acl_access acl,
const htcpSpecifier::Pointer s,
Ip::Address from 
)
static

Definition at line 790 of file htcp.cc.

References Ip::Address::setNoAddr(), and ACLFilledChecklist::src_addr.

Referenced by htcpHandleClr(), and htcpHandleTstRequest().

◆ htcpBuildAuth()

static ssize_t htcpBuildAuth ( char *  buf,
size_t  buflen 
)
static

Definition at line 312 of file htcp.cc.

References assert, and _htcpAuthHeader::length.

Referenced by htcpBuildPacket().

◆ htcpBuildClrOpData()

static ssize_t htcpBuildClrOpData ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static

◆ htcpBuildCountstr()

static ssize_t htcpBuildCountstr ( char *  buf,
size_t  buflen,
const char *  s,
size_t  len 
)
static

Definition at line 326 of file htcp.cc.

References debugs, len, and _Countstr::length.

Referenced by htcpBuildDetail(), and htcpBuildSpecifier().

◆ htcpBuildData()

◆ htcpBuildDetail()

static ssize_t htcpBuildDetail ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static

◆ htcpBuildOpData()

static ssize_t htcpBuildOpData ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static

◆ htcpBuildPacket()

static ssize_t htcpBuildPacket ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static

◆ htcpBuildSpecifier()

static ssize_t htcpBuildSpecifier ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static

◆ htcpBuildTstOpData()

static ssize_t htcpBuildTstOpData ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static

◆ htcpClear()

◆ htcpClosePorts()

void htcpClosePorts ( void  )

Definition at line 1617 of file htcp.cc.

References DBG_IMPORTANT, debugs, htcpSocketShutdown(), Comm::Connection::local, and NULL.

Referenced by mainReconfigureStart(), and SquidShutdown().

◆ htcpClrReply()

static void htcpClrReply ( htcpDataHeader dhdr,
int  purgeSucceeded,
Ip::Address from 
)
static

◆ htcpClrStore()

static int htcpClrStore ( const htcpSpecifier::Pointer s)
static

◆ htcpClrStoreEntry()

static void htcpClrStoreEntry ( StoreEntry e)
static

Definition at line 981 of file htcp.cc.

References debugs, StoreEntry::releaseRequest(), and StoreEntry::url().

Referenced by htcpClrStore().

◆ htcpForwardClr()

static void htcpForwardClr ( char *  buf,
int  sz 
)
static

◆ htcpHandleClr()

◆ htcpHandleMsg()

◆ htcpHandleTst()

static void htcpHandleTst ( htcpDataHeader hdr,
char *  buf,
int  sz,
Ip::Address from 
)
static

Definition at line 1021 of file htcp.cc.

References debugs, htcpHandleTstRequest(), htcpHandleTstResponse(), _htcpDataHeader::RR, and RR_REQUEST.

Referenced by htcpHandleMsg().

◆ htcpHandleTstRequest()

static void htcpHandleTstRequest ( htcpDataHeader dhdr,
char *  buf,
int  sz,
Ip::Address from 
)
static

◆ htcpHandleTstResponse()

◆ htcpHexdump()

static void htcpHexdump ( const char *  tag,
const char *  s,
int  sz 
)
static

Definition at line 286 of file htcp.cc.

References debugs, i, and sz.

Referenced by htcpHandleMsg(), and htcpSend().

◆ htcpIncomingConnectionOpened()

◆ htcpLogHtcp()

static void htcpLogHtcp ( Ip::Address caddr,
const int  opcode,
const LogTags_ot  logcode,
const char *  url,
AccessLogEntryPointer  al 
)
static

◆ htcpOpenPorts()

◆ htcpQuery()

◆ htcpRecv()

static void htcpRecv ( int  fd,
void *  data 
)
static

◆ htcpSend()

static void htcpSend ( const char *  buf,
int  len,
Ip::Address to 
)
static

◆ htcpSocketShutdown()

void htcpSocketShutdown ( void  )

◆ htcpSyncAle()

◆ htcpTstReply()

◆ htcpUnpackDetail()

static htcpDetail * htcpUnpackDetail ( char *  buf,
int  sz 
)
static

◆ htcpUnpackSpecifier()

static htcpSpecifier::Pointer htcpUnpackSpecifier ( char *  buf,
int  sz 
)
static

Variable Documentation

◆ htcpIncomingConn

Comm::ConnectionPointer htcpIncomingConn = NULL
static

Definition at line 236 of file htcp.cc.

◆ htcpOpcodeStr

const char* const htcpOpcodeStr[]
static
Initial value:
= {
"HTCP_NOP",
"HTCP_TST",
"HTCP_MON",
"HTCP_SET",
"HTCP_CLR",
"HTCP_END"
}

Definition at line 203 of file htcp.cc.

Referenced by htcpBuildOpData(), htcpHandleMsg(), and htcpSyncAle().

◆ htcpOutgoingConn

Comm::ConnectionPointer htcpOutgoingConn = NULL
static

Definition at line 235 of file htcp.cc.

◆ msg_id_counter

uint32_t msg_id_counter = 0
static

Definition at line 233 of file htcp.cc.

Referenced by htcpClear(), and htcpQuery().

◆ old_squid_format

int old_squid_format = 0
static

Definition at line 243 of file htcp.cc.

Referenced by htcpBuildData(), htcpBuildPacket(), htcpClear(), htcpHandleMsg(), and htcpQuery().

◆ queried_addr

Ip::Address queried_addr[N_QUERIED_KEYS]
static

Definition at line 241 of file htcp.cc.

◆ queried_id

uint32_t queried_id[N_QUERIED_KEYS]
static

Definition at line 238 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

◆ queried_keys

Definition at line 239 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors