21 singular_db<nat_static::key_t, nat_static> nat_static::m_db;
46 , m_inside(ns.m_inside)
47 , m_outside(ns.m_outside)
56 m_db.release(
key(),
this);
62 return (std::make_pair(m_rd->key(), m_outside));
68 return ((
key() == n.
key()) && (m_inside == n.m_inside));
75 if (m_inside.is_v4()) {
77 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside.to_v4()));
80 m_hw, m_rd->table_id(), m_inside.to_v6(), m_outside.to_v6()));
90 if (m_inside.is_v4()) {
92 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside.to_v4()));
95 m_hw, m_rd->table_id(), m_inside.to_v6(), m_outside.to_v6()));
107 if (m_inside.is_v4()) {
109 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside.to_v4()));
112 m_hw, m_rd->table_id(), m_inside.to_v6(), m_outside.to_v6()));
120 std::ostringstream s;
122 <<
"table:" << m_rd->to_string() <<
" inside:" << m_inside.to_string()
123 <<
" outside:" << m_outside.to_string() <<
"]";
128 std::shared_ptr<nat_static>
129 nat_static::find_or_add(
const nat_static& temp)
131 return (m_db.find_or_add(temp.
key(), temp));
134 std::shared_ptr<nat_static>
137 return (m_db.find(key));
140 std::shared_ptr<nat_static>
143 return find_or_add(*
this);
159 nat_static::event_handler::handle_replay()
170 std::shared_ptr<nat_static_cmds::dump_44_cmd> cmd44 =
171 std::make_shared<nat_static_cmds::dump_44_cmd>();
176 for (
auto& record : *cmd44) {
178 auto& payload = record.get_payload();
193 std::shared_ptr<nat_static_cmds::dump_66_cmd> cmd66 =
194 std::make_shared<nat_static_cmds::dump_66_cmd>();
199 for (
auto& record : *cmd66) {
201 auto& payload = record.get_payload();
218 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'.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
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 &outside)
Construct an NAT Static binding with the outside address in default table.
A cmd class that deletes a NAT 66 static mapping.
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.
void event_handler(void *tls_async)
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.
The VPP Object Model (VOM) library.
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.
A command class that creates NAT 66 static mapping.
const key_t key() const
Return the object's key.
static bool register_listener(listener *listener)
Register a listener of events.