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


C++ route_unlock_node函数代码示例

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


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

示例1: ospf_delete_from_if

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:xi-yang,项目名称:DRAGON,代码行数:16,代码来源:ospf_interface.c

示例2: ripng_enable_network_lookup2

/* Check wether connected is within the ripng_enable_network table. */
static int
ripng_enable_network_lookup2 (struct connected *connected)
{
  struct prefix_ipv6 address;
  struct prefix *p;

  p = connected->address;

  if (p->family == AF_INET6) {
    struct route_node *node;

    address.family = p->family;
    address.prefix = p->u.prefix6;
    address.prefixlen = IPV6_MAX_BITLEN;

    /* LPM on p->family, p->u.prefix6/IPV6_MAX_BITLEN within ripng_enable_network */
    node = route_node_match (ripng_enable_network,
                             (struct prefix *)&address);

    if (node) {
      route_unlock_node (node);
      return 1;
    }
  }

  return -1;
}
开发者ID:KaloNK,项目名称:quagga,代码行数:28,代码来源:ripng_interface.c

示例3: isis_redist_install

/* Install external reachability information into a
 * specific area for a specific level.
 * Schedule an lsp regenerate if necessary */
static void
isis_redist_install(struct isis_area *area, int level,
                    struct prefix *p, struct isis_ext_info *info)
{
  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_get(er_table, p);
  if (er_node->info)
    {
      route_unlock_node(er_node);

      /* Don't update/reschedule lsp generation if nothing changed. */
      if (!memcmp(er_node->info, info, sizeof(*info)))
        return;
    }
  else
    {
      er_node->info = XMALLOC(MTYPE_ISIS, sizeof(*info));
    }

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

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

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

示例6: 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:OPSF,项目名称:uClinux,代码行数:26,代码来源:rip_snmp.c

示例7: ripng_enable_network_lookup_if

/* Check wether the interface has at least a connected prefix that
 * is within the ripng_enable_network table. */
static int
ripng_enable_network_lookup_if (struct interface *ifp)
{
  struct listnode *node;
  struct connected *connected;
  struct prefix_ipv6 address;

  for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, connected))
    {
      struct prefix *p; 
      struct route_node *node;

      p = connected->address;

      if (p->family == AF_INET6)
        {
          address.family = AF_INET6;
          address.prefix = p->u.prefix6;
          address.prefixlen = IPV6_MAX_BITLEN;

          node = route_node_match (ripng_enable_network,
                                   (struct prefix *)&address);
          if (node)
            {
              route_unlock_node (node);
              return 1;
            }
        }
    }
  return -1;
}
开发者ID:KaloNK,项目名称:quagga,代码行数:33,代码来源:ripng_interface.c

示例8: 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:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:34,代码来源:ospf_flood.c

示例9: route_node_get

struct ospf_neighbor *ospf_nbr_get(struct ospf_interface *oi,
				   struct ospf_header *ospfh, struct ip *iph,
				   struct prefix *p)
{
	struct route_node *rn;
	struct prefix key;
	struct ospf_neighbor *nbr;

	key.family = AF_INET;
	key.prefixlen = IPV4_MAX_BITLEN;

	if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
		key.u.prefix4 = ospfh->router_id;	/* index vlink nbrs by router-id */
	else
		key.u.prefix4 = iph->ip_src;

	rn = route_node_get(oi->nbrs, &key);
	if (rn->info) {
		route_unlock_node(rn);
		nbr = rn->info;

		if (oi->type == OSPF_IFTYPE_NBMA && nbr->state == NSM_Attempt) {
			nbr->src = iph->ip_src;
			memcpy(&nbr->address, p, sizeof(struct prefix));
		}
	} else {
		rn->info = nbr = ospf_nbr_add(oi, ospfh, p);
	}

	nbr->router_id = ospfh->router_id;

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

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

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

示例12: ripng_enable_network_delete

/* Delete RIPng enable network. */
static int
ripng_enable_network_delete (struct prefix *p)
{
  struct route_node *node;

  node = route_node_lookup (ripng_enable_network, p);
  if (node)
    {
      node->info = NULL;

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

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

      return 1;
    }
  return -1;
}
开发者ID:Quagga-RE,项目名称:wip-tcs-rfc6506,代码行数:21,代码来源:ripng_interface.c

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

示例14: ifaddr_ipv4_delete

static void
ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
{
  struct route_node *rn;
  struct prefix_ipv4 p;

  p.family = AF_INET;
  p.prefixlen = IPV4_MAX_PREFIXLEN;
  p.prefix = *ifaddr;

  rn = route_node_lookup (ifaddr_ipv4_table, (struct prefix *) &p);
  if (! rn)
    {
      zlog_info ("ifaddr_ipv4_delete(): can't find address %s",
		 inet_ntoa (*ifaddr));
      return;
    }
  rn->info = NULL;
  route_unlock_node (rn);
  route_unlock_node (rn);
}
开发者ID:balajig,项目名称:Layer3Switch,代码行数:21,代码来源:if.c

示例15: 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:millken,项目名称:zhuxianB30,代码行数:40,代码来源:ospf_neighbor.c


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