2 * Nexthop Group Private Functions.
3 * Copyright (C) 2019 Cumulus Networks, Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * These functions should only be used internally for nhg_hash_entry
23 * manipulation and in certain special cases.
25 * Please use `zebra/zebra_nhg.h` for any general nhg_hash_entry api needs.
28 #ifndef __ZEBRA_NHG_PRIVATE_H__
29 #define __ZEBRA_NHG_PRIVATE_H__
31 #include "zebra/zebra_nhg.h"
33 /* Abstraction for connected trees */
34 struct nhg_connected
{
35 struct nhg_connected_tree_item tree_item
;
36 struct nhg_hash_entry
*nhe
;
39 static int nhg_connected_cmp(const struct nhg_connected
*con1
,
40 const struct nhg_connected
*con2
)
42 return (con1
->nhe
->id
- con2
->nhe
->id
);
45 DECLARE_RBTREE_UNIQ(nhg_connected_tree
, struct nhg_connected
, tree_item
,
48 /* nhg connected tree direct access functions */
49 extern void nhg_connected_tree_init(struct nhg_connected_tree_head
*head
);
50 extern void nhg_connected_tree_free(struct nhg_connected_tree_head
*head
);
52 nhg_connected_tree_is_empty(const struct nhg_connected_tree_head
*head
);
53 extern struct nhg_connected
*
54 nhg_connected_tree_root(struct nhg_connected_tree_head
*head
);
55 extern void nhg_connected_tree_del_nhe(struct nhg_connected_tree_head
*head
,
56 struct nhg_hash_entry
*nhe
);
57 extern void nhg_connected_tree_add_nhe(struct nhg_connected_tree_head
*head
,
58 struct nhg_hash_entry
*nhe
);
60 #endif /* __ZEBRA_NHG_PRIVATE_H__ */