|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
22 singular_db<const nat_binding::key_t, nat_binding> nat_binding::m_db;
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));
90 m_binding, m_itf->handle(), m_zone));
92 HW::enqueue(
new nat_binding_cmds::unbind_66_input_cmd(
93 m_binding, m_itf->handle(), m_zone));
97 HW::enqueue(
new nat_binding_cmds::unbind_44_output_cmd(
98 m_binding, m_itf->handle(), m_zone));
108 nat_binding::replay()
113 HW::enqueue(
new nat_binding_cmds::bind_44_input_cmd(
114 m_binding, m_itf->handle(), m_zone));
116 HW::enqueue(
new nat_binding_cmds::bind_66_input_cmd(
117 m_binding, m_itf->handle(), m_zone));
121 HW::enqueue(
new nat_binding_cmds::bind_44_output_cmd(
122 m_binding, m_itf->handle(), m_zone));
131 nat_binding::update(
const nat_binding& desired)
139 HW::enqueue(
new nat_binding_cmds::bind_44_input_cmd(
140 m_binding, m_itf->handle(), m_zone));
142 HW::enqueue(
new nat_binding_cmds::bind_66_input_cmd(
143 m_binding, m_itf->handle(), m_zone));
147 HW::enqueue(
new nat_binding_cmds::bind_44_output_cmd(
148 m_binding, m_itf->handle(), m_zone));
159 std::ostringstream s;
160 s <<
"nat-binding:[" << m_itf->to_string()
162 <<
" zone:" << m_zone.
to_string() <<
"]";
167 std::shared_ptr<nat_binding>
170 return (m_db.find_or_add(temp.
key(), temp));
173 std::shared_ptr<nat_binding>
176 return (m_db.find(
key));
179 std::shared_ptr<nat_binding>
182 return find_or_add(*
this);
194 os <<
"[" << std::get<0>(
key) <<
", " << std::get<1>(
key) <<
", "
195 << std::get<2>(
key) <<
"]";
207 nat_binding::event_handler::handle_replay()
215 std::shared_ptr<nat_binding_cmds::dump_input_44_cmd> icmd =
216 std::make_shared<nat_binding_cmds::dump_input_44_cmd>();
221 for (
auto& record : *icmd) {
222 auto& payload = record.get_payload();
232 << payload.sw_if_index;
236 std::shared_ptr<nat_binding_cmds::dump_output_44_cmd> ocmd =
237 std::make_shared<nat_binding_cmds::dump_output_44_cmd>();
242 for (
auto& record : *ocmd) {
243 auto& payload = record.get_payload();
252 << payload.sw_if_index;
256 std::shared_ptr<nat_binding_cmds::dump_input_66_cmd> i6cmd =
257 std::make_shared<nat_binding_cmds::dump_input_66_cmd>();
262 for (
auto& record : *i6cmd) {
263 auto& payload = record.get_payload();
272 << payload.sw_if_index;
278 nat_binding::event_handler::order()
const
static rc_t write()
Write/Execute all commands hitherto enqueued.
static void dump(std::ostream &os)
Dump all nat_bindings into the stream provided.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
The VPP Object Model (VOM) library.
const static zone_t OUTSIDE
Deny Zone.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
const static l3_proto_t IPV4
const static zone_t INSIDE
Permit Zone.
static std::shared_ptr< nat_binding > find(const key_t &key)
Static function to find the bridge_domain in the model.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
std::tuple< interface::key_t, direction_t, l3_proto_t > key_t
The key for a NAT Binding.
static bool register_listener(listener *listener)
Register a listener of events.
A Class representing the binding of an L2 interface to a bridge-domain and the properties of that bin...
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.
const static zone_t & from_vpp(u8 is_inside)
A template base class for all enum types.
~nat_binding()
Destructor.
const static direction_t OUTPUT
Deny Direction.
A representation of an interface in VPP.
const typedef std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
const static direction_t INPUT
Permit Direction.
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)
const std::string & to_string() const
convert to string format for debug purposes
zone_t(int v, const std::string s)
Constructor.
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route.
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.
bool operator==(const nat_binding &n) const
Comparison operator - for UT.
const key_t key() const
Return the binding's key.
@ BINDING
Then L2/objects that bind to interfaces, BD, ACLS, etc.
void event_handler(void *tls_async)
const static log_level_t ERROR
const static l3_proto_t IPV6
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.