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


C++ ALL_LIST_ELEMENTS函数代码示例

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


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

示例1: ip_address_count

/**gjd : under a interface , calculate the all ip address(include ipv4 and ipv6) num**/
int 
ip_address_count(struct interface* ifp) 
{
   struct connected *c;
   struct listnode *cnode, *cnnode;
   int i = 0;

   #if 0
   for (ALL_LIST_ELEMENTS (ifp->connected, cnode, cnnode, c)) 
   {
	//	if ((c->address->family == AF_INET)||(c->address->family == AF_INET6)) 
			
		if ((c->address->family == AF_INET)) 
			++i;
   }
   return i; 
   #endif

   if (ifp->connected)
    {
      for (ALL_LIST_ELEMENTS (ifp->connected, cnode, cnnode, c))
		{
/*		  	if(CHECK_FLAG (c->conf, ZEBRA_IFC_CONFIGURED))*/
				if(CHECK_FLAG (c->conf, ZEBRA_IFC_CONFIGURED)||CHECK_FLAG (c->conf, ZEBRA_IFC_REAL))
				i++;
		}
    }
   /*zlog_info("############## i = %d #################\n",i);*/
   return i;
   
}
开发者ID:kkcloudy,项目名称:daemongroup,代码行数:32,代码来源:tipc_zclient_lib.c

示例2: delete_marked_cache_groups

static void
delete_marked_cache_groups()
{
  cache_group* cache_group;
  cache* cache;
  struct listnode *cache_group_node, *cache_node;
  struct listnode *next_node, *next_cache_node;
  for (ALL_LIST_ELEMENTS(cache_group_list, cache_group_node, next_node,
      cache_group))
    {
      for (ALL_LIST_ELEMENTS(cache_group->cache_config_list, cache_node,
          next_cache_node, cache))
        {
          if (cache->delete_flag)
            {
              listnode_delete(cache_group->cache_config_list, cache);
              delete_cache(cache);
            }
        }
      if (listcount(cache_group->cache_config_list) == 0
          || cache_group->delete_flag)
        {
          listnode_delete(cache_group_list, cache_group);
          delete_cache_group(cache_group);
        }
    }
}
开发者ID:rtrlib,项目名称:quagga-rtrlib,代码行数:27,代码来源:bgp_rpki_commands.c

示例3: forward_off

static void forward_off(struct pim_upstream *up)
{
  struct listnode      *ifnode;
  struct listnode      *ifnextnode;
  struct listnode      *chnode;
  struct listnode      *chnextnode;
  struct interface     *ifp;
  struct pim_interface *pim_ifp;
  struct pim_ifchannel *ch;

  /* scan all interfaces */
  for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) {
    pim_ifp = ifp->info;
    if (!pim_ifp)
      continue;

    /* scan per-interface (S,G) state */
    for (ALL_LIST_ELEMENTS(pim_ifp->pim_ifchannel_list, chnode, chnextnode, ch)) {

      if (ch->upstream != up)
	continue;

      pim_forward_stop(ch);

    } /* scan iface channel list */
  } /* scan iflist */
}
开发者ID:FujitsuNetworkCommunications,项目名称:Quagga-Graceful-Restart,代码行数:27,代码来源:pim_upstream.c

示例4: JoinDesired

/*
  Evaluate JoinDesired(S,G):

  JoinDesired(S,G) is true if there is a downstream (S,G) interface I
  in the set:

  inherited_olist(S,G) =
  joins(S,G) (+) pim_include(S,G) (-) lost_assert(S,G)

  JoinDesired(S,G) may be affected by changes in the following:

  pim_ifp->primary_address
  pim_ifp->pim_dr_addr
  ch->ifassert_winner_metric
  ch->ifassert_winner
  ch->local_ifmembership 
  ch->ifjoin_state
  ch->upstream->rpf.source_nexthop.mrib_metric_preference
  ch->upstream->rpf.source_nexthop.mrib_route_metric
  ch->upstream->rpf.source_nexthop.interface

  See also pim_upstream_update_join_desired() below.
 */
