paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2002 Yasuhiro Ohara |
| 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 | |
| 28 | #include "ospf6_prefix.h" |
| 29 | #include "ospf6_lsa.h" |
| 30 | |
| 31 | struct ospf6_lsdb_node |
| 32 | { |
| 33 | struct prefix_ipv6 key; |
| 34 | |
| 35 | struct route_node *node; |
| 36 | struct route_node *next; |
| 37 | |
| 38 | struct ospf6_lsa *lsa; |
| 39 | }; |
| 40 | |
| 41 | struct ospf6_lsdb |
| 42 | { |
| 43 | struct route_table *table; |
| 44 | u_int32_t count; |
| 45 | void (*hook) (struct ospf6_lsa *); |
| 46 | }; |
| 47 | |
| 48 | /* int ospf6_lsdb_is_end (struct ospf6_lsdb_node *lsdb_node); */ |
| 49 | #define ospf6_lsdb_is_end(lsdb_node) ((lsdb_node)->node == NULL ? 1 : 0) |
| 50 | |
| 51 | /* global holding hooks for each LS type */ |
| 52 | struct ospf6_lsdb_hook_t |
| 53 | { |
| 54 | void (*hook) (struct ospf6_lsa *old, struct ospf6_lsa *new); |
| 55 | }; |
| 56 | extern struct ospf6_lsdb_hook_t *ospf6_lsdb_hook; |
| 57 | |
| 58 | /* Function Prototypes */ |
| 59 | struct ospf6_lsdb * ospf6_lsdb_create (); |
| 60 | void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb); |
| 61 | |
| 62 | void ospf6_lsdb_remove_maxage (struct ospf6_lsdb *lsdb); |
| 63 | |
| 64 | struct ospf6_lsa * |
| 65 | ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router, |
| 66 | void *scope); |
| 67 | |
| 68 | void ospf6_lsdb_install (struct ospf6_lsa *new); |
| 69 | |
| 70 | void ospf6_lsdb_head (struct ospf6_lsdb_node *node, struct ospf6_lsdb *lsdb); |
| 71 | void ospf6_lsdb_type (struct ospf6_lsdb_node *node, u_int16_t type, |
| 72 | struct ospf6_lsdb *lsdb); |
| 73 | void ospf6_lsdb_type_router (struct ospf6_lsdb_node *node, u_int16_t type, |
| 74 | u_int32_t adv_router, struct ospf6_lsdb *lsdb); |
| 75 | void ospf6_lsdb_next (struct ospf6_lsdb_node *node); |
| 76 | |
| 77 | void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); |
| 78 | void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); |
| 79 | void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb); |
| 80 | |
| 81 | struct ospf6_lsa * |
| 82 | ospf6_lsdb_lookup_lsdb (u_int16_t type, u_int32_t id, u_int32_t adv_router, |
| 83 | struct ospf6_lsdb *lsdb); |
| 84 | |
| 85 | void ospf6_lsdb_init (); |
| 86 | |
| 87 | #endif /* OSPF6_LSDB_H */ |
| 88 | |