+always_inline void
+nat44_ei_port_get (nat44_ei_address_t *a, u8 proto, u16 port)
+{
+ nat44_ei_main_t *nm = &nat44_ei_main;
+
+#define _(N, i, n, s) \
+ case NAT_PROTOCOL_##N: \
+ a->busy_##n##_port_bitmap = \
+ clib_bitmap_set (a->busy_##n##_port_bitmap, port, 1); \
+ break;
+
+ switch (proto)
+ {
+ foreach_nat_protocol;
+ default:
+ nat_elog_info (nm, "unknown protocol");
+ }
+
+#undef _
+}
+
+always_inline void
+nat44_ei_port_put (nat44_ei_address_t *a, u8 proto, u16 port)
+{
+ nat44_ei_main_t *nm = &nat44_ei_main;
+
+#define _(N, i, n, s) \
+ case NAT_PROTOCOL_##N: \
+ a->busy_##n##_port_bitmap = \
+ clib_bitmap_set (a->busy_##n##_port_bitmap, port, 0); \
+ break;
+
+ switch (proto)
+ {
+ foreach_nat_protocol;
+ default:
+ nat_elog_info (nm, "unknown protocol");
+ }
+
+#undef _
+}
+
+always_inline bool
+nat44_ei_port_is_used (nat44_ei_address_t *a, u8 proto, u16 port)
+{
+ nat44_ei_main_t *nm = &nat44_ei_main;
+
+#define _(N, i, n, s) \
+ case NAT_PROTOCOL_##N: \
+ return clib_bitmap_get (a->busy_##n##_port_bitmap, port);
+
+ switch (proto)
+ {
+ foreach_nat_protocol;
+ default:
+ nat_elog_info (nm, "unknown protocol");
+ }
+
+#undef _
+
+ return 0;
+}
+