PcapPlusPlus  Next
pcpp::QuicV1Layer Class Referenceabstract

#include <QuicLayer.h>

Inheritance diagram for pcpp::QuicV1Layer:
pcpp::Layer pcpp::IDataContainer pcpp::QuicV1LongHeaderLayer pcpp::QuicV1OneRttLayer pcpp::QuicV1EstablishmentLayer pcpp::QuicV1RetryLayer pcpp::QuicV1VersionNegotiationLayer pcpp::QuicV1HandshakeLayer pcpp::QuicV1InitialLayer pcpp::QuicV1ZeroRttLayer

Classes

struct  ProtectedPayload
 
struct  quic_common_header
 
struct  quic_long_header
 
struct  quic_short_header
 

Public Types

enum class  QuicPacketType : uint8_t {
  Initial = 0 , ZeroRTT = 1 , Handshake = 2 , Retry = 3 ,
  VersionNegotiation = 253 , OneRtt = 254
}
 
enum class  QuicHeaderForm : uint8_t { ShortHeader = 0 , LongHeader = 1 }
 

Public Member Functions

virtual QuicPacketType getPacketType () const =0
 
QuicHeaderForm getHeaderForm () const
 
uint8_t getFixedBit () const
 
void parseNextLayer () override
 
void computeCalculateFields () override
 Does nothing for this layer.
 
std::string toString () const override
 
OsiModelLayer getOsiModelLayer () const override
 
- Public Member Functions inherited from pcpp::Layer
 ~Layer () override
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () const
 
bool isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) const
 
uint8_t * getData () const
 
size_t getDataLen () const
 
uint8_t * getLayerPayload () const
 
size_t getLayerPayloadSize () const
 
bool isAllocatedToPacket () const
 
void copyData (uint8_t *toArr) const
 Copy the raw data of this layer to another array. More...
 
size_t copyData (uint8_t *dest, size_t destSize) const
 Copy the raw data of this layer to another array, with a specified maximum size. More...
 
uint8_t * getDataPtr (size_t offset=0) const override
 
virtual size_t getHeaderLen () const =0
 

Static Public Member Functions

static QuicV1LayerparseQuicLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
static bool isQuicPort (uint16_t port)
 

Additional Inherited Members

- Protected Member Functions inherited from pcpp::Layer
PacketgetAttachedPacket ()
 Get a pointer to the Packet this layer is attached to (if any). More...
 
Packet const * getAttachedPacket () const
 Get a pointer to the Packet this layer is attached to (if any). More...
 
void allocData (size_t dataLen, bool zeroInit=true)
 Requests the layer to allocate a new data buffer of the specified length. More...
 
