vppapigen: remove support for legacy typedefs 07/21207/6
authorPaul Vinciguerra <pvinci@vinciconsulting.com>
Wed, 7 Aug 2019 04:05:59 +0000 (00:05 -0400)
committerOle Trøan <otroan@employees.org>
Tue, 20 Aug 2019 13:35:21 +0000 (13:35 +0000)
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:
src/plugins/abf/abf.api
src/plugins/acl/acl_types.api
src/plugins/acl/manual_fns.h
src/plugins/gbp/gbp.api
src/plugins/igmp/igmp.api
src/plugins/l3xc/l3xc.api
src/plugins/lb/lb_types.api
src/plugins/mactime/mactime.api
src/plugins/nat/nat.api
src/plugins/nat/nat_api.c
src/plugins/vmxnet3/vmxnet3.api
src/tools/vppapigen/vppapigen.py
src/vlibmemory/memclnt.api
src/vnet/bier/bier.api
src/vnet/dhcp/dhcp.api
src/vnet/ip/ip.api
src/vnet/l2/l2.api
src/vnet/lisp-cp/lisp.api
src/vnet/lisp-cp/lisp_api.c
src/vnet/lisp-cp/one.api
src/vnet/lisp-cp/one_api.c
src/vnet/lisp-gpe/lisp_gpe.api
src/vnet/mfib/mfib_types.api
src/vnet/mpls/mpls.api
src/vnet/srv6/sr.api
src/vpp/api/vpe.api
src/vpp/api/vpe_types.api

index 03044ad..72f4b37 100644 (file)
@@ -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;
index a47c9b3..fb58f88 100644 (file)
@@ -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;
index c592f89..bc0ad92 100644 (file)
@@ -120,61 +120,6 @@ format_acl_action(u8 *s, u8 action)
   return(s);
 }
 
-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)
 {
index 99be9c4..60c9965 100644 (file)
@@ -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;
index b061c5e..bc98711 100644 (file)
@@ -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;
index 512beda..8e37674 100644 (file)
@@ -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;
index 818e514..e01db5d 100644 (file)
@@ -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;
index 3ba6464..5d5731b 100644 (file)
@@ -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 */
index b5057ce..bd880a6 100644 (file)
@@ -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;
index ff11a82..5eaf767 100644 (file)
@@ -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
 
index 7408836..8c3597b 100644 (file)
@@ -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];
index 80097a1..c01fa40 100755 (executable)
@@ -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])
 
index 4802732..2f1e2da 100644 (file)
@@ -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;
index 0cc56ca..30b0478 100644 (file)
@@ -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;
index 6db9033..c84b363 100644 (file)
@@ -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;
index 2dae438..67cdf93 100644 (file)
@@ -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;
index 4b1029d..b0031ba 100644 (file)
@@ -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;
index 708510c..604b34d 100644 (file)
@@ -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];
index 5d426b6..8a0ffff 100644 (file)
 
 #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
index f02caf2..bc3f1b1 100644 (file)
@@ -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];
index fa67536..447b68f 100644 (file)
 
 #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
 #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
 
index fbfc5e3..8f60b15 100644 (file)
@@ -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;
index b2ba432..1182306 100644 (file)
@@ -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;
index 5d85812..2a0c83d 100644 (file)
@@ -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;
index 27b5ac6..e989ffe 100644 (file)
@@ -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];
 };
index 9531ea5..f03507d 100644 (file)
@@ -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];
index 7bd4b29..3b49a19 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-typeonly define version
+typedef version
 {
   u32 major;
   u32 minor;