FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
acl_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/acl_types.hpp"
17 
18 namespace VOM {
19 namespace ACL {
20 const action_t action_t::PERMITANDREFLEX(2, "permitandreflex");
21 const action_t action_t::PERMIT(1, "permit");
22 const action_t action_t::DENY(0, "deny");
23 
24 action_t::action_t(int v, const std::string s)
25  : enum_base(v, s)
26 {
27 }
28 
29 const action_t&
31 {
32  if (i == 2)
34  else if (i)
35  return action_t::PERMIT;
36 
37  return action_t::DENY;
38 }
39 
40 const action_t&
41 action_t::from_bool(bool b, uint8_t c)
42 {
43  if (b) {
44  if (c)
46  return action_t::PERMIT;
47  }
48  return action_t::DENY;
49 }
50 }
51 }
52 
53 /*
54  * fd.io coding-style-patch-verification: ON
55  *
56  * Local Variables:
57  * eval: (c-set-style "mozilla")
58  * End:
59  */
static const action_t & from_int(uint8_t i)
Get the enum type from a VPP integer value.
Definition: acl_types.cpp:30
int i
static const action_t PERMIT
Permit Action.
Definition: acl_types.hpp:36
static const action_t & from_bool(bool b, uint8_t c)
Get the enum type from a bool value and optional uint8_t value which implements the connection tracki...
Definition: acl_types.cpp:41
svmdb_client_t * c
static const action_t DENY
Deny Action.
Definition: acl_types.hpp:41
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
ACL Actions.
Definition: acl_types.hpp:26
static const action_t PERMITANDREFLEX
Permit and Reflexive.
Definition: acl_types.hpp:31