K2.6 patches and update.
[tomato.git] / release / src / router / zebra / ospf6d / ospf6_lsdb.h
blob6330b91d9d156cc313b0378b2c9a1a9b325e4fd7
1 /*
2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
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.
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.
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.
22 #ifndef OSPF6_LSDB_H
23 #define OSPF6_LSDB_H
25 #include "prefix.h"
26 #include "table.h"
28 struct ospf6_lsdb
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 *);
37 #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; \
44 if (lsa->retrans_count != 0) \
45 continue; \
46 if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type)) \
47 zlog_info ("Remove MaxAge %s", lsa->name); \
48 ospf6_lsdb_remove (lsa, lsdb); \
49 } \
50 } while (0)
52 /* Function Prototypes */
53 struct ospf6_lsdb *ospf6_lsdb_create (void *data);
54 void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
56 struct ospf6_lsa *
57 ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router,
58 struct ospf6_lsdb *lsdb);
59 struct ospf6_lsa *
60 ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id,
61 u_int32_t adv_router, struct ospf6_lsdb *lsdb);
63 void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
64 void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
66 struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb);
67 struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa);
69 struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type,
70 u_int32_t adv_router,
71 struct ospf6_lsdb *lsdb);
72 struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type,
73 u_int32_t adv_router,
74 struct ospf6_lsa *lsa);
76 struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type,
77 struct ospf6_lsdb *lsdb);
78 struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type,
79 struct ospf6_lsa *lsa);
81 void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb);
83 #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
88 void 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);
93 u_int32_t ospf6_new_ls_id
94 (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
95 u_int32_t ospf6_new_ls_seqnum
96 (u_int16_t type, u_int32_t id, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
98 #endif /* OSPF6_LSDB_H */