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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #include "vom/arp_proxy_config.hpp"
18 #include <vapi/vpe.api.vapi.hpp>
21 arp_proxy_config::config_cmd::config_cmd(
23 const boost::asio::ip::address_v4& low,
24 const boost::asio::ip::address_v4& high)
32 arp_proxy_config::config_cmd::operator==(const config_cmd& o) const
34 return ((m_low == o.m_low) && (m_high == o.m_high));
38 arp_proxy_config::config_cmd::issue(connection& con)
40 msg_t req(con.ctx(), std::ref(*this));
42 auto& payload = req.get_request().get_payload();
45 std::copy_n(std::begin(m_low.to_bytes()), m_low.to_bytes().size(),
47 std::copy_n(std::begin(m_high.to_bytes()), m_high.to_bytes().size(),
50 VAPI_CALL(req.execute());
52 m_hw_item.set(wait());
58 arp_proxy_config::config_cmd::to_string() const
61 s << "ARP-proxy-config: " << m_hw_item.to_string()
62 << " low:" << m_low.to_string() << " high:" << m_high.to_string();
67 arp_proxy_config::unconfig_cmd::unconfig_cmd(
69 const boost::asio::ip::address_v4& low,
70 const boost::asio::ip::address_v4& high)
78 arp_proxy_config::unconfig_cmd::operator==(const unconfig_cmd& o) const
80 return ((m_low == o.m_low) && (m_high == o.m_high));
84 arp_proxy_config::unconfig_cmd::issue(connection& con)
86 msg_t req(con.ctx(), std::ref(*this));
88 auto& payload = req.get_request().get_payload();
91 std::copy_n(std::begin(m_low.to_bytes()), m_low.to_bytes().size(),
93 std::copy_n(std::begin(m_high.to_bytes()), m_high.to_bytes().size(),
96 VAPI_CALL(req.execute());
99 m_hw_item.set(rc_t::NOOP);
105 arp_proxy_config::unconfig_cmd::to_string() const
107 std::ostringstream s;
108 s << "ARP-proxy-unconfig: " << m_hw_item.to_string()
109 << " low:" << m_low.to_string() << " high:" << m_high.to_string();
115 * fd.io coding-style-patch-verification: ON
118 * eval: (c-set-style "mozilla")