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

C++ dtoh32函数代码示例

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

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



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

示例1: wl_get_channels

int
wl_get_channels(void *wl, int max, int *len, uint16 *channels)
{
	uint32 chan_buf[WL_NUMCHANNELS + 1];
	wl_uint32_list_t *list;
	int ret;
	uint i;
	int count;

	list = (wl_uint32_list_t *)(void *)chan_buf;
	list->count = htod32(WL_NUMCHANNELS);
	ret = wlu_get(wl, WLC_GET_VALID_CHANNELS, chan_buf, sizeof(chan_buf));
	if (ret < 0)
		return ret;

	count = 0;
	for (i = 0; i < dtoh32(list->count); i++) {
		if (count >= max)
			break;
		channels[count++] = dtoh32(list->element[i]);
	}

	*len = count;
	return ret;
}
开发者ID:TheTypoMaster,项目名称:asuswrt,代码行数:25,代码来源:wlu_api.c


示例2: rwl_wifi_config_channel

/*
 *  Configures local channel  for finding server.
 *  Server call this fucntion for getting its current channel,
 *  client uses this fucntion for setting its channel to new channel.
 */
static int
rwl_wifi_config_channel(void *wl, int cmd, int *channel)
{
	int error;
	channel_info_t ci;
	/* Get functionality is used only by server */
	if (cmd == WLC_GET_CHANNEL) {
		memset((char*)&ci, 0, sizeof(ci));
		if ((error = wl_get(wl, cmd, &ci, sizeof(channel_info_t))))
			return error;
		ci.hw_channel = dtoh32(ci.hw_channel);
		ci.scan_channel = dtoh32(ci.scan_channel);
		ci.target_channel = dtoh32(ci.target_channel);
		if (ci.scan_channel)
			printf("Scan in progress.\n");

		*channel = ci.hw_channel;
	}

	if (cmd == WLC_SET_CHANNEL) {
		/* Set functionality is used by the client */
		ci.target_channel = *channel;
		/*   When user wants to execute local CMD being in remote wifi mode, 
		*	rwl_wifi_swap_remote_type fucntion is used to change the remote types.
		*/
		rwl_wifi_swap_remote_type(remote_type);
		error = wl_set(wl, cmd, &ci.target_channel, sizeof(int));
		/* rever it back to same old remote type */
		rwl_wifi_swap_remote_type(remote_type);
	}
	return error;
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:37,代码来源:wlu_pipe.c


示例3: ptp_ptpip_event

static uint16_t
ptp_ptpip_event (PTPParams* params, PTPContainer* event, int wait)
{
	fd_set		infds;
	struct timeval	timeout;
	int ret;
	unsigned char*	data = NULL;
	PTPIPHeader	hdr;
	int n;

	while (1) {
		FD_ZERO(&infds);
		FD_SET(params->evtfd, &infds);
		timeout.tv_sec = 0;
		if (wait == PTP_EVENT_CHECK_FAST)
			timeout.tv_usec = 1;
		else
			timeout.tv_usec = 1000; /* 1/1000 second  .. perhaps wait longer? */

		ret = select (params->evtfd+1, &infds, NULL, NULL, &timeout);
		if (1 != ret) {
			if (-1 == ret) {
				gp_log (GP_LOG_DEBUG,"ptpip/event", "select returned error, errno is %d", errno);
				return PTP_ERROR_IO;
			}
			return PTP_ERROR_TIMEOUT;
		}

		ret = ptp_ptpip_evt_read (params, &hdr, &data);
		if (ret != PTP_RC_OK)
			return ret;
		gp_log (GP_LOG_DEBUG,"ptpip/event", "hdr type %d, length %d", hdr.type, hdr.length);

		if (dtoh32(hdr.type) == PTPIP_EVENT) {
			break;
		}

		/* TODO: Handle cancel transaction and ping/pong
		 * If not PTPIP_EVENT, process it and wait for next PTPIP_EVENT
		 */
		gp_log (GP_LOG_ERROR, "ptpip/event", "unknown/unhandled event type %d", dtoh32(hdr.type));
	}

	event->Code		= dtoh16a(&data[ptpip_event_code]);
	event->Transaction_ID	= dtoh32a(&data[ptpip_event_transid]);
	n = (dtoh32(hdr.length) - sizeof(hdr) - ptpip_event_param1)/sizeof(uint32_t);
	switch (n) {
	case 3: event->Param3 = dtoh32a(&data[ptpip_event_param3]);
	case 2: event->Param2 = dtoh32a(&data[ptpip_event_param2]);
	case 1: event->Param1 = dtoh32a(&data[ptpip_event_param1]);
	case 0: break;
	default:
		gp_log( GP_LOG_ERROR, "ptpip/event", "response got %d parameters?", n);
		break;
	}
	free (data);
	return PTP_RC_OK;
}
开发者ID:FooFeeK,项目名称:libgphoto2,代码行数:58,代码来源:ptpip.c


示例4: dhd_iscan_get_partial_result

static int
dhd_iscan_get_partial_result(void *dhdp, uint *scan_count)
{
	wl_iscan_results_t *list_buf;
	wl_iscan_results_t list;
	wl_scan_results_t *results;
	iscan_buf_t *iscan_cur;
	int status = -1;
	dhd_pub_t *dhd = dhd_bus_pub(dhdp);
	int rc;

	DHD_TRACE(("%s: Enter\n", __FUNCTION__));

	iscan_cur = dhd_iscan_allocate_buf(dhd, &iscan_chain);
	if (!iscan_cur) {
		DHD_ERROR(("%s: Failed to allocate node\n", __FUNCTION__));
		dhd_iscan_free_buf(dhdp, 0);
		dhd_iscan_request(dhdp, WL_SCAN_ACTION_ABORT);
		dhd_ind_scan_confirm(dhdp, FALSE);
		goto fail;
	}

	dhd_iscan_lock();

	memset(iscan_cur->iscan_buf, 0, WLC_IW_ISCAN_MAXLEN);
	list_buf = (wl_iscan_results_t*)iscan_cur->iscan_buf;
	results = &list_buf->results;
	results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE;
	results->version = 0;
	results->count = 0;

	memset(&list, 0, sizeof(list));
	list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN);
	bcm_mkiovar("iscanresults", (char *)&list, WL_ISCAN_RESULTS_FIXED_SIZE,
		iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN);
	rc = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iscan_cur->iscan_buf,
	                      WLC_IW_ISCAN_MAXLEN, FALSE, 0);

	results->buflen = dtoh32(results->buflen);
	results->version = dtoh32(results->version);
	*scan_count = results->count = dtoh32(results->count);
	status = dtoh32(list_buf->status);
	DHD_TRACE(("%s: Got %d resuls\n", __FUNCTION__, results->count));

	dhd_iscan_unlock();

	if (!(*scan_count)) {
		dhd_iscan_free_buf(dhdp, iscan_cur);
	}