int pim_upstream_evaluate_join_desired(struct pim_upstream *up)
{
  struct listnode      *ifnode;
  struct listnode      *ifnextnode;
  struct listnode      *chnode;
  struct listnode      *chnextnode;
  struct interface     *ifp;
  struct pim_interface *pim_ifp;
  struct pim_ifchannel *ch;

  /* scan all interfaces */
  for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) {
    pim_ifp = ifp->info;
    if (!pim_ifp)
      continue;

    /* scan per-interface (S,G) state */
    for (ALL_LIST_ELEMENTS(pim_ifp->pim_ifchannel_list, chnode, chnextnode, ch)) {
      if (ch->upstream != up)
	continue;

      if (pim_macro_ch_lost_assert(ch))
	continue; /* keep searching */

      if (pim_macro_chisin_joins_or_include(ch))
	return 1; /* true */
    } /* scan iface channel list */
  } /* scan iflist */

  return 0; /* false */
}
开发者ID:FujitsuNetworkCommunications,项目名称:Quagga-Graceful-Restart,代码行数:54,代码来源:pim_upstream.c

示例5: zread_interface_add

/* Register zebra server interface information.  Send current all
   interface and address information. */
static int
zread_interface_add (struct zserv *client, u_short length)
{
  struct listnode *ifnode, *ifnnode;
  struct listnode *cnode, *cnnode;
  struct interface *ifp;
  struct connected *c;

  /* Interface information is needed. */
  client->ifinfo = 1;

  for (ALL_LIST_ELEMENTS (iflist, ifnode, ifnnode, ifp))
    {
      /* Skip pseudo interface. */
      if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
	continue;

      if (zsend_interface_add (client, ifp) < 0)
        return -1;

      for (ALL_LIST_ELEMENTS (ifp->connected, cnode, cnnode, c))
	{
	  if (CHECK_FLAG (c->conf, ZEBRA_IFC_REAL) &&
	      (zsend_interface_address (ZEBRA_INTERFACE_ADDRESS_ADD, client, 
				        ifp, c) < 0))
	    return -1;
	}
    }
  return 0;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:32,代码来源:zserv.c

示例6: pim_upstream_update_assert_tracking_desired

static void pim_upstream_update_assert_tracking_desired(struct pim_upstream *up)
{
  struct listnode      *ifnode;
  struct listnode      *ifnextnode;
  struct listnode      *chnode;
  struct listnode      *chnextnode;
  struct interface     *ifp;
  struct pim_interface *pim_ifp;
  struct pim_ifchannel *ch;

  /* scan all interfaces */
  for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) {
    pim_ifp = ifp->info;
    if (!pim_ifp)
      continue;

    /* scan per-interface (S,G) state */
    for (ALL_LIST_ELEMENTS(pim_ifp->pim_ifchannel_list, chnode, chnextnode, ch)) {

      if (ch->upstream != up)
	continue;

      pim_ifchannel_update_assert_tracking_desired(ch);

    } /* scan iface channel list */
  } /* scan iflist */
}
开发者ID:FujitsuNetworkCommunications,项目名称:Quagga-Graceful-Restart,代码行数:27,代码来源:pim_upstream.c

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

示例8: vtysh_config_dump

