PROXY protocol v1 or v2 header. More...
#include <Header.h>
Public Types | |
typedef RefCount< Header > | Pointer |
typedef std::vector< Two::Tlv > | Tlvs |
Public Member Functions | |
Header (const SBuf &ver, const Two::Command cmd) | |
SBuf | toMime () const |
SBuf | getValues (const uint32_t headerType, const char delimiter=',') const |
SBuf | getElem (const uint32_t headerType, const char *member, const char delimiter) const |
const SBuf & | version () const |
PROXY protocol version. More... | |
bool | hasForwardedAddresses () const |
whether source and destination addresses are valid addresses of the original "client" connection More... | |
void | ignoreAddresses () |
marks the header as lacking address information More... | |
bool | hasAddresses () const |
whether the header relays address information (including LOCAL connections) More... | |
const SBuf & | addressFamily () const |
Public Attributes | |
Ip::Address | sourceAddress |
source address of the client connection More... | |
Ip::Address | destinationAddress |
intended destination address of the client connection More... | |
Tlvs | tlvs |
empty in v1 headers and when ignored in v2 headers More... | |
Private Member Functions | |
bool | localConnection () const |
Private Attributes | |
SBuf | version_ |
PROXY protocol version. More... | |
Two::Command | command_ |
bool | ignoreAddresses_ |
true if the header relays no address information More... | |
Detailed Description
Member Typedef Documentation
◆ Pointer
typedef RefCount<Header> ProxyProtocol::Header::Pointer |
◆ Tlvs
Constructor & Destructor Documentation
◆ Header()
ProxyProtocol::Header::Header | ( | const SBuf & | ver, |
const Two::Command | cmd | ||
) |
Member Function Documentation
◆ addressFamily()
const SBuf & ProxyProtocol::Header::addressFamily | ( | ) | const |
◆ getElem()
SBuf ProxyProtocol::Header::getElem | ( | const uint32_t | headerType, |
const char * | member, | ||
const char | delimiter | ||
) | const |
Searches for the first key=value pair occurrence within the value for the provided TLV type. Assumes that the TLV value is a delimiter-separated list.
- Returns
- the value of the found pair or the empty string.
Definition at line 90 of file Header.cc.
References getListMember(), and SBufToString().
◆ getValues()
SBuf ProxyProtocol::Header::getValues | ( | const uint32_t | headerType, |
const char | delimiter = ',' |
||
) | const |
- Returns
- a delimiter-separated list of values of TLVs of the given type
Definition at line 40 of file Header.cc.
References SquidConfig::Addrs, SBufStream::buf(), SquidConfig::client_netmask, Config, ProxyProtocol::Two::htPseudoCommand, ProxyProtocol::Two::htPseudoDstAddr, ProxyProtocol::Two::htPseudoDstPort, ProxyProtocol::Two::htPseudoSrcAddr, ProxyProtocol::Two::htPseudoSrcPort, ProxyProtocol::Two::htPseudoVersion, SBuf::isEmpty(), MAX_IPSTRLEN, and ToSBuf().
◆ hasAddresses()
|
inline |
Definition at line 54 of file Header.h.
References ignoreAddresses_.
Referenced by hasForwardedAddresses().
◆ hasForwardedAddresses()
|
inline |
Definition at line 48 of file Header.h.
References hasAddresses(), and localConnection().
◆ ignoreAddresses()
|
inline |
Definition at line 51 of file Header.h.
References ignoreAddresses_.
◆ localConnection()
|
inlineprivate |
Whether the connection over PROXY protocol is 'cmdLocal'. Such connections are established without being relayed. Received addresses and TLVs are discarded in this mode.
Definition at line 71 of file Header.h.
References ProxyProtocol::Two::cmdLocal, and command_.
Referenced by hasForwardedAddresses().
◆ toMime()
SBuf ProxyProtocol::Header::toMime | ( | ) | const |
HTTP header-like string representation of the header. The returned string has one line per pseudo header and one line per TLV (if any).
Definition at line 25 of file Header.cc.
References SBufStream::buf(), EnumRange(), ProxyProtocol::Two::htPseudoBegin, ProxyProtocol::Two::htPseudoEnd, and ProxyProtocol::PseudoFieldTypeToFieldName().
◆ version()
|
inline |
Member Data Documentation
◆ command_
|
private |
for v2 headers: the command field for v1 headers: Two::cmdProxy
Definition at line 78 of file Header.h.
Referenced by localConnection().
◆ destinationAddress
Ip::Address ProxyProtocol::Header::destinationAddress |
◆ ignoreAddresses_
|
private |
Definition at line 81 of file Header.h.
Referenced by hasAddresses(), and ignoreAddresses().
◆ sourceAddress
Ip::Address ProxyProtocol::Header::sourceAddress |
◆ tlvs
◆ version_
|
private |
The documentation for this class was generated from the following files: