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
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.
std::string to_string() const
Convert to string for debugging.
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.
rc_t rc() const
Get the HW return code.
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
A entry in the ARP termination table of a Bridge Domain.
bool operator==(const nat_static &n) const
Comparison operator - for UT.
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.
std::shared_ptr< nat_static > singular() const
Return the matching 'singular instance'.
const key_t key() const
Return the object's key.
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.
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.
boost::asio::ip::address from_bytes(uint8_t is_ip6, const uint8_t *bytes)
Convert a VPP byte stinrg into a boost addresss.
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.
A command class that creates NAT 66 static mapping.
static bool register_listener(listener *listener)
Register a listener of events.