Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 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 | #ifndef __VOM_ARP_PROXY_CONFIG_CMDS_H__ |
| 17 | #define __VOM_ARP_PROXY_CONFIG_CMDS_H__ |
| 18 | |
| 19 | #include "vom/arp_proxy_config.hpp" |
| 20 | #include "vom/dump_cmd.hpp" |
| 21 | #include "vom/rpc_cmd.hpp" |
| 22 | |
Neale Ranns | b8d4481 | 2017-11-10 06:53:54 -0800 | [diff] [blame] | 23 | #include <vapi/ip.api.vapi.hpp> |
Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 24 | |
| 25 | namespace VOM { |
| 26 | namespace arp_proxy_config_cmds { |
| 27 | /** |
| 28 | * A command class that adds the ARP Proxy config |
| 29 | */ |
| 30 | class config_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del> |
| 31 | { |
| 32 | public: |
| 33 | /** |
| 34 | * Constructor |
| 35 | */ |
| 36 | config_cmd(HW::item<bool>& item, |
| 37 | const boost::asio::ip::address_v4& lo, |
| 38 | const boost::asio::ip::address_v4& high); |
| 39 | |
| 40 | /** |
| 41 | * Issue the command to VPP/HW |
| 42 | */ |
| 43 | rc_t issue(connection& con); |
| 44 | /** |
| 45 | * convert to string format for debug purposes |
| 46 | */ |
| 47 | std::string to_string() const; |
| 48 | |
| 49 | /** |
| 50 | * Comparison operator - only used for UT |
| 51 | */ |
| 52 | bool operator==(const config_cmd& i) const; |
| 53 | |
| 54 | private: |
| 55 | /** |
| 56 | * Address range |
| 57 | */ |
| 58 | const boost::asio::ip::address_v4 m_low; |
| 59 | const boost::asio::ip::address_v4 m_high; |
| 60 | }; |
| 61 | |
| 62 | /** |
| 63 | * A cmd class that Unconfigs ArpProxy Config from an interface |
| 64 | */ |
| 65 | class unconfig_cmd |
| 66 | : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del> |
| 67 | { |
| 68 | public: |
| 69 | /** |
| 70 | * Constructor |
| 71 | */ |
| 72 | unconfig_cmd(HW::item<bool>& item, |
| 73 | const boost::asio::ip::address_v4& lo, |
| 74 | const boost::asio::ip::address_v4& hig); |
| 75 | |
| 76 | /** |
| 77 | * Issue the command to VPP/HW |
| 78 | */ |
| 79 | rc_t issue(connection& con); |
| 80 | /** |
| 81 | * convert to string format for debug purposes |
| 82 | */ |
| 83 | std::string to_string() const; |
| 84 | |
| 85 | /** |
| 86 | * Comparison operator - only used for UT |
| 87 | */ |
| 88 | bool operator==(const unconfig_cmd& i) const; |
| 89 | |
| 90 | private: |
| 91 | /** |
| 92 | * Address range |
| 93 | */ |
| 94 | const boost::asio::ip::address_v4 m_low; |
| 95 | const boost::asio::ip::address_v4 m_high; |
| 96 | }; |
| 97 | }; |
| 98 | }; |
| 99 | |
| 100 | /* |
| 101 | * fd.io coding-style-patch-verification: ON |
| 102 | * |
| 103 | * Local Variables: |
| 104 | * eval: (c-set-style "mozilla") |
| 105 | * End: |
| 106 | */ |
| 107 | |
| 108 | #endif |