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


C++ Log1函数代码示例

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


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

示例1: HPRegisterForHotplugEvents

/**
 * Sets up callbacks for device hotplug events.
 */
ULONG HPRegisterForHotplugEvents(void)
{
	struct udev *udev;

	(void)pthread_mutex_init(&usbNotifierMutex, NULL);

	if (driverSize <= 0)
	{
		Log1(PCSC_LOG_INFO, "No bundle files in pcsc drivers directory: "
			PCSCLITE_HP_DROPDIR);
		Log1(PCSC_LOG_INFO, "Disabling USB support for pcscd");
		return 0;
	}

	/* Create the udev object */
	udev = udev_new();
	if (!udev)
	{
		Log1(PCSC_LOG_ERROR, "udev_new() failed");
		return 0;
	}

	HPRescanUsbBus(udev);

	(void)ThreadCreate(&usbNotifyThread, THREAD_ATTR_DETACHED,
		(PCSCLITE_THREAD_FUNCTION( )) HPEstablishUSBNotifications, udev);

	return 0;
} /* HPRegisterForHotplugEvents */
开发者ID:kenieevan,项目名称:pcsc-lite,代码行数:32,代码来源:hotplug_libudev.c

示例2: MSGCheckHandleAssociation

static LONG MSGCheckHandleAssociation(SCARDHANDLE hCard,
	SCONTEXT * threadContext)
{
	int list_index = 0;

	if (0 == threadContext->hContext)
	{
		/* the handle is no more valid. After SCardReleaseContext() for
		 * example */
		Log1(PCSC_LOG_CRITICAL, "Invalidated handle");
		return -1;
	}

	(void)pthread_mutex_lock(&threadContext->cardsList_lock);
	list_index = list_locate(&threadContext->cardsList, &hCard);
	(void)pthread_mutex_unlock(&threadContext->cardsList_lock);
	if (list_index >= 0)
		return 0;

	/* Must be a rogue client, debug log and sleep a couple of seconds */
	Log1(PCSC_LOG_ERROR, "Client failed to authenticate");
	(void)SYS_Sleep(2);

	return -1;
}
开发者ID:ZuyingWo,项目名称:PCSC,代码行数:25,代码来源:winscard_svc.c

示例3: IFDHPowerICC

RESPONSECODE
IFDHPowerICC (DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD AtrLength)
{
    switch (Action) {
        case IFD_POWER_DOWN:
            if (vicc_poweroff() < 0) {
                Log1(PCSC_LOG_ERROR, "could not powerdown");
                return IFD_COMMUNICATION_ERROR;
            }

            /* XXX see bug #312754 on https://alioth.debian.org/projects/pcsclite */
#if 0
            *AtrLength = 0;

#endif
            return IFD_SUCCESS;
        case IFD_POWER_UP:
            if (vicc_poweron() < 0) {
                Log1(PCSC_LOG_ERROR, "could not powerup");
                return IFD_COMMUNICATION_ERROR;
            }
            break;
        case IFD_RESET:
            if (vicc_reset() < 0) {
                Log1(PCSC_LOG_ERROR, "could not reset");
                return IFD_COMMUNICATION_ERROR;
            }
            break;
        default:
            Log2(PCSC_LOG_ERROR, "%0lX not supported", Action);
            return IFD_NOT_SUPPORTED;
    }

    return IFDHGetCapabilities (Lun, TAG_IFD_ATR, AtrLength, Atr);
}
开发者ID:Churro,项目名称:vsmartcard,代码行数:35,代码来源:ifd-vpcd.c

示例4: latch_overlay_get_account_id

