FD.io VPP  v18.01.1-37-g7ea3975
Vector Packet Processing
interface_ip6_nd_cmds.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_ip6_nd.hpp"
17 
18 #include <vapi/vpe.api.vapi.hpp>
19 
20 namespace VOM {
21 template <>
22 rc_t
24 {
25  msg_t req(con.ctx(), std::ref(*this));
26 
27  auto& payload = req.get_request().get_payload();
28  payload.sw_if_index = m_itf.value();
29  m_cls.to_vpp(payload);
30  payload.is_no = 0;
31 
32  VAPI_CALL(req.execute());
33 
34  m_hw_item.set(wait());
35 
36  return rc_t::OK;
37 }
38 
39 template <>
40 rc_t
42 {
43  msg_t req(con.ctx(), std::ref(*this));
44 
45  auto& payload = req.get_request().get_payload();
46  payload.sw_if_index = m_itf.value();
47  m_cls.to_vpp(payload);
48  payload.is_no = 1;
49 
50  VAPI_CALL(req.execute());
51 
52  wait();
54 
55  return rc_t::OK;
56 }
57 
58 template <>
59 rc_t
61 {
62  msg_t req(con.ctx(), std::ref(*this));
63 
64  auto& payload = req.get_request().get_payload();
65  payload.sw_if_index = m_itf.value();
66  m_cls.to_vpp(payload);
67  payload.is_no = 0;
68 
69  VAPI_CALL(req.execute());
70 
71  m_hw_item.set(wait());
72 
73  return rc_t::OK;
74 }
75 
76 template <>
77 rc_t
79 {
80  msg_t req(con.ctx(), std::ref(*this));
81 
82  auto& payload = req.get_request().get_payload();
83  payload.sw_if_index = m_itf.value();
84  m_cls.to_vpp(payload);
85  payload.is_no = 1;
86 
87  VAPI_CALL(req.execute());
88 
89  wait();
91 
92  return rc_t::OK;
93 }
94 }
95 
96 /*
97  * fd.io coding-style-patch-verification: ON
98  *
99  * Local Variables:
100  * eval: (c-set-style "mozilla")
101  * End:
102  */
static const rc_t NOOP
The HW write/update action was/has not been attempted.
Definition: types.hpp:101
HW::item< bool > & m_hw_item
A reference to an object&#39;s HW::item that the command will update.
Definition: rpc_cmd.hpp:131
uint32_t value() const
get the value of the handle
Definition: types.cpp:92
rc_t issue(connection &con)
Issue the command to VPP/HW.
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
rc_t issue(connection &con)
Issue the command to VPP/HW.
A representation of the connection to VPP.
Definition: connection.hpp:33
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
Definition: types.hpp:29
static const rc_t OK
The HW write was successfull.
Definition: types.hpp:106
vapi::Connection & ctx()
Retrun the VAPI context the commands will use.
Definition: connection.cpp:51
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
Definition: hw.hpp:124
rc_t wait()
Wait on the commands promise.
Definition: rpc_cmd.hpp:89