|
|
A class intended to carry any type of MAC. The assumption is that all current and future MAC classes will have a printable string representation and can be treated as opaque identifiers.
Mac ()
| Mac |
Mac (const uint8_t* from_uint8, size_t len)
throw (BadMac) | Mac |
Constructor from a (uint8_t *) memory pointer.
Parameters:
from_uint8 | the pointer to the memory to copy the address value from. |
len | the length of the address. |
Mac (const string& from_string)
throw (InvalidString) | Mac |
Construct MAC address from string. Mac address format must conform to one of known types.
Parameters:
from_string | string representation of MAC. |
Throws: InvalidString, if, s, is, not, recognized, Mac, type.
size_t copy_out (uint8_t* to_uint8)
| copy_out |
[const]
Copy the Mac raw address to specified memory location.
@param: to_uint8 the pointer to the memory to copy the address to.
Returns: the number of copied octets.
size_t copy_in (const uint8_t* from_uint8, size_t len)
throw (BadMac) | copy_in |
Copy a raw Mac address from specified memory location into Mac container.
Parameters:
from_uint8 | the memory address to copy the address from. |
len | the length of the address. |
Returns: the number of copied octets.
size_t copy_in (const string& from_string)
throw (InvalidString) | copy_in |
Copy a Mac address from string. Mac address format must conform to one of known types.
Parameters:
from_string | the storage to copy the address from. |
Returns: the number of copied octets.
Throws: InvalidString, if, from_string, is, not, recognized, Mac, type.
bool operator< (const Mac& other)
| operator< |
[const]
Less-Than Operator
Parameters:
other | the right-hand operand to compare against. |
Returns: true if the left-hand operand is numerically smaller than the right-hand operand.
const string& str ()
| str |
[const]
Returns: string representation of MAC address.
string normalized_str ()
| normalized_str |
[const]
Get the normalized string of MAC address.
For example, in case of Ethernet MAC address, the original string with an EtherMac address is converted into an "struct ether_addr", and then back to a string. Thus, the string address representation is normalized to the system's internal preference. Example: "00:00:00:00:00:00" -> "0:0:0:0:0:0"
Returns: normalized string representation of MAC address.
size_t addr_bytelen ()
| addr_bytelen |
[const]
Get the size of the raw MAC address (in octets).
Returns: the size of the raw MAC address (in octets).
uint32_t addr_bitlen ()
| addr_bitlen |
[const]
Get the size of the raw MAC address (in number of bits).
Returns: the size of the raw MAC address (in number of bits).
bool is_zero ()
| is_zero |
[const]
Test if this address is numerically zero.
Returns: true if the address is numerically zero.
bool is_multicast ()
| is_multicast |
[const]
Test if this address is a valid multicast address.
Returns: true if the address is a valid multicast address.
const Mac& ZERO ()
| ZERO |
[static]
Pre-defined MAC address constants.
const Mac& ALL_ONES ()
| ALL_ONES |
[static]
const Mac& STP_MULTICAST ()
| STP_MULTICAST |
[static]
const Mac& LLDP_MULTICAST ()
| LLDP_MULTICAST |
[static]
const Mac& GMRP_MULTICAST ()
| GMRP_MULTICAST |
[static]
const Mac& GVRP_MULTICAST ()
| GVRP_MULTICAST |
[static]
void set_rep (const string& s)
| set_rep |
[protected]
string _srep | _srep |
[protected]
inline const Mac& ZERO ()
| ZERO |
[protected]
inline const Mac& ALL_ONES ()
| ALL_ONES |
[protected]
inline const Mac& STP_MULTICAST ()
| STP_MULTICAST |
[protected]
inline const Mac& LLDP_MULTICAST ()
| LLDP_MULTICAST |
[protected]
inline const Mac& GMRP_MULTICAST ()
| GMRP_MULTICAST |
[protected]
inline const Mac& GVRP_MULTICAST ()
| GVRP_MULTICAST |
[protected]