static int
latch_overlay_get_account_id(latch_overlay_config_data *cfg, char *id, char **account_id) {

    int search_scope = LDAP_SCOPE_BASE;
    char *search_base_dn = NULL;
    char *search_filter = NULL;
    int rv = ERROR;

    Log1(LDAP_DEBUG_TRACE, LDAP_LEVEL_DEBUG, ">>> %s\n", __func__);

    search_base_dn = replace_str(cfg->ldap_search_base_dn, "@@@[email protected]@@", id);
    search_filter = replace_str(cfg->ldap_search_filter, "@@@[email protected]@@", id);

    if (cfg->ldap_search_scope != NULL) {
        if (strcmp("onelevel", cfg->ldap_search_scope) == 0) {
            search_scope = LDAP_SCOPE_ONELEVEL;
        }
        else if (strcmp("subtree", cfg->ldap_search_scope) == 0) {
            search_scope = LDAP_SCOPE_SUBTREE;
        }
    }

    rv = latch_overlay_get_entry_attribute(cfg->ldap_uri, cfg->ldap_bind_dn, cfg->ldap_bind_password, search_base_dn, search_filter, search_scope, cfg->ldap_attribute, cfg->ldap_tls_ca_file, account_id);

    free(search_base_dn);
    free(search_filter);

    Log1(LDAP_DEBUG_TRACE, LDAP_LEVEL_DEBUG, "<<< %s\n", __func__);

    return rv;

}
开发者ID:ElevenPaths,项目名称:latch-plugin-openLDAP,代码行数:32,代码来源:latch-overlay-latch.c

示例5: EHDestroyEventHandler

LONG EHDestroyEventHandler(PREADER_CONTEXT rContext)
{
	if (NULL == rContext->readerState)
	{
		Log1(PCSC_LOG_ERROR, "Thread never started (reader init failed?)");
		return SCARD_S_SUCCESS;
	}

	PCSCD::SharedReaderState *rs = PCSCD::SharedReaderState::overlay(rContext->readerState);
	if ((rContext->pthThread == 0) || !rs || (rs->readerNameLength() == 0))
	{
		Log1(PCSC_LOG_INFO, "Thread already stomped.");
		return SCARD_S_SUCCESS;
	}

	secdebug("pcscd", "EHDestroyEventHandler: pthThread: %p, reader name len: %ld",
		rContext->pthThread, rs->readerNameLength());

	/*
	 * Zero out the public status struct to allow it to be recycled and
	 * used again
	 */

	rs->xreaderNameClear();
	rs->xcardAtrClear();
	rs->xreaderID(0);
	rs->xreaderState(0);
	rs->xlockState(0);
	rs->sharing(0);
	rs->xcardAtrLength(0);
	rs->xcardProtocol(SCARD_PROTOCOL_UNSET);		// we only set this one to write to memory cache

	/*
	 * Set the thread to 0 to exit thread
	 */
	ReaderContextLock(rContext);

	Log1(PCSC_LOG_INFO, "Stomping thread.");

	int ix;
	for (ix = 0; (ix < 100) && ReaderContextIsLocked(rContext); ++ix)
	{
		/*
		 * Wait 0.05 seconds for the child to respond
		 */
		SYS_USleep(50000);
	}

	secdebug("pcscd", "EHDestroyEventHandler: post-stop dwLockId: %d", rContext->dwLockId);


	/* Zero the thread */
	rContext->pthThread = 0;

	Log1(PCSC_LOG_INFO, "Thread stomped.");

	return SCARD_S_SUCCESS;
}
开发者ID:smartcardservices,项目名称:smartcardservices,代码行数:58,代码来源:eventhandler.cpp

示例6: HPEstablishUSBNotifications

