paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 28 | struct ospf6_lsdb |
| 29 | { |
| 30 | struct route_table *table; |
| 31 | u_int32_t count; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 32 | void (*hook_add) (struct ospf6_lsa *); |
| 33 | void (*hook_remove) (struct ospf6_lsa *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 34 | }; |
| 35 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 36 | #define OSPF6_LSDB_MAXAGE_REMOVER(lsdb) \ |
| 37 | do { \ |
| 38 | struct ospf6_lsa *lsa; \ |
| 39 | for (lsa = ospf6_lsdb_head (lsdb); lsa; lsa = ospf6_lsdb_next (lsa)) \ |
| 40 | { \ |
| 41 | if (! OSPF6_LSA_IS_MAXAGE (lsa)) \ |
| 42 | continue; \ |
hasso | 3b4cd3a | 2004-05-18 19:28:32 +0000 | [diff] [blame] | 43 | if (lsa->onretrans != 0) \ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 44 | continue; \ |
| 45 | if (IS_OSPF6_DEBUG_LSA (TIMER)) \ |
| 46 | zlog_info (" remove maxage %s", lsa->name); \ |
| 47 | ospf6_lsdb_remove (lsa, lsdb); \ |
| 48 | } \ |
| 49 | } while (0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 50 | |
| 51 | /* Function Prototypes */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 52 | struct ospf6_lsdb *ospf6_lsdb_create (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 53 | void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb); |
| 54 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 55 | struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, |
| 56 | u_int32_t adv_router, |
| 57 | struct ospf6_lsdb *lsdb); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 58 | |
| 59 | void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); |
| 60 | void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 61 | |
| 62 | struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb); |
| 63 | struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa); |
| 64 | |
| 65 | struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type, |
| 66 | u_int32_t adv_router, |
| 67 | struct ospf6_lsdb *lsdb); |
| 68 | struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type, |
| 69 | u_int32_t adv_router, |
| 70 | struct ospf6_lsa *lsa); |
| 71 | |
| 72 | struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type, |
| 73 | struct ospf6_lsdb *lsdb); |
| 74 | struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type, |
| 75 | struct ospf6_lsa *lsa); |
| 76 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 77 | void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb); |
| 78 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 79 | #define OSPF6_LSDB_SHOW_LEVEL_NORMAL 0 |
| 80 | #define OSPF6_LSDB_SHOW_LEVEL_DETAIL 1 |
| 81 | #define OSPF6_LSDB_SHOW_LEVEL_INTERNAL 2 |
| 82 | #define OSPF6_LSDB_SHOW_LEVEL_DUMP 3 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 83 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 84 | void ospf6_lsdb_show |
| 85 | (struct vty *vty, int level, |
| 86 | u_int16_t *type, u_int32_t *id, u_int32_t *adv_router, |
| 87 | struct ospf6_lsdb *lsdb); |
| 88 | |
| 89 | u_int32_t ospf6_new_ls_id |
| 90 | (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb); |
| 91 | u_int32_t ospf6_new_ls_seqnum |
| 92 | (u_int16_t type, u_int32_t id, u_int32_t adv_router, struct ospf6_lsdb *lsdb); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 93 | |
| 94 | #endif /* OSPF6_LSDB_H */ |
| 95 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 96 | |