Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 1 | #ifndef __VOM_NAT_BINDING_CMDS_H__ |
| 2 | #define __VOM_NAT_BINDING_CMDS_H__ |
| 3 | |
| 4 | #include "vom/nat_binding.hpp" |
| 5 | #include "vom/rpc_cmd.hpp" |
| 6 | #include "vom/dump_cmd.hpp" |
| 7 | |
| 8 | #include <vapi/nat.api.vapi.hpp> |
| 9 | |
| 10 | namespace VOM { |
| 11 | namespace nat_binding_cmds { |
| 12 | /** |
| 13 | * A functor class that binds L2 configuration to an interface |
| 14 | */ |
| 15 | class bind_44_input_cmd |
| 16 | : public rpc_cmd<HW::item<bool>, |
| 17 | rc_t, |
| 18 | vapi::Nat44_interface_add_del_feature> |
| 19 | { |
| 20 | public: |
| 21 | /** |
| 22 | * Constructor |
| 23 | */ |
| 24 | bind_44_input_cmd(HW::item<bool>& item, |
| 25 | const handle_t& itf, |
| 26 | const nat_binding::zone_t& zone); |
| 27 | |
| 28 | /** |
| 29 | * Issue the command to VPP/HW |
| 30 | */ |
| 31 | rc_t issue(connection& con); |
| 32 | /** |
| 33 | * convert to string format for debug purposes |
| 34 | */ |
| 35 | std::string to_string() const; |
| 36 | |
| 37 | /** |
| 38 | * Comparison operator - only used for UT |
| 39 | */ |
| 40 | bool operator==(const bind_44_input_cmd& i) const; |
| 41 | |
| 42 | private: |
| 43 | /** |
| 44 | * The interface to bind |
| 45 | */ |
| 46 | const handle_t m_itf; |
| 47 | |
| 48 | /** |
| 49 | * The zone the interface is in |
| 50 | */ |
| 51 | const nat_binding::zone_t m_zone; |
| 52 | }; |
| 53 | |
| 54 | /** |
| 55 | * A cmd class that Unbinds L2 configuration from an interface |
| 56 | */ |
| 57 | class unbind_44_input_cmd |
| 58 | : public rpc_cmd<HW::item<bool>, |
| 59 | rc_t, |
| 60 | vapi::Nat44_interface_add_del_feature> |
| 61 | { |
| 62 | public: |
| 63 | /** |
| 64 | * Constructor |
| 65 | */ |
| 66 | unbind_44_input_cmd(HW::item<bool>& item, |
| 67 | const handle_t& itf, |
| 68 | const nat_binding::zone_t& zone); |
| 69 | |
| 70 | /** |
| 71 | * Issue the command to VPP/HW |
| 72 | */ |
| 73 | rc_t issue(connection& con); |
| 74 | /** |
| 75 | * convert to string format for debug purposes |
| 76 | */ |
| 77 | std::string to_string() const; |
| 78 | |
| 79 | /** |
| 80 | * Comparison operator - only used for UT |
| 81 | */ |
| 82 | bool operator==(const unbind_44_input_cmd& i) const; |
| 83 | |
| 84 | private: |
| 85 | /** |
| 86 | * The interface to bind |
| 87 | */ |
| 88 | const handle_t m_itf; |
| 89 | |
| 90 | /** |
| 91 | * The zone the interface is in |
| 92 | */ |
| 93 | const nat_binding::zone_t m_zone; |
| 94 | }; |
| 95 | |
| 96 | /** |
| 97 | * A cmd class that Dumps all the nat_statics |
| 98 | */ |
| 99 | class dump_44_cmd : public dump_cmd<vapi::Nat44_interface_dump> |
| 100 | { |
| 101 | public: |
| 102 | /** |
| 103 | * Constructor |
| 104 | */ |
| 105 | dump_44_cmd(); |
| 106 | dump_44_cmd(const dump_44_cmd& d); |
| 107 | |
| 108 | /** |
| 109 | * Issue the command to VPP/HW |
| 110 | */ |
| 111 | rc_t issue(connection& con); |
| 112 | /** |
| 113 | * convert to string format for debug purposes |
| 114 | */ |
| 115 | std::string to_string() const; |
| 116 | |
| 117 | /** |
| 118 | * Comparison operator - only used for UT |
| 119 | */ |
| 120 | bool operator==(const dump_44_cmd& i) const; |
| 121 | |
| 122 | private: |
| 123 | /** |
| 124 | * HW reutrn code |
| 125 | */ |
| 126 | HW::item<bool> item; |
| 127 | }; |
| 128 | }; |
| 129 | }; |
| 130 | |
| 131 | #endif |