static void HPEstablishUSBNotifications(void)
{
	int i, do_polling;

	/* libusb default is /dev/bus/usb but the devices are not yet visible there
	 * when a hotplug is requested */
	setenv("USB_DEVFS_PATH", "/proc/bus/usb", 0);

	usb_init();

	/* scan the USB bus for devices at startup */
	HPRescanUsbBus();

	/* if at least one driver do not have IFD_GENERATE_HOTPLUG */
	do_polling = FALSE;
	for (i=0; i<driverSize; i++)
		if (driverTracker[i].libraryPath)
			if ((driverTracker[i].ifdCapabilities & IFD_GENERATE_HOTPLUG) == 0)
			{
				Log2(PCSC_LOG_INFO,
					"Driver %s does not support IFD_GENERATE_HOTPLUG. Using active polling instead.",
					driverTracker[i].bundleName);
				if (HPForceReaderPolling < 1)
					HPForceReaderPolling = 1;
				break;
			}

	if (HPForceReaderPolling)
	{
		Log2(PCSC_LOG_INFO,
				"Polling forced every %d second(s)", HPForceReaderPolling);
		do_polling = TRUE;
	}

	if (do_polling)
	{
		while (!AraKiriHotPlug)
		{
			SYS_Sleep(HPForceReaderPolling);
			HPRescanUsbBus();
		}
	}
	else
	{
		char dummy;

	  	pipe(rescan_pipe);
		while (read(rescan_pipe[0], &dummy, sizeof(dummy)) > 0)
		{
			Log1(PCSC_LOG_INFO, "Reload serial configuration");
			HPRescanUsbBus();
			RFReCheckReaderConf();
			Log1(PCSC_LOG_INFO, "End reload serial configuration");
		}
		close(rescan_pipe[0]);
		rescan_pipe[0] = -1;
	}
}
开发者ID:andyvand,项目名称:pcsc-lite-clone,代码行数:58,代码来源:hotplug_libusb.c

示例7: Log1

void StatusBar::draw_marks(Buffer::iterator& cursor)
{
	Log1("Redrawing status bar");

	std::vector<std::shared_ptr<Mark>> before_cursor(Brush::MarkColorsTotal);
	std::vector<std::shared_ptr<Mark>> after_cursor(Brush::MarkColorsTotal);

	// Initialize before_cursor and after_cursor to 0s.
	for (int i = 0; i < Brush::MarkColorsTotal; i++) {
		before_cursor[i] = 0;
		after_cursor[i] = 0;
	}

	Mark c(cursor);
	for (Mark m : _marks) {
		Log1("Looking at mark " << m);
		Log3("Comparing with cursor " << c);
		if (m < c) {
			Log2("Mark " << m << " is less then cursor. Setting for color " << m.get_color_index());
			before_cursor[m.get_color_index()].reset(new Mark(m));
		} else if (m == c) {
			Log2("Mark " << m << " is equal to cursor.");
		} else {
			Log2("Mark " << m << " is greater then cursor. Setting for color " << m.get_color_index());
			after_cursor[m.get_color_index()].reset(new Mark(m));
		}
	}

	for (int i = 0, x = 2; i < Brush::MarkColorsTotal; i++) {
		std::stringstream ss;
		if (before_cursor[i] != 0) {
			s64 n = before_cursor[i]->get_iterator().distance_lines(cursor);
			Log3("Drawing " << n << " lines before cursor, from " << *before_cursor[i] << 
				" until " << cursor);
			ss << std::setfill(' ') << std::setw(4) << n;
		} else {
			ss << "----";
		}

		ss << "|";

		if (after_cursor[i] != 0) {
			s64 n = after_cursor[i]->get_iterator().distance_lines(cursor);
			Log3("Drawing " << n << " lines after cursor, from " << *after_cursor[i] << 
				" until " << cursor);
			ss << std::setfill(' ') << std::setw(4) << std::left << n;
		} else {
			ss << "----";
		}

		Log3("Marks line: " << ss.str());

		Line l(ss.str());
		_brush.draw_text(x, _text_height + 1, l, _brush.marks[i]);
		x += l.length() + 1;
	}
}
开发者ID:dowel,项目名称:hless,代码行数:57,代码来源:status_bar.cpp

示例8: udev_device_get_sysattr_value

