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 | { |
hasso | 6452df0 | 2004-08-15 05:52:07 +0000 | [diff] [blame] | 30 | void *data; /* data structure that holds this lsdb */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 31 | struct route_table *table; |
| 32 | u_int32_t count; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 33 | void (*hook_add) (struct ospf6_lsa *); |
| 34 | void (*hook_remove) (struct ospf6_lsa *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 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; \ |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 44 | if (lsa->retrans_count != 0) \ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 45 | continue; \ |
hasso | 1e05838 | 2004-09-01 21:36:14 +0000 | [diff] [blame] | 46 | if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type)) \ |
ajs | d1db06f | 2004-12-08 22:01:48 +0000 | [diff] [blame] | 47 | zlog_debug ("Remove MaxAge %s", lsa->name); \ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 48 | ospf6_lsdb_remove (lsa, lsdb); \ |
| 49 | } \ |
| 50 | } while (0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 51 | |
| 52 | /* Function Prototypes */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 53 | extern struct ospf6_lsdb *ospf6_lsdb_create (void *data); |
| 54 | extern void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 56 | extern struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, |
| 57 | u_int32_t adv_router, |
| 58 | struct ospf6_lsdb *lsdb); |
| 59 | extern struct ospf6_lsa *ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, |
| 60 | u_int32_t adv_router, |
| 61 | struct ospf6_lsdb *lsdb); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 62 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 63 | extern void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); |
| 64 | extern void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 65 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 66 | extern struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb); |
| 67 | extern struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 68 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 69 | extern struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 70 | u_int32_t adv_router, |
| 71 | struct ospf6_lsdb *lsdb); |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 72 | extern struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type, |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 73 | u_int32_t adv_router, |
| 74 | struct ospf6_lsa *lsa); |
| 75 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 76 | extern struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type, |
| 77 | struct ospf6_lsdb *lsdb); |
| 78 | extern struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type, |
| 79 | struct ospf6_lsa *lsa); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 80 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 81 | extern void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 82 | |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 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 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 87 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 88 | extern void ospf6_lsdb_show (struct vty *vty, int level, u_int16_t *type, |
| 89 | u_int32_t *id, u_int32_t *adv_router, |
| 90 | struct ospf6_lsdb *lsdb); |
hasso | 049207c | 2004-08-04 20:02:13 +0000 | [diff] [blame] | 91 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 92 | extern u_int32_t ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router, |
| 93 | struct ospf6_lsdb *lsdb); |
| 94 | extern u_int32_t ospf6_new_ls_seqnum (u_int16_t type, u_int32_t id, |
| 95 | u_int32_t adv_router, |
| 96 | struct ospf6_lsdb *lsdb); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 97 | |
| 98 | #endif /* OSPF6_LSDB_H */ |