• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ route_node_lookup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: isis_redist_delete

void
isis_redist_delete(int type, struct prefix *p)
{
  int family = p->family;
  struct route_table *ei_table = get_ext_info(isis, family);
  struct route_node *ei_node;
  struct listnode *node;
  struct isis_area *area;
  int level;
  struct isis_redist *redist;

  char debug_buf[BUFSIZ];
  prefix2str(p, debug_buf, sizeof(debug_buf));

  zlog_debug("%s: Removing route %s from %s.", __func__, debug_buf,
             zebra_route_string(type));

  if (is_default(p))
    {
      /* Don't remove default route but add synthetic route for use
       * by "default-information originate always". Areas without the
       * "always" setting will ignore routes with origin DEFAULT_ROUTE. */
      isis_redist_add(DEFAULT_ROUTE, p, 254, MAX_WIDE_PATH_METRIC);
      return;
    }

  if (!ei_table)
    {
      zlog_warn("%s: External information table not initialized.",
                __func__);
      return;
    }

  ei_node = route_node_lookup(ei_table, p);
  if (!ei_node || !ei_node->info)
    {
      char buf[BUFSIZ];
      prefix2str(p, buf, sizeof(buf));
      zlog_warn("%s: Got a delete for %s route %s, but that route"
                " was never added.", __func__, zebra_route_string(type),
                buf);
      if (ei_node)
        route_unlock_node(ei_node);
      return;
    }
  route_unlock_node(ei_node);

  for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
    for (level = 1; level < ISIS_LEVELS; level++)
      {
        redist = get_redist_settings(area, family, type, level);
        if (!redist->redist)
          continue;

        isis_redist_uninstall(area, level, p);
      }

  XFREE(MTYPE_ISIS, ei_node->info);
  route_unlock_node(ei_node);
}
开发者ID:ColinBS,项目名称:quagga-rtrlib,代码行数:60,代码来源:isis_redist.c


示例2: ospf_free_if_params

void
ospf_free_if_params (struct interface *ifp, struct in_addr addr)
{
  struct ospf_if_params *oip;
  struct prefix_ipv4 p;
  struct route_node *rn;

  p.family = AF_INET;
  p.prefixlen = IPV4_MAX_PREFIXLEN;
  p.prefix = addr;
  rn = route_node_lookup (IF_OIFS_PARAMS (ifp), (struct prefix*)&p);
  if (!rn || !rn->info)
    return;

  oip = rn->info;
  route_unlock_node (rn);
  
  if (!OSPF_IF_PARAM_CONFIGURED (oip, output_cost_cmd) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, transmit_delay) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, retransmit_interval) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, passive_interface) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, v_hello) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, fast_hello) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, v_wait) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, priority) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, type) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, auth_simple) &&
      !OSPF_IF_PARAM_CONFIGURED (oip, auth_type) &&
      listcount (oip->auth_crypt) == 0)
    {
      ospf_del_if_params (oip);
      rn->info = NULL;
      route_unlock_node (rn);
    }
}
开发者ID:Quagga,项目名称:historical,代码行数:35,代码来源:ospf_interface.c


示例3: ospf6_lsdb_remove

void
ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb)
{
  struct route_node *node;
  struct prefix_ipv6 key;

  memset (&key, 0, sizeof (key));
  ospf6_lsdb_set_key (&key, &lsa->header->type, sizeof (lsa->header->type));
  ospf6_lsdb_set_key (&key, &lsa->header->adv_router,
                      sizeof (lsa->header->adv_router));
  ospf6_lsdb_set_key (&key, &lsa->header->id, sizeof (lsa->header->id));

  node = route_node_lookup (lsdb->table, (struct prefix *) &key);
  assert (node && node->info == lsa);

  if (lsa->prev)
    lsa->prev->next = lsa->next;
  if (lsa->next)
    lsa->next->prev = lsa->prev;

  node->info = NULL;
  lsdb->count--;

  if (lsdb->hook_remove)
    (*lsdb->hook_remove) (lsa);

  ospf6_lsa_unlock (lsa);
  route_unlock_node (node);

  ospf6_lsdb_count_assert (lsdb);
}
开发者ID:Addision,项目名称:LVS,代码行数:31,代码来源:ospf6_lsdb.c


示例4: isis_redist_uninstall

/* Remove external reachability information from a
 * specific area for a specific level.
 * Schedule an lsp regenerate if necessary. */
static void
isis_redist_uninstall(struct isis_area *area, int level, struct prefix *p)
{
  int family = p->family;
  struct route_table *er_table = get_ext_reach(area, family, level);
  struct route_node *er_node;

  if (!er_table)
    {
      zlog_warn("%s: External reachability table of area %s"
                " is not initialized.", __func__, area->area_tag);
      return;
    }

  er_node = route_node_lookup(er_table, p);
  if (!er_node)
    return;
  else
    route_unlock_node(er_node);

  if (!er_node->info)
    return;

  XFREE(MTYPE_ISIS, er_node->info);
  route_unlock_node(er_node);
  lsp_regenerate_schedule(area, level, 0);
}
开发者ID:ColinBS,项目名称:quagga-rtrlib,代码行数:30,代码来源:isis_redist.c


示例5: route_node_lookup

/* lookup nbr by address - use this only if you know you must
 * otherwise use the ospf_nbr_lookup() wrapper, which deals 
 * with virtual link neighbours
 */
struct ospf_neighbor *ospf_nbr_lookup_by_addr(struct route_table *nbrs,
					      struct in_addr *addr)
{
	struct prefix p;
	struct route_node *rn;
	struct ospf_neighbor *nbr;

	p.family = AF_INET;
	p.prefixlen = IPV4_MAX_BITLEN;
	p.u.prefix4 = *addr;

	rn = route_node_lookup(nbrs, &p);
	if (!rn)
		return NULL;

	/* See comment in ospf_nbr_delete */
	assert(rn->info);

	if (rn->info == NULL) {
		route_unlock_node(rn);
		return NULL;
	}

	nbr = (struct ospf_neighbor *)rn->info;
	route_unlock_node(rn);

	return nbr;
}
开发者ID:yubo,项目名称:quagga,代码行数:32,代码来源:ospf_neighbor.c


示例6: ospf_external_info_check

/* Check LSA is related to external info. */
struct external_info *
ospf_external_info_check (struct ospf_lsa *lsa)
{
  struct as_external_lsa *al;
  struct prefix_ipv4 p;
  struct route_node *rn;
  int type;

  al = (struct as_external_lsa *) lsa->data;

  p.family = AF_INET;
  p.prefix = lsa->data->id;
  p.prefixlen = ip_masklen (al->mask);

  for (type = 0; type <= ZEBRA_ROUTE_MAX; type++)
    {
      int redist_type = is_prefix_default (&p) ? DEFAULT_ROUTE : type;
      if (ospf_is_type_redistributed (redist_type))
	if (EXTERNAL_INFO (type))
	  {
	    rn = route_node_lookup (EXTERNAL_INFO (type),
				    (struct prefix *) &p);
	    if (rn)
	      {
		route_unlock_node (rn);
		if (rn->info != NULL)
		  return (struct external_info *) rn->info;
	      }
	  }
    }

  return NULL;
}
开发者ID:Skotha,项目名称:quagga,代码行数:34,代码来源:ospf_flood.c


示例7: ospf_nbr_delete

