22 singular_db<const nat_binding::key_t, nat_binding> nat_binding::m_db;
24 nat_binding::event_handler nat_binding::m_evh;
57 : m_binding(o.m_binding)
68 m_db.release(
key(),
this);
74 return (make_tuple(m_itf->key(), m_dir, m_proto));
80 return ((
key() == n.
key()) && (m_zone == n.m_zone));
89 m_binding, m_itf->handle(), m_zone));
92 m_binding, m_itf->handle(), m_zone));
104 m_binding, m_itf->handle(), m_zone));
107 m_binding, m_itf->handle(), m_zone));
121 m_binding, m_itf->handle(), m_zone));
124 m_binding, m_itf->handle(), m_zone));
132 std::ostringstream s;
133 s <<
"nat-binding:[" << m_itf->to_string()
135 <<
" zone:" << m_zone.
to_string() <<
"]";
140 std::shared_ptr<nat_binding>
143 return (m_db.find_or_add(temp.
key(), temp));
146 std::shared_ptr<nat_binding>
149 return (m_db.find(key));
152 std::shared_ptr<nat_binding>
155 return find_or_add(*
this);
167 os <<
"[" << std::get<0>(
key) <<
", " << std::get<1>(key) <<
", " 168 << std::get<2>(
key) <<
"]";
173 nat_binding::event_handler::event_handler()
180 nat_binding::event_handler::handle_replay()
188 std::shared_ptr<nat_binding_cmds::dump_input_44_cmd> icmd =
189 std::make_shared<nat_binding_cmds::dump_input_44_cmd>();
194 for (
auto& record : *icmd) {
195 auto& payload = record.get_payload();
203 std::shared_ptr<nat_binding_cmds::dump_output_44_cmd> ocmd =
204 std::make_shared<nat_binding_cmds::dump_output_44_cmd>();
209 for (
auto& record : *ocmd) {
210 auto& payload = record.get_payload();
220 nat_binding::event_handler::order()
const ~nat_binding()
Destructor.
static const zone_t OUTSIDE
Deny Zone.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
A template base class for all enum types.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.
A functor class that binds a NAT configuration to an output interface.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
static rc_t write()
Write/Execute all commands hitherto enqueued.
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route...
A Class representing the binding of an L2 interface to a bridge-domain and the properties of that bin...
static const direction_t INPUT
Permit Direction.
nat_binding(const interface &itf, const direction_t &dir, const l3_proto_t &proto, const zone_t &zone)
Construct a new object matching the desried state.
static const l3_proto_t IPV4
static const zone_t INSIDE
Permit Zone.
bool operator==(const nat_binding &n) const
Comparison operator - for UT.
const key_t key() const
Return the binding's key.
zone_t(int v, const std::string s)
Constructor.
static void dump(std::ostream &os)
Dump all nat_bindings into the stream provided.
A representation of an interface in VPP.
std::string to_string() const
convert to string format for debug purposes
std::shared_ptr< nat_binding > singular() const
Return the 'singular instance' of the L2 config that matches this object.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
static void enqueue(cmd *f)
Enqueue A command for execution.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
Then L2/objects that bind to interfaces, BD, ACLS, etc.
The VPP Object Model (VOM) library.
static std::shared_ptr< nat_binding > find(const key_t &key)
Static function to find the bridge_domain in the model.
static const direction_t OUTPUT
Deny Direction.
const std::string & to_string() const
convert to string format for debug purposes
std::tuple< interface::key_t, direction_t, l3_proto_t > key_t
The key for a NAT Binding.
A cmd class that unbinds a NAT configuration from an output interface.
static const zone_t & from_vpp(u8 is_inside)
static bool register_listener(listener *listener)
Register a listener of events.