blob: caa993b78d050c8f0c37d880de56ca9da72fa256 [file] [log] [blame]
Dave Barachb5e8a772016-12-06 12:04:42 -05001/*
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 Ranns81458422018-03-12 06:59:36 -070019#include <vnet/fib/fib_types.h>
Neale Ranns097fa662018-05-01 05:17:55 -070020#include <vnet/fib/fib_entry.h>
Jakub Grajciar7dd63e52020-03-19 08:03:55 +010021#include <vnet/ip/ip.api_types.h>
Dave Barachb5e8a772016-12-06 12:04:42 -050022
Neale Ranns097fa662018-05-01 05:17:55 -070023/**
24 * Forward declare the API type, no need to include the generated api headers
25 */
Neale Ranns81458422018-03-12 06:59:36 -070026struct _vl_api_fib_path;
Neale Ranns097fa662018-05-01 05:17:55 -070027struct _vl_api_fib_prefix;
Neale Ranns81458422018-03-12 06:59:36 -070028
Neale Ranns097fa662018-05-01 05:17:55 -070029/**
30 * Encode and decode functions from the API types to internal types
31 */
32extern void fib_api_path_encode(const fib_route_path_t * api_rpath,
Neale Ranns990f6942020-10-20 07:20:17 +000033 vl_api_fib_path_t *out);
34extern int fib_api_path_decode(vl_api_fib_path_t *in,
Neale Ranns097fa662018-05-01 05:17:55 -070035 fib_route_path_t *out);
Dave Barachb5e8a772016-12-06 12:04:42 -050036
Neale Ranns097fa662018-05-01 05:17:55 -070037extern int fib_api_table_id_decode(fib_protocol_t fproto,
38 u32 table_id,
39 u32 *fib_index);
Neale Ranns2303cb12018-02-21 04:57:17 -080040
Neale Ranns097fa662018-05-01 05:17:55 -070041/**
42 * Adding routes from the API
43 */
Neale Rannsc2ac2352019-07-02 14:33:29 +000044extern int fib_api_route_add_del (u8 is_add,
45 u8 is_multipath,
46 u32 fib_index,
47 const fib_prefix_t * prefix,
48 fib_entry_flag_t entry_flags,
49 fib_route_path_t *rpaths);
Neale Ranns2303cb12018-02-21 04:57:17 -080050
Neale Ranns097fa662018-05-01 05:17:55 -070051extern u8* format_vl_api_fib_path(u8 * s, va_list * args);
Neale Ranns2303cb12018-02-21 04:57:17 -080052
Neale Ranns2303cb12018-02-21 04:57:17 -080053
Jakub Grajciar7dd63e52020-03-19 08:03:55 +010054extern int fib_proto_from_api_address_family (vl_api_address_family_t af, fib_protocol_t *out);
55extern vl_api_address_family_t fib_proto_to_api_address_family (fib_protocol_t fproto);
Neale Rannsd1e68ab2018-10-01 01:42:13 -070056
Dave Barachb5e8a772016-12-06 12:04:42 -050057#endif /* __FIB_API_H__ */