38 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 45 #define foreach_vpe_api_msg \ 46 _(MAP_ADD_DOMAIN, map_add_domain) \ 47 _(MAP_DEL_DOMAIN, map_del_domain) \ 48 _(MAP_ADD_DEL_RULE, map_add_del_rule) \ 49 _(MAP_DOMAIN_DUMP, map_domain_dump) \ 50 _(MAP_RULE_DUMP, map_rule_dump) \ 51 _(MAP_SUMMARY_STATS, map_summary_stats) 73 ntohs (mp->
mtu), flags);
78 rmp->
index = ntohl(index);
86 vl_api_map_del_domain_reply_t *rmp;
97 vl_api_map_del_domain_reply_t *rmp;
126 rmp = vl_msg_api_alloc (sizeof (*rmp));
127 rmp->_vl_msg_id = ntohs(VL_API_MAP_DOMAIN_DETAILS);
128 rmp->domain_index = htonl(d - mm->domains);
129 rmp->ea_bits_len = d->ea_bits_len;
130 rmp->psid_offset = d->psid_offset;
131 rmp->psid_length = d->psid_length;
132 clib_memcpy(rmp->ip4_prefix, &d->ip4_prefix, sizeof(rmp->ip4_prefix));
133 rmp->ip4_prefix_len = d->ip4_prefix_len;
134 clib_memcpy(rmp->ip6_prefix, &d->ip6_prefix, sizeof(rmp->ip6_prefix));
135 rmp->ip6_prefix_len = d->ip6_prefix_len;
136 clib_memcpy(rmp->ip6_src, &d->ip6_src, sizeof(rmp->ip6_src));
137 rmp->ip6_src_len = d->ip6_src_len;
138 rmp->mtu = htons(d->mtu);
139 rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION);
140 rmp->context = mp->context;
142 vl_api_send_msg (reg, (u8 *)&rmp);
179 memset (rmp, 0,
sizeof (*rmp));
180 rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS);
181 rmp->
psid = htons (i);
205 rmp->_vl_msg_id = ntohs (VL_API_MAP_SUMMARY_STATS_REPLY);
215 memset (total_pkts, 0,
sizeof (total_pkts));
216 memset (total_bytes, 0,
sizeof (total_bytes));
226 total_pkts[which] += v.
packets;
227 total_bytes[which] += v.
bytes;
237 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]);
241 clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]);
262 #define vl_msg_name_crc_list 264 #undef vl_msg_name_crc_list 269 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 270 foreach_vl_msg_name_crc_map;
280 vl_msg_api_set_handlers(VL_API_##N, #n, \ 281 vl_api_##n##_t_handler, \ 283 vl_api_##n##_t_endian, \ 284 vl_api_##n##_t_print, \ 285 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 foreach_vpe_api_msg
#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)
static void setup_message_id_table(api_main_t *am)
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)
VLIB_API_INIT_FUNCTION(map_api_hookup)
#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
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 clib_error_t * map_api_hookup(vlib_main_t *vm)
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...
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.
counter_t bytes
byte counter
A collection of combined counters.
#define vec_foreach(var, vec)
Vector iterator.
static uword pool_elts(void *v)
Number of active elements in a pool.