/* Display configuration to file pointer. */
void
vtysh_config_dump (FILE *fp)
{
  struct listnode *node, *nnode;
  struct listnode *mnode, *mnnode;
  struct config *config;
  struct list *master;
  char *line;
  unsigned int i;

  for (ALL_LIST_ELEMENTS (config_top, node, nnode, line))
    {
      fprintf (fp, "%s\n", line);
      fflush (fp);
    }
  fprintf (fp, "!\n");
  fflush (fp);

  for (i = 0; i < vector_active (configvec); i++)
    if ((master = vector_slot (configvec, i)) != NULL)
      {
	for (ALL_LIST_ELEMENTS (master, node, nnode, config))
	  {
	    fprintf (fp, "%s\n", config->name);
	    fflush (fp);

	    for (ALL_LIST_ELEMENTS (config->line, mnode, mnnode, line))
	      {
		fprintf  (fp, "%s\n", line);
		fflush (fp);
	      }
	    if (! NO_DELIMITER (i))
	      {
		fprintf (fp, "!\n");
		fflush (fp);
	      }
	  }
	if (NO_DELIMITER (i))
	  {
	    fprintf (fp, "!\n");
	    fflush (fp);
	  }
      }

  for (i = 0; i < vector_active (configvec); i++)
    if ((master = vector_slot (configvec, i)) != NULL)
      {
	list_delete (master);
	vector_slot (configvec, i) = NULL;
      }
  list_delete_all_node (config_top);
}
开发者ID:ColinBS,项目名称:quagga-rtrlib,代码行数:53,代码来源:vtysh_config.c

示例9: bgp_interface_down

static int
bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length)
{
  struct stream *s;
  struct interface *ifp;
  struct connected *c;
  struct listnode *node, *nnode;

  s = zclient->ibuf;
  ifp = zebra_interface_state_read (s);
  if (! ifp)
    return 0;

  if (BGP_DEBUG(zebra, ZEBRA))
    zlog_debug("Zebra rcvd: interface %s down", ifp->name);

  for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, c))
    bgp_connected_delete (c);

  /* Fast external-failover (Currently IPv4 only) */
  {
    struct listnode *mnode;
    struct bgp *bgp;
    struct peer *peer;
    struct interface *peer_if;

    for (ALL_LIST_ELEMENTS_RO (bm->bgp, mnode, bgp))
      {
	if (CHECK_FLAG (bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER))
	  continue;

	for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
	  {
	    if (peer->ttl != 1)
	      continue;

	    if (peer->su.sa.sa_family == AF_INET)
	      peer_if = if_lookup_by_ipv4 (&peer->su.sin.sin_addr);
	    else
	      continue;

	    if (ifp == peer_if)
	      BGP_EVENT_ADD (peer, BGP_Stop);
	  }
      }
  }

  return 0;
}
开发者ID:AsherBond,项目名称:quagga,代码行数:49,代码来源:bgp_zebra.c

示例10: eigrp_nbr_count_get

int eigrp_nbr_count_get(void){

	struct eigrp_interface *iface;
	struct listnode *node, *node2, *nnode2;
	struct eigrp_neighbor *nbr;
	struct eigrp *eigrp = eigrp_lookup();
	u_int32_t counter;

	if (eigrp == NULL)
	  {
	    zlog_debug("EIGRP Routing Process not enabled");
	    return 0;
	  }

	counter=0;
	for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface))
	  {
	    for (ALL_LIST_ELEMENTS(iface->nbrs, node2, nnode2, nbr))
	      {
	        if (nbr->state == EIGRP_NEIGHBOR_UP){
	          counter++;
	        }
	      }
	  }
	return counter;
}
开发者ID:janovic,项目名称:Quagga-EIGRP,代码行数:26,代码来源:eigrp_neighbor.c

示例11: ospf6_spf_display_subtree

void
ospf6_spf_display_subtree (struct vty *vty, const char *prefix, int rest,
                           struct ospf6_vertex *v)
{
  struct listnode *node, *nnode;
  struct ospf6_vertex *c;
  char *next_prefix;
  int len;
  int restnum;

  /* "prefix" is the space prefix of the display line */
  vty_out (vty, "%s+-%s [%d]%s", prefix, v->name, v->cost, VNL);

  len = strlen (prefix) + 4;
  next_prefix = (char *) malloc (len);
  if (next_prefix == NULL)
    {
      vty_out (vty, "malloc failed%s", VNL);
      return;
    }
  snprintf (next_prefix, len, "%s%s", prefix, (rest ? "|  " : "   "));