fail:
	return status;
}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:52,代码来源:dhd_common.c


示例5: lua_ctl_aclchk

static int
lua_ctl_aclchk(lua_State *L, void *wl, lua_cmd_t *cmd, char *argv)
{
	struct maclist *maclist = (struct maclist *) buf;
	struct maclist *acllist = (struct maclist *) (buf + WLC_IOCTL_MAXLEN);
	uint i, j, max = (WLC_IOCTL_MAXLEN - sizeof(int)) / ETHER_ADDR_LEN;
	struct ether_addr *ea, *tea;
	int ret, val, deauth;

	if ((ret = wlu_get(wl, WLC_GET_MACMODE, &val, sizeof(int))) < 0)
		return ret;

	val = dtoh32(val);

	if (val == 0)
	{
		return 0;
	}

	maclist->count = htod32(max);
	if ((ret = wlu_get(wl, WLC_GET_ASSOCLIST, maclist, WLC_IOCTL_MAXLEN)) < 0)
	{
		return ret;
	}
	maclist->count = dtoh32(maclist->count);

	acllist->count = htod32(max);
	if ((ret = wlu_get(wl, WLC_GET_MACLIST, acllist, WLC_IOCTL_MAXLEN)) < 0)
	{
		return ret;
	}
	acllist->count = dtoh32(maclist->count);

	for (i = 0, ea = maclist->ea; i < maclist->count && i < max; i++, ea++)
	{
		deauth = (val == 2) ? 1 : 0;
		for (j = 0, tea = acllist->ea; j < acllist->count && j < max; j++, tea++)
		{
			if (memcmp(ea, tea, sizeof(struct ether_addr)) == 0)
			{
				deauth = !deauth;
			}
		}
		if (deauth)
		{
			/* No reason code furnished, so driver will use its default */
			ret = wlu_set(wl, WLC_SCB_DEAUTHENTICATE, ea, ETHER_ADDR_LEN);
		}
	}
	return 0;
}
开发者ID:HarryDLee,项目名称:hiwifi-openwrt-HC5661-HC5761,代码行数:51,代码来源:wlu_lua.c


