PcapPlusPlus
Next
|
#include <Sll2Layer.h>
Public Member Functions | |
Sll2Layer (uint8_t *data, size_t dataLen, Packet *packet) | |
Sll2Layer (uint32_t interfaceIndex, uint16_t ARPHRDType, uint8_t packetType) | |
sll2_header * | getSll2Header () const |
uint16_t | getProtocolType () const |
void | setProtocolType (uint16_t protocolType) |
uint32_t | getInterfaceIndex () const |
void | setInterfaceIndex (uint32_t interfaceIndex) |
uint16_t | getArphrdType () const |
void | setArphrdType (uint16_t arphrdType) |
uint8_t | getPacketType () const |
void | setPacketType (uint8_t packetType) |
uint8_t | getLinkLayerAddrLen () const |
const uint8_t * | getLinkLayerAddr () const |
bool | setLinkLayerAddr (const uint8_t *addr, size_t addrLength) |
MacAddress | getLinkLayerAsMacAddress () |
bool | setMacAddressAsLinkLayer (const MacAddress &macAddr) |
void | parseNextLayer () override |
void | computeCalculateFields () override |
size_t | getHeaderLen () const override |
std::string | toString () const override |
OsiModelLayer | getOsiModelLayer () const override |
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 | isDataValid (const uint8_t *data, size_t dataLen) |
Represents an SLL2 (Linux cooked capture) protocol layer
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data (will be casted to ether_header) |
[in] | dataLen | Size of the data in bytes |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
pcpp::Sll2Layer::Sll2Layer | ( | uint32_t | interfaceIndex, |
uint16_t | ARPHRDType, | ||
uint8_t | packetType | ||
) |
A constructor that creates a new SLL2 header and allocates the data
[in] | interfaceIndex | The interface index |
[in] | ARPHRDType | The ARPHRD type |
[in] | packetType | The packet type |
|
overridevirtual |
Calculate the next protocol type for known protocols: IPv4, IPv6, ARP, VLAN
Implements pcpp::Layer.
uint16_t pcpp::Sll2Layer::getArphrdType | ( | ) | const |
Get arphrd type of this layer
|
inlineoverridevirtual |
Implements pcpp::Layer.
uint32_t pcpp::Sll2Layer::getInterfaceIndex | ( | ) | const |
Get interface index of this layer
const uint8_t* pcpp::Sll2Layer::getLinkLayerAddr | ( | ) | const |
Get link layer address data pointer
uint8_t pcpp::Sll2Layer::getLinkLayerAddrLen | ( | ) | const |
Get link layer address length
MacAddress pcpp::Sll2Layer::getLinkLayerAsMacAddress | ( | ) |
Get a MAC address in the link layer address field
|
inlineoverridevirtual |
Implements pcpp::Layer.
uint8_t pcpp::Sll2Layer::getPacketType | ( | ) | const |
Get packet type of this layer
uint16_t pcpp::Sll2Layer::getProtocolType | ( | ) | const |
Get a protocol type of this layer
|
inline |
Get a pointer to the Sll header. Notice this points directly to the data, so every change will change the actual packet data
|
static |
A static method that validates the input data
[in] | data | The pointer to the beginning of a byte stream of an IEEE 802.3 Eth packet |
[in] | dataLen | The length of the byte stream |
|
overridevirtual |
Currently identifies the following next layers: IPv4Layer, IPv6Layer, ArpLayer, VlanLayer, PPPoESessionLayer, PPPoEDiscoveryLayer, MplsLayer. Otherwise sets PayloadLayer
Implements pcpp::Layer.
void pcpp::Sll2Layer::setArphrdType | ( | uint16_t | arphrdType | ) |
Set arphrd type of this layer
[in] | arphrdType | arphrd type to set |
void pcpp::Sll2Layer::setInterfaceIndex | ( | uint32_t | interfaceIndex | ) |
Set interface index of this layer
[in] | interfaceIndex | interface index to set |
bool pcpp::Sll2Layer::setLinkLayerAddr | ( | const uint8_t * | addr, |
size_t | addrLength | ||
) |
A setter for the link layer address field
[in] | addr | The address to set. Memory will be copied to packet |
[in] | addrLength | Address length, must be lower or equal to 8 (which is max length for SLL2 address) |
bool pcpp::Sll2Layer::setMacAddressAsLinkLayer | ( | const MacAddress & | macAddr | ) |
Set a MAC address in the link layer address field
[in] | macAddr | MAC address to set |
void pcpp::Sll2Layer::setPacketType | ( | uint8_t | packetType | ) |
Set packet type of this layer
[in] | packetType | packet type to set |
void pcpp::Sll2Layer::setProtocolType | ( | uint16_t | protocolType | ) |
Set protocol type of this layer
[in] | protocolType | type to set |
|
overridevirtual |
Implements pcpp::Layer.