]> git.proxmox.com Git - mirror_frr.git/blob - lib/nexthop_group.h
Merge branch 'master' of https://github.com/frrouting/frr into pmsi-parse-display
[mirror_frr.git] / lib / nexthop_group.h
1 /*
2 * Nexthop Group structure definition.
3 * Copyright (C) 2018 Cumulus Networks, Inc.
4 * Donald Sharp
5 *
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)
9 * any later version.
10 *
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
14 * more details.
15 *
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
19 */
20
21 #ifndef __NEXTHOP_GROUP__
22 #define __NEXTHOP_GROUP__
23
24 /*
25 * What is a nexthop group?
26 *
27 * A nexthop group is a collection of nexthops that make up
28 * the ECMP path for the route.
29 *
30 * This module provides a proper abstraction to this idea.
31 */
32 struct nexthop_group {
33 struct nexthop *nexthop;
34 };
35
36 void nexthop_group_init(void);
37
38 void nexthop_add(struct nexthop **target, struct nexthop *nexthop);
39 void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
40 struct nexthop *rparent);
41
42 /* The following for loop allows to iterate over the nexthop
43 * structure of routes.
44 *
45 * head: The pointer to the first nexthop in the chain.
46 *
47 * nexthop: The pointer to the current nexthop, either in the
48 * top-level chain or in a resolved chain.
49 */
50 #define ALL_NEXTHOPS(head, nhop) \
51 (nhop) = (head.nexthop); \
52 (nhop); \
53 (nhop) = nexthop_next(nhop)
54 #endif