/*@[email protected]*/ static struct _driverTracker *get_driver(struct udev_device *dev,
	const char *devpath, struct _driverTracker **classdriver)
{
	int i;
	unsigned int idVendor, idProduct;
	static struct _driverTracker *driver;
	const char *str;

	str = udev_device_get_sysattr_value(dev, "idVendor");
	if (!str)
	{
		Log1(PCSC_LOG_ERROR, "udev_device_get_sysattr_value() failed");
		return NULL;
	}
	sscanf(str, "%X", &idVendor);

	str = udev_device_get_sysattr_value(dev, "idProduct");
	if (!str)
	{
		Log1(PCSC_LOG_ERROR, "udev_device_get_sysattr_value() failed");
		return NULL;
	}
	sscanf(str, "%X", &idProduct);

	Log4(PCSC_LOG_DEBUG,
		"Looking for a driver for VID: 0x%04X, PID: 0x%04X, path: %s",
		idVendor, idProduct, devpath);

	*classdriver = NULL;
	driver = NULL;
	/* check if the device is supported by one driver */
	for (i=0; i<driverSize; i++)
	{
		if (driverTracker[i].libraryPath != NULL &&
			idVendor == driverTracker[i].manuID &&
			idProduct == driverTracker[i].productID)
		{
			if ((driverTracker[i].CFBundleName != NULL)
				&& (0 == strcmp(driverTracker[i].CFBundleName, "CCIDCLASSDRIVER")))
				*classdriver = &driverTracker[i];
			else
				/* it is not a CCID Class driver */
				driver = &driverTracker[i];
		}
	}

	/* if we found a specific driver */
	if (driver)
		return driver;

	/* else return the Class driver (if any) */
	return *classdriver;
}
开发者ID:kenieevan,项目名称:pcsc-lite,代码行数:53,代码来源:hotplug_libudev.c

示例9: Log1

eFlag Tree::parse(Sit S, DataLine *d)
{
    Log1(S, L1_PARSING, getURI());
    double time_was = getMillisecs();
    TreeConstructer tc(S);
    eFlag retval = tc.parseDataLineUsingExpat(S, this, d);
    if (!retval)
    {
        Log1(S, L1_PARSE_DONE, getMillisecsDiff(time_was));
    }
    return retval;
}
开发者ID:alepharchives,项目名称:Sablotron,代码行数:12,代码来源:tree.cpp

示例10: IFDHPowerICC

RESPONSECODE
IFDHPowerICC (DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD AtrLength)
{
    size_t slot = Lun & 0xffff;
    RESPONSECODE r = IFD_COMMUNICATION_ERROR;

    if (slot >= vicc_max_slots) {
        goto err;
    }

    switch (Action) {
        case IFD_POWER_DOWN:
            if (vicc_poweroff(ctx[slot]) < 0) {
                Log1(PCSC_LOG_ERROR, "could not powerdown");
                goto err;
            }

            /* XXX see bug #312754 on https://alioth.debian.org/projects/pcsclite */
#if 0
            *AtrLength = 0;

#endif
            return IFD_SUCCESS;
        case IFD_POWER_UP:
            if (vicc_poweron(ctx[slot]) < 0) {
                Log1(PCSC_LOG_ERROR, "could not powerup");
                goto err;
            }
            break;
        case IFD_RESET:
            if (vicc_reset(ctx[slot]) < 0) {
                Log1(PCSC_LOG_ERROR, "could not reset");
                goto err;
            }
            break;
        default:
            Log2(PCSC_LOG_ERROR, "%0lX not supported", Action);
            r = IFD_NOT_SUPPORTED;
            goto err;
    }

    r = IFD_SUCCESS;

err:
    if (r != IFD_SUCCESS && AtrLength)
        *AtrLength = 0;
    else
        r = IFDHGetCapabilities (Lun, TAG_IFD_ATR, AtrLength, Atr);

    return r;
}
开发者ID:Jdi99y515,项目名称:vsmartcard,代码行数:51,代码来源:ifd-vpcd.c

