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 "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 "URL.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 &, int, LogTags, const char *)
 
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 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

#define N_QUERIED_KEYS   8192

Definition at line 236 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

Typedef Documentation

typedef struct _Countstr Countstr

Definition at line 40 of file htcp.cc.

Definition at line 48 of file htcp.cc.

Definition at line 44 of file htcp.cc.

Definition at line 46 of file htcp.cc.

typedef struct _htcpHeader htcpHeader

Definition at line 42 of file htcp.cc.

Enumeration Type Documentation

anonymous enum
Enumerator
HTCP_NOP 
HTCP_TST 
HTCP_MON 
HTCP_SET 
HTCP_CLR 
HTCP_END 

Definition at line 193 of file htcp.cc.

anonymous enum
Enumerator
AUTH_REQUIRED 
AUTH_FAILURE 
OPCODE_UNIMPLEMENTED 
MAJOR_VERSION_UNSUPPORTED 
MINOR_VERSION_UNSUPPORTED 
INVALID_OPCODE 

Definition at line 214 of file htcp.cc.

anonymous enum
Enumerator
RR_REQUEST 
RR_RESPONSE 

Definition at line 226 of file htcp.cc.

Function Documentation

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

Definition at line 774 of file htcp.cc.

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

Referenced by htcpHandleClr(), and htcpHandleTstRequest().

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

Definition at line 296 of file htcp.cc.

References assert, and _htcpAuthHeader::length.

Referenced by htcpBuildPacket().

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

Definition at line 310 of file htcp.cc.

References debugs, and len.

Referenced by htcpBuildDetail(), and htcpBuildSpecifier().

static ssize_t htcpBuildDetail ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static
static ssize_t htcpBuildOpData ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static
static ssize_t htcpBuildPacket ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static
static ssize_t htcpBuildSpecifier ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static
static ssize_t htcpBuildTstOpData ( char *  buf,
size_t  buflen,
htcpStuff stuff 
)
static
void htcpClosePorts ( void  )

Definition at line 1569 of file htcp.cc.

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

Referenced by mainReconfigureStart(), and SquidShutdown().

static void htcpClrReply ( htcpDataHeader dhdr,
int  purgeSucceeded,
Ip::Address from 
)
static
static int htcpClrStore ( const htcpSpecifier::Pointer s)
static
static void htcpClrStoreEntry ( StoreEntry e)
static

Definition at line 942 of file htcp.cc.

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

Referenced by htcpClrStore().

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

Definition at line 982 of file htcp.cc.

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

Referenced by htcpHandleMsg().

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

Definition at line 270 of file htcp.cc.

References debugs, and i.

Referenced by htcpHandleMsg(), and htcpSend().

static void htcpLogHtcp ( Ip::Address caddr,
int  opcode,
LogTags  logcode,
const char *  url 
)
static
static void htcpRecv ( int  fd,
void *  data 
)
static
static void htcpSend ( const char *  buf,
int  len,
Ip::Address to 
)
static
void htcpSocketShutdown ( void  )
static htcpDetail * htcpUnpackDetail ( char *  buf,
int  sz 
)
static
static htcpSpecifier::Pointer htcpUnpackSpecifier ( char *  buf,
int  sz 
)
static

Variable Documentation

Comm::ConnectionPointer htcpIncomingConn = NULL
static

Definition at line 235 of file htcp.cc.

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

Definition at line 202 of file htcp.cc.

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

Comm::ConnectionPointer htcpOutgoingConn = NULL
static

Definition at line 234 of file htcp.cc.

uint32_t msg_id_counter = 0
static

Definition at line 232 of file htcp.cc.

Referenced by htcpClear(), and htcpQuery().

int old_squid_format = 0
static

Definition at line 242 of file htcp.cc.

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

Ip::Address queried_addr[N_QUERIED_KEYS]
static

Definition at line 240 of file htcp.cc.

uint32_t queried_id[N_QUERIED_KEYS]
static

Definition at line 237 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

Definition at line 238 of file htcp.cc.

Referenced by htcpHandleTstResponse(), and htcpQuery().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors