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


C++ CHECK_FLAG函数代码示例

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


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

示例1: connected_up_ipv6

void
connected_up_ipv6 (struct interface *ifp, struct connected *ifc)
{
  struct prefix_ipv6 p;
  struct prefix_ipv6 *addr;
  struct prefix_ipv6 *dest;

  if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL))
    return;

  addr = (struct prefix_ipv6 *) ifc->address;
  dest = (struct prefix_ipv6 *) ifc->destination;

  memset (&p, 0, sizeof (struct prefix_ipv6));
  p.family = AF_INET6;
  p.prefixlen = addr->prefixlen;

  if (if_is_pointopoint (ifp) && dest)
    {
      if (IN6_IS_ADDR_UNSPECIFIED (&dest->prefix))
	p.prefix = addr->prefix;
      else
	p.prefix = dest->prefix;
    }
  else
    p.prefix = addr->prefix;

  /* Apply mask to the network. */
  apply_mask_ipv6 (&p);

#if ! defined (MUSICA) && ! defined (LINUX)
  /* XXX: It is already done by rib_bogus_ipv6 within rib_add_ipv6 */
  if (IN6_IS_ADDR_UNSPECIFIED (&p.prefix))
    return;
#endif

  rib_add_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0,
                ifp->metric, 0);

  rib_update ();
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:41,代码来源:connected.c

示例2: connected_dump_vty

/* Dump if address information to vty. */
void
connected_dump_vty (struct vty *vty, struct connected *connected)
{
  struct prefix *p;
  struct interface_FOO *ifp;

  /* Set interface pointer. */
  ifp = connected->ifp;

  /* Print interface address. */
  p = connected->address;
  vty_out (vty, "  %s ", prefix_family_str (p));
  prefix_vty_out (vty, p);
  vty_out (vty, "/%d", p->prefixlen);

  /* If there is destination address, print it. */
  p = connected->destination;
  if (p)
    {
      if (p->family == AF_INET)
	if (ifp->flags & IFF_BROADCAST)
	  {
	    vty_out (vty, " broadcast ");
	    prefix_vty_out (vty, p);
	  }

      if (ifp->flags & IFF_POINTOPOINT)
	{
	  vty_out (vty, " pointopoint ");
	  prefix_vty_out (vty, p);
	}
    }

  if (CHECK_FLAG (connected->flags, ZEBRA_IFA_SECONDARY))
    vty_out (vty, " secondary");

  if (connected->label)
    vty_out (vty, " %s", connected->label);

  vty_out (vty, "%s", VTY_NEWLINE);
}
开发者ID:inet-framework,项目名称:inet-quagga,代码行数:42,代码来源:interface.c

示例3: fetchPutFile

FILE *
fetchPutFile(struct url *u, const char *flags)
{
	FILE *f;

	if (CHECK_FLAG('a'))
		f = fopen(u->doc, "a");
	else
		f = fopen(u->doc, "w+");

	if (f == NULL)
		fetch_syserr();

	if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) {
		fclose(f);
		fetch_syserr();
	}

	fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
	return (f);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:21,代码来源:file.c

示例4: ospf_abr_manage_discard_routes

void
ospf_abr_manage_discard_routes (struct ospf *ospf)
{
  listnode node;
  struct route_node *rn;
  struct ospf_area *area;
  struct ospf_area_range *range;

  for (node = listhead (ospf->areas); node; nextnode (node))
    if ((area = node->data) != NULL)
      for (rn = route_top (area->ranges); rn; rn = route_next (rn))
	if ((range = rn->info) != NULL)
	  if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE))
	    {
	      if (range->specifics)
		ospf_add_discard_route (ospf->new_table, area,
					(struct prefix_ipv4 *) &rn->p);
	      else
		ospf_delete_discard_route ((struct prefix_ipv4 *) &rn->p);
	    }
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:21,代码来源:ospf_abr.c

示例5: messageLogged

bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo &metaInfo, const unsigned int duration, const unsigned int channels, const QString &outputFile, QAtomicInt &abortFlag)
{
	emit messageLogged(QString("Copy file \"%1\" to \"%2\"\n").arg(sourceFile, outputFile));

	callback_t callbackData = { this, &abortFlag };

	emit statusUpdated(0);
	const bool success = MUtils::OS::copy_file(sourceFile, outputFile, true, progressCallback, &callbackData);
	emit statusUpdated(100);

	if (success)
	{
		emit messageLogged(L1S("File copied successfully."));
	}
	else
	{
		emit messageLogged(CHECK_FLAG(abortFlag) ? L1S("Operation cancelled by user!")  : L1S("Error: Failed to copy file!"));
	}

	return success;
}
开发者ID:lordmulder,项目名称:LameXP,代码行数:21,代码来源:Encoder_Wave.cpp

示例6: if_add_update

/* Handle interface addition */
void
if_add_update (struct interface *ifp)
{
  zebra_interface_add_update (ifp);

  if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
    {
      SET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE);

      if_addr_wakeup (ifp);

      if (IS_ZEBRA_DEBUG_KERNEL)
	zlog_info ("interface %s index %d becomes active.", 
		   ifp->name, ifp->ifindex);
    }
  else
    {
      if (IS_ZEBRA_DEBUG_KERNEL)
	zlog_info ("interface %s index %d is added.", ifp->name, ifp->ifindex);
    }
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:22,代码来源:interface.c

示例7: bgp_damp_disable

int
bgp_damp_disable (struct bgp *bgp, afi_t afi, safi_t safi)
{
  /* If it wasn't enabled, there's nothing to do. */
  if (! CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
    return 0;

  /* Cancel reuse thread. */
  if (damp->t_reuse )
    thread_cancel (damp->t_reuse);
  damp->t_reuse = NULL;

  /* Clean BGP dampening information.  */
  bgp_damp_info_clean ();

  /* Clear configuration */
  bgp_damp_config_clean (&bgp_damp_cfg);

  UNSET_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING);
  return 0;
}
开发者ID:ColinBS,项目名称:quagga-rtrlib,代码行数:21,代码来源:bgp_damp.c

示例8: sunml_cvodes_bbd_prec_initb

CAMLprim value sunml_cvodes_bbd_prec_initb (value vparentwhich, value vlocaln,
					value vbandwidths, value vdqrely,
					value vhascomm)
{
    CAMLparam5(vparentwhich, vlocaln, vbandwidths, vdqrely, vhascomm);
    void *cvode_mem = CVODE_MEM_FROM_ML (Field(vparentwhich, 0));
    int flag;

    flag = CVBBDPrecInitB (cvode_mem, Int_val(Field(vparentwhich, 1)),
	Long_val(vlocaln),
	Long_val(Field(vbandwidths, RECORD_CVODE_BANDBLOCK_BANDWIDTHS_MUDQ)),
	Long_val(Field(vbandwidths, RECORD_CVODE_BANDBLOCK_BANDWIDTHS_MLDQ)),
	Long_val(Field(vbandwidths, RECORD_CVODE_BANDBLOCK_BANDWIDTHS_MUKEEP)),
	Long_val(Field(vbandwidths, RECORD_CVODE_BANDBLOCK_BANDWIDTHS_MLKEEP)),
	Double_val(vdqrely),
	bbbdlocal,
	Bool_val(vhascomm) ? bbbdcomm : NULL);
    CHECK_FLAG ("CVBBDPrecInitB", flag);

    CAMLreturn (Val_unit);
}
开发者ID:inria-parkas,项目名称:sundialsml,代码行数:21,代码来源:cvodes_bbd_ml.c

示例9: bgp_dump_packet_func

static void
bgp_dump_packet_func (struct bgp_dump *bgp_dump, struct peer *peer,
		      struct stream *packet)
{
  int ret;
  struct stream *obuf;

  /* If dump file pointer is disabled return immediately. */
  if (bgp_dump->fp == NULL)
    return;

  /* Make dump stream. */
  obuf = bgp_dump_obuf;
  stream_reset (obuf);

