svs: use explicit types in api
[vpp.git] / src / plugins / svs / svs.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2016 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 /**
18  * @file
19  *   This file defines the vpp control-plane API messages
20  *   used to control the Source VRF select (SVS) plugin
21  */
22
23 option version = "1.0.0";
24 import "vnet/ip/ip_types.api";
25 import "vnet/interface_types.api";
26
27 /**
28  * brief Get the plugin version
29  * @param client_index - opaque cookie to identify the sender
30  *@param context - sender context, to match reply w/ request
31  */
32 define svs_plugin_get_version
33 {
34   u32 client_index;
35   u32 context;
36 };
37
38 /**
39  * @brief Reply to get the plugin version
40  * @param context - returned sender context, to match reply w/ request
41  * @param major - Incremented every time a known breaking behavior change is introduced
42  * @param minor - Incremented with small changes, may be used to avoid buggy versions
43  */
44 define svs_plugin_get_version_reply
45 {
46   u32 context;
47   u32 major;
48   u32 minor;
49 };
50
51 /**
52  * @brief Add a table in which to add routes that will match against source
53  *        addresses
54  * @param client_index - opaque cookie to identify the sender
55  * @param context - sender context, to match reply w/ request
56  * @param af - Address Family
57  * @param table_id - User provided ID for the table
58  * @param is_add - add or delete
59  */
60 autoreply define svs_table_add_del
61 {
62   u32 client_index;
63   u32 context;
64   bool is_add;
65   vl_api_address_family_t af;
66   u32 table_id;
67 };
68
69 /**
70  * @brief Add a route into the source address matching table
71  * @param client_index - opaque cookie to identify the sender
72  * @param context - sender context, to match reply w/ request
73  * @param prefix - prefix
74  * @param table_id - The SVS table (from svs_table_add_del)
75  * @param source_table_id - This is the table ID that will be used for
76  *                          the subsequent lookup of the packet. The V in SVS.
77  *                          this table must exist (from e.g. ip_table_add_del)
78  */
79 autoreply define svs_route_add_del
80 {
81   u32 client_index;
82   u32 context;
83   bool is_add;
84   vl_api_prefix_t prefix;
85   u32 table_id;
86   u32 source_table_id;
87 };
88
89 /**
90  * @brief Enable SVS on a given interface by using the given table to match
91  *        RX'd packets' source addresses
92  * @param client_index - opaque cookie to identify the sender
93  * @param context - sender context, to match reply w/ request
94  * @param af - Address Family
95  * @param table_id - The SVS table (from svs_table_add_del)
96  * @param sw_if_index - Interface
97  */
98 autoreply define svs_enable_disable
99 {
100   u32 client_index;
101   u32 context;
102   bool is_enable;
103   vl_api_address_family_t af;
104   u32 table_id;
105   vl_api_interface_index_t sw_if_index;
106 };
107
108 /**
109  * @brief Dump the SVS table mappings of table_id to interface
110  *        To see the routes added to a given table use ip_fib_dump()
111  */
112 define svs_dump
113 {
114   u32 client_index;
115   u32 context;
116 };
117
118 /**
119  * @brief SVS table-id to interface mapping
120  * @param context - sender context, to match reply w/ request
121  * @param af - Address Family
122  * @param table_id - The SVS table (from svs_table_add_del)
123  * @param sw_if_index - Interface
124  */
125 define svs_details
126 {
127   u32 context;
128   u32 table_id;
129   vl_api_interface_index_t sw_if_index;
130   vl_api_address_family_t af;
131 };