]> git.proxmox.com Git - mirror_frr.git/blame - lib/agg_table.c
Merge pull request #13278 from FRRouting/mergify/bp/stable/8.5/pr-13269
[mirror_frr.git] / lib / agg_table.c
CommitLineData
8e1f6512
DS
1/*
2 * Aggregate Route
3 * Copyright (C) 2018 Cumulus Networks, Inc.
4 * Donald Sharp
5 *
6 * FRR 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
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * FRR is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for 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#include "zebra.h"
21
22#include "agg_table.h"
23
24
25static struct route_node *agg_node_create(route_table_delegate_t *delegate,
26 struct route_table *table)
27{
28 struct agg_node *node;
29
30 node = XCALLOC(MTYPE_TMP, sizeof(struct agg_node));
31
32 return agg_node_to_rnode(node);
33}
34
35static void agg_node_destroy(route_table_delegate_t *delegate,
36 struct route_table *table, struct route_node *node)
37
38{
39 struct agg_node *anode = agg_node_from_rnode(node);
40
41 XFREE(MTYPE_TMP, anode);
42}
43
1b3e9a21 44static route_table_delegate_t agg_table_delegate = {
8e1f6512
DS
45 .create_node = agg_node_create,
46 .destroy_node = agg_node_destroy,
47};
48
49struct agg_table *agg_table_init(void)
50{
51 struct agg_table *at;
52
53 at = XCALLOC(MTYPE_TMP, sizeof(struct agg_table));
54
55 at->route_table = route_table_init_with_delegate(&agg_table_delegate);
6ca30e9e 56 route_table_set_info(at->route_table, at);
8e1f6512
DS
57
58 return at;
59}