Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 1 | /* |
| 2 | *------------------------------------------------------------------ |
| 3 | * api_helper_macros.h - message handler helper macros |
| 4 | * |
| 5 | * Copyright (c) 2016 Cisco and/or its affiliates. |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at: |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | *------------------------------------------------------------------ |
| 18 | */ |
| 19 | |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 20 | #ifndef __api_helper_macros_h__ |
| 21 | #define __api_helper_macros_h__ |
| 22 | |
| 23 | #define f64_endian(a) |
| 24 | #define f64_print(a,b) |
| 25 | |
Eyal Bari | 0856b97 | 2017-03-15 14:54:19 +0200 | [diff] [blame] | 26 | #ifndef REPLY_MSG_ID_BASE |
| 27 | #define REPLY_MSG_ID_BASE 0 |
| 28 | #endif |
| 29 | |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 30 | #define REPLY_MACRO(t) \ |
| 31 | do { \ |
| 32 | vl_api_registration_t *rp; \ |
| 33 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 34 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 35 | if (rp == 0) \ |
| 36 | return; \ |
| 37 | \ |
| 38 | rmp = vl_msg_api_alloc (sizeof (*rmp)); \ |
| 39 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 40 | rmp->context = mp->context; \ |
| 41 | rmp->retval = ntohl(rv); \ |
| 42 | \ |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 43 | vl_api_send_msg (rp, (u8 *)rmp); \ |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 44 | } while(0); |
| 45 | |
Ole Troan | bad6792 | 2020-08-24 12:22:01 +0200 | [diff] [blame] | 46 | #define REPLY_MACRO_END(t) \ |
| 47 | do { \ |
| 48 | vl_api_registration_t *rp; \ |
| 49 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 50 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 51 | if (rp == 0) \ |
| 52 | return; \ |
| 53 | \ |
| 54 | rmp = vl_msg_api_alloc (sizeof (*rmp)); \ |
| 55 | rmp->_vl_msg_id = t+(REPLY_MSG_ID_BASE); \ |
| 56 | rmp->context = mp->context; \ |
| 57 | rmp->retval = rv; \ |
| 58 | api_main_t *am = vlibapi_get_main (); \ |
| 59 | void (*endian_fp) (void *); \ |
| 60 | endian_fp = am->msg_endian_handlers[t+(REPLY_MSG_ID_BASE)]; \ |
| 61 | (*endian_fp) (rmp); \ |
| 62 | vl_api_send_msg (rp, (u8 *)rmp); \ |
| 63 | } while(0); |
| 64 | |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 65 | #define REPLY_MACRO2(t, body) \ |
| 66 | do { \ |
| 67 | vl_api_registration_t *rp; \ |
| 68 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 69 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 70 | if (rp == 0) \ |
| 71 | return; \ |
| 72 | \ |
| 73 | rmp = vl_msg_api_alloc (sizeof (*rmp)); \ |
| 74 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 75 | rmp->context = mp->context; \ |
| 76 | rmp->retval = ntohl(rv); \ |
| 77 | do {body;} while (0); \ |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 78 | vl_api_send_msg (rp, (u8 *)rmp); \ |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 79 | } while(0); |
| 80 | |
Ole Troan | e796a18 | 2020-05-18 11:14:05 +0200 | [diff] [blame] | 81 | #define REPLY_MACRO2_END(t, body) \ |
| 82 | do { \ |
| 83 | vl_api_registration_t *rp; \ |
| 84 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 85 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 86 | if (rp == 0) \ |
| 87 | return; \ |
| 88 | \ |
| 89 | rmp = vl_msg_api_alloc (sizeof (*rmp)); \ |
| 90 | rmp->_vl_msg_id = t+(REPLY_MSG_ID_BASE); \ |
| 91 | rmp->context = mp->context; \ |
| 92 | rmp->retval = rv; \ |
| 93 | do {body;} while (0); \ |
| 94 | api_main_t *am = vlibapi_get_main (); \ |
| 95 | void (*endian_fp) (void *); \ |
Ole Troan | bad6792 | 2020-08-24 12:22:01 +0200 | [diff] [blame] | 96 | endian_fp = am->msg_endian_handlers[t+(REPLY_MSG_ID_BASE)]; \ |
Ole Troan | e796a18 | 2020-05-18 11:14:05 +0200 | [diff] [blame] | 97 | (*endian_fp) (rmp); \ |
| 98 | vl_api_send_msg (rp, (u8 *)rmp); \ |
| 99 | } while(0); |
| 100 | |
Paul Vinciguerra | f24de17 | 2020-01-27 18:42:25 -0500 | [diff] [blame] | 101 | #define REPLY_MACRO2_ZERO(t, body) \ |
| 102 | do { \ |
| 103 | vl_api_registration_t *rp; \ |
| 104 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 105 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 106 | if (rp == 0) \ |
| 107 | return; \ |
| 108 | \ |
| 109 | rmp = vl_msg_api_alloc_zero (sizeof (*rmp)); \ |
| 110 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 111 | rmp->context = mp->context; \ |
| 112 | rmp->retval = ntohl(rv); \ |
| 113 | do {body;} while (0); \ |
| 114 | vl_api_send_msg (rp, (u8 *)rmp); \ |
| 115 | } while(0); |
| 116 | |
Ole Troan | 2a1ca78 | 2019-09-19 01:08:30 +0200 | [diff] [blame] | 117 | #define REPLY_MACRO_DETAILS2(t, body) \ |
| 118 | do { \ |
| 119 | vl_api_registration_t *rp; \ |
| 120 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 121 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 122 | if (rp == 0) \ |
| 123 | return; \ |
| 124 | \ |
| 125 | rmp = vl_msg_api_alloc (sizeof (*rmp)); \ |
| 126 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 127 | rmp->context = mp->context; \ |
| 128 | do {body;} while (0); \ |
| 129 | vl_api_send_msg (rp, (u8 *)rmp); \ |
| 130 | } while(0); |
| 131 | |
Ole Troan | f5db371 | 2020-05-20 15:47:06 +0200 | [diff] [blame] | 132 | #define REPLY_MACRO_DETAILS4(t, rp, context, body) \ |
| 133 | do { \ |
| 134 | rmp = vl_msg_api_alloc (sizeof (*rmp)); \ |
| 135 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 136 | rmp->context = context; \ |
| 137 | do {body;} while (0); \ |
| 138 | vl_api_send_msg (rp, (u8 *)rmp); \ |
| 139 | } while(0); |
| 140 | |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 141 | #define REPLY_MACRO3(t, n, body) \ |
| 142 | do { \ |
| 143 | vl_api_registration_t *rp; \ |
| 144 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 145 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 146 | if (rp == 0) \ |
| 147 | return; \ |
| 148 | \ |
| 149 | rmp = vl_msg_api_alloc (sizeof (*rmp) + n); \ |
| 150 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 151 | rmp->context = mp->context; \ |
| 152 | rmp->retval = ntohl(rv); \ |
| 153 | do {body;} while (0); \ |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 154 | vl_api_send_msg (rp, (u8 *)rmp); \ |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 155 | } while(0); |
| 156 | |
Paul Vinciguerra | f24de17 | 2020-01-27 18:42:25 -0500 | [diff] [blame] | 157 | #define REPLY_MACRO3_ZERO(t, n, body) \ |
| 158 | do { \ |
| 159 | vl_api_registration_t *rp; \ |
| 160 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 161 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 162 | if (rp == 0) \ |
| 163 | return; \ |
| 164 | \ |
| 165 | rmp = vl_msg_api_alloc_zero (sizeof (*rmp) + n); \ |
| 166 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 167 | rmp->context = mp->context; \ |
| 168 | rmp->retval = ntohl(rv); \ |
| 169 | do {body;} while (0); \ |
| 170 | vl_api_send_msg (rp, (u8 *)rmp); \ |
| 171 | } while(0); |
| 172 | |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 173 | #define REPLY_MACRO4(t, n, body) \ |
| 174 | do { \ |
| 175 | vl_api_registration_t *rp; \ |
| 176 | u8 is_error = 0; \ |
| 177 | rv = vl_msg_api_pd_handler (mp, rv); \ |
| 178 | \ |
| 179 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 180 | if (rp == 0) \ |
| 181 | return; \ |
| 182 | \ |
| 183 | rmp = vl_msg_api_alloc_or_null (sizeof (*rmp) + n); \ |
| 184 | if (!rmp) \ |
| 185 | { \ |
| 186 | /* if there isn't enough memory, try to allocate */ \ |
| 187 | /* some at least for returning an error */ \ |
| 188 | rmp = vl_msg_api_alloc (sizeof (*rmp)); \ |
| 189 | if (!rmp) \ |
| 190 | return; \ |
| 191 | \ |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 192 | clib_memset (rmp, 0, sizeof (*rmp)); \ |
Dave Barach | 59b2565 | 2017-09-10 15:04:27 -0400 | [diff] [blame] | 193 | rv = VNET_API_ERROR_TABLE_TOO_BIG; \ |
| 194 | is_error = 1; \ |
| 195 | } \ |
| 196 | rmp->_vl_msg_id = htons((t)+(REPLY_MSG_ID_BASE)); \ |
| 197 | rmp->context = mp->context; \ |
| 198 | rmp->retval = ntohl(rv); \ |
| 199 | if (!is_error) \ |
| 200 | do {body;} while (0); \ |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 201 | vl_api_send_msg (rp, (u8 *)rmp); \ |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 202 | } while(0); |
| 203 | |
Ole Troan | f5db371 | 2020-05-20 15:47:06 +0200 | [diff] [blame] | 204 | #define REPLY_AND_DETAILS_MACRO(t, p, body) \ |
| 205 | do { \ |
| 206 | vl_api_registration_t *rp; \ |
| 207 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 208 | if (rp == 0) \ |
| 209 | return; \ |
| 210 | u32 cursor = clib_net_to_host_u32 (mp->cursor); \ |
| 211 | vlib_main_t *vm = vlib_get_main (); \ |
| 212 | f64 start = vlib_time_now (vm); \ |
| 213 | if (pool_is_free_index (p, cursor)) { \ |
| 214 | cursor = pool_next_index (p, cursor); \ |
| 215 | if (cursor == ~0) \ |
| 216 | rv = VNET_API_ERROR_INVALID_VALUE; \ |
| 217 | } \ |
| 218 | while (cursor != ~0) { \ |
| 219 | do {body;} while (0); \ |
| 220 | cursor = pool_next_index (p, cursor); \ |
| 221 | if (vl_api_process_may_suspend (vm, rp, start)) { \ |
| 222 | if (cursor != ~0) \ |
| 223 | rv = VNET_API_ERROR_EAGAIN; \ |
| 224 | break; \ |
| 225 | } \ |
| 226 | } \ |
| 227 | REPLY_MACRO2 (t, ({ \ |
| 228 | rmp->cursor = clib_host_to_net_u32 (cursor); \ |
| 229 | })); \ |
| 230 | } while(0); |
| 231 | |
Jon Loeliger | c0b1954 | 2020-05-11 08:43:51 -0500 | [diff] [blame] | 232 | #define REPLY_AND_DETAILS_VEC_MACRO(t, v, mp, rmp, rv, body) \ |
| 233 | do { \ |
| 234 | vl_api_registration_t *rp; \ |
| 235 | rp = vl_api_client_index_to_registration (mp->client_index); \ |
| 236 | if (rp == 0) \ |
| 237 | return; \ |
| 238 | u32 cursor = clib_net_to_host_u32 (mp->cursor); \ |
| 239 | vlib_main_t *vm = vlib_get_main (); \ |
| 240 | f64 start = vlib_time_now (vm); \ |
| 241 | if (!v || vec_len (v) == 0) { \ |
| 242 | cursor = ~0; \ |
| 243 | rv = VNET_API_ERROR_INVALID_VALUE; \ |
| 244 | } else if (cursor == ~0) \ |
| 245 | cursor = 0; \ |
| 246 | while (cursor != ~0 && cursor < vec_len (v)) { \ |
| 247 | do {body;} while (0); \ |
| 248 | ++cursor; \ |
| 249 | if (vl_api_process_may_suspend (vm, rp, start)) { \ |
| 250 | if (cursor < vec_len (v)) \ |
| 251 | rv = VNET_API_ERROR_EAGAIN; \ |
| 252 | break; \ |
| 253 | } \ |
| 254 | } \ |
| 255 | REPLY_MACRO2 (t, ({ \ |
| 256 | rmp->cursor = clib_host_to_net_u32 (cursor); \ |
| 257 | })); \ |
| 258 | } while(0); |
| 259 | |
| 260 | |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 261 | /* "trust, but verify" */ |
| 262 | |
Eyal Bari | 1c82cd4 | 2017-03-14 14:39:51 +0200 | [diff] [blame] | 263 | static inline uword |
| 264 | vnet_sw_if_index_is_api_valid (u32 sw_if_index) |
| 265 | { |
| 266 | return vnet_sw_interface_is_api_valid (vnet_get_main (), sw_if_index); |
| 267 | } |
| 268 | |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 269 | #define VALIDATE_SW_IF_INDEX(mp) \ |
Neale Ranns | 947ea62 | 2018-06-07 23:48:20 -0700 | [diff] [blame] | 270 | do { u32 __sw_if_index = ntohl((mp)->sw_if_index); \ |
Eyal Bari | 1c82cd4 | 2017-03-14 14:39:51 +0200 | [diff] [blame] | 271 | if (!vnet_sw_if_index_is_api_valid(__sw_if_index)) { \ |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 272 | rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \ |
| 273 | goto bad_sw_if_index; \ |
| 274 | } \ |
| 275 | } while(0); |
| 276 | |
| 277 | #define BAD_SW_IF_INDEX_LABEL \ |
| 278 | do { \ |
| 279 | bad_sw_if_index: \ |
| 280 | ; \ |
| 281 | } while (0); |
| 282 | |
| 283 | #define VALIDATE_RX_SW_IF_INDEX(mp) \ |
Neale Ranns | 947ea62 | 2018-06-07 23:48:20 -0700 | [diff] [blame] | 284 | do { u32 __rx_sw_if_index = ntohl((mp)->rx_sw_if_index); \ |
Eyal Bari | 1c82cd4 | 2017-03-14 14:39:51 +0200 | [diff] [blame] | 285 | if (!vnet_sw_if_index_is_api_valid(__rx_sw_if_index)) { \ |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 286 | rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \ |
| 287 | goto bad_rx_sw_if_index; \ |
| 288 | } \ |
| 289 | } while(0); |
| 290 | |
| 291 | #define BAD_RX_SW_IF_INDEX_LABEL \ |
| 292 | do { \ |
| 293 | bad_rx_sw_if_index: \ |
| 294 | ; \ |
| 295 | } while (0); |
| 296 | |
| 297 | #define VALIDATE_TX_SW_IF_INDEX(mp) \ |
| 298 | do { u32 __tx_sw_if_index = ntohl(mp->tx_sw_if_index); \ |
Eyal Bari | 1c82cd4 | 2017-03-14 14:39:51 +0200 | [diff] [blame] | 299 | if (!vnet_sw_if_index_is_api_valid(__tx_sw_if_index)) { \ |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 300 | rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \ |
| 301 | goto bad_tx_sw_if_index; \ |
| 302 | } \ |
| 303 | } while(0); |
| 304 | |
| 305 | #define BAD_TX_SW_IF_INDEX_LABEL \ |
| 306 | do { \ |
| 307 | bad_tx_sw_if_index: \ |
| 308 | ; \ |
| 309 | } while (0); |
| 310 | |
John Lo | 9793477 | 2017-05-18 22:26:47 -0400 | [diff] [blame] | 311 | #define VALIDATE_BD_ID(mp) \ |
| 312 | do { u32 __rx_bd_id = ntohl(mp->bd_id); \ |
| 313 | if (__rx_bd_id > L2_BD_ID_MAX) { \ |
| 314 | rv = VNET_API_ERROR_BD_ID_EXCEED_MAX; \ |
| 315 | goto bad_bd_id; \ |
| 316 | } \ |
| 317 | } while(0); |
| 318 | |
| 319 | #define BAD_BD_ID_LABEL \ |
| 320 | do { \ |
| 321 | bad_bd_id: \ |
| 322 | ; \ |
| 323 | } while (0); |
| 324 | |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 325 | #define pub_sub_handler(lca,UCA) \ |
| 326 | static void vl_api_want_##lca##_t_handler ( \ |
| 327 | vl_api_want_##lca##_t *mp) \ |
| 328 | { \ |
| 329 | vpe_api_main_t *vam = &vpe_api_main; \ |
| 330 | vpe_client_registration_t *rp; \ |
| 331 | vl_api_want_##lca##_reply_t *rmp; \ |
| 332 | uword *p; \ |
| 333 | i32 rv = 0; \ |
| 334 | \ |
| 335 | p = hash_get (vam->lca##_registration_hash, mp->client_index); \ |
| 336 | if (p) { \ |
| 337 | if (mp->enable_disable) { \ |
Ole Troan | 32ef137 | 2019-01-07 22:17:31 +0100 | [diff] [blame] | 338 | clib_warning ("pid %d: already enabled...", ntohl(mp->pid)); \ |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 339 | rv = VNET_API_ERROR_INVALID_REGISTRATION; \ |
| 340 | goto reply; \ |
| 341 | } else { \ |
| 342 | rp = pool_elt_at_index (vam->lca##_registrations, p[0]); \ |
| 343 | pool_put (vam->lca##_registrations, rp); \ |
| 344 | hash_unset (vam->lca##_registration_hash, \ |
| 345 | mp->client_index); \ |
| 346 | goto reply; \ |
| 347 | } \ |
| 348 | } \ |
| 349 | if (mp->enable_disable == 0) { \ |
| 350 | clib_warning ("pid %d: already disabled...", mp->pid); \ |
| 351 | rv = VNET_API_ERROR_INVALID_REGISTRATION; \ |
| 352 | goto reply; \ |
| 353 | } \ |
| 354 | pool_get (vam->lca##_registrations, rp); \ |
| 355 | rp->client_index = mp->client_index; \ |
| 356 | rp->client_pid = mp->pid; \ |
| 357 | hash_set (vam->lca##_registration_hash, rp->client_index, \ |
| 358 | rp - vam->lca##_registrations); \ |
| 359 | \ |
| 360 | reply: \ |
| 361 | REPLY_MACRO (VL_API_WANT_##UCA##_REPLY); \ |
Neale Ranns | f12dad6 | 2018-06-04 18:41:24 -0700 | [diff] [blame] | 362 | } \ |
| 363 | \ |
| 364 | static clib_error_t * vl_api_want_##lca##_t_reaper (u32 client_index) \ |
| 365 | { \ |
| 366 | vpe_api_main_t *vam = &vpe_api_main; \ |
| 367 | vpe_client_registration_t *rp; \ |
| 368 | uword *p; \ |
| 369 | \ |
Matthew Smith | d465631 | 2018-06-14 11:40:49 -0500 | [diff] [blame] | 370 | p = hash_get (vam->lca##_registration_hash, client_index); \ |
Neale Ranns | f12dad6 | 2018-06-04 18:41:24 -0700 | [diff] [blame] | 371 | if (p) \ |
| 372 | { \ |
| 373 | rp = pool_elt_at_index (vam->lca##_registrations, p[0]); \ |
| 374 | pool_put (vam->lca##_registrations, rp); \ |
| 375 | hash_unset (vam->lca##_registration_hash, client_index); \ |
| 376 | } \ |
| 377 | return (NULL); \ |
| 378 | } \ |
| 379 | \ |
| 380 | VL_MSG_API_REAPER_FUNCTION (vl_api_want_##lca##_t_reaper); \ |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 381 | |
| 382 | #define foreach_registration_hash \ |
| 383 | _(interface_events) \ |
| 384 | _(to_netconf_server) \ |
| 385 | _(from_netconf_server) \ |
| 386 | _(to_netconf_client) \ |
| 387 | _(from_netconf_client) \ |
Klement Sekera | 0e3c0de | 2016-09-29 14:43:44 +0200 | [diff] [blame] | 388 | _(oam_events) \ |
Eyal Bari | 2019748 | 2017-09-13 12:29:08 +0300 | [diff] [blame] | 389 | _(bfd_events) \ |
Neale Ranns | cbe25aa | 2019-09-30 10:53:31 +0000 | [diff] [blame] | 390 | _(l2_arp_term_events) \ |
Juraj Sloboda | 81119e8 | 2018-05-25 14:02:20 +0200 | [diff] [blame] | 391 | _(ip6_ra_events) \ |
Juraj Sloboda | dd3b8f7 | 2018-05-04 14:20:06 +0200 | [diff] [blame] | 392 | _(dhcp6_pd_reply_events) \ |
Matthew Smith | 78f487e | 2020-10-08 11:11:27 -0500 | [diff] [blame] | 393 | _(dhcp6_reply_events) \ |
| 394 | _(vrrp_vr_events) |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 395 | |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 396 | typedef struct |
| 397 | { |
| 398 | u32 client_index; /* in memclnt registration pool */ |
| 399 | u32 client_pid; |
| 400 | } vpe_client_registration_t; |
| 401 | |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 402 | typedef struct |
| 403 | { |
Neale Ranns | cbe25aa | 2019-09-30 10:53:31 +0000 | [diff] [blame] | 404 | #define _(a) \ |
| 405 | uword *a##_registration_hash; \ |
| 406 | vpe_client_registration_t * a##_registrations; |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 407 | foreach_registration_hash |
| 408 | #undef _ |
| 409 | /* notifications happen really early in the game */ |
| 410 | u8 link_state_process_up; |
| 411 | |
Dave Barach | 6d963c2 | 2016-12-05 09:50:05 -0500 | [diff] [blame] | 412 | /* convenience */ |
| 413 | vlib_main_t *vlib_main; |
| 414 | vnet_main_t *vnet_main; |
| 415 | } vpe_api_main_t; |
| 416 | |
| 417 | extern vpe_api_main_t vpe_api_main; |
| 418 | |
Dave Barach | aff7077 | 2016-10-31 11:59:07 -0400 | [diff] [blame] | 419 | #endif /* __api_helper_macros_h__ */ |
| 420 | |
| 421 | /* |
| 422 | * fd.io coding-style-patch-verification: ON |
| 423 | * |
| 424 | * Local Variables: |
| 425 | * eval: (c-set-style "gnu") |
| 426 | * End: |
| 427 | */ |