Elements.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 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_PROXYP_ELEMENTS_H
10 #define SQUID_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  htPseudoVersion = 0x101,
38  htPseudoCommand = 0x102,
39  htPseudoSrcAddr = 0x103,
40  htPseudoDstAddr = 0x104,
41  htPseudoSrcPort = 0x105,
43 } FieldType;
44 
46 typedef enum {
47  cmdLocal = 0x00,
48  cmdProxy = 0x01
49 } Command;
50 
51 typedef enum {
53  afUnspecified = 0x00,
54  afInet = 0x1,
55  afInet6 = 0x2,
56  afUnix = 0x3
58 
59 typedef enum {
60  tpUnspecified = 0x00,
61  tpStream = 0x1,
62  tpDgram = 0x2
64 
66 class Tlv
67 {
68 public:
69  typedef uint8_t value_type;
70 
71  Tlv(const value_type t, const SBuf &val): value(val), type(t) {}
72 
74  value_type type;
75 };
76 
77 } // namespace Two
78 
79 typedef std::map<SBuf, Two::FieldType> FieldMap;
81 extern const FieldMap PseudoHeaderFields;
82 
86 
87 } // namespace ProxyProtocol
88 
89 #endif
90 
corresponds to a local connection or an unsupported protocol family
Definition: Elements.h:53
Definition: SBuf.h:86
Two::FieldType FieldNameToFieldType(const SBuf &nameOrId)
Definition: Elements.cc:77
a single Type-Length-Value (TLV) block from PROXY protocol specs
Definition: Elements.h:66
const FieldMap PseudoHeaderFields
a mapping between pseudo header names and ids
Definition: Elements.cc:16
std::map< SBuf, Two::FieldType > FieldMap
Definition: Elements.h:79
Tlv(const value_type t, const SBuf &val)
Definition: Elements.h:71
FieldType
numeric IDs of registered PROXY protocol TLV types and pseudo headers
Definition: Elements.h:19
Command
PROXY protocol &#39;command&#39; field value.
Definition: Elements.h:46

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors