]>
Commit | Line | Data |
---|---|---|
034cdee9 PG |
1 | /* BGP Flowspec header for utilities |
2 | * Copyright (C) 2018 6WIND | |
3 | * | |
4 | * FRRouting is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU General Public License as published by the | |
6 | * Free Software Foundation; either version 2, or (at your option) any | |
7 | * later version. | |
8 | * | |
9 | * FRRouting is distributed in the hope that it will be useful, but | |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along | |
15 | * with this program; see the file COPYING; if not, write to the Free Software | |
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | */ | |
18 | ||
19 | #ifndef _FRR_BGP_FLOWSPEC_UTIL_H | |
20 | #define _FRR_BGP_FLOWSPEC_UTIL_H | |
21 | ||
22 | #include "zclient.h" | |
23 | ||
24 | #define BGP_FLOWSPEC_STRING_DISPLAY_MAX 512 | |
25 | ||
26 | enum bgp_flowspec_util_nlri_t { | |
27 | BGP_FLOWSPEC_VALIDATE_ONLY = 0, | |
28 | BGP_FLOWSPEC_RETURN_STRING = 1, | |
d33fc23b PG |
29 | BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE = 2, |
30 | BGP_FLOWSPEC_RETURN_JSON = 3, | |
034cdee9 PG |
31 | }; |
32 | ||
33 | ||
34 | extern int bgp_flowspec_op_decode(enum bgp_flowspec_util_nlri_t type, | |
35 | uint8_t *nlri_ptr, | |
36 | uint32_t max_len, | |
37 | void *result, int *error); | |
38 | ||
39 | extern int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type, | |
40 | uint8_t *nlri_ptr, | |
41 | uint32_t max_len, | |
1840384b | 42 | void *result, int *error, |
9cec4121 | 43 | afi_t afi, uint8_t *ipv6_offset); |
034cdee9 | 44 | |
588ec356 | 45 | extern int bgp_flowspec_bitmask_decode(enum bgp_flowspec_util_nlri_t type, |
034cdee9 PG |
46 | uint8_t *nlri_ptr, |
47 | uint32_t max_len, | |
48 | void *result, int *error); | |
49 | ||
47555ee9 PG |
50 | struct bgp_pbr_entry_main; |
51 | extern int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, | |
1840384b PG |
52 | struct bgp_pbr_entry_main *bpem, |
53 | afi_t afi); | |
034cdee9 | 54 | |
bd494ec5 | 55 | extern bool bgp_flowspec_contains_prefix(const struct prefix *pfs, |
63a0b7a9 PG |
56 | struct prefix *input, |
57 | int prefix_check); | |
58 | ||
3dc339cd | 59 | extern bool bgp_flowspec_get_first_nh(struct bgp *bgp, struct bgp_path_info *pi, |
1840384b | 60 | struct prefix *nh, afi_t afi); |
0378bcaa | 61 | |
034cdee9 | 62 | #endif /* _FRR_BGP_FLOWSPEC_UTIL_H */ |