]>
Commit | Line | Data |
---|---|---|
93c7bed1 AS |
1 | /* |
2 | * fpm_pb.h | |
3 | * | |
4 | * @copyright Copyright (C) 2016 Sproute Networks, Inc. | |
5 | * | |
6 | * @author Avneesh Sachdev <avneesh@sproute.com> | |
7 | * | |
8 | * This file is part of Quagga. | |
9 | * | |
10 | * Quagga is free software; you can redistribute it and/or modify it | |
11 | * under the terms of the GNU General Public License as published by the | |
12 | * Free Software Foundation; either version 2, or (at your option) any | |
13 | * later version. | |
14 | * | |
15 | * Quagga is distributed in the hope that it will be useful, but | |
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * General Public License for more details. | |
19 | * | |
896014f4 DL |
20 | * You should have received a copy of the GNU General Public License along |
21 | * with this program; see the file COPYING; if not, write to the Free Software | |
22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
93c7bed1 AS |
23 | */ |
24 | ||
25 | /* | |
26 | * Public header file for fpm protobuf definitions. | |
27 | */ | |
28 | ||
29 | #ifndef _FPM_PB_H | |
30 | #define _FPM_PB_H | |
31 | ||
32 | #include "route_types.h" | |
33 | #include "qpb/qpb.h" | |
34 | ||
35 | #include "fpm/fpm.pb-c.h" | |
36 | ||
37 | /* | |
38 | * fpm__route_key__create | |
39 | */ | |
40 | #define fpm_route_key_create fpm__route_key__create | |
d62a17ae | 41 | static inline Fpm__RouteKey *fpm__route_key__create(qpb_allocator_t *allocator, |
42 | struct prefix *prefix) | |
93c7bed1 | 43 | { |
d62a17ae | 44 | Fpm__RouteKey *key; |
45 | ||
46 | key = QPB_ALLOC(allocator, typeof(*key)); | |
47 | if (!key) { | |
48 | return NULL; | |
49 | } | |
50 | fpm__route_key__init(key); | |
51 | ||
52 | key->prefix = qpb__l3_prefix__create(allocator, prefix); | |
53 | if (!key->prefix) { | |
54 | return NULL; | |
55 | } | |
56 | ||
57 | return key; | |
93c7bed1 AS |
58 | } |
59 | ||
60 | #endif |