From 53fffa1db7cb04982db8977acd61b808ef60d5a8 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Tue, 13 Nov 2018 12:36:56 +0100 Subject: API: Add support for type aliases Previously all types are compound. This adds support for aliases, so one can do things like: typedef u32 interface_index; or typedef u8 ip4_address[4]; Change-Id: I0455cad0123fc88acb491d2a3ea2725426bdb246 Signed-off-by: Ole Troan Signed-off-by: Klement Sekera --- src/vnet/interface.api | 18 ++++++++++++++++++ src/vnet/interface_types.api | 18 ++++++++++++++++++ src/vnet/ipip/ipip.api | 13 +++++++------ 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 src/vnet/interface_types.api (limited to 'src/vnet') diff --git a/src/vnet/interface.api b/src/vnet/interface.api index 2010d8b5f54..84e0483df67 100644 --- a/src/vnet/interface.api +++ b/src/vnet/interface.api @@ -1,5 +1,23 @@ +/* Hey Emacs use -*- mode: C -*- */ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + option version = "2.2.0"; +import "vnet/interface_types.api"; + service { rpc want_interface_events returns want_interface_events_reply events sw_interface_event; diff --git a/src/vnet/interface_types.api b/src/vnet/interface_types.api new file mode 100644 index 00000000000..f6fb4219ef8 --- /dev/null +++ b/src/vnet/interface_types.api @@ -0,0 +1,18 @@ +/* Hey Emacs use -*- mode: C -*- */ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +typedef u32 interface_index; + diff --git a/src/vnet/ipip/ipip.api b/src/vnet/ipip/ipip.api index 5cad28f2814..3dc087c954f 100644 --- a/src/vnet/ipip/ipip.api +++ b/src/vnet/ipip/ipip.api @@ -49,6 +49,7 @@ */ option version = "1.1.0"; +import "vnet/interface_types.api"; /** * Create an IP{v4,v6} over IP{v4,v6} tunnel. @@ -70,7 +71,7 @@ define ipip_add_tunnel_reply { u32 context; i32 retval; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; }; /** @@ -80,7 +81,7 @@ autoreply define ipip_del_tunnel { u32 client_index; u32 context; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; }; /** @@ -106,7 +107,7 @@ define ipip_6rd_add_tunnel_reply { u32 context; i32 retval; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; }; /** @@ -116,7 +117,7 @@ autoreply define ipip_6rd_del_tunnel { u32 client_index; u32 context; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; }; /** @@ -126,13 +127,13 @@ define ipip_tunnel_dump { u32 client_index; u32 context; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; }; define ipip_tunnel_details { u32 context; - u32 sw_if_index; + vl_api_interface_index_t sw_if_index; u32 instance; u8 is_ipv6; u8 src_address[16]; -- cgit 1.2.3-korg