当前位置: 首页>>代码示例>>C++>>正文


C++ route_next函数代码示例

本文整理汇总了C++中route_next函数的典型用法代码示例。如果您正苦于以下问题:C++ route_next函数的具体用法?C++ route_next怎么用?C++ route_next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了route_next函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: vrf_iterator

/* Return the VRF iterator of the given VRF ID. If it does not exist,
 * the iterator of the next existing VRF is returned. */
vrf_iter_t
vrf_iterator (vrf_id_t vrf_id)
{
  struct prefix p;
  struct route_node *rn;

  vrf_build_key (vrf_id, &p);
  rn = route_node_get (vrf_table, &p);
  if (rn->info)
    {
      /* OK, the VRF exists. */
      route_unlock_node (rn); /* get */
      return (vrf_iter_t)rn;
    }

  /* Find the next VRF. */
  for (rn = route_next (rn); rn; rn = route_next (rn))
    if (rn->info)
      {
        route_unlock_node (rn); /* next */
        return (vrf_iter_t)rn;
      }

  return VRF_ITER_INVALID;
}
开发者ID:AT-Corp,项目名称:quagga-atc,代码行数:27,代码来源:vrf.c

示例3: rip_ifaddr_lookup_next

struct interface *
rip_ifaddr_lookup_next (struct in_addr *addr)
{
  struct prefix_ipv4 p;
  struct route_node *rn;
  struct interface *ifp;

  p.family = AF_INET;
  p.prefixlen = IPV4_MAX_BITLEN;
  p.prefix = *addr;

  rn = route_node_get (rip_ifaddr_table, (struct prefix *) &p);

  for (rn = route_next (rn); rn; rn = route_next (rn))
    if (rn->info)
      break;

  if (rn && rn->info)
    {
      ifp = rn->info;
      *addr = rn->p.u.prefix4;
      route_unlock_node (rn);
      return ifp;
    }
  return NULL;
}
开发者ID:xi-yang,项目名称:DRAGON,代码行数:26,代码来源:rip_snmp.c

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: ospf6_lsdb_type_head

struct ospf6_lsa *
ospf6_lsdb_type_head (u_int16_t type, struct ospf6_lsdb *lsdb)
{
  struct route_node *node;
  struct prefix_ipv6 key;
  struct ospf6_lsa *lsa;

  memset (&key, 0, sizeof (key));
  ospf6_lsdb_set_key (&key, &type, sizeof (type));

  /* Walk down tree. */
  node = lsdb->table->top;
  while (node && node->p.prefixlen <= key.prefixlen &&
	 prefix_match (&node->p, (struct prefix *) &key))
    node = node->link[prefix6_bit(&key.prefix, node->p.prefixlen)];

  if (node)
    route_lock_node (node);
  while (node && node->info == NULL)
    node = route_next (node);

  if (node == NULL)
    return NULL;
  else
    route_unlock_node (node);

  if (! prefix_match ((struct prefix *) &key, &node->p))
    return NULL;

  lsa = node->info;
  ospf6_lsa_lock (lsa);

  return lsa;
}
开发者ID:Addision,项目名称:LVS,代码行数:34,代码来源:ospf6_lsdb.c

示例9: 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

示例10: 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

示例11: 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

示例12: vrf_next

/* Return the next VRF iterator to the given iterator. */
vrf_iter_t
vrf_next (vrf_iter_t iter)
{
  struct route_node *rn = NULL;

  /* Lock it first because route_next() will unlock it. */
  if (iter != VRF_ITER_INVALID)
    rn = route_next (route_lock_node ((struct route_node *)iter));

  for (; rn; rn = route_next (rn))
    if (rn->info)
      {
        route_unlock_node (rn); /* next */
        return (vrf_iter_t)rn;
      }
  return VRF_ITER_INVALID;
}
开发者ID:AT-Corp,项目名称:quagga-atc,代码行数:18,代码来源:vrf.c

示例13: 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

示例14: 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

示例15: 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


注:本文中的route_next函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。