PcapPlusPlus  Next
pcpp::WireGuardCookieReplyLayer Class Reference

#include <WireGuardLayer.h>

Inheritance diagram for pcpp::WireGuardCookieReplyLayer:
pcpp::WireGuardLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 WireGuardCookieReplyLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 WireGuardCookieReplyLayer (uint32_t receiverIndex, const uint8_t nonce[24], const uint8_t encryptedCookie[32])
 
uint32_t getReceiverIndex () const
 
std::array< uint8_t, 24 > getNonce () const
 
std::array< uint8_t, 32 > getEncryptedCookie () const
 
void setReceiverIndex (uint32_t receiverIndex)
 
void setNonce (const std::array< uint8_t, 24 > &nonce)
 
void setEncryptedCookie (const std::array< uint8_t, 32 > &encryptedCookie)
 
WireGuardMessageType getWireGuardMessageType () const override
 
- Public Member Functions inherited from pcpp::WireGuardLayer
 WireGuardLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
std::string getMessageTypeAsString () const
 
uint8_t getMessageType () const
 
uint32_t getReserved () const
 
void setReserved (const std::array< uint8_t, 3 > &reserved)
 
void parseNextLayer () override
 
size_t getHeaderLen () const override
 
void computeCalculateFields () override
 
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
 
uint8_t * getDataPtr (size_t offset=0) const override
 

Additional Inherited Members

- Public Types inherited from pcpp::WireGuardLayer
enum class  WireGuardMessageType {
  Unknown = 0 , HandshakeInitiation = 1 , HandshakeResponse = 2 , CookieReply = 3 ,
  TransportData = 4
}
 
- Static Public Member Functions inherited from pcpp::WireGuardLayer
static bool isWireGuardPorts (uint16_t portSrc, uint16_t portDst)
 
static bool isDataValid (const uint8_t *data, size_t dataLen)
 
static WireGuardLayerparseWireGuardLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 

Detailed Description

Represents a Cookie Reply message

Constructor & Destructor Documentation

◆ WireGuardCookieReplyLayer() [1/2]

pcpp::WireGuardCookieReplyLayer::WireGuardCookieReplyLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
inline

A constructor that creates the layer from an existing packet raw data

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 in

◆ WireGuardCookieReplyLayer() [2/2]

pcpp::WireGuardCookieReplyLayer::WireGuardCookieReplyLayer ( uint32_t  receiverIndex,
const uint8_t  nonce[24],
const uint8_t  encryptedCookie[32] 
)

A constructor that creates a new Cookie Reply message

Parameters
[in]receiverIndexThe receiver index
[in]nonceThe nonce field
[in]encryptedCookieThe encrypted cookie

Member Function Documentation

◆ getEncryptedCookie()

std::array<uint8_t, 32> pcpp::WireGuardCookieReplyLayer::getEncryptedCookie ( ) const
Returns
The encrypted cookie as an array of 32 bytes.

◆ getNonce()

std::array<uint8_t, 24> pcpp::WireGuardCookieReplyLayer::getNonce ( ) const
Returns
The nonce field as an array of 24 bytes.

◆ getReceiverIndex()

uint32_t pcpp::WireGuardCookieReplyLayer::getReceiverIndex ( ) const
Returns
The receiver index as a 32-bit unsigned integer.

◆ getWireGuardMessageType()

WireGuardMessageType pcpp::WireGuardCookieReplyLayer::getWireGuardMessageType ( ) const
inlineoverridevirtual
Returns
The message type as a WireGuardMessageType enum value.

Reimplemented from pcpp::WireGuardLayer.

◆ setEncryptedCookie()

void pcpp::WireGuardCookieReplyLayer::setEncryptedCookie ( const std::array< uint8_t, 32 > &  encryptedCookie)
Parameters
encryptedCookieAn array containing the 32-byte encrypted cookie.

◆ setNonce()

void pcpp::WireGuardCookieReplyLayer::setNonce ( const std::array< uint8_t, 24 > &  nonce)
Parameters
nonceAn array containing the 24-byte nonce field.

◆ setReceiverIndex()

void pcpp::WireGuardCookieReplyLayer::setReceiverIndex ( uint32_t  receiverIndex)
Parameters
receiverIndexA 32-bit unsigned integer representing the receiver index.