]>
git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_lcommunity.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* BGP Large Communities Attribute.
4 * Copyright (C) 2016 Keyur Patel <keyur@arrcus.com>
7 #ifndef _QUAGGA_BGP_LCOMMUNITY_H
8 #define _QUAGGA_BGP_LCOMMUNITY_H
11 #include "bgpd/bgp_route.h"
12 #include "bgpd/bgp_clist.h"
14 /* Large Communities value is twelve octets long. */
15 #define LCOMMUNITY_SIZE 12
17 /* Large Communities attribute. */
19 /* Reference counter. */
22 /* Size of Extended Communities attribute. */
25 /* Large Communities value. */
28 /* Large Communities as a json object */
31 /* Human readable format string. */
35 /* Large community value is 12 octets. */
36 struct lcommunity_val
{
37 char val
[LCOMMUNITY_SIZE
];
40 #define lcom_length(X) ((X)->size * LCOMMUNITY_SIZE)
42 extern void lcommunity_init(void);
43 extern void lcommunity_finish(void);
44 extern void lcommunity_free(struct lcommunity
**);
45 extern struct lcommunity
*lcommunity_parse(uint8_t *, unsigned short);
46 extern struct lcommunity
*lcommunity_dup(struct lcommunity
*);
47 extern struct lcommunity
*lcommunity_merge(struct lcommunity
*,
49 extern struct lcommunity
*lcommunity_uniq_sort(struct lcommunity
*);
50 extern struct lcommunity
*lcommunity_intern(struct lcommunity
*);
51 extern bool lcommunity_cmp(const void *arg1
, const void *arg2
);
52 extern void lcommunity_unintern(struct lcommunity
**);
53 extern unsigned int lcommunity_hash_make(const void *);
54 extern struct hash
*lcommunity_hash(void);
55 extern struct lcommunity
*lcommunity_str2com(const char *);
56 extern bool lcommunity_match(const struct lcommunity
*,
57 const struct lcommunity
*);
58 extern char *lcommunity_str(struct lcommunity
*, bool make_json
,
59 bool translate_alias
);
60 extern bool lcommunity_include(struct lcommunity
*lcom
, uint8_t *ptr
);
61 extern void lcommunity_del_val(struct lcommunity
*lcom
, uint8_t *ptr
);
63 extern void bgp_compute_aggregate_lcommunity(
64 struct bgp_aggregate
*aggregate
,
65 struct lcommunity
*lcommunity
);
67 extern void bgp_compute_aggregate_lcommunity_hash(
68 struct bgp_aggregate
*aggregate
,
69 struct lcommunity
*lcommunity
);
70 extern void bgp_compute_aggregate_lcommunity_val(
71 struct bgp_aggregate
*aggregate
);
73 extern void bgp_remove_lcommunity_from_aggregate(
74 struct bgp_aggregate
*aggregate
,
75 struct lcommunity
*lcommunity
);
76 extern void bgp_remove_lcomm_from_aggregate_hash(
77 struct bgp_aggregate
*aggregate
,
78 struct lcommunity
*lcommunity
);
79 extern void bgp_aggr_lcommunity_remove(void *arg
);
81 #endif /* _QUAGGA_BGP_LCOMMUNITY_H */