  /* Dump header and common part. */
  if (CHECK_FLAG (peer->cap, PEER_CAP_AS4_RCV) )
    { 
      bgp_dump_header (obuf, MSG_PROTOCOL_BGP4MP, BGP4MP_MESSAGE_AS4);
    }
  else
    {
      bgp_dump_header (obuf, MSG_PROTOCOL_BGP4MP, BGP4MP_MESSAGE);
    }
  bgp_dump_common (obuf, peer, 0);

  /* Packet contents. */
  stream_put (obuf, STREAM_DATA (packet), stream_get_endp (packet));
  
  /* Set length. */
  bgp_dump_set_size (obuf, MSG_PROTOCOL_BGP4MP);

  /* Write to the stream. */
  ret = fwrite (STREAM_DATA (obuf), stream_get_endp (obuf), 1, bgp_dump->fp);
  if (ret != 1)
    {
      zlog_warn ("bgp_dump_packet_func: fwrite returned %d, expected 1: %s", ret, strerror (errno));
    }
  fflush (bgp_dump->fp);
}
开发者ID:dogbert2,项目名称:quagga,代码行数:40,代码来源:bgp_dump.c

示例10: ws__setBgpGlobalInfo

s32 ws__setBgpGlobalInfo(WS_ENV * ws_env,s32 state,s32 asid, 
    s32 disEBGP,s32 disIBGP,s32 disLOCAL, 
    s32 setType,s8* rtid,s32 ebgpmaxpath,s32 ibgpmaxpath,s8* redis, s32 grconfig, s32 * ret )
{
    web_bgp_global_info_t info ;

    if( NULL == rtid || NULL == redis )
        return ws_send_soap_error(ws_env,"post data failed !");

    info.state = (state&0x00FF) ;
    info.asid  = asid ;
    info.disEBGP = disEBGP ;
    info.disIBGP = disIBGP ;
    info.disLOCAL= disLOCAL;
    info.settype = setType ;
    info.ebgpmaxpath = ebgpmaxpath ;
    info.ibgpmaxpath = ibgpmaxpath ;
    info.grStaleTime   = (grconfig & 0x0FFF );
    info.grState = (0!=CHECK_FLAG(grconfig,0x8000));
    info.grRestartTime = ((grconfig>>16)&0x0FFF );
    
    inet_aton( rtid, &info.rtid );
    strncpy((s8*)info.redis,redis,sizeof(info.redis));

    if( socket_api_write(WEB_BGP_APICMD_SET_GLO,&info,sizeof(info)) < 0 )
    {
        socket_api_close();
        return ws_send_soap_error(ws_env,"set bgp global config failed !");
    }
	if( state == 0x0001 )
	{
		WEB_SEND_EX_OPERLOG_QUICK(ERROR_SUCCESS,"BGP is enabled , ASID %d.",asid);
	}
	if( state == 0x0100 )
	{
		WEB_SEND_EX_OPERLOG_QUICK(ERROR_SUCCESS,"BGP is disabled.");
	}
    socket_api_reset();
    return WS_OK;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:40,代码来源:ws_bgp.c

示例11: bgp_connect

/* BGP try to connect to the peer.  */
int
bgp_connect (struct peer *peer)
{
  unsigned int ifindex = 0;

  /* Make socket for the peer. */
  peer->fd = sockunion_socket (&peer->su);
  if (peer->fd < 0)
    return -1;

  /* If we can get socket for the peer, adjest TTL and make connection. */
  if (peer_sort (peer) == BGP_PEER_EBGP)
    sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl);

  sockopt_reuseaddr (peer->fd);
  sockopt_reuseport (peer->fd);

  /* Bind socket. */
  bgp_bind (peer);

  /* Update source bind. */
  bgp_update_source (peer);

#ifdef HAVE_IPV6
  if (peer->ifname)
    ifindex = if_nametoindex (peer->ifname);
#endif /* HAVE_IPV6 */

  if (BGP_DEBUG (events, EVENTS))
    plog_info (peer->log, "%s [Event] Connect start to %s fd %d",
	       peer->host, peer->host, peer->fd);

#ifdef HAVE_TCP_SIGNATURE
  if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSWORD))
    bgp_tcpsig_set (peer->fd, peer);
