FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
interface_types.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "vom/interface.hpp"
17 
18 namespace VOM {
19 /*
20  * constants and enums
21  */
22 const interface::type_t interface::type_t::UNKNOWN(0, "unknown");
23 const interface::type_t interface::type_t::BVI(1, "BVI");
24 const interface::type_t interface::type_t::ETHERNET(2, "Ethernet");
25 const interface::type_t interface::type_t::VXLAN(3, "VXLAN");
26 const interface::type_t interface::type_t::AFPACKET(4, "AFPACKET");
27 const interface::type_t interface::type_t::LOOPBACK(5, "LOOPBACK");
28 const interface::type_t interface::type_t::LOCAL(6, "LOCAL");
29 const interface::type_t interface::type_t::TAP(7, "TAP");
30 
31 const interface::oper_state_t interface::oper_state_t::DOWN(0, "down");
32 const interface::oper_state_t interface::oper_state_t::UP(1, "up");
33 
34 const interface::admin_state_t interface::admin_state_t::DOWN(0, "down");
35 const interface::admin_state_t interface::admin_state_t::UP(1, "up");
36 
37 interface::type_t
38 interface::type_t::from_string(const std::string& str)
39 {
40  if (str.find("Ethernet") != std::string::npos) {
42  } else if (str.find("vxlan") != std::string::npos) {
44  } else if (str.find("loop") != std::string::npos) {
46  } else if (str.find("host-") != std::string::npos) {
48  } else if (str.find("local") != std::string::npos) {
50  } else if (str.find("tap") != std::string::npos) {
52  } else if (str.find("bvi") != std::string::npos) {
54  }
55 
57 }
58 
59 interface::type_t::type_t(int v, const std::string& s)
61 {
62 }
63 
64 interface::oper_state_t::oper_state_t(int v, const std::string& s)
66 {
67 }
68 
69 interface::admin_state_t::admin_state_t(int v, const std::string& s)
71 {
72 }
73 
76 {
77  if (0 == v) {
79  }
81 }
82 
85 {
86  if (0 == v) {
88  }
90 }
91 }
92 
93 /*
94  * fd.io coding-style-patch-verification: ON
95  *
96  * Local Variables:
97  * eval: (c-set-style "mozilla")
98  * End:
99  */
static const type_t AFPACKET
AF-Packet interface type.
Definition: interface.hpp:79
A template base class for all enum types.
Definition: enum_base.hpp:30
static const oper_state_t UP
Operational UP state.
Definition: interface.hpp:143
The oper state of the interface.
Definition: interface.hpp:134
static const type_t LOCAL
Local interface type (specific to VPP)
Definition: interface.hpp:87
static const type_t ETHERNET
Ethernet interface type.
Definition: interface.hpp:75
static const oper_state_t DOWN
Operational DOWN state.
Definition: interface.hpp:139
#define v
Definition: acl.c:341
static admin_state_t from_int(uint8_t val)
Convert VPP's numerical value to enum type.
The admin state of the interface.
Definition: interface.hpp:108
static type_t from_string(const std::string &str)
Convert VPP's name of the interface to a type.
static const type_t UNKNOWN
Unkown type.
Definition: interface.hpp:63
static oper_state_t from_int(uint8_t val)
Convert VPP's numerical value to enum type.
static const type_t VXLAN
VXLAN interface.
Definition: interface.hpp:71
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
static const admin_state_t UP
Admin UP state.
Definition: interface.hpp:117
static const type_t BVI
A brideged Virtual interface (aka SVI or IRB)
Definition: interface.hpp:67
static const admin_state_t DOWN
Admin DOWN state.
Definition: interface.hpp:113
static const type_t TAP
TAP interface type.
Definition: interface.hpp:91
static const type_t LOOPBACK
loopback interface type
Definition: interface.hpp:83