/src/frr/zebra/zebra_nhg_private.h
Line | Count | Source |
1 | | // SPDX-License-Identifier: GPL-2.0-or-later |
2 | | /* |
3 | | * Nexthop Group Private Functions. |
4 | | * Copyright (C) 2019 Cumulus Networks, Inc. |
5 | | * Stephen Worley |
6 | | */ |
7 | | |
8 | | /** |
9 | | * These functions should only be used internally for nhg_hash_entry |
10 | | * manipulation and in certain special cases. |
11 | | * |
12 | | * Please use `zebra/zebra_nhg.h` for any general nhg_hash_entry api needs. |
13 | | */ |
14 | | |
15 | | #ifndef __ZEBRA_NHG_PRIVATE_H__ |
16 | | #define __ZEBRA_NHG_PRIVATE_H__ |
17 | | |
18 | | #include "zebra/zebra_nhg.h" |
19 | | |
20 | | #ifdef __cplusplus |
21 | | extern "C" { |
22 | | #endif |
23 | | |
24 | | /* Abstraction for connected trees */ |
25 | | struct nhg_connected { |
26 | | struct nhg_connected_tree_item tree_item; |
27 | | struct nhg_hash_entry *nhe; |
28 | | }; |
29 | | |
30 | | static int nhg_connected_cmp(const struct nhg_connected *con1, |
31 | | const struct nhg_connected *con2) |
32 | 0 | { |
33 | 0 | return (con1->nhe->id - con2->nhe->id); |
34 | 0 | } Unexecuted instantiation: connected.c:nhg_connected_cmp Unexecuted instantiation: if_netlink.c:nhg_connected_cmp Unexecuted instantiation: interface.c:nhg_connected_cmp Unexecuted instantiation: ioctl.c:nhg_connected_cmp Unexecuted instantiation: main.c:nhg_connected_cmp Unexecuted instantiation: redistribute.c:nhg_connected_cmp Unexecuted instantiation: rt_netlink.c:nhg_connected_cmp Unexecuted instantiation: rtadv.c:nhg_connected_cmp Unexecuted instantiation: rule_netlink.c:nhg_connected_cmp Unexecuted instantiation: tc_netlink.c:nhg_connected_cmp Unexecuted instantiation: zapi_msg.c:nhg_connected_cmp Unexecuted instantiation: zebra_dplane.c:nhg_connected_cmp Unexecuted instantiation: zebra_l2.c:nhg_connected_cmp Unexecuted instantiation: zebra_l2_bridge_if.c:nhg_connected_cmp Unexecuted instantiation: zebra_evpn.c:nhg_connected_cmp Unexecuted instantiation: zebra_evpn_mac.c:nhg_connected_cmp Unexecuted instantiation: zebra_evpn_neigh.c:nhg_connected_cmp Unexecuted instantiation: zebra_mpls.c:nhg_connected_cmp Unexecuted instantiation: zebra_nb.c:nhg_connected_cmp Unexecuted instantiation: zebra_nb_config.c:nhg_connected_cmp Unexecuted instantiation: zebra_nb_rpcs.c:nhg_connected_cmp Unexecuted instantiation: zebra_nb_state.c:nhg_connected_cmp Unexecuted instantiation: zebra_netns_notify.c:nhg_connected_cmp Unexecuted instantiation: zebra_nhg.c:nhg_connected_cmp Unexecuted instantiation: zebra_ns.c:nhg_connected_cmp Unexecuted instantiation: zebra_ptm.c:nhg_connected_cmp Unexecuted instantiation: zebra_ptm_redistribute.c:nhg_connected_cmp Unexecuted instantiation: zebra_rib.c:nhg_connected_cmp Unexecuted instantiation: zebra_router.c:nhg_connected_cmp Unexecuted instantiation: zebra_rnh.c:nhg_connected_cmp Unexecuted instantiation: zebra_vrf.c:nhg_connected_cmp Unexecuted instantiation: zebra_vty.c:nhg_connected_cmp Unexecuted instantiation: zebra_vxlan.c:nhg_connected_cmp Unexecuted instantiation: zebra_vxlan_if.c:nhg_connected_cmp Unexecuted instantiation: zebra_evpn_mh.c:nhg_connected_cmp Unexecuted instantiation: zebra_neigh.c:nhg_connected_cmp |
35 | | |
36 | | DECLARE_RBTREE_UNIQ(nhg_connected_tree, struct nhg_connected, tree_item, |
37 | | nhg_connected_cmp); |
38 | | |
39 | | /* nhg connected tree direct access functions */ |
40 | | extern void nhg_connected_tree_init(struct nhg_connected_tree_head *head); |
41 | | extern void nhg_connected_tree_free(struct nhg_connected_tree_head *head); |
42 | | extern bool |
43 | | nhg_connected_tree_is_empty(const struct nhg_connected_tree_head *head); |
44 | | extern struct nhg_connected * |
45 | | nhg_connected_tree_root(struct nhg_connected_tree_head *head); |
46 | | |
47 | | /* I realize _add/_del returns are backwords. |
48 | | * |
49 | | * Currently the list APIs are not standardized for what happens in |
50 | | * the _del() function when the item isn't present. |
51 | | * |
52 | | * We are choosing to return NULL if not found in the _del case for now. |
53 | | */ |
54 | | |
55 | | /* Delete NHE from the tree. On success, return the NHE, otherwise NULL. */ |
56 | | extern struct nhg_hash_entry * |
57 | | nhg_connected_tree_del_nhe(struct nhg_connected_tree_head *head, |
58 | | struct nhg_hash_entry *nhe); |
59 | | /* ADD NHE to the tree. On success, return NULL, otherwise return the NHE. */ |
60 | | extern struct nhg_hash_entry * |
61 | | nhg_connected_tree_add_nhe(struct nhg_connected_tree_head *head, |
62 | | struct nhg_hash_entry *nhe); |
63 | | |
64 | | #ifdef __cplusplus |
65 | | } |
66 | | #endif |
67 | | |
68 | | #endif /* __ZEBRA_NHG_PRIVATE_H__ */ |