示例6: lua_get_acllist

static int
lua_get_acllist(lua_State *L, void *wl, lua_cmd_t *cmd, char *argv)
{
	struct maclist *maclist = (struct maclist *) buf;
	uint i, max = (WLC_IOCTL_MAXLEN - sizeof(int)) / ETHER_ADDR_LEN;
	struct ether_addr *ea;
	int ret;

	maclist->count = htod32(max);
	if ((ret = wlu_get(wl, WLC_GET_MACLIST, maclist, WLC_IOCTL_MAXLEN)) < 0)
	{
		return ret;
	}
	maclist->count = dtoh32(maclist->count);
	lua_newtable(L);
	for (i = 0, ea = maclist->ea; i < maclist->count && i < max; i++, ea++)
	{
		lua_newtable(L);

		lua_pushstring(L, wl_ether_etoa(ea));
		lua_setfield(L, -2, "macaddr");

		lua_rawseti(L, -2, i+1);
	}

	return ret;
}
开发者ID:HarryDLee,项目名称:hiwifi-openwrt-HC5661-HC5761,代码行数:27,代码来源:wlu_lua.c


示例7: make_growing_image

/* produce a growing image file */
int make_growing_image(FILE *fp, Bit64u sec)
{
        redolog_header_t header;
        Bit32u i, not_allocated = htod32(REDOLOG_PAGE_NOT_ALLOCATED);

        memset(&header, 0, sizeof(header));
        make_redolog_header(&header, REDOLOG_SUBTYPE_GROWING, sec * 512);

        if (fwrite(&header, sizeof(header), 1, fp) != 1)
        {
                fclose (fp);
                fatal ("ERROR: The disk image is not complete - could not write header!");
        }

        for (i=0; i<dtoh32(header.specific.catalog); i++)
        {
                if (fwrite(&not_allocated, sizeof(Bit32u), 1, fp) != 1)
                {
                        fclose (fp);
                        fatal ("ERROR: The disk image is not complete - could not write catalog!");
                }
        }

        return 0;
}
开发者ID:PennPanda,项目名称:MIT--6.828,代码行数:26,代码来源:bximage.c


示例8: wlmEstimatedPowerGet

int wlmEstimatedPowerGet(int *estPower, int chain)
{
	tx_power_t power;
	int mimo;

	memset(&power, 0, sizeof(power));

	if (wlu_get(irh, WLC_CURRENT_PWR, &power, sizeof(power)) < 0) {
		printf("wlmEstimatedPowerGet: %s\n", wlmLastError());
		return FALSE;
	}
	power.flags = dtoh32(power.flags);
	power.chanspec = dtohchanspec(power.chanspec);
	mimo = (power.flags & WL_TX_POWER_F_MIMO);

	/* value returned is in units of quarter dBm, need to multiply by 250 to get milli-dBm */
	if (mimo) {
		*estPower = power.est_Pout[chain] * 250;
	} else {
		*estPower = power.est_Pout[0] * 250;
	}

	if (!mimo && CHSPEC_IS2G(power.chanspec)) {
		*estPower = power.est_Pout_cck * 250;
	}

	return TRUE;
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:28,代码来源:wlm.c


示例9: wldev_get_ap_status

int
wldev_get_ap_status(struct net_device *dev)
{
	int res = 0;
	int ap = 0;
	int apsta = 0;
       	char smbuf[WLC_IOCTL_SMLEN];

	printf("%s: enter\n", __FUNCTION__);

        if (!dev) {
                WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__));
                return -1;
        }

        if ((res = wldev_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap), 0))) {
                WLDEV_ERROR(("%s fail to get ap\n", __FUNCTION__));
		ap = 0;
	}

        if ((res = wldev_iovar_getbuf(dev, "apsta", &apsta, sizeof(apsta), smbuf, sizeof(smbuf), NULL)) < 0 ){
                WLDEV_ERROR(("%s fail to get apsta \n", __FUNCTION__));
        } else {
		memcpy(&apsta, smbuf, sizeof(apsta));
		apsta = dtoh32(apsta);
	}

	return (ap||apsta);
}
开发者ID:curbthepain,项目名称:NuK3rn3l_m7_sense_lollipop,代码行数:29,代码来源:wldev_common.c


