20 singular_db<nat_static::key_t, nat_static> nat_static::m_db;
21 nat_static::event_handler nat_static::m_evh;
24 const boost::asio::ip::address_v4& outside)
33 const boost::asio::ip::address& inside,
34 const boost::asio::ip::address_v4& outside)
45 , m_inside(ns.m_inside)
46 , m_outside(ns.m_outside)
55 m_db.release(
key(),
this);
61 return (std::make_pair(m_rd->key(), m_outside));
67 return ((
key() == n.
key()) && (m_inside == n.m_inside));
74 if (m_inside.is_v4()) {
76 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
86 if (m_inside.is_v4()) {
88 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
100 if (m_inside.is_v4()) {
102 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
110 std::ostringstream s;
112 <<
"table:" << m_rd->to_string() <<
" inside:" << m_inside.to_string()
113 <<
" outside:" << m_outside.to_string() <<
"]";
118 std::shared_ptr<nat_static>
119 nat_static::find_or_add(
const nat_static& temp)
121 return (m_db.find_or_add(temp.
key(), temp));
124 std::shared_ptr<nat_static>
127 return (m_db.find(key));
130 std::shared_ptr<nat_static>
133 return find_or_add(*
this);
145 os <<
"[" << key.first <<
", " << key.second <<
"]";
150 nat_static::event_handler::event_handler()
157 nat_static::event_handler::handle_replay()
168 std::shared_ptr<nat_static_cmds::dump_44_cmd>
cmd =
169 std::make_shared<nat_static_cmds::dump_44_cmd>();
174 for (
auto& record : *cmd) {
176 auto& payload = record.get_payload();
178 boost::asio::ip::address inside =
from_bytes(0, payload.local_ip_address);
179 boost::asio::ip::address outside =
193 nat_static::event_handler::order()
const A cmd class that deletes a NAT 44 static mapping.
void replay(void)
replay the object to create it in hardware
std::shared_ptr< nat_static > singular() const
Return the matching 'singular instance'.
A command class that creates NAT 44 static mapping.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
std::string to_string() const
Convert to string for debugging.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
rc_t rc() const
Get the HW return code.
A entry in the ARP termination table of a Bridge Domain.
nat_static(const boost::asio::ip::address &inside, const boost::asio::ip::address_v4 &outside)
Construct an NAT Static binding with the outside address in default table.
std::pair< route::table_id_t, boost::asio::ip::address > key_t
The key for a NAT static mapping.
boost::asio::ip::address from_bytes(uint8_t is_ip6, uint8_t *bytes)
Convert a VPP byte stinrg into a boost addresss.
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 const rc_t OK
The HW write was successfull.
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)
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
static std::shared_ptr< nat_static > find(const key_t &key)
Find the instnace of the bridge_domain domain in the OM.
bool operator==(const nat_static &n) const
Comparison operator - for UT.
const key_t key() const
Return the object's key.
static bool register_listener(listener *listener)
Register a listener of events.