htcp.cc File Reference
#include "squid.h"
#include "AccessLogEntry.h"
#include "acl/Acl.h"
#include "acl/FilledChecklist.h"
#include "base/AsyncCallbacks.h"
#include "CachePeer.h"
#include "CachePeers.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/Loops.h"
#include "compat/xalloc.h"
#include "debug/Messages.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 "ipc/StartListening.h"
#include "md5.h"
#include "mem/forward.h"
#include "MemBuf.h"
#include "refresh.h"
#include "SquidConfig.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 (Ipc::StartListeningAnswer &)
 
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, 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 = nullptr
 
static Comm::ConnectionPointer htcpIncomingConn = nullptr
 
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 242 of file htcp.cc.

Typedef Documentation

◆ Countstr

typedef struct _Countstr Countstr

Definition at line 42 of file htcp.cc.

◆ htcpAuthHeader

Definition at line 50 of file htcp.cc.

◆ htcpDataHeader

Definition at line 46 of file htcp.cc.

◆ htcpDataHeaderSquid

Definition at line 48 of file htcp.cc.

◆ htcpHeader

typedef struct _htcpHeader htcpHeader

Definition at line 44 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 199 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 220 of file htcp.cc.

◆ anonymous enum

anonymous enum
Enumerator
RR_REQUEST 
RR_RESPONSE 

Definition at line 232 of file htcp.cc.

Function Documentation

◆ htcpAccessAllowed()

◆ htcpBuildAuth()

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

Definition at line 321 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 335 of file htcp.cc.

References debugs.

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  )

◆ 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 1018 of file htcp.cc.

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

Referenced by htcpClrStore().

◆ htcpForwardClr()

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

Definition at line 1274 of file htcp.cc.

References CurrentCachePeers(), and htcpSend().

Referenced by htcpHandleMsg().

◆ htcpHandleClr()

◆ htcpHandleMsg()

◆ htcpHandleTst()

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

Definition at line 1058 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 291 of file htcp.cc.

References debugs.

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()

◆ 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 = nullptr
static

Definition at line 241 of file htcp.cc.

Referenced by htcpClear(), htcpOpenPorts(), htcpQuery(), and htcpSocketShutdown().

◆ htcpOpcodeStr

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

Definition at line 208 of file htcp.cc.

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

◆ htcpOutgoingConn

Comm::ConnectionPointer htcpOutgoingConn = nullptr
static

◆ msg_id_counter

uint32_t msg_id_counter = 0
static

Definition at line 238 of file htcp.cc.

Referenced by htcpClear(), and htcpQuery().

◆ old_squid_format

int old_squid_format = 0
static

Definition at line 248 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 246 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

◆ queried_id

uint32_t queried_id[N_QUERIED_KEYS]
static

Definition at line 243 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

◆ queried_keys

Definition at line 244 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors