diff options
author | Ole Troan <ot@cisco.com> | 2016-12-06 12:50:08 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-12-06 13:59:10 +0000 |
commit | f0c90e20f7e407209ed723b0c448ea29950b747e (patch) | |
tree | f0fcaa214612ecd3ee833a639a232744b01b83e8 /vpp/vpp-api | |
parent | dbb3c25374fc5735c57960465bcc10278b147e5a (diff) |
MAP: Split MAP API out of vpe.api.
Change-Id: I91a612a00ea85a9ddd4233d9aa19a6a4332d9701
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'vpp/vpp-api')
-rw-r--r-- | vpp/vpp-api/api.c | 198 | ||||
-rw-r--r-- | vpp/vpp-api/vpe.api | 163 |
2 files changed, 0 insertions, 361 deletions
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index c0facc0d..4a3ec06d 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -239,12 +239,6 @@ _(IKEV2_PROFILE_SET_TS, ikev2_profile_set_ts) \ _(IKEV2_SET_LOCAL_KEY, ikev2_set_local_key) \ _(DELETE_LOOPBACK, delete_loopback) \ _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ -_(MAP_ADD_DOMAIN, map_add_domain) \ -_(MAP_DEL_DOMAIN, map_del_domain) \ -_(MAP_ADD_DEL_RULE, map_add_del_rule) \ -_(MAP_DOMAIN_DUMP, map_domain_dump) \ -_(MAP_RULE_DUMP, map_rule_dump) \ -_(MAP_SUMMARY_STATS, map_summary_stats) \ _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \ _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \ _(GET_NODE_GRAPH, get_node_graph) \ @@ -6181,198 +6175,6 @@ vl_api_ikev2_set_local_key_t_handler (vl_api_ikev2_set_local_key_t * mp) } static void -vl_api_map_add_domain_t_handler (vl_api_map_add_domain_t * mp) -{ - vl_api_map_add_domain_reply_t *rmp; - int rv = 0; - u32 index; - u8 flags = mp->is_translation ? MAP_DOMAIN_TRANSLATION : 0; - rv = - map_create_domain ((ip4_address_t *) & mp->ip4_prefix, mp->ip4_prefix_len, - (ip6_address_t *) & mp->ip6_prefix, mp->ip6_prefix_len, - (ip6_address_t *) & mp->ip6_src, - mp->ip6_src_prefix_len, mp->ea_bits_len, - mp->psid_offset, mp->psid_length, &index, - ntohs (mp->mtu), flags); - - /* *INDENT-OFF* */ - REPLY_MACRO2(VL_API_MAP_ADD_DOMAIN_REPLY, - ({ - rmp->index = ntohl(index); - })); - /* *INDENT-ON* */ -} - -static void -vl_api_map_del_domain_t_handler (vl_api_map_del_domain_t * mp) -{ - vl_api_map_del_domain_reply_t *rmp; - int rv = 0; - - rv = map_delete_domain (ntohl (mp->index)); - - REPLY_MACRO (VL_API_MAP_DEL_DOMAIN_REPLY); -} - -static void -vl_api_map_add_del_rule_t_handler (vl_api_map_add_del_rule_t * mp) -{ - vl_api_map_del_domain_reply_t *rmp; - int rv = 0; - - rv = - map_add_del_psid (ntohl (mp->index), ntohs (mp->psid), - (ip6_address_t *) mp->ip6_dst, mp->is_add); - - REPLY_MACRO (VL_API_MAP_ADD_DEL_RULE_REPLY); -} - -static void -vl_api_map_domain_dump_t_handler (vl_api_map_domain_dump_t * mp) -{ - vl_api_map_domain_details_t *rmp; - map_main_t *mm = &map_main; - map_domain_t *d; - unix_shared_memory_queue_t *q; - - if (pool_elts (mm->domains) == 0) - return; - - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - - /* *INDENT-OFF* */ - pool_foreach(d, mm->domains, - ({ - /* Make sure every field is initiated (or don't skip the memset()) */ - rmp = vl_msg_api_alloc (sizeof (*rmp)); - rmp->_vl_msg_id = ntohs(VL_API_MAP_DOMAIN_DETAILS); - rmp->domain_index = htonl(d - mm->domains); - rmp->ea_bits_len = d->ea_bits_len; - rmp->psid_offset = d->psid_offset; - rmp->psid_length = d->psid_length; - clib_memcpy(rmp->ip4_prefix, &d->ip4_prefix, sizeof(rmp->ip4_prefix)); - rmp->ip4_prefix_len = d->ip4_prefix_len; - clib_memcpy(rmp->ip6_prefix, &d->ip6_prefix, sizeof(rmp->ip6_prefix)); - rmp->ip6_prefix_len = d->ip6_prefix_len; - clib_memcpy(rmp->ip6_src, &d->ip6_src, sizeof(rmp->ip6_src)); - rmp->ip6_src_len = d->ip6_src_len; - rmp->mtu = htons(d->mtu); - rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION); - rmp->context = mp->context; - - vl_msg_api_send_shmem (q, (u8 *)&rmp); - })); - /* *INDENT-ON* */ -} - -static void -vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp) -{ - unix_shared_memory_queue_t *q; - u16 i; - ip6_address_t dst; - vl_api_map_rule_details_t *rmp; - map_main_t *mm = &map_main; - u32 domain_index = ntohl (mp->domain_index); - map_domain_t *d; - - if (pool_elts (mm->domains) == 0) - return; - - d = pool_elt_at_index (mm->domains, domain_index); - if (!d || !d->rules) - { - return; - } - - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - - for (i = 0; i < (0x1 << d->psid_length); i++) - { - dst = d->rules[i]; - if (dst.as_u64[0] == 0 && dst.as_u64[1] == 0) - { - continue; - } - rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS); - rmp->psid = htons (i); - clib_memcpy (rmp->ip6_dst, &dst, sizeof (rmp->ip6_dst)); - rmp->context = mp->context; - vl_msg_api_send_shmem (q, (u8 *) & rmp); - } -} - -static void -vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp) -{ - vl_api_map_summary_stats_reply_t *rmp; - vlib_combined_counter_main_t *cm; - vlib_counter_t v; - int i, which; - u64 total_pkts[VLIB_N_RX_TX]; - u64 total_bytes[VLIB_N_RX_TX]; - map_main_t *mm = &map_main; - unix_shared_memory_queue_t *q = - vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) - return; - - rmp = vl_msg_api_alloc (sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_MAP_SUMMARY_STATS_REPLY); - rmp->context = mp->context; - rmp->retval = 0; - - memset (total_pkts, 0, sizeof (total_pkts)); - memset (total_bytes, 0, sizeof (total_bytes)); - - map_domain_counter_lock (mm); - vec_foreach (cm, mm->domain_counters) - { - which = cm - mm->domain_counters; - - for (i = 0; i < vec_len (cm->maxi); i++) - { - vlib_get_combined_counter (cm, i, &v); - total_pkts[which] += v.packets; - total_bytes[which] += v.bytes; - } - } - - map_domain_counter_unlock (mm); - - /* Note: in network byte order! */ - rmp->total_pkts[MAP_DOMAIN_COUNTER_RX] = - clib_host_to_net_u64 (total_pkts[MAP_DOMAIN_COUNTER_RX]); - rmp->total_bytes[MAP_DOMAIN_COUNTER_RX] = - clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_RX]); - rmp->total_pkts[MAP_DOMAIN_COUNTER_TX] = - clib_host_to_net_u64 (total_pkts[MAP_DOMAIN_COUNTER_TX]); - rmp->total_bytes[MAP_DOMAIN_COUNTER_TX] = - clib_host_to_net_u64 (total_bytes[MAP_DOMAIN_COUNTER_TX]); - rmp->total_bindings = clib_host_to_net_u64 (pool_elts (mm->domains)); - rmp->total_ip4_fragments = 0; // Not yet implemented. Should be a simple counter. - rmp->total_security_check[MAP_DOMAIN_COUNTER_TX] = - clib_host_to_net_u64 (map_error_counter_get - (ip4_map_node.index, MAP_ERROR_ENCAP_SEC_CHECK)); - rmp->total_security_check[MAP_DOMAIN_COUNTER_RX] = - clib_host_to_net_u64 (map_error_counter_get - (ip4_map_node.index, MAP_ERROR_DECAP_SEC_CHECK)); - - vl_msg_api_send_shmem (q, (u8 *) & rmp); -} - -static void vl_api_ipsec_sa_set_key_t_handler (vl_api_ipsec_sa_set_key_t * mp) { vlib_main_t *vm __attribute__ ((unused)) = vlib_get_main (); diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api index cc444ba7..487ce3aa 100644 --- a/vpp/vpp-api/vpe.api +++ b/vpp/vpp-api/vpe.api @@ -3877,169 +3877,6 @@ define dhcp_compl_event u8 host_mac[6]; }; -/** \brief Add MAP domains - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request - @param ip6_prefix - Rule IPv6 prefix - @param ip4_prefix - Rule IPv4 prefix - @param ip6_src - MAP domain IPv6 BR address / Tunnel source - @param ip6_prefix_len - Rule IPv6 prefix length - @param ip4_prefix_len - Rule IPv4 prefix length - @param ea_bits_len - Embedded Address bits length - @param psid_offset - Port Set Identifider (PSID) offset - @param psid_length - PSID length - @param is_translation - MAP-E / MAP-T - @param mtu - MTU -*/ -define map_add_domain -{ - u32 client_index; - u32 context; - u8 ip6_prefix[16]; - u8 ip4_prefix[4]; - u8 ip6_src[16]; - u8 ip6_prefix_len; - u8 ip4_prefix_len; - u8 ip6_src_prefix_len; - u8 ea_bits_len; - u8 psid_offset; - u8 psid_length; - u8 is_translation; - u16 mtu; -}; - -/** \brief Reply for MAP domain add - @param context - returned sender context, to match reply w/ request - @param index - MAP domain index - @param retval - return code -*/ -define map_add_domain_reply -{ - u32 context; - u32 index; - i32 retval; -}; - -/** \brief Delete MAP domain - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request - @param index - MAP Domain index -*/ -define map_del_domain -{ - u32 client_index; - u32 context; - u32 index; -}; - -/** \brief Reply for MAP domain del - @param context - returned sender context, to match reply w/ request - @param retval - return code -*/ -define map_del_domain_reply -{ - u32 context; - i32 retval; -}; - -/** \brief Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber) - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request - @param index - MAP Domain index - @param is_add - If 1 add rule, if 0 delete rule - @param ip6_dst - MAP CE IPv6 address - @param psid - Rule PSID -*/ -define map_add_del_rule -{ - u32 client_index; - u32 context; - u32 index; - u32 is_add; - u8 ip6_dst[16]; - u16 psid; -}; - -/** \brief Reply for MAP rule add/del - @param context - returned sender context, to match reply w/ request - @param retval - return code -*/ -define map_add_del_rule_reply -{ - u32 context; - i32 retval; -}; - -/** \brief Get list of map domains - @param client_index - opaque cookie to identify the sender -*/ -define map_domain_dump -{ - u32 client_index; - u32 context; -}; - -define map_domain_details -{ - u32 context; - u32 domain_index; - u8 ip6_prefix[16]; - u8 ip4_prefix[4]; - u8 ip6_src[16]; - u8 ip6_prefix_len; - u8 ip4_prefix_len; - u8 ip6_src_len; - u8 ea_bits_len; - u8 psid_offset; - u8 psid_length; - u8 flags; - u16 mtu; - u8 is_translation; -}; - -define map_rule_dump -{ - u32 client_index; - u32 context; - u32 domain_index; -}; - -define map_rule_details -{ - u32 context; - u8 ip6_dst[16]; - u16 psid; -}; - -/** \brief Request for a single block of summary stats - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request -*/ -define map_summary_stats -{ - u32 client_index; - u32 context; -}; - -/** \brief Reply for map_summary_stats request - @param context - sender context, to match reply w/ request - @param retval - return code for request - @param total_bindings - - @param total_pkts - - @param total_ip4_fragments - - @param total_security_check - -*/ -define map_summary_stats_reply -{ - u32 context; - i32 retval; - u64 total_bindings; - u64 total_pkts[2]; - u64 total_bytes[2]; - u64 total_ip4_fragments; - u64 total_security_check[2]; -}; - /** \brief cop: enable/disable junk filtration features on an interface @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request |