ip: Sub Address Family types. Feature enable for each SAFI
[vpp.git] / src / vnet / ip / ip_types.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 option version = "3.0.0";
18 manual_print typedef u8 ip4_address[4];
19 manual_print typedef u8 ip6_address[16];
20
21 enum address_family : u8 {
22   ADDRESS_IP4 = 0,
23   ADDRESS_IP6,
24 };
25
26 /**
27  * @brief The location at which to apply a feature
28  */
29 enum ip_feature_location: u8 {
30   IP_API_FEATURE_INPUT = 0,
31   IP_API_FEATURE_OUTPUT,
32   IP_API_FEATURE_LOCAL,
33   IP_API_FEATURE_PUNT,
34   IP_API_FEATURE_DROP,
35 };
36
37 /* ECN code points - RFC 3168
38    https://tools.ietf.org/html/rfc3168
39 */
40 enum ip_ecn : u8 {
41   IP_API_ECN_NONE = 0,
42   IP_API_ECN_ECT0 = 1,
43   IP_API_ECN_ECT1 = 2,
44   IP_API_ECN_CE = 3,
45 };
46
47 /* DSCP code points - RFC 2474
48    https://tools.ietf.org/html/rfc2474
49    Values other than these RFC defined values are accepted.
50 */
51 enum ip_dscp : u8 {
52   IP_API_DSCP_CS0 =  0,
53   IP_API_DSCP_CS1 = 8,
54   IP_API_DSCP_AF11 = 10,
55   IP_API_DSCP_AF12 = 12,
56   IP_API_DSCP_AF13 = 14,
57   IP_API_DSCP_CS2 =  16,
58   IP_API_DSCP_AF21 = 18,
59   IP_API_DSCP_AF22 = 20,
60   IP_API_DSCP_AF23 = 22,
61   IP_API_DSCP_CS3 =  24,
62   IP_API_DSCP_AF31 = 26,
63   IP_API_DSCP_AF32 = 28,
64   IP_API_DSCP_AF33 = 30,
65   IP_API_DSCP_CS4 =  32,
66   IP_API_DSCP_AF41 = 34,
67   IP_API_DSCP_AF42 = 36,
68   IP_API_DSCP_AF43 = 38,
69   IP_API_DSCP_CS5 =  40,
70   IP_API_DSCP_EF =   46,
71   IP_API_DSCP_CS6 =  48,
72   IP_API_DSCP_CS7 =  50,
73 };
74
75 enum ip_proto : u8 {
76   IP_API_PROTO_HOPOPT = 0,
77   IP_API_PROTO_ICMP = 1,
78   IP_API_PROTO_IGMP = 2,
79   IP_API_PROTO_TCP = 6,
80   IP_API_PROTO_UDP = 17,
81   IP_API_PROTO_GRE = 47,
82   IP_API_PROTO_ESP = 50,
83   IP_API_PROTO_AH = 51,
84   IP_API_PROTO_ICMP6 = 58,
85   IP_API_PROTO_EIGRP = 88,
86   IP_API_PROTO_OSPF = 89,
87   IP_API_PROTO_SCTP = 132,
88   IP_API_PROTO_RESERVED = 255,
89 };
90
91 union address_union {
92   vl_api_ip4_address_t ip4;
93   vl_api_ip6_address_t ip6;
94 };
95
96 manual_print typedef address {
97   vl_api_address_family_t af;
98   vl_api_address_union_t un;
99 };
100
101 manual_print typedef prefix {
102   vl_api_address_t address;
103   u8 len;
104 };
105
106 typedef ip4_address_and_mask
107 {
108   vl_api_ip4_address_t addr;
109   vl_api_ip4_address_t mask;
110 };
111
112 typedef ip6_address_and_mask
113 {
114   vl_api_ip6_address_t addr;
115   vl_api_ip6_address_t mask;
116 };
117
118 typedef mprefix {
119   vl_api_address_family_t af;
120   u16 grp_address_length;
121   vl_api_address_union_t grp_address;
122   vl_api_address_union_t src_address;
123 };
124
125 manual_print typedef ip6_prefix {
126   vl_api_ip6_address_t address;
127   u8 len;
128 };
129
130 manual_print typedef ip4_prefix {
131   vl_api_ip4_address_t address;
132   u8 len;
133 };
134
135 /** \brief
136  *
137  * The vl_api_[ip4|ip6]_address_with_prefix_t types are used as a type to denote
138  * both an IP address and a prefix. I.e. in CIDR notation
139  * '192.168.10.1/24' the address is 192.168.10.1 and the network
140  * prefix is 192.168.10.0/24.
141  *
142  * If only an address is needed use: vl_api_address_t types and if
143  * only a network prefix is needed (i.e. no hosts bits), then use the
144  * vl_api_prefix_t types.
145  *
146  **/
147
148 manual_print typedef vl_api_prefix_t address_with_prefix;
149 manual_print typedef vl_api_ip4_prefix_t ip4_address_with_prefix;
150 manual_print typedef vl_api_ip6_prefix_t ip6_address_with_prefix;
151
152 /** \brief A context for matching prefixes against.  (Think ip prefix list.)
153     The meaning (exact match / want subnets) of an unset matcher is left to the implementer.
154     @param le - le mut be <= to prefix.len. Default: 255 (not set).
155     @param ge - ge must be greater than le and <= max_size of prefix. Default: 255 (not set).
156
157 */
158 typedef prefix_matcher {
159   u8 le; /* [default=255] */
160   u8 ge; /* [default=255] */
161 };