示例11: IFDHGetCapabilities

RESPONSECODE
IFDHGetCapabilities (DWORD Lun, DWORD Tag, PDWORD Length, PUCHAR Value)
{
    unsigned char *atr = NULL;
    ssize_t size;

    if (!Length || !Value)
        return IFD_COMMUNICATION_ERROR;

    switch (Tag) {
        case TAG_IFD_ATR:

            size = vicc_getatr(&atr);
            if (size < 0) {
                Log1(PCSC_LOG_ERROR, "could not get ATR");
                return IFD_COMMUNICATION_ERROR;
            }
            if (size == 0) {
                Log1(PCSC_LOG_ERROR, "Virtual ICC removed");
                return IFD_ICC_NOT_PRESENT;
            }
            Log2(PCSC_LOG_DEBUG, "Got ATR (%d bytes)", size);

            if (*Length < size) {
                free(atr);
                Log1(PCSC_LOG_ERROR, "Not enough memory for ATR");
                return IFD_COMMUNICATION_ERROR;
            }

            memcpy(Value, atr, size);
            *Length = size;
            free(atr);
            break;

        case TAG_IFD_SLOTS_NUMBER:
            if (*Length < 1) {
                Log1(PCSC_LOG_ERROR, "Invalid input data");
                return IFD_COMMUNICATION_ERROR;
            }

            *Value  = 1;
            *Length = 1;
            break;

        default:
            Log2(PCSC_LOG_DEBUG, "unknown tag %d", (int)Tag);
            return IFD_ERROR_TAG;
    }

    return IFD_SUCCESS;
}
开发者ID:Churro,项目名称:vsmartcard,代码行数:51,代码来源:ifd-vpcd.c

示例12: sendData

/* wrap data, transmit to the device and get answer */
RESPONSECODE sendData(PUCHAR TxBuffer, DWORD TxLength, 
				 PUCHAR RxBuffer, PDWORD RxLength, int wait)
{
	RESPONSECODE rc;
	
	if (present == 0)
	{
		return IFD_COMMUNICATION_ERROR;
	}
	
	unsigned char apdu[TxLength];
	unsigned char buffer[2000];
	unsigned int i, j, response_length, n = 0;
	int sLen = TxLength;
	
	for (i = 0; i < TxLength; ++i)
	{
		apdu[i] = *(TxBuffer + i);
	}

	Log2(PCSC_LOG_DEBUG, "preparing to write %d data bytes", TxLength);
	printf(">> %s \n", hexdump(TxBuffer, TxLength));
	int rv;

	rv = rfid_protocol_transceive(ph, TxBuffer, TxLength, RxBuffer, &response_length, 0, 0);
	if (rv < 0)
	{
		Log2(PCSC_LOG_ERROR, "Error from transceive, returned %d\n", rv);
		present = 0;
		rfid_protocol_close(ph);
		rfid_layer2_close(l2h);
		rfid_reader_close(rh);
		return IFD_COMMUNICATION_ERROR;
	}

	Log2(PCSC_LOG_DEBUG, "wrote %d data bytes", TxLength);		
	Log2(PCSC_LOG_DEBUG, "got %d response bytes", response_length);
		
    if (response_length > 0)
    {
		*RxLength = response_length;
		
		//for (j = 0; j < response_length; ++j)
		//{
		//	*(RxBuffer + j) = buffer[j];
		//}
		rc = IFD_SUCCESS;
	    
	}
	else
	{
	    Log1(PCSC_LOG_ERROR, "no response, meaning eof, reader not usable anymore\n");
		present = 0;
		rfid_protocol_close(ph);
		rfid_layer2_close(l2h);
		rfid_reader_close(rh);
	    rc = IFD_COMMUNICATION_ERROR;
	}
	return rc;
}
开发者ID:jdkbx,项目名称:librfid-pcsc-ifdhandler,代码行数:61,代码来源:ok.c

