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