PcapPlusPlus
22.11
|
#include <MacAddress.h>
Public Member Functions | |
MacAddress () | |
MacAddress (const uint8_t *addr) | |
MacAddress (const char *addr) | |
MacAddress (const std::string &addr) | |
MacAddress (uint8_t firstOctest, uint8_t secondOctet, uint8_t thirdOctet, uint8_t fourthOctet, uint8_t fifthOctet, uint8_t sixthOctet) | |
bool | operator== (const MacAddress &other) const |
bool | operator!= (const MacAddress &other) const |
const uint8_t * | getRawData () const |
bool | isValid () const |
std::string | toString () const |
void | copyTo (uint8_t **arr) const |
void | copyTo (uint8_t *arr) const |
Static Public Attributes | |
static MacAddress | Zero |
Represents L2 MAC addresses. Can be constructed from string or a series of 6 byte octets
|
inline |
Default constructor for this class. Initializes object to me MacAddress::Zero
|
inline |
A constructor that creates an instance of the class out of a byte array. The byte array length must be equal or greater to 6 (as MAC address is 6-byte long)
[in] | addr | A pointer to the byte array containing 6 bytes representing the MAC address |
|
inline |
A constructor that creates an instance of the class out of a (char*) string. If the string doesn't represent a valid MAC address, instance will be invalid, meaning isValid() will return false
[in] | addr | A pointer to the (char*) string |
|
inline |
A constructor that creates an instance of the class out of a std::string. If the string doesn't represent a valid MAC address, instance will be invalid, meaning isValid() will return false
[in] | addr | A pointer to the string |
|
inline |
A constructor that creates an instance of 6 bytes representing the MAC address
[in] | firstOctest | Represent the first octet in the address |
[in] | secondOctet | Represent the second octet in the address |
[in] | thirdOctet | Represent the third octet in the address |
[in] | fourthOctet | Represent the fourth octet in the address |
[in] | fifthOctet | Represent the fifth octet in the address |
[in] | sixthOctet | Represent the sixth octet in the address |
|
inline |
Allocates a byte array of length 6 and copies address value into it. Array deallocation is user responsibility
[in] | arr | A pointer to where array will be allocated |
|
inline |
Gets a pointer to an already allocated byte array and copies the address value to it. This method assumes array allocated size is at least 6 (the size of a MAC address)
[in] | arr | A pointer to the array which address will be copied to |
|
inline |
Returns the pointer to raw data
|
inline |
Get an indication whether the MAC address is valid. An address can be invalid if it was constructed from illegal input, for example: invalid string
|
inline |
Overload of the not-equal operator
[in] | other | The object to compare with |
|
inline |
Overload of the comparison operator
[in] | other | The object to compare with |
std::string pcpp::MacAddress::toString | ( | ) | const |
Returns a std::string representation of the address
|
static |
A static value representing a zero value of MAC address, meaning address of value "00:00:00:00:00:00"