Open Lighting Architecture
0.9.0
|
Represents a MAC Address.
All methods use network byte order unless otherwise mentioned. TODO(Peter): Is the above actually true for MAC addresses?
Public Types | |
enum | { LENGTH = ETHER_ADDR_LEN } |
Public Member Functions | |
MACAddress (const struct ether_addr &address) | |
MACAddress (const uint8_t *data) | |
Construct a new MAC address from binary data. | |
MACAddress (const MACAddress &other) | |
MACAddress & | operator= (const MACAddress &other) |
bool | operator== (const MACAddress &other) const |
bool | operator!= (const MACAddress &other) const |
bool | operator< (const MACAddress &other) const |
Order addresses. Note that this won't order how humans expect because ether_addr is in network byte order. TODO(Peter): Check if this is actually true for MAC Addresses. | |
bool | operator> (const MACAddress &other) const |
struct ether_addr & | Address () const |
void | Get (uint8_t ptr[LENGTH]) const |
bool | Pack (uint8_t *buffer, unsigned int length) const |
Write the binary representation of the MAC address to memory. | |
std::string | ToString () const |
Static Public Member Functions | |
static MACAddress * | FromString (const std::string &address) |
static bool | FromString (const std::string &address, MACAddress *target) |
static MACAddress | FromStringOrDie (const std::string &address) |
Friends | |
std::ostream & | operator<< (std::ostream &out, const MACAddress &address) |
|
inlineexplicit |
Construct a new MAC address from binary data.
data | a pointer to the memory containing the MAC address data. The data should be most significant byte first. |
|
static |
Convert a string to a MACAddress object
address | a string in the form 'nn:nn:nn:nn:nn:nn' or 'nn.nn.nn.nn.nn.nn' |
|
static |
Convert a string to a MACAddress object
address | a string in the form 'nn:nn:nn:nn:nn:nn' or 'nn.nn.nn.nn.nn.nn' | |
[out] | target | a pointer to a MACAddress object |
|
inline |
Write the binary representation of the MAC address to memory.
buffer | a pointer to memory to write the MAC address to |
length | the size of the memory block, should be at least LENGTH. |
string ola::network::MACAddress::ToString | ( | ) | const |
ether_ntoa_r doesn't exist on Mac, so can't use it; ether_ntoa isn't thread safe