]>
git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_lsdb.h
3 * Copyright (C) 1999, 2000 Alex Zinin, Kunihiro Ishiguro, Toshiaki Takada
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef _ZEBRA_OSPF_LSDB_H
23 #define _ZEBRA_OSPF_LSDB_H
25 /* OSPF LSDB structure. */
31 unsigned long count_self
;
32 unsigned int checksum
;
33 struct route_table
*db
;
36 #define MONITOR_LSDB_CHANGE 1 /* XXX */
37 #ifdef MONITOR_LSDB_CHANGE
38 /* Hooks for callback functions to catch every add/del event. */
39 int (* new_lsa_hook
)(struct ospf_lsa
*);
40 int (* del_lsa_hook
)(struct ospf_lsa
*);
41 #endif /* MONITOR_LSDB_CHANGE */
45 #define LSDB_LOOP(T,N,L) \
47 for ((N) = route_top ((T)); ((N)); ((N)) = route_next ((N))) \
48 if (((L) = (N)->info))
50 #define ROUTER_LSDB(A) ((A)->lsdb->type[OSPF_ROUTER_LSA].db)
51 #define NETWORK_LSDB(A) ((A)->lsdb->type[OSPF_NETWORK_LSA].db)
52 #define SUMMARY_LSDB(A) ((A)->lsdb->type[OSPF_SUMMARY_LSA].db)
53 #define ASBR_SUMMARY_LSDB(A) ((A)->lsdb->type[OSPF_ASBR_SUMMARY_LSA].db)
54 #define EXTERNAL_LSDB(O) ((O)->lsdb->type[OSPF_AS_EXTERNAL_LSA].db)
55 #define NSSA_LSDB(A) ((A)->lsdb->type[OSPF_AS_NSSA_LSA].db)
56 #define OPAQUE_LINK_LSDB(A) ((A)->lsdb->type[OSPF_OPAQUE_LINK_LSA].db)
57 #define OPAQUE_AREA_LSDB(A) ((A)->lsdb->type[OSPF_OPAQUE_AREA_LSA].db)
58 #define OPAQUE_AS_LSDB(O) ((O)->lsdb->type[OSPF_OPAQUE_AS_LSA].db)
60 #define AREA_LSDB(A,T) ((A)->lsdb->type[(T)].db)
61 #define AS_LSDB(O,T) ((O)->lsdb->type[(T)].db)
63 /* OSPF LSDB related functions. */
64 extern struct ospf_lsdb
*ospf_lsdb_new (void);
65 extern void ospf_lsdb_init (struct ospf_lsdb
*);
66 extern void ospf_lsdb_free (struct ospf_lsdb
*);
67 extern void ospf_lsdb_cleanup (struct ospf_lsdb
*);
68 extern void ls_prefix_set (struct prefix_ls
*lp
, struct ospf_lsa
*lsa
);
69 extern void ospf_lsdb_add (struct ospf_lsdb
*, struct ospf_lsa
*);
70 extern void ospf_lsdb_delete (struct ospf_lsdb
*, struct ospf_lsa
*);
71 extern void ospf_lsdb_delete_all (struct ospf_lsdb
*);
72 /* Set all stats to -1 (LSA_SPF_NOT_EXPLORED). */
73 extern void ospf_lsdb_clean_stat (struct ospf_lsdb
*lsdb
);
74 extern struct ospf_lsa
*ospf_lsdb_lookup (struct ospf_lsdb
*, struct ospf_lsa
*);
75 extern struct ospf_lsa
*ospf_lsdb_lookup_by_id (struct ospf_lsdb
*, u_char
,
76 struct in_addr
, struct in_addr
);
77 extern struct ospf_lsa
*ospf_lsdb_lookup_by_id_next (struct ospf_lsdb
*, u_char
,
78 struct in_addr
, struct in_addr
,
80 extern unsigned long ospf_lsdb_count_all (struct ospf_lsdb
*);
81 extern unsigned long ospf_lsdb_count (struct ospf_lsdb
*, int);
82 extern unsigned long ospf_lsdb_count_self (struct ospf_lsdb
*, int);
83 extern unsigned int ospf_lsdb_checksum (struct ospf_lsdb
*, int);
84 extern unsigned long ospf_lsdb_isempty (struct ospf_lsdb
*);
86 #endif /* _ZEBRA_OSPF_LSDB_H */