blob: 6330b91d9d156cc313b0378b2c9a1a9b325e4fd7 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
hasso508e53e2004-05-18 18:57:06 +00002 * Copyright (C) 2003 Yasuhiro Ohara
paul718e3742002-12-13 20:15:29 +00003 *
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
paul718e3742002-12-13 20:15:29 +000028struct ospf6_lsdb
29{
hasso6452df02004-08-15 05:52:07 +000030 void *data; /* data structure that holds this lsdb */
paul718e3742002-12-13 20:15:29 +000031 struct route_table *table;
32 u_int32_t count;
hasso508e53e2004-05-18 18:57:06 +000033 void (*hook_add) (struct ospf6_lsa *);
34 void (*hook_remove) (struct ospf6_lsa *);
paul718e3742002-12-13 20:15:29 +000035};
36
hasso508e53e2004-05-18 18:57:06 +000037#define OSPF6_LSDB_MAXAGE_REMOVER(lsdb) \
38 do { \
39 struct ospf6_lsa *lsa; \
40 for (lsa = ospf6_lsdb_head (lsdb); lsa; lsa = ospf6_lsdb_next (lsa)) \
41 { \
42 if (! OSPF6_LSA_IS_MAXAGE (lsa)) \
43 continue; \
hasso1e058382004-09-01 21:36:14 +000044 if (lsa->retrans_count != 0) \
hasso508e53e2004-05-18 18:57:06 +000045 continue; \
hasso1e058382004-09-01 21:36:14 +000046 if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type)) \
47 zlog_info ("Remove MaxAge %s", lsa->name); \
hasso508e53e2004-05-18 18:57:06 +000048 ospf6_lsdb_remove (lsa, lsdb); \
49 } \
50 } while (0)
paul718e3742002-12-13 20:15:29 +000051
52/* Function Prototypes */
hasso6452df02004-08-15 05:52:07 +000053struct ospf6_lsdb *ospf6_lsdb_create (void *data);
paul718e3742002-12-13 20:15:29 +000054void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
55
hasso2680aa22004-11-25 20:54:46 +000056struct ospf6_lsa *
57ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router,
58 struct ospf6_lsdb *lsdb);
59struct ospf6_lsa *
60ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id,
61 u_int32_t adv_router, struct ospf6_lsdb *lsdb);
paul718e3742002-12-13 20:15:29 +000062
63void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
64void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
hasso508e53e2004-05-18 18:57:06 +000065
66struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb);
67struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa);
68
69struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type,
70 u_int32_t adv_router,
71 struct ospf6_lsdb *lsdb);
72struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type,
73 u_int32_t adv_router,
74 struct ospf6_lsa *lsa);
75
76struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type,
77 struct ospf6_lsdb *lsdb);
78struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type,
79 struct ospf6_lsa *lsa);
80
paul718e3742002-12-13 20:15:29 +000081void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb);
82
hasso049207c2004-08-04 20:02:13 +000083#define OSPF6_LSDB_SHOW_LEVEL_NORMAL 0
84#define OSPF6_LSDB_SHOW_LEVEL_DETAIL 1
85#define OSPF6_LSDB_SHOW_LEVEL_INTERNAL 2
86#define OSPF6_LSDB_SHOW_LEVEL_DUMP 3
paul718e3742002-12-13 20:15:29 +000087
hasso049207c2004-08-04 20:02:13 +000088void ospf6_lsdb_show
89 (struct vty *vty, int level,
90 u_int16_t *type, u_int32_t *id, u_int32_t *adv_router,
91 struct ospf6_lsdb *lsdb);
92
93u_int32_t ospf6_new_ls_id
94 (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
95u_int32_t ospf6_new_ls_seqnum
96 (u_int16_t type, u_int32_t id, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
paul718e3742002-12-13 20:15:29 +000097
98#endif /* OSPF6_LSDB_H */
99
hasso508e53e2004-05-18 18:57:06 +0000100