diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-08-07 00:05:59 -0400 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-08-20 13:35:21 +0000 |
commit | e71748291171e53158e2d36d8f413fed1a137013 (patch) | |
tree | 2cd4c20efd3fd75e3e180ae39fd2ab400c406d75 | |
parent | 630ab5846bceddf8d663e9f488a2dc0378949827 (diff) |
vppapigen: remove support for legacy typedefs
vppapigen has remapped legacy to typedefs behind the scenes
for some time now.
- update .api files to use new style typedefs.
- issue error on 'typeonly define' in .api files
- remove unneeded macros redefining vl_noop_handler
Type: refactor
Change-Id: I7a8c4a6dafacee6a131f95cd0e9b03a8c60dea8b
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
27 files changed, 53 insertions, 120 deletions
diff --git a/src/plugins/abf/abf.api b/src/plugins/abf/abf.api index 03044ad5a6b..72f4b37ce8e 100644 --- a/src/plugins/abf/abf.api +++ b/src/plugins/abf/abf.api @@ -51,7 +51,7 @@ define abf_plugin_get_version_reply @param n_paths Number of paths @param paths The set of forwarding paths that are being added or removed. */ -typeonly define abf_policy +typedef abf_policy { u32 policy_id; u32 acl_index; @@ -96,7 +96,7 @@ define abf_policy_dump on this interface. lower value is 'better' @param is_ipv6 Does this attachment apply to IPv6 packets (or IPv4) */ -typeonly define abf_itf_attach +typedef abf_itf_attach { u32 policy_id; u32 sw_if_index; diff --git a/src/plugins/acl/acl_types.api b/src/plugins/acl/acl_types.api index a47c9b3668c..fb58f8851c8 100644 --- a/src/plugins/acl/acl_types.api +++ b/src/plugins/acl/acl_types.api @@ -32,7 +32,7 @@ @param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with */ -typeonly manual_print define acl_rule +typedef acl_rule { u8 is_permit; u8 is_ipv6; @@ -77,7 +77,7 @@ typeonly manual_print define acl_rule @param src_ip_prefix_len - Source prefix length */ -typeonly manual_print define macip_acl_rule +typedef macip_acl_rule { u8 is_permit; u8 is_ipv6; diff --git a/src/plugins/acl/manual_fns.h b/src/plugins/acl/manual_fns.h index c592f892272..bc0ad92f3f1 100644 --- a/src/plugins/acl/manual_fns.h +++ b/src/plugins/acl/manual_fns.h @@ -121,61 +121,6 @@ format_acl_action(u8 *s, u8 action) } static inline void * -vl_api_acl_rule_t_print (vl_api_acl_rule_t * a, void *handle) -{ - u8 *s; - - s = format (0, " %s ", a->is_ipv6 ? "ipv6" : "ipv4"); - s = format_acl_action (s, a->is_permit); - s = format (s, " \\\n"); - - if (a->is_ipv6) - s = format (s, " src %U/%d dst %U/%d \\\n", - format_ip6_address, a->src_ip_addr, a->src_ip_prefix_len, - format_ip6_address, a->dst_ip_addr, a->dst_ip_prefix_len); - else - s = format (s, " src %U/%d dst %U/%d \\\n", - format_ip4_address, a->src_ip_addr, a->src_ip_prefix_len, - format_ip4_address, a->dst_ip_addr, a->dst_ip_prefix_len); - s = format (s, " proto %d \\\n", a->proto); - s = format (s, " sport %d-%d dport %d-%d \\\n", - clib_net_to_host_u16 (a->srcport_or_icmptype_first), - clib_net_to_host_u16 (a->srcport_or_icmptype_last), - clib_net_to_host_u16 (a->dstport_or_icmpcode_first), - clib_net_to_host_u16 (a->dstport_or_icmpcode_last)); - - s = format (s, " tcpflags %u mask %u, \\", - a->tcp_flags_value, a->tcp_flags_mask); - PRINT_S; - return handle; -} - - - -static inline void * -vl_api_macip_acl_rule_t_print (vl_api_macip_acl_rule_t * a, void *handle) -{ - u8 *s; - - s = format (0, " %s %s \\\n", a->is_ipv6 ? "ipv6" : "ipv4", - a->is_permit ? "permit" : "deny"); - - s = format (s, " src mac %U mask %U \\\n", - format_ethernet_address, a->src_mac, - format_ethernet_address, a->src_mac_mask); - - if (a->is_ipv6) - s = format (s, " src ip %U/%d, \\", - format_ip6_address, a->src_ip_addr, a->src_ip_prefix_len); - else - s = format (s, " src ip %U/%d, \\", - format_ip4_address, a->src_ip_addr, a->src_ip_prefix_len); - - PRINT_S; - return handle; -} - -static inline void * vl_api_acl_add_replace_t_print (vl_api_acl_add_replace_t * a, void *handle) { u8 *s = 0; diff --git a/src/plugins/gbp/gbp.api b/src/plugins/gbp/gbp.api index 99be9c4f777..60c996583b6 100644 --- a/src/plugins/gbp/gbp.api +++ b/src/plugins/gbp/gbp.api @@ -167,7 +167,7 @@ typedef gbp_endpoint_retention u32 remote_ep_timeout; }; -typeonly define gbp_endpoint_group +typedef gbp_endpoint_group { u32 vnid; u16 sclass; @@ -202,7 +202,7 @@ define gbp_endpoint_group_details vl_api_gbp_endpoint_group_t epg; }; -typeonly define gbp_recirc +typedef gbp_recirc { u32 sw_if_index; u16 sclass; @@ -238,7 +238,7 @@ enum gbp_subnet_type GBP_API_SUBNET_ANON_L3_OUT, }; -typeonly define gbp_subnet +typedef gbp_subnet { u32 rd_id; u32 sw_if_index; @@ -399,7 +399,7 @@ enum gbp_ext_itf_flags GBP_API_EXT_ITF_F_ANON = 1, }; -typeonly define gbp_ext_itf +typedef gbp_ext_itf { u32 sw_if_index; u32 bd_id; diff --git a/src/plugins/igmp/igmp.api b/src/plugins/igmp/igmp.api index b061c5e1a35..bc98711dd66 100644 --- a/src/plugins/igmp/igmp.api +++ b/src/plugins/igmp/igmp.api @@ -61,7 +61,7 @@ enum filter_mode { * @param saddr - source address * @param gaddr - group address */ -typeonly define igmp_group +typedef igmp_group { vl_api_filter_mode_t filter; u8 n_srcs; diff --git a/src/plugins/l3xc/l3xc.api b/src/plugins/l3xc/l3xc.api index 512bedab778..8e37674e964 100644 --- a/src/plugins/l3xc/l3xc.api +++ b/src/plugins/l3xc/l3xc.api @@ -50,7 +50,7 @@ define l3xc_plugin_get_version_reply @param n_paths Number of paths @param paths The set of forwarding paths. */ -typeonly define l3xc +typedef l3xc { u32 sw_if_index; u8 is_ip6; diff --git a/src/plugins/lb/lb_types.api b/src/plugins/lb/lb_types.api index 818e51462c5..e01db5dd16c 100644 --- a/src/plugins/lb/lb_types.api +++ b/src/plugins/lb/lb_types.api @@ -65,7 +65,7 @@ enum lb_nat_protocol @param protocol - tcp or udp. @param port - destination port. */ -typeonly define lb_vip +typedef lb_vip { vl_api_prefix_t pfx; vl_api_ip_proto_t protocol; diff --git a/src/plugins/mactime/mactime.api b/src/plugins/mactime/mactime.api index 3ba6464ec43..5d5731bc75b 100644 --- a/src/plugins/mactime/mactime.api +++ b/src/plugins/mactime/mactime.api @@ -34,7 +34,7 @@ autoreply define mactime_enable_disable * times are in double-precision fp seconds since 1/1/1970, * which was a Thursday. */ -typeonly define time_range +typedef time_range { f64 start; /**< start of the time range */ f64 end; /**< end of the time range */ diff --git a/src/plugins/nat/nat.api b/src/plugins/nat/nat.api index b5057ce1d3c..bd880a6498d 100644 --- a/src/plugins/nat/nat.api +++ b/src/plugins/nat/nat.api @@ -893,7 +893,7 @@ define nat44_user_session_details { @param probability - probability of the internal node to be randomly matched @param vrf_id - VRF id */ -typeonly manual_endian define nat44_lb_addr_port { +typedef nat44_lb_addr_port { vl_api_ip4_address_t addr; u16 port; u8 probability; diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c index ff11a82f099..5eaf7672914 100644 --- a/src/plugins/nat/nat_api.c +++ b/src/plugins/nat/nat_api.c @@ -33,7 +33,6 @@ #include <vnet/fib/fib_table.h> #include <vnet/ip/ip_types_api.h> -#define vl_api_nat44_lb_addr_port_t_endian vl_noop_handler #define vl_api_nat44_add_del_lb_static_mapping_t_endian vl_noop_handler #define vl_api_nat44_nat44_lb_static_mapping_details_t_endian vl_noop_handler diff --git a/src/plugins/vmxnet3/vmxnet3.api b/src/plugins/vmxnet3/vmxnet3.api index 7408836af7b..8c3597bd6a0 100644 --- a/src/plugins/vmxnet3/vmxnet3.api +++ b/src/plugins/vmxnet3/vmxnet3.api @@ -80,7 +80,7 @@ autoreply define vmxnet3_delete @param tx_consume - tx consume index */ -typeonly define vmxnet3_tx_list +typedef vmxnet3_tx_list { u16 tx_qsize; u16 tx_next; @@ -96,7 +96,7 @@ typeonly define vmxnet3_tx_list @param rx_consume - rx consume index */ -typeonly define vmxnet3_rx_list +typedef vmxnet3_rx_list { u16 rx_qsize; u16 rx_fill[2]; diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py index 80097a10a62..c01fa40c169 100755 --- a/src/tools/vppapigen/vppapigen.py +++ b/src/tools/vppapigen/vppapigen.py @@ -450,7 +450,9 @@ class VPPAPIParser(object): '''define : flist DEFINE ID '{' block_statements_opt '}' ';' ''' # Legacy typedef if 'typeonly' in p[1]: - p[0] = Typedef(p[3], p[1], p[5]) + self._parse_error('legacy typedef. use typedef: {} {}[{}];' + .format(p[1], p[2], p[4]), + self._token_coord(p, 1)) else: p[0] = Define(p[3], p[1], p[5]) diff --git a/src/vlibmemory/memclnt.api b/src/vlibmemory/memclnt.api index 4802732a07b..2f1e2daa4b6 100644 --- a/src/vlibmemory/memclnt.api +++ b/src/vlibmemory/memclnt.api @@ -114,7 +114,7 @@ define get_first_msg_id_reply { /* * Get API version table (includes built-in and plugins) */ -typeonly define module_version { +typedef module_version { u32 major; u32 minor; u32 patch; diff --git a/src/vnet/bier/bier.api b/src/vnet/bier/bier.api index 0cc56cab50a..30b0478a4a3 100644 --- a/src/vnet/bier/bier.api +++ b/src/vnet/bier/bier.api @@ -27,7 +27,7 @@ import "vnet/fib/fib_types.api"; @param bt_sub_domain - the sud-domain @param bt_bit_header_length - the number of bits in the header length */ -typeonly define bier_table_id +typedef bier_table_id { u8 bt_set; u8 bt_sub_domain; diff --git a/src/vnet/dhcp/dhcp.api b/src/vnet/dhcp/dhcp.api index 6db9033a7f4..c84b3639103 100644 --- a/src/vnet/dhcp/dhcp.api +++ b/src/vnet/dhcp/dhcp.api @@ -75,7 +75,7 @@ autoreply define dhcp_proxy_set_vss @param dscp - DSCP value set in IP packets sent by the client @param pid - sender's pid */ -typeonly define dhcp_client +typedef dhcp_client { u32 sw_if_index; u8 hostname[64]; @@ -103,7 +103,7 @@ autoreply define dhcp_client_config /** \brief Struct representing domain server @param address - IP address */ -typeonly manual_print manual_endian define domain_server +typedef domain_server { u8 address[16]; }; @@ -117,7 +117,7 @@ typeonly manual_print manual_endian define domain_server @param router_address - Router IP address @param host_mac - Host MAC address */ -typeonly define dhcp_lease +typedef dhcp_lease { u32 sw_if_index; u8 state; @@ -177,7 +177,7 @@ define dhcp_proxy_dump u8 is_ip6; }; -typeonly manual_print manual_endian define dhcp_server +typedef dhcp_server { u32 server_vrf_id; u8 dhcp_server[16]; @@ -228,7 +228,7 @@ autoreply define dhcp6_clients_enable_disable @param valid_time - valid lifetime @param preferred_time - preferred lifetime */ -typeonly define dhcp6_address_info +typedef dhcp6_address_info { u8 address[16]; u32 valid_time; @@ -241,7 +241,7 @@ typeonly define dhcp6_address_info @param valid_time - valid lifetime @param preferred_time - preferred lifetime */ -typeonly define dhcp6_pd_prefix_info +typedef dhcp6_pd_prefix_info { u8 prefix[16]; u8 prefix_length; diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api index 2dae4385602..67cdf9377b3 100644 --- a/src/vnet/ip/ip.api +++ b/src/vnet/ip/ip.api @@ -35,7 +35,7 @@ import "vnet/mfib/mfib_types.api"; not set by the client, then VPP will generate something meaningfull. */ -typeonly define ip_table +typedef ip_table { u32 table_id; u8 is_ip6; @@ -82,7 +82,7 @@ manual_endian manual_print define ip_table_details @param n_paths The number of paths the route has @param paths The paths of the route */ -typeonly define ip_route +typedef ip_route { u32 table_id; u32 stats_index; @@ -582,7 +582,7 @@ autoreply define ip_punt_police @param nh - the next-hop to redirect the traffic to. @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4 */ -typeonly define punt_redirect +typedef punt_redirect { u32 rx_sw_if_index; u32 tx_sw_if_index; @@ -841,7 +841,7 @@ autoreply define want_ip6_ra_events @param valid_time - RA prefix info valid time @param preferred_time - RA prefix info preferred time */ -typeonly define ip6_ra_prefix_info +typedef ip6_ra_prefix_info { vl_api_prefix_t prefix; u8 flags; @@ -887,7 +887,7 @@ service { @param low - Low address of the Proxy ARP range @param hi - High address of the Proxy ARP range */ -typeonly define proxy_arp +typedef proxy_arp { u32 table_id; vl_api_ip4_address_t low; diff --git a/src/vnet/l2/l2.api b/src/vnet/l2/l2.api index 4b1029d90f8..b0031ba16cc 100644 --- a/src/vnet/l2/l2.api +++ b/src/vnet/l2/l2.api @@ -165,7 +165,7 @@ autoreply define want_l2_macs_events 3 => MAC move (sw_if_index changed) @param flags - flag bits to provide other info, not yet used */ -typeonly define mac_entry +typedef mac_entry { u32 sw_if_index; u8 mac_addr[6]; @@ -284,7 +284,7 @@ define bridge_domain_dump @param sw_if_index - sw_if_index in the domain @param shg - split horizon group for the interface */ -typeonly manual_print manual_endian define bridge_domain_sw_if +typedef bridge_domain_sw_if { u32 context; u32 sw_if_index; diff --git a/src/vnet/lisp-cp/lisp.api b/src/vnet/lisp-cp/lisp.api index 708510cec87..604b34d815d 100644 --- a/src/vnet/lisp-cp/lisp.api +++ b/src/vnet/lisp-cp/lisp.api @@ -15,7 +15,7 @@ option version = "1.0.0"; -typeonly manual_print manual_endian define local_locator +typedef local_locator { u32 sw_if_index; u8 priority; @@ -307,7 +307,7 @@ define show_lisp_map_request_mode_reply u8 mode; }; -typeonly manual_endian manual_print define remote_locator +typedef remote_locator { u8 is_ip4; u8 priority; @@ -559,7 +559,7 @@ define lisp_eid_table_dump @param reid_prefix_len - remote EID IP prefix length @param leid_prefix_len - local EID IP prefix length */ -typeonly manual_print manual_endian define lisp_adjacency +typedef lisp_adjacency { u8 eid_type; u8 reid[16]; diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c index 5d426b6277c..8a0ffffd9cf 100644 --- a/src/vnet/lisp-cp/lisp_api.c +++ b/src/vnet/lisp-cp/lisp_api.c @@ -27,10 +27,6 @@ #include <vnet/vnet_msg_enum.h> -#define vl_api_remote_locator_t_endian vl_noop_handler -#define vl_api_remote_locator_t_print vl_noop_handler -#define vl_api_local_locator_t_endian vl_noop_handler -#define vl_api_local_locator_t_print vl_noop_handler #define vl_api_lisp_add_del_locator_set_t_endian vl_noop_handler #define vl_api_lisp_add_del_locator_set_t_print vl_noop_handler diff --git a/src/vnet/lisp-cp/one.api b/src/vnet/lisp-cp/one.api index f02caf2be96..bc3f1b16221 100644 --- a/src/vnet/lisp-cp/one.api +++ b/src/vnet/lisp-cp/one.api @@ -15,7 +15,7 @@ option version = "1.0.0"; -typeonly manual_print manual_endian define one_local_locator +typedef one_local_locator { u32 sw_if_index; u8 priority; @@ -355,7 +355,7 @@ define show_one_map_request_mode_reply u8 mode; }; -typeonly manual_endian manual_print define one_remote_locator +typedef one_remote_locator { u8 is_ip4; u8 priority; @@ -434,7 +434,7 @@ define one_l2_arp_entries_get u32 bd; }; -typeonly manual_print manual_endian define one_l2_arp_entry +typedef one_l2_arp_entry { u8 mac[6]; u32 ip4; @@ -471,7 +471,7 @@ define one_ndp_entries_get u32 bd; }; -typeonly manual_print manual_endian define one_ndp_entry +typedef one_ndp_entry { u8 mac[6]; u8 ip6[16]; @@ -768,7 +768,7 @@ define one_eid_table_dump @param reid_prefix_len - remote EID IP prefix length @param leid_prefix_len - local EID IP prefix length */ -typeonly manual_print manual_endian define one_adjacency +typedef one_adjacency { u8 eid_type; u8 reid[16]; diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c index fa67536c32d..447b68f377c 100644 --- a/src/vnet/lisp-cp/one_api.c +++ b/src/vnet/lisp-cp/one_api.c @@ -27,11 +27,6 @@ #include <vnet/vnet_msg_enum.h> -#define vl_api_one_remote_locator_t_endian vl_noop_handler -#define vl_api_one_remote_locator_t_print vl_noop_handler -#define vl_api_one_local_locator_t_endian vl_noop_handler -#define vl_api_one_local_locator_t_print vl_noop_handler - #define vl_api_one_add_del_locator_set_t_endian vl_noop_handler #define vl_api_one_add_del_locator_set_t_print vl_noop_handler #define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler @@ -42,13 +37,9 @@ #define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler #define vl_api_one_add_del_remote_mapping_t_print vl_noop_handler -#define vl_api_one_l2_arp_entry_t_endian vl_noop_handler -#define vl_api_one_l2_arp_entry_t_print vl_noop_handler #define vl_api_one_add_del_l2_arp_entry vl_noop_handler #define vl_api_one_l2_arp_bd_get vl_noop_handler -#define vl_api_one_ndp_entry_t_endian vl_noop_handler -#define vl_api_one_ndp_entry_t_print vl_noop_handler #define vl_api_one_ndp_entries_get_reply_t_endian vl_noop_handler #define vl_api_one_ndp_entries_get_reply_t_print vl_noop_handler diff --git a/src/vnet/lisp-gpe/lisp_gpe.api b/src/vnet/lisp-gpe/lisp_gpe.api index fbfc5e315a4..8f60b15ad87 100644 --- a/src/vnet/lisp-gpe/lisp_gpe.api +++ b/src/vnet/lisp-gpe/lisp_gpe.api @@ -20,7 +20,7 @@ option version = "1.0.0"; @param weight - locator weight @param addr - IPv4/6 address */ -typeonly manual_print manual_endian define gpe_locator +typedef gpe_locator { u8 is_ip4; u8 weight; @@ -117,7 +117,7 @@ define gpe_fwd_entries_get u32 vni; }; -typeonly manual_print manual_endian define gpe_fwd_entry +typedef gpe_fwd_entry { u32 fwd_entry_index; u32 dp_table; @@ -225,7 +225,7 @@ define gpe_native_fwd_rpaths_get @param nh_sw_if_index - next-hop sw_if_index (~0 if not set) @param nh_addr - next hop address */ -typeonly manual_print manual_endian define gpe_native_fwd_rpath +typedef gpe_native_fwd_rpath { u32 fib_index; u32 nh_sw_if_index; diff --git a/src/vnet/mfib/mfib_types.api b/src/vnet/mfib/mfib_types.api index b2ba4329ea5..118230680d1 100644 --- a/src/vnet/mfib/mfib_types.api +++ b/src/vnet/mfib/mfib_types.api @@ -28,7 +28,7 @@ enum mfib_itf_flags /** \brief mFIB path */ -typeonly define mfib_path +typedef mfib_path { vl_api_mfib_itf_flags_t itf_flags; vl_api_fib_path_t path; diff --git a/src/vnet/mpls/mpls.api b/src/vnet/mpls/mpls.api index 5d85812807a..2a0c83d4dd5 100644 --- a/src/vnet/mpls/mpls.api +++ b/src/vnet/mpls/mpls.api @@ -40,7 +40,7 @@ autoreply define mpls_ip_bind_unbind vl_api_prefix_t mb_prefix; }; -typeonly define mpls_tunnel +typedef mpls_tunnel { u32 mt_sw_if_index; u32 mt_tunnel_index; @@ -99,7 +99,7 @@ manual_endian manual_print define mpls_tunnel_details is not set by the client, then VPP will generate something meaningfull. */ -typeonly define mpls_table +typedef mpls_table { u32 mt_table_id; u8 mt_name[64]; @@ -137,7 +137,7 @@ define mpls_table_details @param mr_n_paths - The number of paths @param mr_paths - The paths */ -typeonly define mpls_route +typedef mpls_route { u32 mr_table_id; u32 mr_label; diff --git a/src/vnet/srv6/sr.api b/src/vnet/srv6/sr.api index 27b5ac6f89e..e989ffe2f16 100644 --- a/src/vnet/srv6/sr.api +++ b/src/vnet/srv6/sr.api @@ -18,12 +18,12 @@ option version = "1.2.0"; /** \brief SRv6 SID */ -typeonly define srv6_sid +typedef srv6_sid { u8 addr[16]; }; -typeonly define srv6_sid_list +typedef srv6_sid_list { u8 num_sids; u32 weight; @@ -59,7 +59,7 @@ autoreply define sr_localsid_add_del u8 nh_addr4[4]; }; -typeonly define sr_ip6_address +typedef sr_ip6_address { u8 data[16]; }; diff --git a/src/vpp/api/vpe.api b/src/vpp/api/vpe.api index 9531ea5643d..f03507ded4f 100644 --- a/src/vpp/api/vpe.api +++ b/src/vpp/api/vpe.api @@ -213,7 +213,7 @@ define show_threads @param core - thread pinned to actual physical core. @param cpu_socket - thread is running on which cpu socket. */ -typeonly define thread_data +typedef thread_data { u32 id; u8 name[64]; diff --git a/src/vpp/api/vpe_types.api b/src/vpp/api/vpe_types.api index 7bd4b29e846..3b49a19e8f0 100644 --- a/src/vpp/api/vpe_types.api +++ b/src/vpp/api/vpe_types.api @@ -14,7 +14,7 @@ * limitations under the License. */ -typeonly define version +typedef version { u32 major; u32 minor; |