]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_lsdb.h
oops, forgot to update changelog.
[mirror_frr.git] / ospf6d / ospf6_lsdb.h
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 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
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22#ifndef OSPF6_LSDB_H
23#define OSPF6_LSDB_H
24
25#include "prefix.h"
26#include "table.h"
27
718e3744 28struct ospf6_lsdb
29{
30 struct route_table *table;
31 u_int32_t count;
508e53e2 32 void (*hook_add) (struct ospf6_lsa *);
33 void (*hook_remove) (struct ospf6_lsa *);
718e3744 34};
35
508e53e2 36#define LSDB_FOREACH_LSA(vty, func, lsdb) \
37 do { \
38 struct ospf6_lsa *lsa; \
39 for (lsa = ospf6_lsdb_head (lsdb); lsa; \
40 lsa = ospf6_lsdb_next (lsa)) \
41 { \
42 (*(func)) (vty, lsa); \
43 } \
44 } while (0)
45#define LSDB_FOREACH_LSA_T(vty, func, lsdb, type) \
46 do { \
47 struct ospf6_lsa *lsa; \
48 for (lsa = ospf6_lsdb_type_head (type, lsdb); lsa; \
49 lsa = ospf6_lsdb_type_next (type, lsa)) \
50 { \
51 (*(func)) (vty, lsa); \
52 } \
53 } while (0)
54#define LSDB_FOREACH_LSA_I(vty, func, lsdb, id) \
55 do { \
56 struct ospf6_lsa *lsa; \
57 for (lsa = ospf6_lsdb_head (lsdb); lsa; \
58 lsa = ospf6_lsdb_next (lsa)) \
59 { \
60 if (lsa->header->id != id) \
61 continue; \
62 (*(func)) (vty, lsa); \
63 } \
64 } while (0)
65#define LSDB_FOREACH_LSA_R(vty, func, lsdb, router) \
66 do { \
67 struct ospf6_lsa *lsa; \
68 for (lsa = ospf6_lsdb_head (lsdb); lsa; \
69 lsa = ospf6_lsdb_next (lsa)) \
70 { \
71 if (lsa->header->adv_router != router) \
72 continue; \
73 (*(func)) (vty, lsa); \
74 } \
75 } while (0)
76#define LSDB_FOREACH_LSA_TI(vty, func, lsdb, type, id) \
77 do { \
78 struct ospf6_lsa *lsa; \
79 for (lsa = ospf6_lsdb_type_head (type, lsdb); lsa; \
80 lsa = ospf6_lsdb_type_next (type, lsa)) \
81 { \
82 if (lsa->header->id != id) \
83 continue; \
84 (*(func)) (vty, lsa); \
85 } \
86 } while (0)
87#define LSDB_FOREACH_LSA_TR(vty, func, lsdb, type, router) \
88 do { \
89 struct ospf6_lsa *lsa; \
90 for (lsa = ospf6_lsdb_type_router_head (type, router, lsdb); lsa; \
91 lsa = ospf6_lsdb_type_router_next (type, router, lsa)) \
92 { \
93 (*(func)) (vty, lsa); \
94 } \
95 } while (0)
96#define LSDB_FOREACH_LSA_IR(vty, func, lsdb, id, router) \
97 do { \
98 struct ospf6_lsa *lsa; \
99 for (lsa = ospf6_lsdb_head (lsdb); lsa; \
100 lsa = ospf6_lsdb_next (lsa)) \
101 { \
102 if (lsa->header->adv_router != router) \
103 continue; \
104 if (lsa->header->id != id) \
105 continue; \
106 (*(func)) (vty, lsa); \
107 } \
108 } while (0)
109#define LSDB_FOREACH_LSA_TIR(vty, func, lsdb, type, id, router) \
110 do { \
111 struct ospf6_lsa *lsa; \
112 lsa = ospf6_lsdb_lookup (type, id, router, lsdb); \
113 if (lsa) \
114 (*(func)) (vty, lsa); \
115 } while (0)
116
117#define OSPF6_LSDB_MAXAGE_REMOVER(lsdb) \
118 do { \
119 struct ospf6_lsa *lsa; \
120 for (lsa = ospf6_lsdb_head (lsdb); lsa; lsa = ospf6_lsdb_next (lsa)) \
121 { \
122 if (! OSPF6_LSA_IS_MAXAGE (lsa)) \
123 continue; \
3b4cd3a9 124 if (lsa->onretrans != 0) \
508e53e2 125 continue; \
126 if (IS_OSPF6_DEBUG_LSA (TIMER)) \
127 zlog_info (" remove maxage %s", lsa->name); \
128 ospf6_lsdb_remove (lsa, lsdb); \
129 } \
130 } while (0)
718e3744 131
132/* Function Prototypes */
508e53e2 133struct ospf6_lsdb *ospf6_lsdb_create ();
718e3744 134void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
135
508e53e2 136struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id,
137 u_int32_t adv_router,
138 struct ospf6_lsdb *lsdb);
718e3744 139
508e53e2 140void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
141void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
718e3744 142
508e53e2 143struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb);
144struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa);
718e3744 145
508e53e2 146struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type,
147 u_int32_t adv_router,
148 struct ospf6_lsdb *lsdb);
149struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type,
150 u_int32_t adv_router,
151 struct ospf6_lsa *lsa);
152
153struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type,
154 struct ospf6_lsdb *lsdb);
155struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type,
156 struct ospf6_lsa *lsa);
718e3744 157
718e3744 158void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb);
159
508e53e2 160int ospf6_lsdb_show (struct vty *vty, int argc, char **argv,
161 struct ospf6_lsdb *lsdb);
718e3744 162
508e53e2 163#if 0
718e3744 164void ospf6_lsdb_init ();
508e53e2 165void ospf6_lsdb_remove_maxage (struct ospf6_lsdb *lsdb);
166#endif
718e3744 167
168#endif /* OSPF6_LSDB_H */
169
508e53e2 170