Dave Barach | b5e8a77 | 2016-12-06 12:04:42 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 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 | #ifndef __FIB_API_H__ |
| 17 | #define __FIB_API_H__ |
| 18 | |
Neale Ranns | 8145842 | 2018-03-12 06:59:36 -0700 | [diff] [blame] | 19 | #include <vnet/fib/fib_types.h> |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 20 | #include <vnet/fib/fib_entry.h> |
Jakub Grajciar | 7dd63e5 | 2020-03-19 08:03:55 +0100 | [diff] [blame] | 21 | #include <vnet/ip/ip.api_types.h> |
Dave Barach | b5e8a77 | 2016-12-06 12:04:42 -0500 | [diff] [blame] | 22 | |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Forward declare the API type, no need to include the generated api headers |
| 25 | */ |
Neale Ranns | 8145842 | 2018-03-12 06:59:36 -0700 | [diff] [blame] | 26 | struct _vl_api_fib_path; |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 27 | struct _vl_api_fib_prefix; |
Neale Ranns | 8145842 | 2018-03-12 06:59:36 -0700 | [diff] [blame] | 28 | |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 29 | /** |
| 30 | * Encode and decode functions from the API types to internal types |
| 31 | */ |
Benoît Ganne | 83e7370 | 2021-08-10 16:23:36 +0200 | [diff] [blame] | 32 | extern vl_api_fib_path_nh_proto_t fib_api_path_dpo_proto_to_nh (dpo_proto_t dproto); |
| 33 | extern int fib_api_path_nh_proto_to_dpo (vl_api_fib_path_nh_proto_t pp, dpo_proto_t *dproto); |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 34 | extern void fib_api_path_encode(const fib_route_path_t * api_rpath, |
Neale Ranns | 990f694 | 2020-10-20 07:20:17 +0000 | [diff] [blame] | 35 | vl_api_fib_path_t *out); |
| 36 | extern int fib_api_path_decode(vl_api_fib_path_t *in, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 37 | fib_route_path_t *out); |
Dave Barach | b5e8a77 | 2016-12-06 12:04:42 -0500 | [diff] [blame] | 38 | |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 39 | extern int fib_api_table_id_decode(fib_protocol_t fproto, |
| 40 | u32 table_id, |
| 41 | u32 *fib_index); |
Neale Ranns | 2303cb1 | 2018-02-21 04:57:17 -0800 | [diff] [blame] | 42 | |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 43 | /** |
| 44 | * Adding routes from the API |
| 45 | */ |
Neale Ranns | c2ac235 | 2019-07-02 14:33:29 +0000 | [diff] [blame] | 46 | extern int fib_api_route_add_del (u8 is_add, |
| 47 | u8 is_multipath, |
| 48 | u32 fib_index, |
| 49 | const fib_prefix_t * prefix, |
Neale Ranns | 976b259 | 2019-12-04 06:11:00 +0000 | [diff] [blame] | 50 | fib_source_t src, |
Neale Ranns | c2ac235 | 2019-07-02 14:33:29 +0000 | [diff] [blame] | 51 | fib_entry_flag_t entry_flags, |
| 52 | fib_route_path_t *rpaths); |
Neale Ranns | 2303cb1 | 2018-02-21 04:57:17 -0800 | [diff] [blame] | 53 | |
Benoît Ganne | 32dc913 | 2024-06-17 15:33:59 +0200 | [diff] [blame] | 54 | extern u8 *format_vl_api_address_union (u8 * s, va_list * args); |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 55 | extern u8* format_vl_api_fib_path(u8 * s, va_list * args); |
Neale Ranns | 2303cb1 | 2018-02-21 04:57:17 -0800 | [diff] [blame] | 56 | |
Neale Ranns | 2303cb1 | 2018-02-21 04:57:17 -0800 | [diff] [blame] | 57 | |
Jakub Grajciar | 7dd63e5 | 2020-03-19 08:03:55 +0100 | [diff] [blame] | 58 | extern int fib_proto_from_api_address_family (vl_api_address_family_t af, fib_protocol_t *out); |
| 59 | extern vl_api_address_family_t fib_proto_to_api_address_family (fib_protocol_t fproto); |
Neale Ranns | d1e68ab | 2018-10-01 01:42:13 -0700 | [diff] [blame] | 60 | |
Dave Barach | b5e8a77 | 2016-12-06 12:04:42 -0500 | [diff] [blame] | 61 | #endif /* __FIB_API_H__ */ |