示例10: ptp_ptpip_getresp

uint16_t
ptp_ptpip_getresp (PTPParams* params, PTPContainer* resp)
{
	PTPIPHeader	hdr;
	unsigned char	*data = NULL;
	uint16_t 	ret;
	int		n;

	ret = ptp_ptpip_cmd_read (params, &hdr, &data);
	if (ret != PTP_RC_OK)
		return ret;

	resp->Code		= dtoh16a(&data[ptpip_resp_code]);
	resp->Transaction_ID	= dtoh32a(&data[ptpip_resp_transid]);
	n = (dtoh32(hdr.length) - sizeof(hdr) - ptpip_resp_param1)/sizeof(uint32_t);
	switch (n) {
	case 5: resp->Param5 = dtoh32a(&data[ptpip_resp_param5]);
	case 4: resp->Param4 = dtoh32a(&data[ptpip_resp_param4]);
	case 3: resp->Param3 = dtoh32a(&data[ptpip_resp_param3]);
	case 2: resp->Param2 = dtoh32a(&data[ptpip_resp_param2]);
	case 1: resp->Param1 = dtoh32a(&data[ptpip_resp_param1]);
	case 0: break;
	default:
		gp_log( GP_LOG_ERROR, "ptpip/getresp", "response got %d parameters?", n);
		break;
	}
	free (data);
	return PTP_RC_OK;
}
开发者ID:FooFeeK,项目名称:libgphoto2,代码行数:29,代码来源:ptpip.c


示例11: ptp_ptpip_init_command_ack

static uint16_t
ptp_ptpip_init_command_ack (PTPParams* params)
{
	PTPIPHeader	hdr;
	unsigned char	*data = NULL;
	uint16_t 	ret;
	int		i;
	unsigned short	*name;

	ret = ptp_ptpip_generic_read (params, params->cmdfd, &hdr, &data);
	if (ret != PTP_RC_OK)
		return ret;
	if (hdr.type != dtoh32(PTPIP_INIT_COMMAND_ACK)) {
		gp_log (GP_LOG_ERROR, "ptpip/init_cmd_ack", "bad type returned %d", htod32(hdr.type));
		free (data);
		return PTP_RC_GeneralError;
	}
	params->eventpipeid = dtoh32a(&data[ptpip_cmdack_idx]);
	memcpy (params->cameraguid, &data[ptpip_cmdack_guid], 16);
	name = (unsigned short*)&data[ptpip_cmdack_name];
	for (i=0;name[i];i++) /* EMPTY */;
	params->cameraname = malloc((i+1)*sizeof(uint16_t));
	for (i=0;name[i];i++)
		params->cameraname[i] = name[i];
	free (data);
	return PTP_RC_OK;
}
开发者ID:FooFeeK,项目名称:libgphoto2,代码行数:27,代码来源:ptpip.c


示例12: wl_update_rssi_cache