示例13: IFDHSetProtocolParameters

RESPONSECODE IFDHSetProtocolParameters ( DWORD Lun, DWORD Protocol, 
				   UCHAR Flags, UCHAR PTS1,
				   UCHAR PTS2, UCHAR PTS3) {

  /* This function should set the PTS of a particular card/slot using
     the three PTS parameters sent

     Protocol  - 0 .... 14  T=0 .... T=14
     Flags     - Logical OR of possible values:
     IFD_NEGOTIATE_PTS1 IFD_NEGOTIATE_PTS2 IFD_NEGOTIATE_PTS3
     to determine which PTS values to negotiate.
     PTS1,PTS2,PTS3 - PTS Values.

     returns:

     IFD_SUCCESS
     IFD_ERROR_PTS_FAILURE
     IFD_COMMUNICATION_ERROR
     IFD_PROTOCOL_NOT_SUPPORTED
  */
	Log1(PCSC_LOG_DEBUG, "IFDHSetProtocolParameters");
	if (Protocol != SCARD_PROTOCOL_T0 && Protocol != SCARD_PROTOCOL_T1)
	{
		return IFD_PROTOCOL_NOT_SUPPORTED;
	}
	return IFD_SUCCESS;
}
开发者ID:FlexCOS,项目名称:lib-tty-ifdhandler,代码行数:27,代码来源:ifdhandler.c

示例14: sysMapMem

/*
 * Map a range of virtual memory.  Note that the size asked for here
 * is literally what the upper level has asked for.  We need to do
 * any rounding, etc. here.  If mapping fails return 0, otherwise
 * return the address of the base of the mapped memory.
 */
void *
sysMapMem(size_t requestedSize, size_t *mappedSize)
{
    void *mappedAddr;

    *mappedSize = roundUpToGrain(requestedSize);
#ifdef USE_MALLOC
    mappedAddr = (void *) sysMalloc(*mappedSize); /* Returns 0 on failure */
#ifdef __linux__
     if (mappedAddr) {
       memset(mappedAddr, 0, *mappedSize);
       mappedAddr = (void *) roundUpToGrain(mappedAddr);
     }
#endif
#else
    mappedAddr = mapChunk(*mappedSize);           /* Returns 0 on failure */
#endif /* USE_MALLOC */
    if (mappedAddr) {
        Log3(2, "sysMapMem: 0x%x bytes at 0x%x (request: 0x%x bytes)\n",
             *mappedSize, mappedAddr, requestedSize);
    } else {
        Log1(2, "sysMapMem failed: (request: 0x%x bytes)\n", requestedSize);
    }
    return mappedAddr;
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:31,代码来源:memory_md.c

示例15: vernum_db_init

static int
vernum_db_init(
	BackendDB	*be,
	ConfigReply	*cr)
{
	slap_overinst	*on = (slap_overinst *) be->bd_info;
	vernum_t	*vn = NULL;

	if ( SLAP_ISGLOBALOVERLAY( be ) ) {
		Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
			"vernum_db_init: vernum cannot be used as global overlay.\n" );
		return 1;
	}

	if ( be->be_nsuffix == NULL ) {
		Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
			"vernum_db_init: database must have suffix\n" );
		return 1;
	}

	if ( BER_BVISNULL( &be->be_rootndn ) || BER_BVISEMPTY( &be->be_rootndn ) ) {
		Log1( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
			"vernum_db_init: missing rootdn for database DN=\"%s\", YMMV\n",
			be->be_suffix[ 0 ].bv_val );
	}

	vn = (vernum_t *)ch_calloc( 1, sizeof( vernum_t ) );

	on->on_bi.bi_private = (void *)vn;

	return 0;
}
开发者ID:ystk,项目名称:debian-openldap,代码行数:32,代码来源:vernum.c


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