Class for representing the Wake on LAN Layer.
More...
#include <WakeOnLanLayer.h>
Class for representing the Wake on LAN Layer.
◆ WakeOnLanLayer() [1/5]
pcpp::WakeOnLanLayer::WakeOnLanLayer |
( |
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] | data | A pointer to the raw data |
[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 |
◆ WakeOnLanLayer() [2/5]
Construct a new Wake On Lan Layer with provided values
- Parameters
-
[in] | targetAddr | Target MAC address |
◆ WakeOnLanLayer() [3/5]
pcpp::WakeOnLanLayer::WakeOnLanLayer |
( |
const pcpp::MacAddress & |
targetAddr, |
|
|
uint8_t * |
password, |
|
|
uint8_t |
len |
|
) |
| |
Construct a new Wake On Lan Layer with provided values
- Parameters
-
[in] | targetAddr | Target MAC address |
[in] | password | Password as array |
[in] | len | Length of the password array, length of the password should be less than 6 bytes |
◆ WakeOnLanLayer() [4/5]
Construct a new Wake On Lan Layer with provided values
- Parameters
-
[in] | targetAddr | Target MAC address |
[in] | password | Password as MAC address |
◆ WakeOnLanLayer() [5/5]
Construct a new Wake On Lan Layer with provided values
- Parameters
-
[in] | targetAddr | Target MAC address |
[in] | password | Password as IPv4 address |
◆ getHeaderLen()
size_t pcpp::WakeOnLanLayer::getHeaderLen |
( |
| ) |
const |
|
inlineoverridevirtual |
- Returns
- Get the size of the layer
Implements pcpp::Layer.
◆ getOsiModelLayer()
- Returns
- The OSI layer level of Wake on LAN (Data Link Layer)
Implements pcpp::Layer.
◆ getPassword()
std::string pcpp::WakeOnLanLayer::getPassword |
( |
| ) |
const |
Get the password of the command
- Returns
- Returns the password if exists, empty string otherwise
◆ getTargetAddr()
Get the target MAC address of the command
- Returns
- MAC address of the target
◆ getWakeOnLanHeader()
wol_header* pcpp::WakeOnLanLayer::getWakeOnLanHeader |
( |
| ) |
const |
|
inline |
Get a pointer to the Wake On LAN header. Notice this points directly to the data, so every change will change the actual packet data
- Returns
- A pointer to the wol_header
◆ isDataValid()
static bool pcpp::WakeOnLanLayer::isDataValid |
( |
const uint8_t * |
data, |
|
|
size_t |
dataSize |
|
) |
| |
|
static |
A static method that takes a byte array and detects whether it is a Wake on LAN message
- Parameters
-
[in] | data | A byte array |
[in] | dataSize | The byte array size (in bytes) |
- Returns
- True if the data is identified as Wake on LAN message
◆ isWakeOnLanPort()
static bool pcpp::WakeOnLanLayer::isWakeOnLanPort |
( |
uint16_t |
port | ) |
|
|
inlinestatic |
A static method that checks whether the port is considered as Wake on LAN
- Parameters
-
[in] | port | The port number to be checked |
◆ setPassword() [1/4]
bool pcpp::WakeOnLanLayer::setPassword |
( |
const IPv4Address & |
addr | ) |
|
Set the password of the command
- Parameters
-
addr | Password as IPv4 address |
- Returns
- True if operation successful, false otherwise
◆ setPassword() [2/4]
bool pcpp::WakeOnLanLayer::setPassword |
( |
const MacAddress & |
addr | ) |
|
Set the password of the command
- Parameters
-
[in] | addr | Password as MAC address |
- Returns
- True if operation successful, false otherwise
◆ setPassword() [3/4]
bool pcpp::WakeOnLanLayer::setPassword |
( |
const std::string & |
password | ) |
|
Set the password of the command
- Parameters
-
[in] | password | Password as string. Length of the password should be less than 6 bytes |
- Returns
- True if operation successful, false otherwise
◆ setPassword() [4/4]
bool pcpp::WakeOnLanLayer::setPassword |
( |
const uint8_t * |
password, |
|
|
uint8_t |
len |
|
) |
| |
Set the password of the command
- Parameters
-
[in] | password | Password as array |
[in] | len | Length of the password array, length of the password should be less than 6 bytes |
- Returns
- True if operation successful, false otherwise
◆ setTargetAddr()
Set the target MAC address
- Parameters
-
[in] | targetAddr | MAC address of the target |
◆ toString()
std::string pcpp::WakeOnLanLayer::toString |
( |
| ) |
const |
|
overridevirtual |
- Returns
- Returns the protocol info as readable string
Implements pcpp::Layer.