本文整理汇总了C++中route_top函数的典型用法代码示例。如果您正苦于以下问题:C++ route_top函数的具体用法?C++ route_top怎么用?C++ route_top使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了route_top函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ripng_if_down
static int
ripng_if_down (struct interface *ifp)
{
struct route_node *rp;
struct ripng_info *rinfo;
struct ripng_interface *ri;
struct list *list = NULL;
struct listnode *listnode = NULL, *nextnode = NULL;
if (ripng)
for (rp = route_top (ripng->table); rp; rp = route_next (rp))
if ((list = rp->info) != NULL)
for (ALL_LIST_ELEMENTS (list, listnode, nextnode, rinfo))
if (rinfo->ifindex == ifp->ifindex)
ripng_ecmp_delete (rinfo);
ri = ifp->info;
if (ri->running)
{
if (IS_RIPNG_DEBUG_EVENT)
zlog_debug ("turn off %s", ifp->name);
/* Leave from multicast group. */
ripng_multicast_leave (ifp);
ri->running = 0;
}
return 0;
}
开发者ID:KaloNK,项目名称:quagga,代码行数:31,代码来源:ripng_interface.c
示例2: ospf_area_range_lookup_next
struct ospf_area_range *
ospf_area_range_lookup_next (struct ospf_area *area, struct in_addr *range_net,
int first)
{
struct route_node *rn;
struct prefix_ipv4 p;
struct ospf_area_range *find;
p.family = AF_INET;
p.prefixlen = IPV4_MAX_BITLEN;
p.prefix = *range_net;
if (first)
rn = route_top (area->ranges);
else
{
rn = route_node_get (area->ranges, (struct prefix *) &p);
rn = route_next (rn);
}
for (; rn; rn = route_next (rn))
if (rn->info)
break;
if (rn && rn->info)
{
find = rn->info;
*range_net = rn->p.u.prefix4;
route_unlock_node (rn);
return find;
}
return NULL;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:33,代码来源:ospf_abr.c
示例3: ospf_abr_prepare_aggregates
void
ospf_abr_prepare_aggregates (struct ospf *ospf)
{
listnode node;
struct route_node *rn;
struct ospf_area_range *range;
if (IS_DEBUG_OSPF_EVENT)
zlog_info ("ospf_abr_prepare_aggregates(): Start");
for (node = listhead (ospf->areas); node; nextnode (node))
{
struct ospf_area *area = getdata (node);
for (rn = route_top (area->ranges); rn; rn = route_next (rn))
if ((range = rn->info) != NULL)
{
range->cost = 0;
range->specifics = 0;
}
}
if (IS_DEBUG_OSPF_EVENT)
zlog_info ("ospf_abr_prepare_aggregates(): Stop");
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:25,代码来源:ospf_abr.c
示例4: zebra_cleanup_rnh_client
int
zebra_cleanup_rnh_client (vrf_id_t vrfid, int family, struct zserv *client)
{
struct route_table *ntable;
struct route_node *nrn;
struct rnh *rnh;
ntable = lookup_rnh_table(vrfid, family);
if (!ntable)
{
zlog_debug("cleanup_rnh_client: rnh table not found\n");
return -1;
}
for (nrn = route_top (ntable); nrn; nrn = route_next (nrn))
{
if (!nrn->info)
continue;
rnh = nrn->info;
if (IS_ZEBRA_DEBUG_NHT)
{
char bufn[INET6_ADDRSTRLEN];
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
zlog_debug("rnh %s - cleaning state for client %s", bufn,
zebra_route_string(client->proto));
}
zebra_remove_rnh_client(rnh, client);
}
return 1;
}
开发者ID:Quagga,项目名称:quagga,代码行数:31,代码来源:zebra_rnh.c
示例5: zebra_dispatch_rnh_table
int
zebra_dispatch_rnh_table (vrf_id_t vrfid, int family, struct zserv *client)
{
struct route_table *ntable;
struct route_node *nrn;
struct rnh *rnh;
ntable = lookup_rnh_table(vrfid, family);
if (!ntable)
{
zlog_debug("dispatch_rnh_table: rnh table not found\n");
return -1;
}
for (nrn = route_top (ntable); nrn; nrn = route_next (nrn))
{
if (!nrn->info)
continue;
rnh = nrn->info;
if (IS_ZEBRA_DEBUG_NHT)
{
char bufn[INET6_ADDRSTRLEN];
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
zlog_debug("rnh %s - sending nexthop %s event to client %s", bufn,
rnh->state ? "reachable" : "unreachable",
zebra_route_string(client->proto));
}
send_client(rnh, client, vrfid);
}
return 1;
}
开发者ID:Quagga,项目名称:quagga,代码行数:32,代码来源:zebra_rnh.c
示例6: ospf_interface_delete
static int
ospf_interface_delete (int command, struct zclient *zclient,
zebra_size_t length)
{
struct interface *ifp;
struct stream *s;
struct route_node *rn;
s = zclient->ibuf;
/* zebra_interface_state_read() updates interface structure in iflist */
ifp = zebra_interface_state_read (s);
if (ifp == NULL)
return 0;
if (if_is_up (ifp))
zlog_warn ("Zebra: got delete of %s, but interface is still up",
ifp->name);
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug
("Zebra: interface delete %s index %d flags %llx metric %d mtu %d",
ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
#ifdef HAVE_SNMP
ospf_snmp_if_delete (ifp);
#endif /* HAVE_SNMP */
for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
if (rn->info)
ospf_if_free ((struct ospf_interface *) rn->info);
ifp->ifindex = IFINDEX_INTERNAL;
return 0;
}
开发者ID:LabNConsulting,项目名称:OLD-quagga-patches,代码行数:35,代码来源:ospf_zebra.c
示例7: ospf_interface_state_down
static int
ospf_interface_state_down (int command, struct zclient *zclient,
zebra_size_t length)
{
struct interface *ifp;
struct ospf_interface *oi;
struct route_node *node;
ifp = zebra_interface_state_read (zclient->ibuf);
if (ifp == NULL)
return 0;
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: Interface[%s] state change to down.", ifp->name);
for (node = route_top (IF_OIFS (ifp)); node; node = route_next (node))
{
if ((oi = node->info) == NULL)
continue;
ospf_if_down (oi);
}
return 0;
}
开发者ID:LabNConsulting,项目名称:OLD-quagga-patches,代码行数:25,代码来源:ospf_zebra.c
示例8: ospf_renegotiate_optional_capabilities
void ospf_renegotiate_optional_capabilities(struct ospf *top)
{
struct listnode *node;
struct ospf_interface *oi;
struct route_table *nbrs;
struct route_node *rn;
struct ospf_neighbor *nbr;
/* At first, flush self-originated LSAs from routing domain. */
ospf_flush_self_originated_lsas_now(top);
/* Revert all neighbor status to ExStart. */
for (ALL_LIST_ELEMENTS_RO(top->oiflist, node, oi)) {
if ((nbrs = oi->nbrs) == NULL)
continue;
for (rn = route_top(nbrs); rn; rn = route_next(rn)) {
if ((nbr = rn->info) == NULL || nbr == oi->nbr_self)
continue;
if (nbr->state < NSM_ExStart)
continue;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug
("Renegotiate optional capabilities with neighbor(%s)",
inet_ntoa(nbr->router_id));
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_SeqNumberMismatch);
}
}
return;
}
开发者ID:yubo,项目名称:quagga,代码行数:34,代码来源:ospf_neighbor.c
示例9: ospf_if_cleanup
/* Restore an interface to its pre UP state
Used from ism_interface_down only */
void
ospf_if_cleanup (struct ospf_interface *oi)
{
struct route_node *rn;
struct listnode *node, *nnode;
struct ospf_neighbor *nbr;
struct ospf_nbr_nbma *nbr_nbma;
struct ospf_lsa *lsa;
/* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
/* delete all static neighbors attached to this interface */
for (ALL_LIST_ELEMENTS (oi->nbr_nbma, node, nnode, nbr_nbma))
{
OSPF_POLL_TIMER_OFF (nbr_nbma->t_poll);
if (nbr_nbma->nbr)
{
nbr_nbma->nbr->nbr_nbma = NULL;
nbr_nbma->nbr = NULL;
}
nbr_nbma->oi = NULL;
listnode_delete (oi->nbr_nbma, nbr_nbma);
}
/* send Neighbor event KillNbr to all associated neighbors. */
for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info) != NULL)
if (nbr != oi->nbr_self)
OSPF_NSM_EVENT_EXECUTE (nbr, NSM_KillNbr);
/* Cleanup Link State Acknowlegdment list. */
for (ALL_LIST_ELEMENTS (oi->ls_ack, node, nnode, lsa))
ospf_lsa_unlock (&lsa); /* oi->ls_ack */
list_delete_all_node (oi->ls_ack);
oi->crypt_seqnum = 0;
/* Empty link state update queue */
ospf_ls_upd_queue_empty (oi);
/* Reset pseudo neighbor. */
ospf_nbr_delete (oi->nbr_self);
oi->nbr_self = ospf_nbr_new (oi);
ospf_nbr_add_self (oi);
ospf_lsa_unlock (&oi->network_lsa_self);
oi->network_lsa_self = NULL;
OSPF_TIMER_OFF (oi->t_network_lsa_self);
#ifdef HAVE_GRACEFUL_RESTART
THREAD_TIMER_OFF(oi->t_opaque_lsa_refresh);
oi->v_opaque_lsa_count = 0 ;
#endif
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:57,代码来源:ospf_interface.c
示例10: isis_redist_set
static void
isis_redist_set(struct isis_area *area, int level,
int family, int type, uint32_t metric,
const char *routemap, int originate_type)
{
int protocol = redist_protocol(family);
struct isis_redist *redist = get_redist_settings(area, family, type, level);
int i;
struct route_table *ei_table;
struct route_node *rn;
struct isis_ext_info *info;
redist->redist = (type == DEFAULT_ROUTE) ? originate_type : 1;
redist->metric = metric;
isis_redist_routemap_set(redist, routemap);
if (!area->ext_reach[protocol][level-1])
{
area->ext_reach[protocol][level-1] =
route_table_init_with_delegate(&isis_redist_rt_delegate);
}
for (i = 0; i < REDIST_PROTOCOL_COUNT; i++)
if (!area->isis->ext_info[i])
{
area->isis->ext_info[i] =
route_table_init_with_delegate(&isis_redist_rt_delegate);
}
isis_redist_update_zebra_subscriptions(area->isis);
if (type == DEFAULT_ROUTE && originate_type == DEFAULT_ORIGINATE_ALWAYS)
isis_redist_ensure_default(area->isis, family);
ei_table = get_ext_info(area->isis, family);
for (rn = route_top(ei_table); rn; rn = route_next(rn))
{
if (!rn->info)
continue;
info = rn->info;
if (type == DEFAULT_ROUTE)
{
if (!is_default(&rn->p))
continue;
}
else
{
if (info->origin != type)
continue;
}
isis_redist_update_ext_reach(area, level, redist, &rn->p, info);
}
}
开发者ID:ColinBS,项目名称:quagga-rtrlib,代码行数:55,代码来源:isis_redist.c
示例11: ripng_if_down
static int
ripng_if_down (struct interface *ifp)
{
struct route_node *rp;
struct ripng_info *rinfo;
struct ripng_interface *ri;
if (ripng)
{
for (rp = route_top (ripng->table); rp; rp = route_next (rp))
if ((rinfo = rp->info) != NULL)
{
/* Routes got through this interface. */
if (rinfo->ifindex == ifp->ifindex
&& rinfo->type == ZEBRA_ROUTE_RIPNG
&& rinfo->sub_type == RIPNG_ROUTE_RTE)
{
ripng_zebra_ipv6_delete ((struct prefix_ipv6 *) &rp->p,
&rinfo->nexthop,
rinfo->ifindex);
ripng_redistribute_delete (rinfo->type, rinfo->sub_type,
(struct prefix_ipv6 *)&rp->p,
rinfo->ifindex);
}
else
{
/* All redistributed routes got through this interface,
* but the static and system ones are kept. */
if ((rinfo->ifindex == ifp->ifindex) &&
(rinfo->type != ZEBRA_ROUTE_STATIC) &&
(rinfo->type != ZEBRA_ROUTE_SYSTEM))
ripng_redistribute_delete (rinfo->type, rinfo->sub_type,
(struct prefix_ipv6 *) &rp->p,
rinfo->ifindex);
}
}
}
ri = ifp->info;
if (ri->running)
{
if (IS_RIPNG_DEBUG_EVENT)
zlog_debug ("turn off %s", ifp->name);
/* Leave from multicast group. */
ripng_multicast_leave (ifp);
ri->running = 0;
}
return 0;
}
开发者ID:Quagga-RE,项目名称:wip-tcs-rfc6506,代码行数:54,代码来源:ripng_interface.c
示例12: vrf_first
/* Return the iterator of the first VRF. */
vrf_iter_t
vrf_first (void)
{
struct route_node *rn;
for (rn = route_top (vrf_table); rn; rn = route_next (rn))
if (rn->info)
{
route_unlock_node (rn); /* top/next */
return (vrf_iter_t)rn;
}
return VRF_ITER_INVALID;
}
开发者ID:AT-Corp,项目名称:quagga-atc,代码行数:14,代码来源:vrf.c
示例13: route_table_unlock
void
route_table_unlock(struct route_table *t)
{
struct route_node *node;
for (node = route_top(t); node != NULL; node = route_next(node)) {
if (node == NULL) {
break;
}
if (node->lock > 0)
node->lock--;
}
}
开发者ID:adjih,项目名称:rosandtech-rpld,代码行数:13,代码来源:table.c
示例14: ospf_if_reset
/* Simulate down/up on the interface. This is needed, for example, when
the MTU changes. */
void ospf_if_reset(struct interface *ifp)
{
struct route_node *rn;
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
struct ospf_interface *oi;
if ((oi = rn->info) == NULL)
continue;
ospf_if_down(oi);
ospf_if_up(oi);
}
}
开发者ID:yubo,项目名称:quagga,代码行数:16,代码来源:ospf_interface.c
示例15: ospf_if_update_params
void ospf_if_update_params(struct interface *ifp, struct in_addr addr)
{
struct route_node *rn;
struct ospf_interface *oi;
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
if ((oi = rn->info) == NULL)
continue;
if (IPV4_ADDR_SAME(&oi->address->u.prefix4, &addr))
oi->params =
ospf_lookup_if_params(ifp, oi->address->u.prefix4);
}
}
开发者ID:yubo,项目名称:quagga,代码行数:14,代码来源:ospf_interface.c
示例16:
struct ospf_neighbor *ospf_nbr_lookup_by_routerid(struct route_table *nbrs,
struct in_addr *id)
{
struct route_node *rn;
struct ospf_neighbor *nbr;
for (rn = route_top(nbrs); rn; rn = route_next(rn))
if ((nbr = rn->info) != NULL)
if (IPV4_ADDR_SAME(&nbr->router_id, id)) {
route_unlock_node(rn);
return nbr;
}
return NULL;
}
开发者ID:yubo,项目名称:quagga,代码行数:15,代码来源:ospf_neighbor.c
示例17: ospf_nbr_count
/* Get neighbor count by status.
Specify status = 0, get all neighbor other than myself. */
int ospf_nbr_count(struct ospf_interface *oi, int state)
{
struct ospf_neighbor *nbr;
struct route_node *rn;
int count = 0;
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn))
if ((nbr = rn->info))
if (!IPV4_ADDR_SAME
(&nbr->router_id, &oi->ospf->router_id))
if (state == 0 || nbr->state == state)
count++;
return count;
}
开发者ID:yubo,项目名称:quagga,代码行数:17,代码来源:ospf_neighbor.c
示例18: ospf_dr_change
/* Generate AdjOK? NSM event. */
static void
ospf_dr_change (struct ospf *ospf, struct route_table *nbrs)
{
struct route_node *rn;
struct ospf_neighbor *nbr;
for (rn = route_top (nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info) != NULL)
/* Ignore 0.0.0.0 node*/
if (nbr->router_id.s_addr != 0)
/* Is neighbor upper 2-Way? */
if (nbr->state >= NSM_TwoWay)
/* Ignore myself. */
if (!IPV4_ADDR_SAME (&nbr->router_id, &ospf->router_id))
OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_AdjOK);
}
开发者ID:ColinBS,项目名称:quagga-rtrlib,代码行数:17,代码来源:ospf_ism.c
示例19: ospf_dr_eligible_routers
static void
ospf_dr_eligible_routers (struct route_table *nbrs, struct list *el_list)
{
struct route_node *rn;
struct ospf_neighbor *nbr;
for (rn = route_top (nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info) != NULL)
/* Ignore 0.0.0.0 node*/
if (nbr->router_id.s_addr != 0)
/* Is neighbor eligible? */
if (nbr->priority > 0)
/* Is neighbor upper 2-Way? */
if (nbr->state >= NSM_TwoWay)
listnode_add (el_list, nbr);
}
开发者ID:ColinBS,项目名称:quagga-rtrlib,代码行数:16,代码来源:ospf_ism.c
示例20: ospf_nbr_count_opaque_capable
int
ospf_nbr_count_opaque_capable (struct ospf_interface *oi)
{
struct ospf_neighbor *nbr;
struct route_node *rn;
int count = 0;
for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info))
if (!IPV4_ADDR_SAME (&nbr->router_id, &oi->ospf->router_id))
if (nbr->state == NSM_Full)
if (CHECK_FLAG (nbr->options, OSPF_OPTION_O))
count++;
return count;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:16,代码来源:ospf_neighbor.c
注:本文中的route_top函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论