ProxyProtocol::Two Namespace Reference

Classes

class  Tlv
 a single Type-Length-Value (TLV) block from PROXY protocol specs More...
 

Typedefs

typedef std::vector< std::pair< SBuf, FieldType > > FieldMap
 a mapping between pseudo header names and ids More...
 

Enumerations

enum  FieldType {
  htUnknown = 0x00,
  htAlpn = 0x01,
  htAuthority = 0x02,
  htCrc32c = 0x03,
  htNoop = 0x04,
  htSsl = 0x20,
  htSslVersion = 0x21,
  htSslCn = 0x22,
  htSslCipher = 0x23,
  htSslSigAlg = 0x24,
  htSslKeyAlg = 0x25,
  htNetns = 0x30,
  htPseudoBegin = 0x101,
  htPseudoVersion,
  htPseudoCommand,
  htPseudoSrcAddr,
  htPseudoDstAddr,
  htPseudoSrcPort,
  htPseudoDstPort,
  htPseudoEnd
}
 numeric IDs of registered PROXY protocol TLV types and pseudo headers More...
 
enum  Command {
  cmdLocal = 0x00,
  cmdProxy = 0x01
}
 PROXY protocol 'command' field value. More...
 
enum  AddressFamily {
  afUnspecified = 0x00,
  afInet = 0x1,
  afInet6 = 0x2,
  afUnix = 0x3
}
 
enum  TransportProtocol {
  tpUnspecified = 0x00,
  tpStream = 0x1,
  tpDgram = 0x2
}
 

Functions

static const auto & Magic ()
 magic octet prefix for PROXY protocol version 2 More...
 
static Parsed Parse (const SBuf &buf)
 extracts PROXY protocol v2 header from the given buffer More...
 
static void ParseAddresses (const uint8_t family, Parser::BinaryTokenizer &tok, Header::Pointer &header)
 
static void ParseTLVs (Parser::BinaryTokenizer &tok, Header::Pointer &header)
 

Variables

static const FieldMap PseudoHeaderFields
 

Typedef Documentation

◆ FieldMap

Definition at line 22 of file Elements.cc.

Enumeration Type Documentation

◆ AddressFamily

Enumerator
afUnspecified 

corresponds to a local connection or an unsupported protocol family

afInet 
afInet6 
afUnix 

Definition at line 53 of file Elements.h.

◆ Command

Enumerator
cmdLocal 
cmdProxy 

Definition at line 48 of file Elements.h.

◆ FieldType

Enumerator
htUnknown 
htAlpn 
htAuthority 
htCrc32c 
htNoop 
htSsl 
htSslVersion 
htSslCn 
htSslCipher 
htSslSigAlg 
htSslKeyAlg 
htNetns 
htPseudoBegin 
htPseudoVersion 
htPseudoCommand 
htPseudoSrcAddr 
htPseudoDstAddr 
htPseudoSrcPort 
htPseudoDstPort 
htPseudoEnd 

Definition at line 19 of file Elements.h.

◆ TransportProtocol

Enumerator
tpUnspecified 
tpStream 
tpDgram 

Definition at line 61 of file Elements.h.

Function Documentation

◆ Magic()

static const auto& ProxyProtocol::Two::Magic ( )
static

Definition at line 50 of file Parser.cc.

Referenced by ProxyProtocol::Parse(), and ProxyProtocol::One::Parse().

◆ Parse()

◆ ParseAddresses()

void ProxyProtocol::Two::ParseAddresses ( const uint8_t  family,
Parser::BinaryTokenizer tok,
Header::Pointer header 
)
static

Definition at line 164 of file Parser.cc.

References afInet, afInet6, afUnix, and Must.

Referenced by ProxyProtocol::One::Parse(), and Parse().

◆ ParseTLVs()

void ProxyProtocol::Two::ParseTLVs ( Parser::BinaryTokenizer tok,
Header::Pointer header 
)
static

Definition at line 199 of file Parser.cc.

Referenced by Parse().

Variable Documentation

◆ PseudoHeaderFields

const FieldMap ProxyProtocol::Two::PseudoHeaderFields
static
Initial value:
= {
{ SBuf(":version"), htPseudoVersion },
{ SBuf(":command"), htPseudoCommand },
{ SBuf(":src_addr"), htPseudoSrcAddr },
{ SBuf(":dst_addr"), htPseudoDstAddr },
{ SBuf(":src_port"), htPseudoSrcPort },
{ SBuf(":dst_port"), htPseudoDstPort }
}

Definition at line 23 of file Elements.cc.

Referenced by ProxyProtocol::NameToFieldType(), and ProxyProtocol::PseudoFieldTypeToFieldName().

Definition: SBuf.h:93

 

Introduction

Documentation

Support

Miscellaneous