X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp-api%2Fvom%2Ftypes.cpp;h=c6093ebd15df4e7409f50c7f8042e2e1f0451dfc;hb=refs%2Fchanges%2F47%2F11547%2F10;hp=cdced0ffb722ecc3c0f3e2ad3cd001988193b970;hpb=a2ee029d0772e894911c84fb8a0cab5f253e145b;p=vpp.git diff --git a/src/vpp-api/vom/types.cpp b/src/vpp-api/vom/types.cpp index cdced0ffb72..c6093ebd15d 100644 --- a/src/vpp-api/vom/types.cpp +++ b/src/vpp-api/vom/types.cpp @@ -28,9 +28,6 @@ rc_t::rc_t(int v, const std::string s) : enum_base(v, s) { } -rc_t::~rc_t() -{ -} const rc_t& rc_t::from_vpp_retval(int32_t rv) @@ -39,7 +36,11 @@ rc_t::from_vpp_retval(int32_t rv) return (rc_t::OK); } if (-68 == rv) { - // interface laready exists + // sub interface already exists + return (rc_t::OK); + } + if (-79 == rv) { + // interface already exists return (rc_t::OK); } @@ -94,6 +95,12 @@ handle_t::value() const return (m_value); } +void +handle_t::reset() +{ + m_value = ~0; +} + std::ostream& operator<<(std::ostream& os, const handle_t& h) { @@ -261,8 +268,64 @@ direction_t::direction_t(int v, const std::string s) : enum_base(v, s) { } +std::ostream& +operator<<(std::ostream& os, const direction_t& dir) +{ + os << dir.to_string(); + return os; +} + +const ethertype_t ethertype_t::ARP(0x0806, "arp"); +const ethertype_t ethertype_t::FCOE(0x8906, "fcoe"); +const ethertype_t ethertype_t::IPV4(0x0800, "ipv4"); +const ethertype_t ethertype_t::IPV6(0x86DD, "ipv6"); +const ethertype_t ethertype_t::MAC_SECURITY(0x88E5, "mac-security"); +const ethertype_t ethertype_t::MPLS_UNICAST(0x8847, "mpls-unicast"); +const ethertype_t ethertype_t::TRILL(0x22F3, "trill"); +const ethertype_t ethertype_t::UNSPECIFIED(0x0, "unspecified"); + +ethertype_t::ethertype_t(int v, const std::string s) + : enum_base(v, s) +{ } +std::ostream& +operator<<(std::ostream& os, const ethertype_t& ether) +{ + os << ether.to_string(); + return os; +} + +const ethertype_t& +ethertype_t::from_numeric_val(uint16_t numeric) +{ + if (0x0806 == numeric) { + return (ethertype_t::ARP); + } + if (0x8906 == numeric) { + return (ethertype_t::FCOE); + } + if (0x0800 == numeric) { + return (ethertype_t::IPV4); + } + if (0x86DD == numeric) { + return (ethertype_t::IPV6); + } + if (0x88E5 == numeric) { + return (ethertype_t::MAC_SECURITY); + } + if (0x8847 == numeric) { + return (ethertype_t::MPLS_UNICAST); + } + if (0x22F3 == numeric) { + return (ethertype_t::TRILL); + } + + return (ethertype_t::UNSPECIFIED); +} + +}; // namespace VOM + /* * fd.io coding-style-patch-verification: ON *