/* Delete specified OSPF neighbor from interface. */
void ospf_nbr_delete(struct ospf_neighbor *nbr)
{
	struct ospf_interface *oi;
	struct route_node *rn;
	struct prefix p;

	oi = nbr->oi;

	/* get appropriate prefix 'key' */
	ospf_nbr_key(oi, nbr, &p);

	rn = route_node_lookup(oi->nbrs, &p);
	if (rn) {
		/* If lookup for a NBR succeeds, the leaf route_node could
		 * only exist because there is (or was) a nbr there.
		 * If the nbr was deleted, the leaf route_node should have
		 * lost its last refcount too, and be deleted.
		 * Therefore a looked-up leaf route_node in nbrs table
		 * should never have NULL info.
		 */
		assert(rn->info);

		if (rn->info) {
			rn->info = NULL;
			route_unlock_node(rn);
		} else
			zlog_info("Can't find neighbor %s in the interface %s",
				  inet_ntoa(nbr->src), IF_NAME(oi));

		route_unlock_node(rn);
	}

	/* Free ospf_neighbor structure. */
	ospf_nbr_free(nbr);
}
开发者ID:yubo,项目名称:quagga,代码行数:36,代码来源:ospf_neighbor.c


示例8: ospf_ia_network_route

static void
ospf_ia_network_route (struct ospf *ospf, struct route_table *rt,
		       struct prefix_ipv4 *p, struct ospf_route *new_or,
		       struct ospf_route *abr_or)
{
  struct route_node *rn1;
  struct ospf_route *or;

  if (IS_DEBUG_OSPF_EVENT)
    zlog_debug ("ospf_ia_network_route(): processing summary route to %s/%d", 
	       inet_ntoa (p->prefix), p->prefixlen);

  /* Find a route to the same dest */
  if ((rn1 = route_node_lookup (rt, (struct prefix *) p)))
    {
      int res;

      route_unlock_node (rn1);

      if ((or = rn1->info))
	{
	  if (IS_DEBUG_OSPF_EVENT)
	    zlog_debug ("ospf_ia_network_route(): "
		       "Found a route to the same network");
	  /* Check the existing route. */
	  if ((res = ospf_route_cmp (ospf, new_or, or)) < 0)
	    {
	      /* New route is better, so replace old one. */
	      ospf_route_subst (rn1, new_or, abr_or);
	    }
	  else if (res == 0)
	    {
	      /* New and old route are equal, so next hops can be added. */
	      route_lock_node (rn1);
	      ospf_route_copy_nexthops (or, abr_or->paths);
	      route_unlock_node (rn1);

	      /* new route can be deleted, because existing route has been updated. */
	      ospf_route_free (new_or);
	    }
	  else
	    {
	      /* New route is worse, so free it. */
	      ospf_route_free (new_or);
	      return;
	    }
	} /* if (or)*/
    } /*if (rn1)*/
  else
    { /* no route */
      if (IS_DEBUG_OSPF_EVENT)
	zlog_debug ("ospf_ia_network_route(): add new route to %s/%d",
		   inet_ntoa (p->prefix), p->prefixlen);
      ospf_route_add (rt, p, new_or, abr_or);
    }
}
开发者ID:rgmabs19357,项目名称:qpimd,代码行数:56,代码来源:ospf_ia.c


示例9: ospf6_damp_lookup

