2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_XACTION_INITIATOR_H
10 #define SQUID_SRC_XACTION_INITIATOR_H
12 /// identifies a protocol agent or Squid feature initiating transactions
13 class XactionInitiator
{
15 /// transaction triggers
18 initClient
= 1 << 0, ///< HTTP or FTP client
19 initPeerPool
= 1 << 1, ///< PeerPool manager
20 initCertFetcher
= 1 << 2, ///< Missing intermediate certificates fetching code
21 initEsi
= 1 << 3, ///< ESI processing code
22 initCacheDigest
= 1 << 4, ///< Cache Digest fetching code
23 initHtcp
= 1<< 5, ///< HTCP client
24 initIcp
= 1 << 6, ///< the ICP/neighbors subsystem
25 initIcmp
= 1 << 7, ///< the ICMP RTT database (NetDB) neighbors exchange subsystem
26 initAsn
= 1 << 8, ///< the ASN db subsystem
27 initIpc
= 1 << 9, ///< the IPC subsystem
28 initAdaptation
= 1 << 10, ///< ICAP/ECAP requests generated by Squid
29 initIcon
= 1 << 11, ///< internal icons
30 initPeerMcast
= 1 << 12, ///< neighbor multicast
31 initServer
= 1 << 13, ///< HTTP/2 push request (not yet supported by Squid)
33 initAdaptationOrphan_
= 1 << 31 ///< eCAP-created HTTP message w/o an associated HTTP transaction (not ACL-detectable)
36 typedef uint32_t Initiators
; ///< Initiator set
38 // this class is a just a trivial wrapper so we allow explicit conversions
39 XactionInitiator(Initiator i
) : initiator(i
) {}
41 /// whether this initiator belongs to the given set
42 bool in(Initiators setOfInitiators
) const {return (initiator
& setOfInitiators
) != 0;}
44 /// whether the transaction was initiated by an internal subsystem
45 bool internalClient() const {
46 return (initiator
& InternalInitiators()) != 0;
49 /// internally generated requests
50 static Initiators
InternalInitiators() {
51 return initPeerPool
| initCertFetcher
| initEsi
| initCacheDigest
| initIcp
| initIcmp
| initIpc
| initAdaptation
| initIcon
| initPeerMcast
;
55 static Initiators
AllInitiators() {
59 static Initiators
ParseInitiators(const char *name
);
67 #endif // SQUID_SRC_XACTION_INITIATOR_H