PcapPlusPlus  Next
pcpp::WireGuardHandshakeResponseLayer Class Reference

#include <WireGuardLayer.h>

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

Public Member Functions

 WireGuardHandshakeResponseLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 WireGuardHandshakeResponseLayer (uint32_t senderIndex, uint32_t receiverIndex, const uint8_t responderEphemeral[32], const uint8_t encryptedEmpty[16], const uint8_t mac1[16], const uint8_t mac2[16])
 
uint32_t getSenderIndex () const
 
uint32_t getReceiverIndex () const
 
std::array< uint8_t, 32 > getResponderEphemeral () const
 
std::array< uint8_t, 16 > getEncryptedEmpty () const
 
std::array< uint8_t, 16 > getMac1 () const
 
std::array< uint8_t, 16 > getMac2 () const
 
void setSenderIndex (uint32_t senderIndex)
 
void setReceiverIndex (uint32_t receiverIndex)
 
void setResponderEphemeral (const std::array< uint8_t, 32 > &responderEphemeral)
 
void setEncryptedEmpty (const std::array< uint8_t, 16 > &encryptedEmpty)
 
void setMac1 (const std::array< uint8_t, 16 > &mac1)
 
void setMac2 (const std::array< uint8_t, 16 > &mac2)
 
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 Handshake Response message

Constructor & Destructor Documentation

◆ WireGuardHandshakeResponseLayer() [1/2]

pcpp::WireGuardHandshakeResponseLayer::WireGuardHandshakeResponseLayer ( 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

◆ WireGuardHandshakeResponseLayer() [2/2]

pcpp::WireGuardHandshakeResponseLayer::WireGuardHandshakeResponseLayer ( uint32_t  senderIndex,
uint32_t  receiverIndex,
const uint8_t  responderEphemeral[32],
const uint8_t  encryptedEmpty[16],
const uint8_t  mac1[16],
const uint8_t  mac2[16] 
)

A constructor that creates a new Handshake Response message

Parameters
[in]senderIndexThe sender index
[in]receiverIndexThe receiver index
[in]responderEphemeralThe responder's ephemeral public key
[in]encryptedEmptyThe encrypted empty field
[in]mac1The MAC1 field
[in]mac2The MAC2 field

Member Function Documentation

◆ getEncryptedEmpty()

std::array<uint8_t, 16> pcpp::WireGuardHandshakeResponseLayer::getEncryptedEmpty ( ) const
Returns
The encrypted empty field as an array of 16 bytes.

◆ getMac1()

std::array<uint8_t, 16> pcpp::WireGuardHandshakeResponseLayer::getMac1 ( ) const
Returns
The MAC1 field as an array of 16 bytes.

◆ getMac2()

std::array<uint8_t, 16> pcpp::WireGuardHandshakeResponseLayer::getMac2 ( ) const
Returns
The MAC2 field as an array of 16 bytes.

◆ getReceiverIndex()

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

◆ getResponderEphemeral()

std::array<uint8_t, 32> pcpp::WireGuardHandshakeResponseLayer::getResponderEphemeral ( ) const
Returns
The responder's ephemeral public key as an array of 32 bytes.

◆ getSenderIndex()

uint32_t pcpp::WireGuardHandshakeResponseLayer::getSenderIndex ( ) const
Returns
The sender index as a 32-bit unsigned integer.

◆ getWireGuardMessageType()

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

Reimplemented from pcpp::WireGuardLayer.

◆ setEncryptedEmpty()

void pcpp::WireGuardHandshakeResponseLayer::setEncryptedEmpty ( const std::array< uint8_t, 16 > &  encryptedEmpty)
Parameters
encryptedEmptyAn array containing the 16-byte encrypted empty field.

◆ setMac1()

void pcpp::WireGuardHandshakeResponseLayer::setMac1 ( const std::array< uint8_t, 16 > &  mac1)
Parameters
mac1An array containing the 16-byte MAC1 field.

◆ setMac2()

void pcpp::WireGuardHandshakeResponseLayer::setMac2 ( const std::array< uint8_t, 16 > &  mac2)
Parameters
mac2An array containing the 16-byte MAC2 field.

◆ setReceiverIndex()

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

◆ setResponderEphemeral()

void pcpp::WireGuardHandshakeResponseLayer::setResponderEphemeral ( const std::array< uint8_t, 32 > &  responderEphemeral)
Parameters
responderEphemeralAn array containing the 32-byte responder ephemeral public key.

◆ setSenderIndex()

void pcpp::WireGuardHandshakeResponseLayer::setSenderIndex ( uint32_t  senderIndex)
Parameters
senderIndexA 32-bit unsigned integer representing the sender index.