static struct ospf6_damp_info *
ospf6_damp_lookup (u_short type, struct prefix *name)
{
    struct route_node *node;

    node = route_node_lookup (damp_info_table[type], name);
    if (node && node->info)
        return (struct ospf6_damp_info *) node->info;
    return NULL;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:10,代码来源:ospf6_damp.c


示例10: ospf_interface_address_delete

static int
ospf_interface_address_delete (int command, struct zclient *zclient,
                               zebra_size_t length)
{
  struct ospf *ospf;
  struct connected *c;
  struct interface *ifp;
  struct ospf_interface *oi;
  struct route_node *rn;
  struct prefix p;

  c = zebra_interface_address_read (command, zclient->ibuf);

  if (c == NULL)
    return 0;

  if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
    {
      char buf[128];
      prefix2str(c->address, buf, sizeof(buf));
      zlog_debug("Zebra: interface %s address delete %s", c->ifp->name, buf);
    }

  ifp = c->ifp;
  p = *c->address;
  p.prefixlen = IPV4_MAX_PREFIXLEN;

  rn = route_node_lookup (IF_OIFS (ifp), &p);
  if (!rn)
    {
      connected_free (c);
      return 0;
    }

  assert (rn->info);
  oi = rn->info;

  /* Call interface hook functions to clean up */
  ospf_if_free (oi);

#ifdef HAVE_SNMP
  ospf_snmp_if_update (c->ifp);
#endif /* HAVE_SNMP */

  connected_free (c);

  ospf = ospf_lookup ();
  if (ospf != NULL)
    ospf_if_update (ospf);

  return 0;
}
开发者ID:Quagga,项目名称:historical,代码行数:52,代码来源:ospf_zebra.c


示例11: ospf_area_range_lookup

struct ospf_area_range *
ospf_area_range_lookup (struct ospf_area *area, struct prefix_ipv4 *p)
{
  struct route_node *rn;

  rn = route_node_lookup (area->ranges, (struct prefix *)p);
  if (rn)
    {
      route_unlock_node (rn);
      return rn->info;
    }
  return NULL;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:13,代码来源:ospf_abr.c


示例12: vrf_lookup

/* Look up a VRF by identifier. */
static struct vrf *
vrf_lookup (vrf_id_t vrf_id)
{
  struct prefix p;
  struct route_node *rn;
  struct vrf *vrf = NULL;

  vrf_build_key (vrf_id, &p);
  rn = route_node_lookup (vrf_table, &p);
  if (rn)
    {
      vrf = (struct vrf *)rn->info;
      route_unlock_node (rn); /* lookup */
    }
  return vrf;
}
开发者ID:AT-Corp,项目名称:quagga-atc,代码行数:17,代码来源:vrf.c


示例13: ospf_delete_from_if

static void
ospf_delete_from_if (struct interface *ifp, struct ospf_interface *oi)
{
  struct route_node *rn;
  struct prefix p;

  p = *oi->address;
  p.prefixlen = IPV4_MAX_PREFIXLEN;

  rn = route_node_lookup (IF_OIFS (oi->ifp), &p);
  assert (rn);
  assert (rn->info);
  rn->info = NULL;
  route_unlock_node (rn);
  route_unlock_node (rn);
}
开发者ID:Quagga,项目名称:historical,代码行数:16,代码来源:ospf_interface.c


示例14:

/* lookup oi for specified prefix/ifp */
struct ospf_interface *ospf_if_table_lookup(struct interface *ifp,
					    struct prefix *prefix)
{
	struct prefix p;
	struct route_node *rn;
	struct ospf_interface *rninfo = NULL;

	p = *prefix;
	p.prefixlen = IPV4_MAX_PREFIXLEN;

	/* route_node_get implicitely locks */
	if ((rn = route_node_lookup(IF_OIFS(ifp), &p))) {
		rninfo = (struct ospf_interface *)rn->info;
		route_unlock_node(rn);
	}

	return rninfo;
}
开发者ID:yubo,项目名称:quagga,代码行数:19,代码来源:ospf_interface.c


示例15: ospf_area_range_delete

void
ospf_area_range_delete (struct ospf_area *area, struct ospf_area_range *range)
{
  struct route_node *rn;
  struct prefix_ipv4 p;

  p.family = AF_INET;
  p.prefixlen = range->masklen;
  p.prefix = range->addr;

  rn = route_node_lookup (area->ranges, (struct prefix *)&p);
  if (rn)
    {
      ospf_area_range_free (rn->info);
      rn->info = NULL;
      route_unlock_node (rn);
      route_unlock_node (rn);
    }
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:19,代码来源:ospf_abr.c


示例16: rip_neighbor_lookup

int
rip_neighbor_lookup (struct sockaddr_in *from)
{
  struct prefix_ipv4 p;
  struct route_node *node;

  memset (&p, 0, sizeof (struct prefix_ipv4));
  p.family = AF_INET;
  p.prefix = from->sin_addr;
  p.prefixlen = IPV4_MAX_BITLEN;

  node = route_node_lookup (rip->neighbor, (struct prefix *) &p);
  if (node)
    {
      route_unlock_node (node);
      return 1;
    }
  return 0;
}
开发者ID:FujitsuNetworkCommunications,项目名称:Quagga-Graceful-Restart,代码行数:19,代码来源:rip_interface.c


示例17: route_node_lookup

struct ospf_if_params *ospf_lookup_if_params(struct interface *ifp,
					     struct in_addr addr)
{
	struct prefix_ipv4 p;
	struct route_node *rn;

	p.family = AF_INET;
	p.prefixlen = IPV4_MAX_PREFIXLEN;
	p.prefix = addr;

	rn = route_node_lookup(IF_OIFS_PARAMS(ifp), (struct prefix *)&p);

	if (rn) {
		route_unlock_node(rn);
		return rn->info;
	}

	return NULL;
}
开发者ID:yubo,项目名称:quagga,代码行数:19,代码来源:ospf_interface.c


示例18: if_subnet_delete

/* Untie an interface address from its derived subnet list of addresses. */
int
if_subnet_delete (struct interface *ifp, struct connected *ifc)
{
  struct route_node *rn;
  struct zebra_if *zebra_if;
  struct list *addr_list;

  assert (ifp && ifp->info && ifc);
  zebra_if = ifp->info;

  /* Get address derived subnet node. */
  rn = route_node_lookup (zebra_if->ipv4_subnets, ifc->address);
  if (! (rn && rn->info))
    return -1;
  route_unlock_node (rn);
  
  /* Untie address from subnet's address list. */
  addr_list = rn->info;
  listnode_delete (addr_list, ifc);
  route_unlock_node (rn);

  /* Return list element count, if not empty. */
  if (addr_list->count)
    {
      /* If deleted address is primary, mark subsequent one as such and distribute. */
      if (! CHECK_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY))
	{
	  ifc = listgetdata (listhead (addr_list));
	  zebra_interface_address_delete_update (ifp, ifc);
	  UNSET_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY);
	  zebra_interface_address_add_update (ifp, ifc);
	}
      
      return addr_list->count;
    }
  
  /* Otherwise, free list and route node. */
  list_free (addr_list);
  rn->info = NULL;
  route_unlock_node (rn);

  return 0;
}
开发者ID:edderick,项目名称:quagga_zOSPF,代码行数:44,代码来源:interface.c


示例19: rip_neighbor_delete

/* Delete RIP neighbor from the neighbor tree. */
static int
rip_neighbor_delete (struct prefix_ipv4 *p)
{
  struct route_node *node;

  /* Lock for look up. */
  node = route_node_lookup (rip->neighbor, (struct prefix *) p);
  if (! node)
    return -1;
  
  node->info = NULL;

  /* Unlock lookup lock. */
  route_unlock_node (node);

  /* Unlock real neighbor information lock. */
  route_unlock_node (node);

  return 0;
}
开发者ID:FujitsuNetworkCommunications,项目名称:Quagga-Graceful-Restart,代码行数:21,代码来源:rip_interface.c


示例20: ospf6_lsdb_lookup

struct ospf6_lsa *
ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router,
                   struct ospf6_lsdb *lsdb)
{
  struct route_node *node;
  struct prefix_ipv6 key;

  if (lsdb == NULL)
    return NULL;

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

  node = route_node_lookup (lsdb->table, (struct prefix *) &key);
  if (node == NULL || node->info == NULL)
    return NULL;
  return (struct ospf6_lsa *) node->info;
}
开发者ID:Addision,项目名称:LVS,代码行数:20,代码来源:ospf6_lsdb.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ route_top函数代码示例发布时间:2022-05-30
下一篇:
C++ route_next函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap