|
struct ospf_lsa *
ospf_lsa_lookup_by_id (struct ospf_area *area, u_int32_t type,
struct
in_addr id)
{
struct ospf_lsa *lsa;
struct route_node *rn;
struct route_node
*table;
struct prefix_ls lp;
switch (type)
{
case OSPF_ROUTER_LSA:
return ospf_lsdb_lookup_by_id
(area->lsdb, type, id, id);
break;
case OSPF_NETWORK_LSA:
table=area->lsdb->type[type].db;
memset (&lp, 0,
sizeof (struct prefix_ls));
lp.family = 0;
lp.prefixlen = 32;
lp.id = id;
lp.adv_router = id; /* not used */
/* lookup partial
(table,prefix,length) looks for an LSA with a prefix that must be
length bit long and must
begin with prefix*/
rn = route_node_lookup_partial (table,
(struct prefix *) &lp, 64);
if (rn)
{
lsa = rn->info;
route_unlock_node
(rn);
return lsa;
}
return NULL;
break;
[ ... ]
}
|