2e3bfaf53f56d91c0cac6dead0544e021bf98a5f
[vpp.git] / src / vnet / mpls / mpls.api
1 /*
2  * Copyright (c) 2015-2016 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 /** \brief Bind/Unbind an MPLS local label to an IP prefix. i.e. create
17            a per-prefix label entry.
18     @param client_index - opaque cookie to identify the sender
19     @param context - sender context, to match reply w/ request
20     @param mb_mpls_table_id - The MPLS table-id the MPLS entry will be added in
21     @param mb_label - The MPLS label value to bind
22     @param mb_ip_table_id - The IP table-id of the IP prefix to bind to.
23     @param mb_create_table_if_needed - Create either/both tables if required.
24     @param mb_is_bind - Bind or unbind
25     @param mb_is_ip4 - The prefix to bind to is IPv4
26     @param mb_address_length - Length of IP prefix
27     @param mb_address[16] - IP prefix/
28 */
29 define mpls_ip_bind_unbind
30 {
31   u32 client_index;
32   u32 context;
33   u32 mb_mpls_table_id;
34   u32 mb_label;
35   u32 mb_ip_table_id;
36   u8 mb_create_table_if_needed;
37   u8 mb_is_bind;
38   u8 mb_is_ip4;
39   u8 mb_address_length;
40   u8 mb_address[16];
41 };
42
43 /** \brief Reply for MPLS IP bind/unbind request
44     @param context - returned sender context, to match reply w/ request
45     @param retval - return code
46 */
47 define mpls_ip_bind_unbind_reply
48 {
49   u32 context;
50   i32 retval;
51 };
52
53 /** \brief MPLS tunnel Add / del route
54     @param client_index - opaque cookie to identify the sender
55     @param context - sender context, to match reply w/ request
56     @param mt_is_add - Is this a route add or delete
57     @param mt_sw_if_index - The SW interface index of the tunnel to delete
58     @param mt_next_hop_proto_is_ip4 - The next-hop is IPV4
59     @param mt_next_hop_weight - The weight, for UCMP
60     @param mt_next_hop[16] - the nextop address
61     @param mt_next_hop_sw_if_index - the next-hop SW interface
62     @param mt_next_hop_table_id - the next-hop table-id (if appropriate)
63     @param mt_next_hop_n_out_labels - the number of next-hop output labels
64     @param mt_next_hop_out_label_stack - the next-hop output label stack,  outer most first
65 */
66 define mpls_tunnel_add_del
67 {
68   u32 client_index;
69   u32 context;
70   u32 mt_sw_if_index;
71   u8 mt_is_add;
72   u8 mt_l2_only;
73   u8 mt_next_hop_proto_is_ip4;
74   u8 mt_next_hop_weight;
75   u8 mt_next_hop[16];
76   u8 mt_next_hop_n_out_labels;
77   u32 mt_next_hop_sw_if_index;
78   u32 mt_next_hop_table_id;
79   u32 mt_next_hop_out_label_stack[mt_next_hop_n_out_labels];
80 };
81
82 /** \brief Reply for MPLS tunnel add / del request
83     @param context - returned sender context, to match reply w/ request
84     @param retval - return code
85     @param sw_if_index - SW interface index of the tunnel created
86 */
87 define mpls_tunnel_add_del_reply
88 {
89   u32 context;
90   i32 retval;
91   u32 sw_if_index;
92 };
93
94 /** \brief Dump mpls eth tunnel table
95     @param client_index - opaque cookie to identify the sender
96     @param tunnel_index - eth tunnel identifier or -1 in case of all tunnels
97 */
98 define mpls_tunnel_dump
99 {
100   u32 client_index;
101   u32 context;
102   i32 tunnel_index;
103 };
104
105 /** \brief mpls eth tunnel operational state response
106     @param tunnel_index - eth tunnel identifier
107     @param intfc_address - interface ipv4 addr
108     @param mask_width - interface ipv4 addr mask
109     @param hw_if_index - interface id
110     @param l2_only -
111     @param tunnel_dst_mac -
112     @param tx_sw_if_index -
113     @param encap_index - reference to mpls label table
114     @param nlabels - number of resolved labels
115     @param labels - resolved labels
116 */
117 define mpls_tunnel_details
118 {
119   u32 context;
120   u32 tunnel_index;
121   u8 mt_l2_only;
122   u8 mt_sw_if_index;
123   u8 mt_next_hop_proto_is_ip4;
124   u8 mt_next_hop[16];
125   u32 mt_next_hop_sw_if_index;
126   u32 mt_next_hop_table_id;
127   u32 mt_next_hop_n_labels;
128   u32 mt_next_hop_out_labels[mt_next_hop_n_labels];
129 };
130
131 /** \brief MPLS Route Add / del route
132     @param client_index - opaque cookie to identify the sender
133     @param context - sender context, to match reply w/ request
134     @param mr_label - The MPLS label value
135     @param mr_eos - The End of stack bit
136     @param mr_table_id - The MPLS table-id the route is added in
137     @param mr_classify_table_index - If this is a classify route, 
138                                      this is the classify table index
139     @param  mr_create_table_if_needed - If the MPLS or IP tables do not exist,
140                                         create them
141     @param mr_is_add - Is this a route add or delete
142     @param mr_is_classify - Is this route result a classify
143     @param mr_is_multipath - Is this route update a multipath - i.e. is this
144                              a path addition to an existing route
145     @param mr_is_resolve_host - Recurse resolution constraint via a host prefix
146     @param mr_is_resolve_attached - Recurse resolution constraint via attached prefix
147     @param mr_next_hop_proto_is_ip4 - The next-hop is IPV4
148     @param mr_next_hop_weight - The weight, for UCMP
149     @param mr_next_hop[16] - the nextop address
150     @param mr_next_hop_sw_if_index - the next-hop SW interface
151     @param mr_next_hop_table_id - the next-hop table-id (if appropriate)
152     @param mr_next_hop_n_out_labels - the number of labels in the label stack
153     @param mr_next_hop_out_label_stack - the next-hop output label stack, outer most first
154     @param next_hop_via_label - The next-hop is a resolved via a local label
155 */
156 define mpls_route_add_del
157 {
158   u32 client_index;
159   u32 context;
160   u32 mr_label;
161   u8 mr_eos;
162   u32 mr_table_id;
163   u32 mr_classify_table_index;
164   u8 mr_create_table_if_needed;
165   u8 mr_is_add;
166   u8 mr_is_classify;
167   u8 mr_is_multipath;
168   u8 mr_is_resolve_host;
169   u8 mr_is_resolve_attached;
170   u8 mr_next_hop_proto_is_ip4;
171   u8 mr_next_hop_weight;
172   u8 mr_next_hop[16];
173   u8 mr_next_hop_n_out_labels;
174   u32 mr_next_hop_sw_if_index;
175   u32 mr_next_hop_table_id;
176   u32 mr_next_hop_via_label;
177   u32 mr_next_hop_out_label_stack[mr_next_hop_n_out_labels];
178 };
179
180 /** \brief Reply for MPLS route add / del request
181     @param context - returned sender context, to match reply w/ request
182     @param retval - return code
183 */
184 define mpls_route_add_del_reply
185 {
186   u32 context;
187   i32 retval;
188 };
189
190 /** \brief FIB path
191     @param sw_if_index - index of the interface
192     @param weight - The weight, for UCMP
193     @param is_local - local if non-zero, else remote
194     @param is_drop - Drop the packet
195     @param is_unreach - Drop the packet and rate limit send ICMP unreachable
196     @param is_prohibit - Drop the packet and rate limit send ICMP prohibited
197     @param afi - the afi of the next hop, IP46_TYPE_IP4=1, IP46_TYPE_IP6=2
198     @param next_hop[16] - the next hop address
199
200     WARNING: this type is replicated, pending cleanup completion
201
202 */
203 typeonly manual_print manual_endian define fib_path2
204 {
205   u32 sw_if_index;
206   u32 weight;
207   u8 is_local;
208   u8 is_drop;
209   u8 is_unreach;
210   u8 is_prohibit;
211   u8 afi;
212   u8 next_hop[16];
213 };
214
215 /** \brief Dump MPLS fib table
216     @param client_index - opaque cookie to identify the sender
217 */
218 define mpls_fib_dump
219 {
220   u32 client_index;
221   u32 context;
222 };
223
224 /** \brief mpls FIB table response
225     @param table_id - MPLS fib table id
226     @param s_bit - End-of-stack bit
227     @param label - MPLS label value
228     @param count - the number of fib_path in path
229     @param path  - array of of fib_path structures
230 */
231 manual_endian manual_print define mpls_fib_details
232 {
233   u32 context;
234   u32 table_id;
235   u8  eos_bit;
236   u32 label;
237   u32 count;
238   vl_api_fib_path2_t path[count];
239 };
240
241 /*
242  * Local Variables:
243  * eval: (c-set-style "gnu")
244  * End:
245  */
246