void
wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list)
{
	wl_rssi_cache_t *node, *prev, *leaf, **rssi_head;
	wl_bss_info_t *bi = NULL;
	int i, j, k;

	if (!ss_list->count)
		return;

	rssi_head = &rssi_cache_ctrl->m_cache_head;

	/* update RSSI */
	for (i = 0; i < ss_list->count; i++) {
		node = *rssi_head;
		prev = NULL;
		k = 0;
		bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info;
		for (;node;) {
			if (!memcmp(&node->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) {
				ANDROID_INFO(("%s: Update %d with BSSID %pM, RSSI=%d, SSID \"%s\"\n",
					__FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID));
				for(j=0; j<RSSIAVG_LEN-1; j++)
					node->RSSI[j] = node->RSSI[j+1];
				node->RSSI[j] = dtoh16(bi->RSSI);
				node->dirty = 0;
				break;
			}
			prev = node;
			node = node->next;
			k++;
		}

		if (node)
			continue;

		leaf = kmalloc(sizeof(wl_rssi_cache_t), GFP_KERNEL);
		if (!leaf) {
			ANDROID_ERROR(("%s: Memory alloc failure %d\n",
				__FUNCTION__, sizeof(wl_rssi_cache_t)));
			return;
		}
		ANDROID_INFO(("%s: Add %d with cached BSSID %pM, RSSI=%d, SSID \"%s\" in the leaf\n",
				__FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID));

		leaf->next = NULL;
		leaf->dirty = 0;
		memcpy(&leaf->BSSID, &bi->BSSID, ETHER_ADDR_LEN);
		for (j=0; j<RSSIAVG_LEN; j++)
			leaf->RSSI[j] = dtoh16(bi->RSSI);

		if (!prev)
			*rssi_head = leaf;
		else
			prev->next = leaf;
	}
}
开发者ID:maikovisky,项目名称:BananaPi-Android-4.2.2-Liab,代码行数:57,代码来源:wl_android.c


示例13: wlmIsAdapterUp

int wlmIsAdapterUp(int *up)
{
	/*  Get 'isup' - check if adapter is up */
	up = dtoh32(up);
	if (wlu_get(irh, WLC_GET_UP, up, sizeof(int))) {
		printf("wlmIsAdapterUp: %s\n", wlmLastError());
		return FALSE;
	}

	return TRUE;
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:11,代码来源:wlm.c


示例14:

int vmware3_image_t::read_ints(int fd, Bit32u *buffer, size_t count)
{
    size_t i;
    Bit32u *p;

    int res=::read(fd, (void*)buffer, count * 4);
    for (p = buffer, i=0; i<count; p++, i++)
      *p=dtoh32(*p);

    return res;
}
开发者ID:iver6,项目名称:BA,代码行数:11,代码来源:vmware3.cpp


示例15: wl_p2p_dev

int wl_p2p_dev(void *wl, int *bsscfgIndex)
{
	int *ptr;
	int err;

	err = wlu_var_getbuf(wl, "p2p_dev", NULL, 0, (void*)&ptr);
	if (err >= 0)
		*bsscfgIndex = dtoh32(*ptr);

	return err;
}
开发者ID:TheTypoMaster,项目名称:asuswrt,代码行数:11,代码来源:wlu_api.c


示例16: wl_p2p_if

int wl_p2p_if(void *wl, struct ether_addr *ea, int *bsscfgIndex)
{
	wl_p2p_ifq_t *ptr;
	int err;

	err = wlu_var_getbuf(wl, "p2p_if", ea, sizeof(*ea), (void*)&ptr);
	if (err >= 0)
		*bsscfgIndex = dtoh32(ptr->bsscfgidx);

	return err;
}
开发者ID:TheTypoMaster,项目名称:asuswrt,代码行数:11,代码来源:wlu_api.c


示例17: wlu_iovar_getint

/*
 * get named iovar as an integer value
 * iovar name is converted to lower case
 */
int
wlu_iovar_getint(void *wl, const char *iovar, int *pval)
{
	int ret;

	ret = wlu_iovar_get(wl, iovar, pval, sizeof(int));
	if (ret >= 0)
	{
		*pval = dtoh32(*pval);
	}
	return ret;
}
开发者ID:fishbaoz,项目名称:wiced-emw3165,代码行数:16,代码来源:wlu_common.c


示例18: wlmRssiGet

int wlmRssiGet(int *rssi)
{
	wl_pkteng_stats_t *cnt;

	if (wlu_var_getbuf(irh, "pkteng_stats", NULL, 0, (void **)&cnt)) {
		printf("wlmRssiGet: %s\n", wlmLastError());
		return FALSE;
	}

	*rssi = dtoh32(cnt->rssi);

	return TRUE;
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:13,代码来源:wlm.c


示例19: wlmRxGetReceivedPackets

int wlmRxGetReceivedPackets(unsigned int *count)
{
	wl_cnt_t *cnt;

	if (wlu_var_getbuf(irh, "counters", NULL, 0, (void **)&cnt)) {
		printf("wlmRxGetReceivedPackets: %s\n", wlmLastError());
		return FALSE;
	}

	*count = dtoh32(cnt->pktengrxducast);

	return TRUE;
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:13,代码来源:wlm.c


示例20: wldev_get_ssid

int wldev_get_ssid(
	struct net_device *dev, wlc_ssid_t *pssid)
{
	int error;

	if (!pssid)
		return -ENOMEM;
	error = wldev_ioctl(dev, WLC_GET_SSID, pssid, sizeof(wlc_ssid_t), 0);
	if (unlikely(error))
		return error;
	pssid->SSID_len = dtoh32(pssid->SSID_len);
	return error;
}
开发者ID:curbthepain,项目名称:NuK3rn3l_m7_sense_lollipop,代码行数:13,代码来源:wldev_common.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ dtostrf函数代码示例发布时间:2022-05-30
下一篇:
C++ dtkWarn函数代码示例发布时间: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