Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
route.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019 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 
20 #ifndef HICN_ROUTE_H
21 #define HICN_ROUTE_H
22 
23 #include <hicn/util/ip_address.h>
24 #include <hicn/ctrl/face.h>
25 
26 typedef u16 route_cost_t;
27 
28 typedef struct hicn_route_s hicn_route_t;
29 
30 #define MAXSZ_ROUTE_ MAXSZ_PREFIX + 3 + MAXSZ_COST
31 #define MAXSZ_ROUTE MAXSZ_ROUTE_ + NULLTERM
32 
33 hicn_route_t * hicn_route_create(ip_prefix_t * prefix, face_id_t face_id, route_cost_t cost);
34 hicn_route_t * hicn_route_dup(const hicn_route_t * route);
35 void hicn_route_free(hicn_route_t * route);
36 
37 int hicn_route_cmp(const hicn_route_t * route1, const hicn_route_t * route2);
38 
39 int hicn_route_get_prefix(const hicn_route_t * route, ip_prefix_t * prefix);
40 int hicn_route_set_prefix(hicn_route_t * route, const ip_prefix_t prefix);
41 
42 int hicn_route_get_cost(const hicn_route_t * route, int * cost);
43 int hicn_route_set_cost(hicn_route_t * route, const int cost);
44 
45 size_t hicn_route_snprintf(char * s, size_t size, const hicn_route_t * route);
46 
47 #endif
ip_prefix_t
Definition: ip_address.h:103
face.h
Face abstraction.