66static void icpCount(
void *,
int,
size_t,
int);
106 flags(0), pad(0), shostid(0)
162 e->abandon(__func__);
280 char *urloffset =
nullptr;
285 buf_len +=
sizeof(uint32_t);
287 buf = (
char *)
xcalloc(buf_len, 1);
295 headerp->
length = (uint16_t) htons(buf_len);
301 headerp->
pad = htonl(
pad);
308 urloffset +=
sizeof(uint32_t);
310 memcpy(urloffset, url, strlen(url));
328 debugs(12, 5,
"icpUdpSend: FD " << fd <<
" sending " <<
336 icpLogIcp(to, logcode, len, (
char *) (msg + 1), delay, al);
339 }
else if (0 == delay) {
412 fatal(
"expected ICP opcode\n");
445 debugs(12, 2,
"Access Denied due to lack of ICP access rules.");
452 const auto &answer = checklist.
fastCheck();
453 if (answer.allowed())
456 debugs(12, 2,
"Access Denied for " << from <<
" by " << answer.lastCheckDescription() <<
".");
469 const auto mx = MasterXaction::MakePortless<XactionInitiator::initIcp>();
485 char *url = buf +
sizeof(
icp_common_t) +
sizeof(uint32_t);
502 src_rtt = ((hops & 0xFFFF) << 16) | (rtt & 0xFFFF);
547 debugs(12,
DBG_CRITICAL,
"icpHandleIcpV2: Neighbor " << from <<
" returned reqnum = 0");
564 debugs(12, 3,
"icpHandleIcpV2: ICP message is too small");
573 if (len != header.
length) {
574 debugs(12, 3,
"icpHandleIcpV2: ICP message is too small");
644 if (xerrno != ECONNREFUSED && xerrno != EHOSTUNREACH)
654 debugs(12, 4,
"icpHandleUdp: FD " << sock <<
": received " <<
655 (
unsigned long int)len <<
" bytes from " << from);
658 debugs(12, 4,
"icpHandleUdp: Ignoring too-small UDP packet");
662 icp_version = (
int) buf[1];
666 debugs(12, 4,
"icpHandleUdp: Ignoring UDP packet sent by myself");
673 " received from " << from);
691 fatal(
"ICP port cannot be opened.");
711 fatal(
"ICP port cannot be opened.");
723 fatal(
"Cannot open Outgoing ICP Port");
735 const auto &conn = answer.
conn;
738 fatal(
"Cannot open ICP Port");
747 fd_note(conn->fd,
"Incoming ICP port");
796icpCount(
void *buf,
int which,
size_t len,
int delay)
800 if (len <
sizeof(*icp))
819 }
else if (
RECV == which) {
837#define N_QUERIED_KEYS 8192
838#define N_QUERIED_KEYS_MASK 8191
844 static int reqnum = 0;
void accessLogLog(const AccessLogEntryPointer &, ACLChecklist *)
#define asyncCallbackFun(dbgSection, dbgLevel, function)
AsyncCall for calling back a function.
Acl::Answer const & fastCheck()
void setRequest(HttpRequest *)
configure client request-related fields for the first time
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
struct timeval start_time
The time the master transaction started.
struct timeval trTime
The response time.
MessageSizes clientReplySz
counters for the response sent to client
class AccessLogEntry::CacheDetails cache
class AccessLogEntry::HttpDetails http
void setVirginUrlForMissingRequest(const SBuf &vu)
Remember Client URI (or equivalent) when there is no HttpRequest.
class AccessLogEntry::IcpDetails icp
void host(const char *src)
a delayed icpUdpSend() call
AccessLogEntryPointer ale
sender's master transaction summary
icp_common_t * msg
ICP message with network byte order fields.
Ip::Address address
remote peer (which may not be a cache_peer)
DelayedUdpSend * next
invasive FIFO queue of delayed ICP messages
struct timeval queue_time
queuing timestamp
static HttpRequest * FromUrlXXX(const char *url, const MasterXaction::Pointer &, const HttpRequestMethod &method=Http::METHOD_GET)
AnyP::Uri url
the request URI
ICP2State(icp_common_t &aHeader, HttpRequest *aRequest)
LogTags * loggingTags() const override
bool isHit() const
whether the cache contains the requested entry
void fillChecklist(ACLFilledChecklist &) const override
configure the given checklist (to reflect the current transaction state)
ICPState(icp_common_t &aHeader, HttpRequest *aRequest)
bool confirmAndPrepHit(const StoreEntry &) const
either confirms and starts processing a cache hit or returns false
unsigned short port() const
Comm::ConnectionPointer conn
opened listening socket
uint64_t payloadData
total size of payload block(s) excluding transfer encoding overheads
struct SquidConfig::@85 Addrs
struct SquidConfig::@90 onoff
wordlist * mcast_group_list
struct SquidConfig::@91 accessList
struct SquidConfig::@78 Port
ByteCounter r_kbytes_sent
ByteCounter q_kbytes_sent
ByteCounter q_kbytes_recv
ByteCounter r_kbytes_recv
struct StatCounters::@106 icp
bool didCollapse
whether startCollapsingOn() was called and returned true
bool startCollapsingOn(const StoreEntry &, const bool doingRevalidation) const
bool hittingRequiresCollapsing() const
whether this entry can feed collapsed requests and only them
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
void handleReply(char *buf, Ip::Address &from)
icp_opcode getOpCode() const
static icp_common_t * CreateMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad)
void clientdbUpdate(const Ip::Address &addr, const LogTags <ype, AnyP::ProtocolType p, size_t size)
int clientdbCutoffDenied(const Ip::Address &addr)
int ignoreErrno(int ierrno)
int comm_udp_sendto(int fd, const Ip::Address &to_addr, const void *buf, int len)
void comm_open_listener(int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note)
int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from)
A const & max(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
#define COMM_SELECT_WRITE
#define ICP_VERSION_CURRENT
void fatal(const char *message)
void fd_note(int fd, const char *s)
int neighbors_do_private_keys
time_t hit_only_mode_until
int incoming_sockets_accepted
void ipcache_nbgethostbyname(const char *name, IPH *handler, void *handlerData)
icp_opcode icpGetCommonOpcode()
int icpSetCacheKey(const cache_key *key)
void icpCreateAndSend(icp_opcode opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntry::Pointer al)
void icpConnectionShutdown(void)
void icpHandleIcpV3(int, Ip::Address &, char *, int)
bool icpAccessAllowed(Ip::Address &from, HttpRequest *icp_request)
const cache_key * icpGetCacheKey(const char *url, int reqnum)
void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
HttpRequest * icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
static void icpHandleIcpV2(int, Ip::Address &, char *, int)
Comm::ConnectionPointer icpOutgoingConn
static void icpCount(void *, int, size_t, int)
Comm::ConnectionPointer icpIncomingConn
static void icpLogIcp(const Ip::Address &, const LogTags_ot, int, const char *, const int, AccessLogEntryPointer &)
updates ALE (if any) and logs the transaction (if needed)
static DelayedUdpSend * IcpQueueTail
static DelayedUdpSend * IcpQueueHead
static void icpUdpSendQueue(int fd, void *)
void HTTPMSGUNLOCK(M *&a)
void HTTPMSGLOCK(Http::Message *a)
const char * icp_opcode_str[]
static void icpIncomingConnectionOpened(Ipc::StartListeningAnswer &)
#define N_QUERIED_KEYS_MASK
static cache_key queried_keys[N_QUERIED_KEYS][SQUID_MD5_DIGEST_LENGTH]
static int icpUdpSend(int fd, const Ip::Address &to, icp_common_t *msg, int delay, AccessLogEntryPointer al)
static void doV2Query(int fd, Ip::Address &from, char *buf, icp_common_t header)
static LogTags_ot icpLogFromICPCode(icp_opcode)
static void icpSyncAle(AccessLogEntryPointer &al, const Ip::Address &caddr, const char *url, int len, int delay)
#define SQUID_MD5_DIGEST_LENGTH
bool IsConnOpen(const Comm::ConnectionPointer &conn)
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
void StartListening(int sock_type, int proto, const Comm::ConnectionPointer &listenConn, FdNoteId, StartListeningCallback &)
void neighborsUdpAck(const cache_key *key, icp_common_t *header, const Ip::Address &from)
void netdbPingSite(const char *hostname)
int netdbHostHops(const char *host)
int netdbHostRtt(const char *host)
int refreshCheckICP(const StoreEntry *entry, HttpRequest *request)
#define rfc1738_escape(x)
#define LOCAL_ARRAY(type, name, size)
#define SQUID_UDP_SO_RCVBUF
unsigned char cache_key
Store key.
StoreEntry * storeGetPublic(const char *uri, const HttpRequestMethod &method)
cache_key * storeKeyCopy(cache_key *dst, const cache_key *src)
const cache_key * storeKeyPublic(const char *url, const HttpRequestMethod &method, const KeyScope keyScope)
int tvSubUsec(struct timeval t1, struct timeval t2)
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
void * xcalloc(size_t n, size_t sz)
const char * xstrerr(int error)