Squid Web Cache
master
Loading...
Searching...
No Matches
Header.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3
*
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.
7
*/
8
9
#ifndef SQUID_SRC_PROXYP_HEADER_H
10
#define SQUID_SRC_PROXYP_HEADER_H
11
12
#include "
base/RefCount.h
"
13
#include "
ip/Address.h
"
14
#include "
proxyp/Elements.h
"
15
#include "
sbuf/SBuf.h
"
16
17
#include <vector>
18
19
namespace
ProxyProtocol
{
20
22
class
Header
:
public
RefCountable
23
{
24
public
:
25
typedef
RefCount<Header>
Pointer
;
26
typedef
std::vector<Two::Tlv>
Tlvs
;
27
28
Header
(
const
SBuf
&ver,
const
Two::Command
cmd);
29
33
SBuf
toMime
()
const
;
34
36
SBuf
getValues
(
const
uint32_t headerType,
const
char
delimiter
=
','
)
const
;
37
42
SBuf
getElem
(
const
uint32_t headerType,
const
char
*member,
const
char
delimiter
)
const
;
43
45
const
SBuf
&
version
()
const
{
return
version_
; }
46
48
bool
hasForwardedAddresses
()
const
{
return
!
localConnection
() &&
hasAddresses
(); }
49
51
void
ignoreAddresses
() {
ignoreAddresses_
=
true
; }
52
54
bool
hasAddresses
()
const
{
return
!
ignoreAddresses_
; }
55
58
const
SBuf
&
addressFamily
()
const
;
59
61
Ip::Address
sourceAddress
;
63
Ip::Address
destinationAddress
;
65
Tlvs
tlvs
;
66
67
private
:
71
bool
localConnection
()
const
{
return
command_
==
Two::cmdLocal
; }
72
74
SBuf
version_
;
75
78
Two::Command
command_
;
79
81
bool
ignoreAddresses_
;
82
};
83
84
}
// namespace ProxyProtocol
85
86
#endif
/* SQUID_SRC_PROXYP_HEADER_H */
87
RefCountable
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition
Lock.h:66
RefCount.h
SBuf.h
Ip::Address
Definition
Address.h:43
ProxyProtocol::Header
PROXY protocol v1 or v2 header.
Definition
Header.h:23
ProxyProtocol::Header::getElem
SBuf getElem(const uint32_t headerType, const char *member, const char delimiter) const
Definition
Header.cc:90
ProxyProtocol::Header::toMime
SBuf toMime() const
Definition
Header.cc:25
ProxyProtocol::Header::hasAddresses
bool hasAddresses() const
whether the header relays address information (including LOCAL connections)
Definition
Header.h:54
ProxyProtocol::Header::command_
Two::Command command_
Definition
Header.h:78
ProxyProtocol::Header::Tlvs
std::vector< Two::Tlv > Tlvs
Definition
Header.h:26
ProxyProtocol::Header::getValues
SBuf getValues(const uint32_t headerType, const char delimiter=',') const
Definition
Header.cc:40
ProxyProtocol::Header::ignoreAddresses_
bool ignoreAddresses_
true if the header relays no address information
Definition
Header.h:81
ProxyProtocol::Header::ignoreAddresses
void ignoreAddresses()
marks the header as lacking address information
Definition
Header.h:51
ProxyProtocol::Header::Pointer
RefCount< Header > Pointer
Definition
Header.h:25
ProxyProtocol::Header::hasForwardedAddresses
bool hasForwardedAddresses() const
whether source and destination addresses are valid addresses of the original "client" connection
Definition
Header.h:48
ProxyProtocol::Header::sourceAddress
Ip::Address sourceAddress
source address of the client connection
Definition
Header.h:61
ProxyProtocol::Header::version_
SBuf version_
PROXY protocol version.
Definition
Header.h:74
ProxyProtocol::Header::localConnection
bool localConnection() const
Definition
Header.h:71
ProxyProtocol::Header::version
const SBuf & version() const
PROXY protocol version.
Definition
Header.h:45
ProxyProtocol::Header::addressFamily
const SBuf & addressFamily() const
Definition
Header.cc:97
ProxyProtocol::Header::tlvs
Tlvs tlvs
empty in v1 headers and when ignored in v2 headers
Definition
Header.h:65
ProxyProtocol::Header::destinationAddress
Ip::Address destinationAddress
intended destination address of the client connection
Definition
Header.h:63
RefCount
Definition
RefCount.h:28
SBuf
Definition
SBuf.h:94
delimiter
static const char * delimiter
Definition
ldap_backend.cc:65
Address.h
ProxyProtocol::Two::Command
Command
PROXY protocol 'command' field value.
Definition
Elements.h:48
ProxyProtocol::Two::cmdLocal
@ cmdLocal
Definition
Elements.h:49
ProxyProtocol
Definition
Elements.cc:18
Elements.h
squid
src
proxyp
Header.h
Generated by
1.9.8