]>
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 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with Quagga; see the file COPYING. If not, write to the Free | |
22 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
23 | * 02111-1307, USA. | |
24 | */ | |
25 | ||
26 | /* | |
27 | * Public header file for fpm protobuf definitions. | |
28 | */ | |
29 | ||
30 | #ifndef _FPM_PB_H | |
31 | #define _FPM_PB_H | |
32 | ||
33 | #include "route_types.h" | |
34 | #include "qpb/qpb.h" | |
35 | ||
36 | #include "fpm/fpm.pb-c.h" | |
37 | ||
38 | /* | |
39 | * fpm__route_key__create | |
40 | */ | |
41 | #define fpm_route_key_create fpm__route_key__create | |
ac4d0be5 | 42 | static inline Fpm__RouteKey *fpm__route_key__create(qpb_allocator_t *allocator, |
43 | struct prefix *prefix) | |
93c7bed1 | 44 | { |
ac4d0be5 | 45 | Fpm__RouteKey *key; |
46 | ||
47 | key = QPB_ALLOC(allocator, typeof(*key)); | |
48 | if (!key) { | |
49 | return NULL; | |
50 | } | |
51 | fpm__route_key__init(key); | |
52 | ||
53 | key->prefix = qpb__l3_prefix__create(allocator, prefix); | |
54 | if (!key->prefix) { | |
55 | return NULL; | |
56 | } | |
57 | ||
58 | return key; | |
93c7bed1 AS |
59 | } |
60 | ||
61 | #endif |