35 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 41 #define vl_api_version(n,v) static u32 api_version=(v); 45 #define REPLY_MSG_ID_BASE mm->msg_id_base 69 ntohs (mp->
mtu), flags);
74 rmp->
index = ntohl(index);
83 vl_api_map_del_domain_reply_t *rmp;
95 vl_api_map_del_domain_reply_t *rmp;
124 rmp = vl_msg_api_alloc (sizeof (*rmp));
125 rmp->_vl_msg_id = htons(VL_API_MAP_DOMAIN_DETAILS + mm->msg_id_base);
126 rmp->context = mp->context;
127 rmp->domain_index = htonl(d - mm->domains);
128 clib_memcpy(rmp->ip6_prefix, &d->ip6_prefix, sizeof(rmp->ip6_prefix));
129 clib_memcpy(rmp->ip4_prefix, &d->ip4_prefix, sizeof(rmp->ip4_prefix));
130 clib_memcpy(rmp->ip6_src, &d->ip6_src, sizeof(rmp->ip6_src));
131 rmp->ip6_prefix_len = d->ip6_prefix_len;
132 rmp->ip4_prefix_len = d->ip4_prefix_len;
133 rmp->ip6_src_len = d->ip6_src_len;
134 rmp->ea_bits_len = d->ea_bits_len;
135 rmp->psid_offset = d->psid_offset;
136 rmp->psid_length = d->psid_length;
137 rmp->flags = d->flags;
138 rmp->mtu = htons(d->mtu);
139 rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION);
141 vl_api_send_msg (reg, (u8 *) rmp);
178 memset (rmp, 0,
sizeof (*rmp));
179 rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->
msg_id_base);
180 rmp->
psid = htons (i);
204 rmp->_vl_msg_id = htons (VL_API_MAP_SUMMARY_STATS_REPLY + mm->
msg_id_base);
214 memset (total_pkts, 0,
sizeof (total_pkts));
215 memset (total_bytes, 0,
sizeof (total_bytes));
225 total_pkts[which] += v.
packets;
226 total_bytes[which] += v.
bytes;
236 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]);
240 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]);
254 #define foreach_map_plugin_api_msg \ 255 _(MAP_ADD_DOMAIN, map_add_domain) \ 256 _(MAP_DEL_DOMAIN, map_del_domain) \ 257 _(MAP_ADD_DEL_RULE, map_add_del_rule) \ 258 _(MAP_DOMAIN_DUMP, map_domain_dump) \ 259 _(MAP_RULE_DUMP, map_rule_dump) \ 260 _(MAP_SUMMARY_STATS, map_summary_stats) 262 #define vl_msg_name_crc_list 264 #undef vl_msg_name_crc_list 269 #define _(id,n,crc) \ 270 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + mm->msg_id_base); 271 foreach_vl_msg_name_crc_map;
280 u8 *name =
format (0,
"map_%08x%c", api_version, 0);
286 vl_msg_api_set_handlers((VL_API_##N + mm->msg_id_base), \ 288 vl_api_##n##_t_handler, \ 290 vl_api_##n##_t_endian, \ 291 vl_api_##n##_t_print, \ 292 sizeof(vl_api_##n##_t), 1);
Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber)
int map_delete_domain(u32 map_domain_index)
static void vl_api_map_domain_dump_t_handler(vl_api_map_domain_dump_t *mp)
#define REPLY_MACRO2(t, body)
u64 map_error_counter_get(u32 node_index, map_error_t map_error)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
static void map_domain_counter_unlock(map_main_t *mm)
Combined counter to hold both packets and byte differences.
u64 total_security_check[2]
vlib_node_registration_t ip4_map_node
(constructor) VLIB_REGISTER_NODE (ip4_map_node)
void * vl_msg_api_alloc(int nbytes)
static void vl_api_map_add_del_rule_t_handler(vl_api_map_add_del_rule_t *mp)
static void vl_api_map_summary_stats_t_handler(vl_api_map_summary_stats_t *mp)
static void vl_api_map_add_domain_t_handler(vl_api_map_add_domain_t *mp)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vlib_combined_counter_main_t * domain_counters
static void vl_api_map_del_domain_t_handler(vl_api_map_del_domain_t *mp)
int map_add_del_psid(u32 map_domain_index, u16 psid, ip6_address_t *tep, u8 is_add)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
counter_t packets
packet counter
clib_error_t * map_plugin_api_hookup(vlib_main_t *vm)
static void vl_api_map_rule_dump_t_handler(vl_api_map_rule_dump_t *mp)
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
static void setup_message_id_table(map_main_t *mm, api_main_t *am)
API main structure, used by both vpp and binary API clients.
An API client registration, only in vpp/vlib.
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
#define vec_free(V)
Free vector's memory (no header).
int map_create_domain(ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip6_address_t *ip6_src, u8 ip6_src_len, u8 ea_bits_len, u8 psid_offset, u8 psid_length, u32 *map_domain_index, u16 mtu, u8 flags)
#define clib_memcpy(a, b, c)
Reply for map_summary_stats request.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static void map_domain_counter_lock(map_main_t *mm)
Request for a single block of summary stats.
Reply for MAP domain add.
#define foreach_map_plugin_api_msg
counter_t bytes
byte counter
A collection of combined counters.
#define vec_foreach(var, vec)
Vector iterator.
u16 vl_msg_api_get_msg_ids(const char *name, int n)
static uword pool_elts(void *v)
Number of active elements in a pool.