#include <MacAddress.h>
Definition at line 31 of file MacAddress.h.
folly::MacAddress::MacAddress |
( |
| ) |
|
|
inline |
folly::MacAddress::MacAddress |
( |
uint64_t |
valueNBO | ) |
|
|
inlineexplicitprivate |
const uint8_t* folly::MacAddress::bytes |
( |
| ) |
const |
|
inline |
Definition at line 70 of file MacAddress.h.
References MacAddress().
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
uint64_t folly::MacAddress::getByte |
( |
size_t |
index | ) |
const |
|
inlineprivate |
bool folly::MacAddress::isBroadcast |
( |
| ) |
const |
|
inline |
bool folly::MacAddress::isLocallyAdministered |
( |
| ) |
const |
|
inline |
bool folly::MacAddress::isMulticast |
( |
| ) |
const |
|
inline |
bool folly::MacAddress::isUnicast |
( |
| ) |
const |
|
inline |
bool folly::MacAddress::operator!= |
( |
const MacAddress & |
other | ) |
const |
|
inline |
bool folly::MacAddress::operator< |
( |
const MacAddress & |
other | ) |
const |
|
inline |
bool folly::MacAddress::operator<= |
( |
const MacAddress & |
other | ) |
const |
|
inline |
bool folly::MacAddress::operator== |
( |
const MacAddress & |
other | ) |
const |
|
inline |
bool folly::MacAddress::operator> |
( |
const MacAddress & |
other | ) |
const |
|
inline |
bool folly::MacAddress::operator>= |
( |
const MacAddress & |
other | ) |
const |
|
inline |
uint64_t folly::MacAddress::packedBytes |
( |
| ) |
const |
|
inlineprivate |
Definition at line 74 of file MacAddress.cpp.
References folly::Range< Iter >::begin(), c, folly::Range< Iter >::end(), folly::detail::hexTable, setFromBinary(), folly::sformat(), SIZE, and uint8_t.
Referenced by MacAddress(), and u64HBO().
76 auto isSeparatorChar = [](
char c) {
return c ==
':' ||
c ==
'-'; };
80 for (
unsigned int byteIndex = 0; byteIndex <
SIZE; ++byteIndex) {
82 throw invalid_argument(
83 sformat(
"invalid MAC address '{}': not enough digits", str));
87 if (byteIndex != 0 && isSeparatorChar(*p)) {
90 throw invalid_argument(
91 sformat(
"invalid MAC address '{}': not enough digits", str));
98 throw invalid_argument(
99 sformat(
"invalid MAC address '{}': contains non-hex digit", str));
105 if (p == str.end()) {
113 if (isSeparatorChar(*p)) {
117 throw invalid_argument(
118 sformat(
"invalid MAC address '{}': contains non-hex digit", str));
125 parsed[byteIndex] = (upper << 4) | lower;
128 if (p != str.end()) {
130 throw invalid_argument(
131 sformat(
"invalid MAC address '{}': found trailing characters", str));
std::string sformat(StringPiece fmt, Args &&...args)
static constexpr size_t SIZE
const std::array< unsigned char, 256 > hexTable
void setFromBinary(ByteRange value)
Range< const unsigned char * > ByteRange
void folly::MacAddress::setFromBinary |
( |
ByteRange |
value | ) |
|
Definition at line 139 of file MacAddress.cpp.
References folly::Range< Iter >::begin(), bytes_, folly::sformat(), SIZE, and folly::Range< Iter >::size().
Referenced by fromBinary(), parse(), and u64HBO().
141 throw invalid_argument(
142 sformat(
"MAC address must be 6 bytes long, got ",
value.size()));
std::string sformat(StringPiece fmt, Args &&...args)
static constexpr size_t SIZE
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
string folly::MacAddress::toString |
( |
| ) |
const |
uint64_t folly::MacAddress::u64HBO |
( |
| ) |
const |
|
inline |
uint64_t folly::MacAddress::u64NBO |
( |
| ) |
const |
|
inline |
unsigned char folly::MacAddress::bytes_[8] |
|
private |
constexpr size_t folly::MacAddress::SIZE = 6 |
|
static |
The documentation for this class was generated from the following files: