PcapPlusPlus
Next
|
#include <WireGuardLayer.h>
Classes | |
struct | wg_common_header |
Public Types | |
enum class | WireGuardMessageType { Unknown = 0 , HandshakeInitiation = 1 , HandshakeResponse = 2 , CookieReply = 3 , TransportData = 4 } |
Public Member Functions | |
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 |
virtual WireGuardMessageType | getWireGuardMessageType () const |
Public Member Functions inherited from pcpp::Layer | |
~Layer () override | |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () 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 |
Static Public Member Functions | |
static bool | isWireGuardPorts (uint16_t portSrc, uint16_t portDst) |
static bool | isDataValid (const uint8_t *data, size_t dataLen) |
static WireGuardLayer * | parseWireGuardLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) |
Represents a WireGuard protocol layer
|
strong |
|
inline |
Constructs a WireGuardLayer object.
data | Pointer to the raw data representing the WireGuard layer |
dataLen | Length of the data |
prevLayer | Pointer to the previous layer in the packet (if any) |
packet | Pointer to the packet this layer belongs to |
|
inlineoverridevirtual |
No fields to compute or update, so this method is left empty.
Implements pcpp::Layer.
|
overridevirtual |
Implements pcpp::Layer.
uint8_t pcpp::WireGuardLayer::getMessageType | ( | ) | const |
std::string pcpp::WireGuardLayer::getMessageTypeAsString | ( | ) | const |
|
inlineoverridevirtual |
Implements pcpp::Layer.
uint32_t pcpp::WireGuardLayer::getReserved | ( | ) | const |
|
inlinevirtual |
Reimplemented in pcpp::WireGuardTransportDataLayer, pcpp::WireGuardCookieReplyLayer, pcpp::WireGuardHandshakeResponseLayer, and pcpp::WireGuardHandshakeInitiationLayer.
|
static |
Checks if the given data represents a WireGuard message.
data | Pointer to the raw data |
dataLen | Length of the data |
|
inlinestatic |
Checks if the given port numbers are WireGuard ports.
portSrc | The source port number to check |
portDst | The destination port number to check |
|
inlineoverridevirtual |
Does nothing for this layer (WireGuard layer is always last)
Implements pcpp::Layer.
|
static |
Parses the raw data into a WireGuard layer.
data | Pointer to the raw data |
dataLen | Length of the data |
prevLayer | Pointer to the previous layer |
packet | Pointer to the packet |
void pcpp::WireGuardLayer::setReserved | ( | const std::array< uint8_t, 3 > & | reserved | ) |
reserved | The reserved field to set as a An array containing the 3-byte. |
|
overridevirtual |
Converts the WireGuard layer to a string representation.
Implements pcpp::Layer.