#endif /* HAVE_TCP_SIGNATURE */

  /* Connect to the remote peer. */
  return sockunion_connect (peer->fd, &peer->su, htons (peer->port), ifindex);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:41,代码来源:bgp_network.c

示例12: bgp_stop_with_notify

/* something went wrong, send notify and tear down */
static int
bgp_stop_with_notify (struct peer *peer, u_char code, u_char sub_code)
{
  /* Send notify to remote peer */
  bgp_notify_send (peer, code, sub_code);

  /* Sweep if it is temporary peer. */
  if (CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
    {
      zlog_info ("%s [Event] Accepting BGP peer is deleted", peer->host);
      peer_delete (peer);
      return -1;
    }

  /* Clear start timer value to default. */
  peer->v_start = BGP_INIT_START_TIMER;

  /* bgp_stop needs to be invoked while in Established state */
  bgp_stop(peer);

  return 0;
}
开发者ID:LabNConsulting,项目名称:quagga-vnc,代码行数:23,代码来源:bgp_fsm.c

示例13: connected_down_ipv4

void
connected_down_ipv4 (struct interface *ifp, struct connected *ifc)
{
  struct prefix_ipv4 p;

  if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL))
    return;

  PREFIX_COPY_IPV4(&p, CONNECTED_PREFIX(ifc));

  /* Apply mask to the network. */
  apply_mask_ipv4 (&p);

  /* In case of connected address is 0.0.0.0/0 we treat it tunnel
     address. */
  if (prefix_ipv4_any (&p))
    return;

  rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0);

  rib_update ();
}
开发者ID:damomeen,项目名称:ospf-geysers-extensions,代码行数:22,代码来源:connected.c

示例14: pim_zebra_if_address_del

static int pim_zebra_if_address_del(int command, struct zclient *client,
				    zebra_size_t length, vrf_id_t vrf_id)
{
  struct connected *c;
  struct prefix *p;

  /*
    zebra api notifies address adds/dels events by using the same call
    interface_add_read below, see comments in lib/zclient.c

    zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE, ...)
    will remove address from interface list by calling
    connected_delete_by_prefix()
  */
  c = zebra_interface_address_read(command, client->ibuf, vrf_id);
  if (!c)
    return 0;
  
  p = c->address;
  if (p->family != AF_INET)
    return 0;
  
  if (PIM_DEBUG_ZEBRA) {
    char buf[BUFSIZ];
    prefix2str(p, buf, BUFSIZ);
    zlog_debug("%s: %s disconnected IP address %s flags %u %s",
	       __PRETTY_FUNCTION__,
	       c->ifp->name, buf, c->flags,
	       CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY) ? "secondary" : "primary");
    
#ifdef PIM_DEBUG_IFADDR_DUMP
    dump_if_address(c->ifp);
#endif
  }

  pim_if_addr_del(c, 0);
  
  return 0;
}
开发者ID:Distrotech,项目名称:quagga,代码行数:39,代码来源:pim_zebra.c

示例15: bgp_fsm_holdtime_expire

/* Hold timer expire.  This is error of BGP connection. So cut the
   peer and change to Idle status. */
static int
bgp_fsm_holdtime_expire (struct peer *peer)
{
  if (BGP_DEBUG (fsm, FSM))
    zlog (peer->log, LOG_DEBUG, "%s [FSM] Hold timer expire", peer->host);

  /* Send notify to remote peer. */
  bgp_notify_send (peer, BGP_NOTIFY_HOLD_ERR, 0);

  /* Sweep if it is temporary peer. */
  if (CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
    {
      zlog_info ("%s [Event] Accepting BGP peer is deleted", peer->host);
      peer_delete (peer);
      return -1;
    }

  /* bgp_stop needs to be invoked while in Established state */
  bgp_stop(peer);

  return 0;
}
开发者ID:ahouston,项目名称:quagga-multiple,代码行数:24,代码来源:bgp_fsm.c


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