|
PcapPlusPlus
24.09
|
#include <MacAddress.h>
Public Member Functions | |
| MacAddress ()=default | |
| MacAddress (const uint8_t *addr) | |
| MacAddress (const std::string &addr) | |
| template<typename T , typename = typename std::enable_if<std::is_convertible<T, std::string>::value>::type> | |
| MacAddress (const T &addr) | |
| MacAddress (uint8_t firstOctet, uint8_t secondOctet, uint8_t thirdOctet, uint8_t fourthOctet, uint8_t fifthOctet, uint8_t sixthOctet) | |
| MacAddress (std::initializer_list< uint8_t > octets) | |
| bool | operator== (const MacAddress &other) const |
| bool | operator!= (const MacAddress &other) const |
| MacAddress & | operator= (std::initializer_list< uint8_t > octets) |
| const uint8_t * | getRawData () 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
|
default |
Default constructor for this class. Initializes the address as 00:00:00:00:00:00.
|
inlineexplicit |
A constructor that creates an instance of the class out of a byte array. The byte array length should be 6 (as MAC address is 6-byte long), and the remaining bytes are ignored. If the byte array is invalid, the constructor throws an exception.
| [in] | addr | A pointer to the byte array containing 6 bytes representing the MAC address |
|
explicit |
A constructor that creates an instance of the class out of a std::string. If the string doesn't represent a valid MAC address, the constructor throws an exception.
| [in] | addr | the string representing the MAC address in format "00:00:00:00:00:00" |
|
inline |
A template constructor that creates an instance of the class out of a string convertible to std::string. If the string doesn't represent a valid MAC address, the constructor throws an exception.
| [in] | addr | the string representing the MAC address in format "00:00:00:00:00:00" |
|
inline |
A constructor that creates an instance of 6 bytes representing the MAC address
| [in] | firstOctet | 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 |
A constructor that creates an instance out of the initializer list. The byte list length should be 6 (as MAC address is 6-byte long). If the list is invalid, the constructor throws an exception.
| [in] | octets | An initializer list containing the values of type uint8_t representing the MAC 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 |
Overload of the not-equal operator
| [in] | other | The object to compare with |
|
inline |
Overload of the assignment operator. If the list is invalid, the constructor throws an exception.
| [in] | octets | An initializer list containing the values of type uint8_t representing the MAC address, the length of the list must be equal to 6 |
|
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"