]>
Commit | Line | Data |
---|---|---|
1 | // SPDX-License-Identifier: GPL-2.0-or-later | |
2 | /* | |
3 | * fpm_pb.h | |
4 | * | |
5 | * @copyright Copyright (C) 2016 Sproute Networks, Inc. | |
6 | * | |
7 | * @author Avneesh Sachdev <avneesh@sproute.com> | |
8 | */ | |
9 | ||
10 | /* | |
11 | * Public header file for fpm protobuf definitions. | |
12 | */ | |
13 | ||
14 | #ifndef _FPM_PB_H | |
15 | #define _FPM_PB_H | |
16 | ||
17 | #include "lib/route_types.h" | |
18 | #include "qpb/qpb.h" | |
19 | ||
20 | #include "fpm/fpm.pb-c.h" | |
21 | ||
22 | /* | |
23 | * fpm__route_key__create | |
24 | */ | |
25 | #define fpm_route_key_create fpm__route_key__create | |
26 | static inline Fpm__RouteKey *fpm__route_key__create(qpb_allocator_t *allocator, | |
27 | struct prefix *prefix) | |
28 | { | |
29 | Fpm__RouteKey *key; | |
30 | ||
31 | key = QPB_ALLOC(allocator, typeof(*key)); | |
32 | if (!key) { | |
33 | return NULL; | |
34 | } | |
35 | fpm__route_key__init(key); | |
36 | ||
37 | key->prefix = qpb__l3_prefix__create(allocator, prefix); | |
38 | if (!key->prefix) { | |
39 | return NULL; | |
40 | } | |
41 | ||
42 | return key; | |
43 | } | |
44 | ||
45 | #endif |