summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_lsdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_lsdb.c')
-rw-r--r--ospfd/ospf_lsdb.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c
index 71a98ddc..46d8d705 100644
--- a/ospfd/ospf_lsdb.c
+++ b/ospfd/ospf_lsdb.c
@@ -282,3 +282,18 @@ ospf_lsdb_isempty (struct ospf_lsdb *lsdb)
{
return (lsdb->total == 0);
}
+
+struct ospf_lsa *
+foreach_lsa (struct route_table *table, void *p_arg, int int_arg,
+ int (*callback) (struct ospf_lsa *, void *, int))
+{
+ struct route_node *rn;
+ struct ospf_lsa *lsa;
+
+ for (rn = route_top (table); rn; rn = route_next (rn))
+ if ((lsa = rn->info) != NULL)
+ if (callback (lsa, p_arg, int_arg))
+ return lsa;
+
+ return NULL;
+}