VPPAPIGEN: Add union and enum support and IP4/IP6 address type.
[vpp.git] / src / vnet / ip / ip_types.api
1 /*
2  * Copyright (c) 2018 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 typedef ip4_address {
17   u8 address[4];
18 };
19
20 typedef ip6_address {
21   u8 address[16];
22 };
23
24 enum address_family {
25   ADDRESS_IP4 = 0,
26   ADDRESS_IP6,
27 };
28
29 union address_union {
30   vl_api_ip4_address_t ip4;
31   vl_api_ip6_address_t ip6;
32 };
33
34 typedef address {
35   vl_api_address_family_t af;
36   vl_api_address_union_t un;
37 };