PcapPlusPlus
21.05
|
#include <EthLayer.h>
Public Member Functions | |
EthLayer (uint8_t *data, size_t dataLen, Packet *packet) | |
EthLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
EthLayer (const MacAddress &sourceMac, const MacAddress &destMac, uint16_t etherType=0) | |
ether_header * | getEthHeader () const |
MacAddress | getSourceMac () const |
void | setSourceMac (const MacAddress &sourceMac) |
MacAddress | getDestMac () const |
void | setDestMac (const MacAddress &destMac) |
void | parseNextLayer () |
size_t | getHeaderLen () const |
void | computeCalculateFields () |
std::string | toString () const |
OsiModelLayer | getOsiModelLayer () const |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () 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 |
Static Public Member Functions | |
static bool | isDataValid (const uint8_t *data, size_t dataLen) |
Represents an Ethernet II 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 |
|
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] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
pcpp::EthLayer::EthLayer | ( | const MacAddress & | sourceMac, |
const MacAddress & | destMac, | ||
uint16_t | etherType = 0 |
||
) |
A constructor that creates a new Ethernet header and allocates the data
[in] | sourceMac | The source MAC address |
[in] | destMac | The destination MAC address |
[in] | etherType | The EtherType to be used. It's an optional parameter, a value of 0 will be set if not provided |
|
virtual |
Calculate ether_header::etherType for known protocols: IPv4, IPv6, ARP, VLAN
Implements pcpp::Layer.
|
inline |
Get the destination MAC address
|
inline |
Get a pointer to the Ethernet header. Notice this points directly to the data, so every change will change the actual packet data
|
inlinevirtual |
Implements pcpp::Layer.
|
inlinevirtual |
Implements pcpp::Layer.
|
inline |
Get the source MAC address
|
static |
A static method that validates the input data
[in] | data | The pointer to the beginning of a byte stream of an Ethernet II packet |
[in] | dataLen | The length of the byte stream |
|
virtual |
Currently identifies the following next layers: IPv4Layer, IPv6Layer, ArpLayer, VlanLayer, PPPoESessionLayer, PPPoEDiscoveryLayer, MplsLayer. Otherwise sets PayloadLayer
Implements pcpp::Layer.
|
inline |
Set destination MAC address
destMac | Destination MAC to set |
|
inline |
Set source MAC address
sourceMac | Source MAC to set |
|
virtual |
Implements pcpp::Layer.