Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* Hey Emacs use -*- mode: C -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2015 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 | |
Florin Coras | eaec2a6 | 2018-12-04 16:34:05 -0800 | [diff] [blame] | 17 | option version = "2.1.0"; |
Dave Barach | 0d056e5 | 2017-09-28 15:11:16 -0400 | [diff] [blame] | 18 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 19 | /* |
Ole Troan | 94495f2 | 2018-08-02 11:58:12 +0200 | [diff] [blame] | 20 | * Define services not following the normal conventions here |
Marek Gradzki | 51e5968 | 2018-03-06 10:05:44 +0100 | [diff] [blame] | 21 | */ |
| 22 | service { |
| 23 | rpc memclnt_rx_thread_suspend returns null; |
| 24 | rpc memclnt_read_timeout returns null; |
| 25 | rpc rx_thread_exit returns null; |
| 26 | rpc trace_plugin_msg_ids returns null; |
| 27 | }; |
| 28 | |
| 29 | /* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 30 | * Create a client registration |
| 31 | */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 32 | define memclnt_create { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 33 | u32 context; /* opaque value to be returned in the reply */ |
Klement Sekera | dab732a | 2018-07-04 13:43:46 +0200 | [diff] [blame] | 34 | i32 ctx_quota; /* requested punt context quota */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 35 | u64 input_queue; /* client's queue */ |
Ole Troan | daa4bff | 2019-08-28 14:12:02 +0200 | [diff] [blame] | 36 | string name[64]; /* for show, find by name, whatever */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 37 | u32 api_versions[8]; /* client-server pairs use as desired */ |
| 38 | }; |
| 39 | |
| 40 | define memclnt_create_reply { |
Klement Sekera | dab732a | 2018-07-04 13:43:46 +0200 | [diff] [blame] | 41 | u32 context; /* opaque value from the create request */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 42 | i32 response; /* Non-negative = success */ |
Dave Barach | 557d128 | 2016-11-10 14:22:49 -0500 | [diff] [blame] | 43 | u64 handle; /* handle by which vlib knows this client */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 44 | u32 index; /* index, used e.g. by API trace replay */ |
Dave Barach | 557d128 | 2016-11-10 14:22:49 -0500 | [diff] [blame] | 45 | u64 message_table; /* serialized message table in shmem */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | /* |
| 49 | * Delete a client registration |
| 50 | */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 51 | define memclnt_delete { |
| 52 | u32 index; /* index, used e.g. by API trace replay */ |
| 53 | u64 handle; /* handle by which vlib knows this client */ |
Ole Troan | 8e38839 | 2019-12-06 15:06:49 +0100 | [diff] [blame] | 54 | bool do_cleanup; /* vlib to cleanup the registration */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | define memclnt_delete_reply { |
| 58 | i32 response; /* Non-negative = success */ |
| 59 | u64 handle; /* in case the client wonders */ |
| 60 | }; |
| 61 | |
Ole Troan | dfc9b7c | 2017-03-06 23:51:57 +0100 | [diff] [blame] | 62 | /* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 63 | * Client RX thread exit |
| 64 | */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 65 | define rx_thread_exit { |
| 66 | u8 dummy; |
| 67 | }; |
| 68 | |
| 69 | /* |
Ole Troan | dfc9b7c | 2017-03-06 23:51:57 +0100 | [diff] [blame] | 70 | * Client RX thread suspend |
| 71 | */ |
| 72 | define memclnt_rx_thread_suspend { |
| 73 | u8 dummy; |
| 74 | }; |
| 75 | |
| 76 | /* |
| 77 | * Client read timeout |
| 78 | */ |
| 79 | define memclnt_read_timeout { |
| 80 | u8 dummy; |
| 81 | }; |
| 82 | |
| 83 | /* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 84 | * RPC |
| 85 | */ |
Dave Barach | 11b8dbf | 2017-04-24 10:46:54 -0400 | [diff] [blame] | 86 | autoreply define rpc_call { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 87 | u32 client_index; |
| 88 | u32 context; |
| 89 | u64 function; |
| 90 | u8 multicast; |
| 91 | u8 need_barrier_sync; |
| 92 | u8 send_reply; |
Juraj Sloboda | 7528245 | 2018-06-12 14:20:49 +0200 | [diff] [blame] | 93 | u32 data_len; |
| 94 | u8 data[data_len]; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 95 | }; |
| 96 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 97 | /* |
| 98 | * Lookup message-ID base by name |
| 99 | */ |
| 100 | define get_first_msg_id { |
| 101 | u32 client_index; |
| 102 | u32 context; |
Ole Troan | daa4bff | 2019-08-28 14:12:02 +0200 | [diff] [blame] | 103 | string name[64]; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | define get_first_msg_id_reply { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 107 | u32 context; |
| 108 | i32 retval; |
| 109 | u16 first_msg_id; |
| 110 | }; |
Dave Barach | 987e11d | 2017-02-27 13:10:27 -0500 | [diff] [blame] | 111 | |
| 112 | /* |
Dave Barach | 0d056e5 | 2017-09-28 15:11:16 -0400 | [diff] [blame] | 113 | * Get API version table (includes built-in and plugins) |
| 114 | */ |
Paul Vinciguerra | e717482 | 2019-08-07 00:05:59 -0400 | [diff] [blame] | 115 | typedef module_version { |
Dave Barach | 0d056e5 | 2017-09-28 15:11:16 -0400 | [diff] [blame] | 116 | u32 major; |
| 117 | u32 minor; |
| 118 | u32 patch; |
Ole Troan | daa4bff | 2019-08-28 14:12:02 +0200 | [diff] [blame] | 119 | string name[64]; |
Dave Barach | 0d056e5 | 2017-09-28 15:11:16 -0400 | [diff] [blame] | 120 | }; |
| 121 | define api_versions { |
| 122 | u32 client_index; |
| 123 | u32 context; |
| 124 | }; |
| 125 | define api_versions_reply { |
Dave Barach | 0d056e5 | 2017-09-28 15:11:16 -0400 | [diff] [blame] | 126 | u32 context; |
| 127 | i32 retval; |
| 128 | u32 count; |
| 129 | vl_api_module_version_t api_versions[count]; |
| 130 | }; |
| 131 | |
| 132 | /* |
Dave Barach | 987e11d | 2017-02-27 13:10:27 -0500 | [diff] [blame] | 133 | * Trace the plugin message-id allocator |
| 134 | * so we stand a chance of dealing with different sets of plugins |
| 135 | * at api trace replay time |
| 136 | */ |
| 137 | |
Filip Tehlar | 36217e3 | 2021-07-23 08:51:10 +0000 | [diff] [blame] | 138 | define trace_plugin_msg_ids |
Dave Barach | 987e11d | 2017-02-27 13:10:27 -0500 | [diff] [blame] | 139 | { |
| 140 | u32 client_index; |
| 141 | u32 context; |
Ole Troan | daa4bff | 2019-08-28 14:12:02 +0200 | [diff] [blame] | 142 | string plugin_name[128]; |
Dave Barach | 987e11d | 2017-02-27 13:10:27 -0500 | [diff] [blame] | 143 | u16 first_msg_id; |
| 144 | u16 last_msg_id; |
| 145 | }; |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 146 | |
Ole Troan | 94495f2 | 2018-08-02 11:58:12 +0200 | [diff] [blame] | 147 | typedef message_table_entry |
| 148 | { |
| 149 | u16 index; |
Ole Troan | daa4bff | 2019-08-28 14:12:02 +0200 | [diff] [blame] | 150 | string name[64]; |
Ole Troan | 94495f2 | 2018-08-02 11:58:12 +0200 | [diff] [blame] | 151 | }; |
| 152 | |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 153 | /* |
| 154 | * Create a socket client registration. |
| 155 | */ |
| 156 | define sockclnt_create { |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 157 | u32 context; /* opaque value to be returned in the reply */ |
Ole Troan | daa4bff | 2019-08-28 14:12:02 +0200 | [diff] [blame] | 158 | string name[64]; /* for show, find by name, whatever */ |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 159 | }; |
| 160 | |
| 161 | define sockclnt_create_reply { |
Ole Troan | 94495f2 | 2018-08-02 11:58:12 +0200 | [diff] [blame] | 162 | u32 client_index; |
Klement Sekera | dab732a | 2018-07-04 13:43:46 +0200 | [diff] [blame] | 163 | u32 context; /* opaque value from the create request */ |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 164 | i32 response; /* Non-negative = success */ |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 165 | u32 index; /* index, used e.g. by API trace replay */ |
Ole Troan | 94495f2 | 2018-08-02 11:58:12 +0200 | [diff] [blame] | 166 | u16 count; |
| 167 | vl_api_message_table_entry_t message_table[count]; |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 168 | }; |
| 169 | |
| 170 | /* |
| 171 | * Delete a client registration |
| 172 | */ |
| 173 | define sockclnt_delete { |
Ole Troan | 94495f2 | 2018-08-02 11:58:12 +0200 | [diff] [blame] | 174 | u32 client_index; |
| 175 | u32 context; |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 176 | u32 index; /* index, used e.g. by API trace replay */ |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | define sockclnt_delete_reply { |
Ole Troan | 94495f2 | 2018-08-02 11:58:12 +0200 | [diff] [blame] | 180 | u32 context; |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 181 | i32 response; /* Non-negative = success */ |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 182 | }; |
| 183 | |
| 184 | /* |
Florin Coras | 90a6398 | 2017-12-19 04:50:01 -0800 | [diff] [blame] | 185 | * Initialize shm api over socket api |
| 186 | */ |
Dave Barach | 7895872 | 2018-05-10 16:44:27 -0400 | [diff] [blame] | 187 | autoreply define sock_init_shm { |
Florin Coras | 90a6398 | 2017-12-19 04:50:01 -0800 | [diff] [blame] | 188 | u32 client_index; |
| 189 | u32 context; |
| 190 | u32 requested_size; |
| 191 | u8 nitems; |
| 192 | u64 configs[nitems]; |
| 193 | }; |
| 194 | |
Dave Barach | 7895872 | 2018-05-10 16:44:27 -0400 | [diff] [blame] | 195 | /* define sock_init_shm_reply { |
Florin Coras | 90a6398 | 2017-12-19 04:50:01 -0800 | [diff] [blame] | 196 | u32 client_index; |
| 197 | u32 context; |
| 198 | i32 retval; |
Dave Barach | 7895872 | 2018-05-10 16:44:27 -0400 | [diff] [blame] | 199 | }; */ |
Florin Coras | 90a6398 | 2017-12-19 04:50:01 -0800 | [diff] [blame] | 200 | |
| 201 | /* |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 202 | * Memory client ping / response |
| 203 | * Only sent on inactive connections |
| 204 | */ |
| 205 | autoreply define memclnt_keepalive |
| 206 | { |
| 207 | u32 client_index; |
| 208 | u32 context; |
| 209 | }; |
Filip Tehlar | f0e67d7 | 2021-07-23 22:03:05 +0000 | [diff] [blame] | 210 | |
| 211 | /** \brief Control ping from client to api server request |
| 212 | @param client_index - opaque cookie to identify the sender |
| 213 | @param context - sender context, to match reply w/ request |
| 214 | */ |
| 215 | define control_ping |
| 216 | { |
| 217 | u32 client_index; |
| 218 | u32 context; |
| 219 | }; |
| 220 | |
| 221 | /** \brief Control ping from the client to the server response |
| 222 | @param client_index - opaque cookie to identify the sender |
| 223 | @param context - sender context, to match reply w/ request |
| 224 | @param retval - return code for the request |
| 225 | @param vpe_pid - the pid of the vpe, returned by the server |
| 226 | */ |
| 227 | define control_ping_reply |
| 228 | { |
| 229 | u32 context; |
| 230 | i32 retval; |
| 231 | u32 client_index; |
| 232 | u32 vpe_pid; |
| 233 | }; |
| 234 | |