|
PcapPlusPlus
Next
|
#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 () override |
| size_t | getHeaderLen () const override |
| void | computeCalculateFields () override |
| Calculate ether_header::etherType for known protocols: IPv4, IPv6, ARP, VLAN. | |
| 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) |
Additional Inherited Members | |
Protected Member Functions inherited from pcpp::Layer | |
| template<typename T , typename... Args> | |
| Layer * | constructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
| template<typename T , typename TFallback , typename... Args> | |
| Layer * | tryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
Static Protected Member Functions inherited from pcpp::Layer | |
| template<typename T > | |
| static bool | canReinterpretAs (const uint8_t *data, size_t dataLen) |
| Check if the data is large enough to reinterpret as a type. More... | |
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 |
|
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
|
inlineoverridevirtual |
Implements pcpp::Layer.
|
inlineoverridevirtual |
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 |
|
overridevirtual |
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 |
|
overridevirtual |
Implements pcpp::Layer.