]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_lsdb.h
Merge pull request #794 from opensourcerouting/table-hash-ospf6-lsdb-refactor
[mirror_frr.git] / ospf6d / ospf6_lsdb.h
1 /*
2 * Copyright (C) 2003 Yasuhiro Ohara
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra 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 * GNU Zebra 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
21 #ifndef OSPF6_LSDB_H
22 #define OSPF6_LSDB_H
23
24 #include "prefix.h"
25 #include "table.h"
26 #include "ospf6_route.h"
27
28 struct ospf6_lsdb
29 {
30 void *data; /* data structure that holds this lsdb */
31 struct route_table *table;
32 u_int32_t count;
33 void (*hook_add) (struct ospf6_lsa *);
34 void (*hook_remove) (struct ospf6_lsa *);
35 };
36
37 /* Function Prototypes */
38 extern struct ospf6_lsdb *ospf6_lsdb_create (void *data);
39 extern void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
40
41 extern struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id,
42 u_int32_t adv_router,
43 struct ospf6_lsdb *lsdb);
44 extern struct ospf6_lsa *ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id,
45 u_int32_t adv_router,
46 struct ospf6_lsdb *lsdb);
47
48 extern void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
49 extern void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
50
51 extern const struct route_node *ospf6_lsdb_head (
52 struct ospf6_lsdb *lsdb,
53 int argmode,
54 uint16_t type,
55 uint32_t adv_router,
56 struct ospf6_lsa **lsa);
57 extern struct ospf6_lsa *ospf6_lsdb_next (const struct route_node *iterend,
58 struct ospf6_lsa *lsa);
59
60 #define ALL_LSDB_TYPED_ADVRTR(lsdb, type, adv_router, lsa) \
61 const struct route_node *iterend = \
62 ospf6_lsdb_head(lsdb, 2, type, adv_router, &lsa); \
63 lsa; \
64 lsa = ospf6_lsdb_next(iterend, lsa)
65
66 #define ALL_LSDB_TYPED(lsdb, type, lsa) \
67 const struct route_node *iterend = \
68 ospf6_lsdb_head(lsdb, 1, type, 0, &lsa); \
69 lsa; \
70 lsa = ospf6_lsdb_next(iterend, lsa)
71
72 #define ALL_LSDB(lsdb, lsa) \
73 const struct route_node *iterend = \
74 ospf6_lsdb_head(lsdb, 0, 0, 0, &lsa); \
75 lsa; \
76 lsa = ospf6_lsdb_next(iterend, lsa)
77
78 extern void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb);
79 extern void ospf6_lsdb_lsa_unlock (struct ospf6_lsa *lsa);
80
81 enum ospf_lsdb_show_level {
82 OSPF6_LSDB_SHOW_LEVEL_NORMAL = 0,
83 OSPF6_LSDB_SHOW_LEVEL_DETAIL,
84 OSPF6_LSDB_SHOW_LEVEL_INTERNAL,
85 OSPF6_LSDB_SHOW_LEVEL_DUMP,
86 };
87
88 extern void ospf6_lsdb_show (struct vty *vty,
89 enum ospf_lsdb_show_level level, u_int16_t *type,
90 u_int32_t *id, u_int32_t *adv_router,
91 struct ospf6_lsdb *lsdb);
92
93 extern u_int32_t ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router,
94 struct ospf6_lsdb *lsdb);
95 extern u_int32_t ospf6_new_ls_seqnum (u_int16_t type, u_int32_t id,
96 u_int32_t adv_router,
97 struct ospf6_lsdb *lsdb);
98 extern int ospf6_lsdb_maxage_remover (struct ospf6_lsdb *lsdb);
99
100 #endif /* OSPF6_LSDB_H */