21 #include <boost/algorithm/string.hpp> 28 : enum_base<rc_t>(v, s)
70 return (std::to_string(m_value));
76 return (m_value == other.m_value);
82 return (!(*
this == other));
88 return (m_value < other.m_value);
107 std::copy(b, b + 6, std::begin(bytes));
112 std::copy(i.begin(), i.end(), std::begin(bytes));
117 std::vector<std::string> parts;
119 boost::split(parts, str, boost::is_any_of(
":"));
121 size_t n_bytes = std::min(bytes.size(), parts.size());
123 for (uint32_t ii = 0; ii < n_bytes; ii++) {
124 bytes[ii] = std::stoul(parts[ii],
nullptr, 16);
135 for (
int i = 0;
i < 6 &&
i < len;
i++) {
143 std::ostringstream s;
148 for (
auto byte : bytes) {
153 s << std::setw(2) << static_cast<unsigned int>(byte);
162 return (bytes == mac.
bytes);
167 return (bytes < m.
bytes);
181 std::copy_n(b, n_bytes, std::begin(
bytes));
203 for (uint8_t
i = 0;
i <
bytes.size() &&
i < len;
i++) {
213 std::copy_n(
bytes.begin(), mac.bytes.size(), mac.bytes.begin());
221 std::ostringstream s;
226 for (
auto byte :
bytes) {
231 s << std::setw(2) << static_cast<unsigned int>(byte);
static const rc_t NOOP
The HW write/update action was/has not been attempted.
rc_t(const rc_t &rc)=default
sll srl srl sll sra u16x4 i
static const rc_t & from_vpp_retval(int32_t rv)
Get the rc_t from the VPP API value.
direction_t(int v, const std::string s)
Constructor.
A template base class for all enum types.
uint32_t value() const
get the value of the handle
void to_bytes(uint8_t *array, uint8_t len) const
Convert to byte array.
bool operator<(const handle_t &other) const
less than operator
std::string to_string() const
String conversion.
bool operator==(const mac_address_t &m) const
Comparison operator.
Error codes that VPP will return during a HW write.
static const l2_address_t ZERO
An all 0's L2 address.
static const direction_t INPUT
Permit Direction.
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
Type def of a L2 address as read from VPP.
static const l2_address_t ONE
An all 1's L2 address.
std::string to_string() const
convert to string format for debug purposes
bool operator!=(const handle_t &other) const
Comparison operator.
static heap_elt_t * first(heap_header_t *h)
static const mac_address_t ONE
An all 1's MAC address.
std::vector< uint8_t > bytes
Underlying bytes array - filled from least to most significant.
std::string to_string() const
String conversion.
A type declaration of an interface handle in VPP.
std::array< uint8_t, 6 > bytes
Underlying bytes array.
static const rc_t OK
The HW write was successfull.
void to_bytes(uint8_t *array, uint8_t len) const
Convert to byte array.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
static const rc_t INVALID
HW write reported invalid input.
The VPP Object Model (VOM) library.
bool operator<(const mac_address_t &m) const
less than operator
static const rc_t UNSET
The value un-set.
bool operator==(const handle_t &other) const
Comparison operator.
bool operator==(const l2_address_t &m) const
Comparison operator.
static const direction_t OUTPUT
Deny Direction.
const std::string & to_string() const
convert to string format for debug purposes
mac_address_t to_mac() const
MAC address conversion.
mac_address_t(uint8_t bytes[6])
Type def of a Ethernet address.
static const mac_address_t ZERO
An all 0's MAC address.
bool operator!=(const l2_address_t &m) const
Comparison operator.
static const rc_t TIMEOUT
HW write timedout - VPP did not respond within a timely manner.
l2_address_t(const uint8_t bytes[8], uint8_t n_bytes)