fib: fib api updates
[vpp.git] / src / vnet / fib / fib_api.h
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
19 #include <vnet/fib/fib_types.h>
20 #include <vnet/fib/fib_entry.h>
21
22 /**
23  * Forward declare the API type, no need to include the generated api headers
24  */
25 struct _vl_api_fib_path;
26 struct _vl_api_fib_prefix;
27
28 /**
29  * Encode and decode functions from the API types to internal types
30  */
31 extern void fib_api_path_encode(const fib_route_path_t * api_rpath,
32                                 struct _vl_api_fib_path *out);
33 extern int fib_api_path_decode(struct _vl_api_fib_path *in,
34                                fib_route_path_t *out);
35
36 extern int fib_api_table_id_decode(fib_protocol_t fproto,
37                                    u32 table_id,
38                                    u32 *fib_index);
39
40 /**
41  * Adding routes from the API
42  */
43 extern void fib_api_route_add_del (u8 is_add,
44                                    u8 is_multipath,
45                                    u32 fib_index,
46                                    const fib_prefix_t * prefix,
47                                    fib_entry_flag_t entry_flags,
48                                    fib_route_path_t *rpaths);
49
50 extern u8* format_vl_api_fib_path(u8 * s, va_list * args);
51
52
53 extern fib_protocol_t fib_proto_from_api_address_family (int af);
54 extern int fib_proto_to_api_address_family (fib_protocol_t fproto);
55
56 #endif /* __FIB_API_H__ */