template<typename T , typename... Args>
LayerconstructNextLayer (uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Construct the next layer in the protocol stack. No validation is performed on the data. More...
 
template<typename T , typename... Args>
LayerconstructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
template<typename TFactory , typename... Args>
LayerconstructNextLayerFromFactory (TFactory factoryFn, uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Construct the next layer in the protocol stack using a factory functor. More...
 
template<typename TFactory , typename... Args>
LayerconstructNextLayerFromFactory (TFactory factoryFn, uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 Construct the next layer in the protocol stack using a factory functor. More...
 
template<typename T , typename... Args>
LayertryConstructNextLayer (uint8_t *data, size_t dataLen, Args &&... extraArgs)
 
template<typename T , typename... Args>
LayertryConstructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
template<typename T , typename TFallback , typename... Args>
LayertryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Try to construct the next layer in the protocol stack with a fallback option. More...
 
template<typename T , typename TFallback , typename... Args>
LayertryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
template<typename TFallback , typename TFactory , typename... Args>
LayertryConstructNextLayerFromFactoryWithFallback (TFactory factoryFn, uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Try to construct the next layer in the protocol stack using a factory functor with a fallback option. More...
 
template<typename TFallback , typename TFactory , typename... Args>
LayertryConstructNextLayerFromFactoryWithFallback (TFactory factoryFn, uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 Try to construct the next layer in the protocol stack using a factory functor with a fallback option. More...
 
- Static Protected Member Functions inherited from pcpp::Layer
template<typename T >
static bool canReinterpretAs (const uint8_t *data, size_t dataLen)
 Check if the data is large enough to reinterpret as a type. More...
 

Detailed Description

Represents a QUIC v1 (RFC 9000/9001) protocol layer.

Member Enumeration Documentation

◆ QuicHeaderForm

enum pcpp::QuicV1Layer::QuicHeaderForm : uint8_t
strong

Identifies whether a QUIC packet uses the long or short header form (RFC 9000 Section 17.2 vs. 17.3)

Enumerator
ShortHeader 

Short header - used for 1-RTT packets once the connection ID length is known out of band

LongHeader 

Long header - used for Initial, 0-RTT, Handshake, Retry and Version Negotiation packets, all of which are exchanged before that connection ID length is known

◆ QuicPacketType

enum pcpp::QuicV1Layer::QuicPacketType : uint8_t
strong

Identifies the kind of QUIC v1 packet, as carried by the Long Packet Type field for long-header packets (RFC 9000 Section 17.2), or inferred for short-header (1-RTT) and Version Negotiation packets, which don't carry this field on the wire

Enumerator
Initial 

Initial packet - carries the start of the cryptographic handshake, plus an optional address-validation Token

ZeroRTT 

0-RTT packet - carries application data sent before the handshake completes

Handshake 

Handshake packet - carries the remainder of the cryptographic handshake.

Retry 

Retry packet - sent by a server to perform address validation before committing state to a connection

VersionNegotiation 

Version Negotiation packet - sent by a server that doesn't support the client's requested QUIC version

OneRtt 

1-RTT packet - a short-header packet carrying post-handshake application data

Member Function Documentation

◆ getFixedBit()

uint8_t pcpp::QuicV1Layer::getFixedBit ( ) const
Returns
The value of the Fixed Bit field. Per RFC 9000 this is always 1

◆ getHeaderForm()

QuicHeaderForm pcpp::QuicV1Layer::getHeaderForm ( ) const
Returns
The header form (long or short) of this QUIC packet, as read straight off the wire

◆ getOsiModelLayer()

OsiModelLayer pcpp::QuicV1Layer::getOsiModelLayer ( ) const
inlineoverridevirtual
Returns
OsiModelTransportLayer

Implements pcpp::Layer.

◆ getPacketType()

virtual QuicPacketType pcpp::QuicV1Layer::getPacketType ( ) const
pure virtual
Returns
The type of this QUIC packet

Implemented in pcpp::QuicV1OneRttLayer, pcpp::QuicV1VersionNegotiationLayer, and pcpp::QuicV1LongHeaderLayer.

◆ isQuicPort()

static bool pcpp::QuicV1Layer::isQuicPort ( uint16_t  port)
inlinestatic

A static method that checks whether the port is considered as QUIC

Parameters
[in]portThe port number to be checked
Returns
True if the port is considered as QUIC, false otherwise

◆ parseNextLayer()

void pcpp::QuicV1Layer::parseNextLayer ( )
overridevirtual

Wraps any bytes remaining after this packet's header/payload as a subsequent QuicV1Layer if getHeaderLen() leaves data unconsumed - QUIC datagrams commonly coalesce multiple packets back to back - falling back to a PayloadLayer if what follows can't be parsed as QUIC

Implements pcpp::Layer.

◆ parseQuicLayer()

static QuicV1Layer* pcpp::QuicV1Layer::parseQuicLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
static

A static method that creates a QUIC v11 layer from packet raw data. Returns nullptr if data is not valid.

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored
Returns
The newly allocated layer or nullptr if the data isn't valid

◆ toString()

std::string pcpp::QuicV1Layer::toString ( ) const
overridevirtual
Returns
A string representation of the packet, e.g. "QUIC v1 Layer, Initial message"

Implements pcpp::Layer.