  restnum = listcount (v->child_list);
  for (ALL_LIST_ELEMENTS (v->child_list, node, nnode, c))
    {
      restnum--;
      ospf6_spf_display_subtree (vty, next_prefix, restnum, c);
    }

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

示例12: igmp_group_delete

static void igmp_group_delete(struct igmp_group *group)
{
  struct listnode *src_node;
  struct listnode *src_nextnode;
  struct igmp_source *src;

  if (PIM_DEBUG_IGMP_TRACE) {
    char group_str[100];
    pim_inet4_dump("<group?>", group->group_addr, group_str, sizeof(group_str));
    zlog_debug("Deleting IGMP group %s from socket %d interface %s",
	       group_str,
	       group->group_igmp_sock->fd,
	       group->group_igmp_sock->interface->name);
  }

  for (ALL_LIST_ELEMENTS(group->group_source_list, src_node, src_nextnode, src)) {
    igmp_source_delete(src);
  }

  if (group->t_group_query_retransmit_timer) {
    THREAD_OFF(group->t_group_query_retransmit_timer);
    zassert(!group->t_group_query_retransmit_timer);
  }

  group_timer_off(group);
  listnode_delete(group->group_igmp_sock->igmp_group_list, group);
  igmp_group_free(group);
}
开发者ID:AT-Corp,项目名称:quagga-atc,代码行数:28,代码来源:pim_igmp.c

示例13: bgp_router_id_update

/* Router-id update message from zebra. */
static int
bgp_router_id_update (int command, struct zclient *zclient, zebra_size_t length)
{
  struct prefix router_id;
  struct listnode *node, *nnode;
  struct bgp *bgp;

  zebra_router_id_update_read(zclient->ibuf,&router_id);

  if (BGP_DEBUG(zebra, ZEBRA))
    {
      char buf[128];
      prefix2str(&router_id, buf, sizeof(buf));
      zlog_debug("Zebra rcvd: router id update %s", buf);
    }

  router_id_zebra = router_id.u.prefix4;

  for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
    {
      if (!bgp->router_id_static.s_addr)
        bgp_router_id_set (bgp, &router_id.u.prefix4);
    }

  return 0;
}
开发者ID:DorChen,项目名称:quagga,代码行数:27,代码来源:bgp_zebra.c

示例14: clear_checksum_streams

void
clear_checksum_streams (uint16_t checksum)
{
  struct listnode * node, * nnode;
  struct sisis_listener * listener;

  for(ALL_LIST_ELEMENTS (sm->listen_sockets, node, nnode, listener))
  {
     if(stream_get_getp(listener->chksum_stream) < stream_get_endp(listener->chksum_stream))
     {
       uint16_t checksum_head = stream_getw(listener->chksum_stream);
       if(checksum_head != checksum)
       {
         stream_putw(listener->chksum_stream, checksum_head);
         uint16_t next_checksum = stream_peekw(listener->chksum_stream);
         while(next_checksum != checksum_head)
         {
           next_checksum = stream_getw(listener->chksum_stream);
           if(next_checksum != checksum)
             stream_putw(listener->chksum_stream, next_checksum);
         }
       }
     }
  }
}
开发者ID:ecks,项目名称:sis-is,代码行数:25,代码来源:svz_sisis.c

示例15: eigrp_update_send_all

void
eigrp_update_send_all (struct eigrp *eigrp, struct eigrp_interface *exception)
{

  struct eigrp_interface *iface;
  struct listnode *node, *node2, *nnode2;
  struct eigrp_prefix_entry *pe;

  for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface))
    {
      if (iface != exception)
        {
          eigrp_update_send(iface);
        }
    }

  for (ALL_LIST_ELEMENTS(eigrp->topology_changes_internalIPV4, node2, nnode2, pe))
    {
      if(pe->req_action & EIGRP_FSM_NEED_UPDATE)
        {
          pe->req_action &= ~EIGRP_FSM_NEED_UPDATE;
          listnode_delete(eigrp->topology_changes_internalIPV4, pe);
          zlog_debug("UPDATE COUNT: %d", eigrp->topology_changes_internalIPV4->count);
        }
    }
}
开发者ID:janovic,项目名称:Quagga-EIGRP,代码行数:26,代码来源:eigrp_update.c


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