Elements.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_ELEMENTS_H
10 #define SQUID_SRC_PROXYP_ELEMENTS_H
11 
12 #include "sbuf/SBuf.h"
13 
14 // https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
15 namespace ProxyProtocol {
16 namespace Two {
17 
19 typedef enum {
20  htUnknown = 0x00,
21 
22  // The PROXY protocol specs list these TLV types as already registered.
23  htAlpn = 0x01, // PP2_TYPE_ALPN
24  htAuthority = 0x02, // PP2_TYPE_AUTHORITY
25  htCrc32c = 0x03, // PP2_TYPE_CRC32C
26  htNoop = 0x04, // PP2_TYPE_NOOP
27  htSsl = 0x20, // PP2_TYPE_SSL
28  htSslVersion = 0x21, // PP2_SUBTYPE_SSL_VERSION
29  htSslCn = 0x22, // PP2_SUBTYPE_SSL_CN
30  htSslCipher = 0x23, // PP2_SUBTYPE_SSL_CIPHER
31  htSslSigAlg = 0x24, // PP2_SUBTYPE_SSL_SIG_ALG
32  htSslKeyAlg = 0x25, // PP2_SUBTYPE_SSL_KEY_ALG
33  htNetns = 0x30, // PP2_TYPE_NETNS
34 
35  // IDs for PROXY protocol header pseudo-headers.
36  // Larger than 255 to avoid clashes with possible TLV type IDs.
37  htPseudoBegin = 0x101, // smallest pseudo-header value (for iteration)
44  htPseudoEnd // largest pseudo-header value plus 1 (for iteration)
45 } FieldType;
46 
48 typedef enum {
49  cmdLocal = 0x00,
50  cmdProxy = 0x01
51 } Command;
52 
53 typedef enum {
55  afUnspecified = 0x00,
56  afInet = 0x1,
57  afInet6 = 0x2,
58  afUnix = 0x3
60 
61 typedef enum {
62  tpUnspecified = 0x00,
63  tpStream = 0x1,
64  tpDgram = 0x2
66 
68 class Tlv
69 {
70 public:
71  typedef uint8_t value_type;
72 
73  Tlv(const value_type t, const SBuf &val): value(val), type(t) {}
74 
77 };
78 
79 } // namespace Two
80 
84 
88 
89 } // namespace ProxyProtocol
90 
91 #endif /* SQUID_SRC_PROXYP_ELEMENTS_H */
92 
Definition: SBuf.h:93
const SBuf & PseudoFieldTypeToFieldName(const Two::FieldType)
Definition: Elements.cc:40
Tlv(const value_type t, const SBuf &val)
Definition: Elements.h:73
Two::FieldType FieldNameToFieldType(const SBuf &nameOrId)
Definition: Elements.cc:102
a single Type-Length-Value (TLV) block from PROXY protocol specs
Definition: Elements.h:68
Command
PROXY protocol 'command' field value.
Definition: Elements.h:48
FieldType
numeric IDs of registered PROXY protocol TLV types and pseudo headers
Definition: Elements.h:19
@ afUnspecified
corresponds to a local connection or an unsupported protocol family
Definition: Elements.h:55

 

Introduction

Documentation

Support

Miscellaneous