您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ uint8_tobuffer函数代码示例

51自学网 2021-06-03 09:07:42
  C++
这篇教程C++ uint8_tobuffer函数代码示例写得很实用,希望能帮到您。

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

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

示例1: fromstruct_dlv

static inline isc_result_tfromstruct_dlv(ARGS_FROMSTRUCT) {	dns_rdata_dlv_t *dlv = source;	REQUIRE(type == 32769);	REQUIRE(source != NULL);	REQUIRE(dlv->common.rdtype == type);	REQUIRE(dlv->common.rdclass == rdclass);	switch (dlv->digest_type) {	case DNS_DSDIGEST_SHA1:		REQUIRE(dlv->length == ISC_SHA1_DIGESTLENGTH);		break;	case DNS_DSDIGEST_SHA256:		REQUIRE(dlv->length == ISC_SHA256_DIGESTLENGTH);		break;	}	UNUSED(type);	UNUSED(rdclass);	RETERR(uint16_tobuffer(dlv->key_tag, target));	RETERR(uint8_tobuffer(dlv->algorithm, target));	RETERR(uint8_tobuffer(dlv->digest_type, target));	return (mem_tobuffer(target, dlv->digest, dlv->length));}
开发者ID:DHTNS,项目名称:bind9-9.7.0-P1.dfsg,代码行数:26,


示例2: fromtext_sshfp

static inline isc_result_tfromtext_sshfp(ARGS_FROMTEXT) {	isc_token_t token;	REQUIRE(type == 44);	UNUSED(type);	UNUSED(rdclass);	UNUSED(origin);	UNUSED(options);	UNUSED(callbacks);	/*	 * Algorithm.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Digest type.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Digest.	 */	return (isc_hex_tobuffer(lexer, target, -1));}
开发者ID:enukane,项目名称:netbsd-src,代码行数:35,


示例3: fromstruct_hip

static inline isc_result_tfromstruct_hip(ARGS_FROMSTRUCT) {	dns_rdata_hip_t *hip = source;	dns_rdata_hip_t myhip;	isc_result_t result;	REQUIRE(type == dns_rdatatype_hip);	REQUIRE(source != NULL);	REQUIRE(hip->common.rdtype == type);	REQUIRE(hip->common.rdclass == rdclass);	REQUIRE(hip->hit_len > 0 && hip->hit != NULL);	REQUIRE(hip->key_len > 0 && hip->key != NULL);	REQUIRE((hip->servers == NULL && hip->servers_len == 0) ||		 (hip->servers != NULL && hip->servers_len != 0));	UNUSED(type);	UNUSED(rdclass);	RETERR(uint8_tobuffer(hip->hit_len, target));	RETERR(uint8_tobuffer(hip->algorithm, target));	RETERR(uint16_tobuffer(hip->key_len, target));	RETERR(mem_tobuffer(target, hip->hit, hip->hit_len));	RETERR(mem_tobuffer(target, hip->key, hip->key_len));	myhip = *hip;	for (result = dns_rdata_hip_first(&myhip);	     result == ISC_R_SUCCESS;	     result = dns_rdata_hip_next(&myhip))		/* empty */;	return(mem_tobuffer(target, hip->servers, hip->servers_len));}
开发者ID:chris-wood,项目名称:bind-prime,代码行数:32,


示例4: fromstruct_keydata

static inline isc_result_tfromstruct_keydata(ARGS_FROMSTRUCT) {	dns_rdata_keydata_t *keydata = source;	REQUIRE(type == 65533);	REQUIRE(source != NULL);	REQUIRE(keydata->common.rdtype == type);	REQUIRE(keydata->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	/* Refresh timer */	RETERR(uint32_tobuffer(keydata->refresh, target));	/* Add hold-down */	RETERR(uint32_tobuffer(keydata->addhd, target));	/* Remove hold-down */	RETERR(uint32_tobuffer(keydata->removehd, target));	/* Flags */	RETERR(uint16_tobuffer(keydata->flags, target));	/* Protocol */	RETERR(uint8_tobuffer(keydata->protocol, target));	/* Algorithm */	RETERR(uint8_tobuffer(keydata->algorithm, target));	/* Data */	return (mem_tobuffer(target, keydata->data, keydata->datalen));}
开发者ID:pexip,项目名称:os-bind9,代码行数:33,


示例5: generic_fromstruct_ds

static inline isc_result_tgeneric_fromstruct_ds(ARGS_FROMSTRUCT) {	dns_rdata_ds_t *ds = source;	REQUIRE(source != NULL);	REQUIRE(ds->common.rdtype == type);	REQUIRE(ds->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	switch (ds->digest_type) {	case DNS_DSDIGEST_SHA1:		REQUIRE(ds->length == ISC_SHA1_DIGESTLENGTH);		break;	case DNS_DSDIGEST_SHA256:		REQUIRE(ds->length == ISC_SHA256_DIGESTLENGTH);		break;#ifdef ISC_GOST_DIGESTLENGTH	case DNS_DSDIGEST_GOST:		REQUIRE(ds->length == ISC_GOST_DIGESTLENGTH);		break;#endif	case DNS_DSDIGEST_SHA384:		REQUIRE(ds->length == ISC_SHA384_DIGESTLENGTH);		break;	}	RETERR(uint16_tobuffer(ds->key_tag, target));	RETERR(uint8_tobuffer(ds->algorithm, target));	RETERR(uint8_tobuffer(ds->digest_type, target));	return (mem_tobuffer(target, ds->digest, ds->length));}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:34,


示例6: fromstruct_naptr

static inline isc_result_tfromstruct_naptr(ARGS_FROMSTRUCT) {	dns_rdata_naptr_t *naptr = source;	isc_region_t region;	REQUIRE(type == dns_rdatatype_naptr);	REQUIRE(source != NULL);	REQUIRE(naptr->common.rdtype == type);	REQUIRE(naptr->common.rdclass == rdclass);	REQUIRE(naptr->flags != NULL || naptr->flags_len == 0);	REQUIRE(naptr->service != NULL || naptr->service_len == 0);	REQUIRE(naptr->regexp != NULL || naptr->regexp_len == 0);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint16_tobuffer(naptr->order, target));	RETERR(uint16_tobuffer(naptr->preference, target));	RETERR(uint8_tobuffer(naptr->flags_len, target));	RETERR(mem_tobuffer(target, naptr->flags, naptr->flags_len));	RETERR(uint8_tobuffer(naptr->service_len, target));	RETERR(mem_tobuffer(target, naptr->service, naptr->service_len));	RETERR(uint8_tobuffer(naptr->regexp_len, target));	RETERR(mem_tobuffer(target, naptr->regexp, naptr->regexp_len));	dns_name_toregion(&naptr->replacement, &region);	return (isc_buffer_copyregion(target, &region));}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:27,


示例7: fromstruct_nsec3

static inline isc_result_tfromstruct_nsec3(ARGS_FROMSTRUCT) {	dns_rdata_nsec3_t *nsec3 = source;	isc_region_t region;	REQUIRE(type == dns_rdatatype_nsec3);	REQUIRE(source != NULL);	REQUIRE(nsec3->common.rdtype == type);	REQUIRE(nsec3->common.rdclass == rdclass);	REQUIRE(nsec3->typebits != NULL || nsec3->len == 0);	REQUIRE(nsec3->hash == dns_hash_sha1);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint8_tobuffer(nsec3->hash, target));	RETERR(uint8_tobuffer(nsec3->flags, target));	RETERR(uint16_tobuffer(nsec3->iterations, target));	RETERR(uint8_tobuffer(nsec3->salt_length, target));	RETERR(mem_tobuffer(target, nsec3->salt, nsec3->salt_length));	RETERR(uint8_tobuffer(nsec3->next_length, target));	RETERR(mem_tobuffer(target, nsec3->next, nsec3->next_length));	region.base = nsec3->typebits;	region.length = nsec3->len;	RETERR(typemap_test(&region, ISC_TRUE));	return (mem_tobuffer(target, nsec3->typebits, nsec3->len));}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:28,


示例8: fromstruct_sig

static inline isc_result_tfromstruct_sig(ARGS_FROMSTRUCT) {	dns_rdata_sig_t *sig = source;	REQUIRE(type == dns_rdatatype_sig);	REQUIRE(source != NULL);	REQUIRE(sig->common.rdtype == type);	REQUIRE(sig->common.rdclass == rdclass);	REQUIRE(sig->signature != NULL || sig->siglen == 0);	UNUSED(type);	UNUSED(rdclass);	/*	 * Type covered.	 */	RETERR(uint16_tobuffer(sig->covered, target));	/*	 * Algorithm.	 */	RETERR(uint8_tobuffer(sig->algorithm, target));	/*	 * Labels.	 */	RETERR(uint8_tobuffer(sig->labels, target));	/*	 * Original TTL.	 */	RETERR(uint32_tobuffer(sig->originalttl, target));	/*	 * Expire time.	 */	RETERR(uint32_tobuffer(sig->timeexpire, target));	/*	 * Time signed.	 */	RETERR(uint32_tobuffer(sig->timesigned, target));	/*	 * Key ID.	 */	RETERR(uint16_tobuffer(sig->keyid, target));	/*	 * Signer name.	 */	RETERR(name_tobuffer(&sig->signer, target));	/*	 * Signature.	 */	return (mem_tobuffer(target, sig->signature, sig->siglen));}
开发者ID:fatman2021,项目名称:netbsd-src,代码行数:58,


示例9: fromtext_dlv

static inline isc_result_tfromtext_dlv(ARGS_FROMTEXT) {	isc_token_t token;	unsigned char c;	int length;	REQUIRE(type == 32769);	UNUSED(type);	UNUSED(rdclass);	UNUSED(origin);	UNUSED(options);	UNUSED(callbacks);	/*	 * Key tag.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffffU)		RETTOK(ISC_R_RANGE);	RETERR(uint16_tobuffer(token.value.as_ulong, target));	/*	 * Algorithm.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Digest type.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	c = (unsigned char) token.value.as_ulong;	/*	 * Digest.	 */	if (c == DNS_DSDIGEST_SHA1)		length = ISC_SHA1_DIGESTLENGTH;	else if (c == DNS_DSDIGEST_SHA256)		length = ISC_SHA256_DIGESTLENGTH;	else		length = -1;	return (isc_hex_tobuffer(lexer, target, -1));}
开发者ID:DHTNS,项目名称:bind9-9.7.0-P1.dfsg,代码行数:53,


示例10: fromtext_nsec3param

static inline isc_result_tfromtext_nsec3param(ARGS_FROMTEXT) {	isc_token_t token;	unsigned int flags = 0;	unsigned char hashalg;	REQUIRE(type == dns_rdatatype_nsec3param);	UNUSED(type);	UNUSED(rdclass);	UNUSED(callbacks);	UNUSED(origin);	UNUSED(options);	/* Hash. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	RETTOK(dns_hashalg_fromtext(&hashalg, &token.value.as_textregion));	RETERR(uint8_tobuffer(hashalg, target));	/* Flags. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	flags = token.value.as_ulong;	if (flags > 255U)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(flags, target));	/* Iterations. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffffU)		RETTOK(ISC_R_RANGE);	RETERR(uint16_tobuffer(token.value.as_ulong, target));	/* Salt. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	if (token.value.as_textregion.length > (255*2))		RETTOK(DNS_R_TEXTTOOLONG);	if (strcmp(DNS_AS_STR(token), "-") == 0) {		RETERR(uint8_tobuffer(0, target));	} else {		RETERR(uint8_tobuffer(strlen(DNS_AS_STR(token)) / 2, target));		RETERR(isc_hex_decodestring(DNS_AS_STR(token), target));	}	return (ISC_R_SUCCESS);}
开发者ID:crossbuild,项目名称:bind,代码行数:49,


示例11: fromtext_ds

static inline isc_result_tfromtext_ds(ARGS_FROMTEXT) {	isc_token_t token;	unsigned char c;	int length;	REQUIRE(type == 43);	UNUSED(type);	UNUSED(rdclass);	UNUSED(origin);	UNUSED(options);	UNUSED(callbacks);	/*	 * Key tag.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffffU)		RETTOK(ISC_R_RANGE);	RETERR(uint16_tobuffer(token.value.as_ulong, target));	/*	 * Algorithm.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	RETTOK(dns_secalg_fromtext(&c, &token.value.as_textregion));	RETERR(mem_tobuffer(target, &c, 1));	/*	 * Digest type.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	c = (unsigned char) token.value.as_ulong;	/*	 * Digest.	 */	switch (c) {	case DNS_DSDIGEST_SHA1:		length = ISC_SHA1_DIGESTLENGTH;		break;	case DNS_DSDIGEST_SHA256:		length = ISC_SHA256_DIGESTLENGTH;		break;	case DNS_DSDIGEST_GOST:		length = ISC_GOST_DIGESTLENGTH;		break;	default:		length = -1;		break;	}	return (isc_hex_tobuffer(lexer, target, length));}
开发者ID:2014-class,项目名称:freerouter,代码行数:60,


示例12: fromstruct_isdn

static inline isc_result_tfromstruct_isdn(ARGS_FROMSTRUCT) {	dns_rdata_isdn_t *isdn = source;	REQUIRE(type == 20);	REQUIRE(source != NULL);	REQUIRE(isdn->common.rdtype == type);	REQUIRE(isdn->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint8_tobuffer(isdn->isdn_len, target));	RETERR(mem_tobuffer(target, isdn->isdn, isdn->isdn_len));	RETERR(uint8_tobuffer(isdn->subaddress_len, target));	return (mem_tobuffer(target, isdn->subaddress, isdn->subaddress_len));}
开发者ID:KaiToTo,项目名称:freebsd,代码行数:17,


示例13: fromstruct_hinfo

static inline isc_result_tfromstruct_hinfo(ARGS_FROMSTRUCT) {	dns_rdata_hinfo_t *hinfo = source;	REQUIRE(type == 13);	REQUIRE(source != NULL);	REQUIRE(hinfo->common.rdtype == type);	REQUIRE(hinfo->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint8_tobuffer(hinfo->cpu_len, target));	RETERR(mem_tobuffer(target, hinfo->cpu, hinfo->cpu_len));	RETERR(uint8_tobuffer(hinfo->os_len, target));	return (mem_tobuffer(target, hinfo->os, hinfo->os_len));}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:17,


示例14: fromtext_caa

static inline isc_result_tfromtext_caa(ARGS_FROMTEXT) {	isc_token_t token;	isc_textregion_t tr;	isc_uint8_t flags;	unsigned int i;	REQUIRE(type == 257);	UNUSED(type);	UNUSED(rdclass);	UNUSED(origin);	UNUSED(options);	UNUSED(callbacks);	/* Flags. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 255U)		RETTOK(ISC_R_RANGE);	flags = token.value.as_ulong & 255U;	RETERR(uint8_tobuffer(flags, target));	/*	 * Tag	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	tr = token.value.as_textregion;	for (i = 0; i < tr.length; i++)		if (!alphanumeric[(unsigned char) tr.base[i]])			RETTOK(DNS_R_SYNTAX);	RETERR(uint8_tobuffer(tr.length, target));	RETERR(mem_tobuffer(target, tr.base, tr.length));	/*	 * Value	 */	RETERR(isc_lex_getmastertoken(lexer, &token,				      isc_tokentype_qstring, ISC_FALSE));	if (token.type != isc_tokentype_qstring &&	    token.type != isc_tokentype_string)		RETERR(DNS_R_SYNTAX);	RETERR(multitxt_fromtext(&token.value.as_textregion, target));	return (ISC_R_SUCCESS);}
开发者ID:krichter722,项目名称:bind9,代码行数:46,


示例15: fromstruct_sshfp

static inline isc_result_tfromstruct_sshfp(ARGS_FROMSTRUCT) {	dns_rdata_sshfp_t *sshfp = source;	REQUIRE(type == 44);	REQUIRE(source != NULL);	REQUIRE(sshfp->common.rdtype == type);	REQUIRE(sshfp->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint8_tobuffer(sshfp->algorithm, target));	RETERR(uint8_tobuffer(sshfp->digest_type, target));	return (mem_tobuffer(target, sshfp->digest, sshfp->length));}
开发者ID:JasonCC,项目名称:Openswan,代码行数:17,


示例16: fromstruct_tlsa

static inline isc_result_tfromstruct_tlsa(ARGS_FROMSTRUCT) {	dns_rdata_tlsa_t *tlsa = source;	REQUIRE(type == 52);	REQUIRE(source != NULL);	REQUIRE(tlsa->common.rdtype == type);	REQUIRE(tlsa->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint8_tobuffer(tlsa->usage, target));	RETERR(uint8_tobuffer(tlsa->selector, target));	RETERR(uint8_tobuffer(tlsa->match, target));	return (mem_tobuffer(target, tlsa->data, tlsa->length));}
开发者ID:JeanCaron,项目名称:bind9,代码行数:18,


示例17: fromtext_tlsa

static inline isc_result_tfromtext_tlsa(ARGS_FROMTEXT) {	isc_token_t token;	REQUIRE(type == 52);	UNUSED(type);	UNUSED(rdclass);	UNUSED(origin);	UNUSED(options);	UNUSED(callbacks);	/*	 * Certificate Usage.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Selector.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Matching type.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Certificate Association Data.	 */	return (isc_hex_tobuffer(lexer, target, -1));}
开发者ID:JeanCaron,项目名称:bind9,代码行数:44,


示例18: fromstruct_gpos

static inline isc_result_t fromstruct_gpos (ARGS_FROMSTRUCT){    dns_rdata_gpos_t *gpos = source;    REQUIRE (type == 27);    REQUIRE (source != NULL);    REQUIRE (gpos->common.rdtype == type);    REQUIRE (gpos->common.rdclass == rdclass);    UNUSED (type);    UNUSED (rdclass);    RETERR (uint8_tobuffer (gpos->long_len, target));    RETERR (mem_tobuffer (target, gpos->longitude, gpos->long_len));    RETERR (uint8_tobuffer (gpos->lat_len, target));    RETERR (mem_tobuffer (target, gpos->latitude, gpos->lat_len));    RETERR (uint8_tobuffer (gpos->alt_len, target));    return (mem_tobuffer (target, gpos->altitude, gpos->alt_len));}
开发者ID:274914765,项目名称:C,代码行数:19,


示例19: fromstruct_caa

static inline isc_result_tfromstruct_caa(ARGS_FROMSTRUCT) {	dns_rdata_caa_t *caa = source;	isc_region_t region;	unsigned int i;	REQUIRE(type == 257);	REQUIRE(source != NULL);	REQUIRE(caa->common.rdtype == type);	REQUIRE(caa->common.rdclass == rdclass);	REQUIRE(caa->tag != NULL && caa->tag_len != 0);	REQUIRE(caa->value != NULL);	UNUSED(type);	UNUSED(rdclass);	/*	 * Flags	 */	RETERR(uint8_tobuffer(caa->flags, target));	/*	 * Tag length	 */	RETERR(uint8_tobuffer(caa->tag_len, target));	/*	 * Tag	 */	region.base = caa->tag;	region.length = caa->tag_len;	for (i = 0; i < region.length; i++)		if (!alphanumeric[region.base[i]])			RETERR(DNS_R_SYNTAX);	RETERR(isc_buffer_copyregion(target, &region));	/*	 * Value	 */	region.base = caa->value;	region.length = caa->value_len;	return (isc_buffer_copyregion(target, &region));}
开发者ID:krichter722,项目名称:bind9,代码行数:43,


示例20: fromstruct_ipseckey

static inline isc_result_tfromstruct_ipseckey(ARGS_FROMSTRUCT) {	dns_rdata_ipseckey_t *ipseckey = source;	isc_region_t region;	isc_uint32_t n;	REQUIRE(type == 45);	REQUIRE(source != NULL);	REQUIRE(ipseckey->common.rdtype == type);	REQUIRE(ipseckey->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	if (ipseckey->gateway_type > 3U)		return (ISC_R_NOTIMPLEMENTED);	RETERR(uint8_tobuffer(ipseckey->precedence, target));	RETERR(uint8_tobuffer(ipseckey->gateway_type, target));	RETERR(uint8_tobuffer(ipseckey->algorithm, target));	switch  (ipseckey->gateway_type) {	case 0:		break;	case 1:		n = ntohl(ipseckey->in_addr.s_addr);		RETERR(uint32_tobuffer(n, target));		break;	case 2:		RETERR(mem_tobuffer(target, ipseckey->in6_addr.s6_addr, 16));		break;	case 3:		dns_name_toregion(&ipseckey->gateway, &region);		RETERR(isc_buffer_copyregion(target, &region));		break;	}	return (mem_tobuffer(target, ipseckey->key, ipseckey->keylength));}
开发者ID:enukane,项目名称:netbsd-src,代码行数:42,


示例21: fromstruct_nsec3param

static inline isc_result_tfromstruct_nsec3param(ARGS_FROMSTRUCT) {	dns_rdata_nsec3param_t *nsec3param = source;	REQUIRE(type == dns_rdatatype_nsec3param);	REQUIRE(source != NULL);	REQUIRE(nsec3param->common.rdtype == type);	REQUIRE(nsec3param->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint8_tobuffer(nsec3param->hash, target));	RETERR(uint8_tobuffer(nsec3param->flags, target));	RETERR(uint16_tobuffer(nsec3param->iterations, target));	RETERR(uint8_tobuffer(nsec3param->salt_length, target));	RETERR(mem_tobuffer(target, nsec3param->salt,			    nsec3param->salt_length));	return (ISC_R_SUCCESS);}
开发者ID:crossbuild,项目名称:bind,代码行数:20,


示例22: generic_fromstruct_key

static inline isc_result_tgeneric_fromstruct_key(ARGS_FROMSTRUCT) {	dns_rdata_key_t *key = source;	REQUIRE(key != NULL);	REQUIRE(key->common.rdtype == type);	REQUIRE(key->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	/* Flags */	RETERR(uint16_tobuffer(key->flags, target));	/* Protocol */	RETERR(uint8_tobuffer(key->protocol, target));	/* Algorithm */	RETERR(uint8_tobuffer(key->algorithm, target));	/* Data */	return (mem_tobuffer(target, key->data, key->datalen));}
开发者ID:fatman2021,项目名称:netbsd-src,代码行数:23,


示例23: fromstruct_cert

static inline isc_result_tfromstruct_cert(ARGS_FROMSTRUCT) {	dns_rdata_cert_t *cert = source;	REQUIRE(type == 37);	REQUIRE(source != NULL);	REQUIRE(cert->common.rdtype == type);	REQUIRE(cert->common.rdclass == rdclass);	UNUSED(type);	UNUSED(rdclass);	RETERR(uint16_tobuffer(cert->type, target));	RETERR(uint16_tobuffer(cert->key_tag, target));	RETERR(uint8_tobuffer(cert->algorithm, target));	return (mem_tobuffer(target, cert->certificate, cert->length));}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:18,


示例24: fromstruct_x25

static inline isc_result_tfromstruct_x25(ARGS_FROMSTRUCT) {    dns_rdata_x25_t *x25 = source;    isc_uint8_t i;    REQUIRE(type == dns_rdatatype_x25);    REQUIRE(source != NULL);    REQUIRE(x25->common.rdtype == type);    REQUIRE(x25->common.rdclass == rdclass);    REQUIRE(x25->x25 != NULL && x25->x25_len != 0);    UNUSED(type);    UNUSED(rdclass);    if (x25->x25_len < 4)        return (ISC_R_RANGE);    for (i = 0; i < x25->x25_len; i++)        if (!isdigit(x25->x25[i] & 0xff))            return (ISC_R_RANGE);    RETERR(uint8_tobuffer(x25->x25_len, target));    return (mem_tobuffer(target, x25->x25, x25->x25_len));}
开发者ID:ryo,项目名称:netbsd-src,代码行数:24,


示例25: fromtext_nsec3

static inline isc_result_tfromtext_nsec3(ARGS_FROMTEXT) {	isc_token_t token;	unsigned int flags;	unsigned char hashalg;	isc_buffer_t b;	unsigned char buf[256];	REQUIRE(type == dns_rdatatype_nsec3);	UNUSED(type);	UNUSED(rdclass);	UNUSED(callbacks);	UNUSED(origin);	UNUSED(options);	/* Hash. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	RETTOK(dns_hashalg_fromtext(&hashalg, &token.value.as_textregion));	RETERR(uint8_tobuffer(hashalg, target));	/* Flags. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	flags = token.value.as_ulong;	if (flags > 255U)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(flags, target));	/* Iterations. */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffffU)		RETTOK(ISC_R_RANGE);	RETERR(uint16_tobuffer(token.value.as_ulong, target));	/* salt */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	if (token.value.as_textregion.length > (255*2))		RETTOK(DNS_R_TEXTTOOLONG);	if (strcmp(DNS_AS_STR(token), "-") == 0) {		RETERR(uint8_tobuffer(0, target));	} else {		RETERR(uint8_tobuffer(strlen(DNS_AS_STR(token)) / 2, target));		RETERR(isc_hex_decodestring(DNS_AS_STR(token), target));	}	/*	 * Next hash a single base32hex word.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	isc_buffer_init(&b, buf, sizeof(buf));	RETTOK(isc_base32hexnp_decodestring(DNS_AS_STR(token), &b));	if (isc_buffer_usedlength(&b) > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(isc_buffer_usedlength(&b), target));	RETERR(mem_tobuffer(target, &buf, isc_buffer_usedlength(&b)));	return (typemap_fromtext(lexer, target, ISC_TRUE));}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:63,


示例26: fromtext_ipseckey

static inline isc_result_tfromtext_ipseckey(ARGS_FROMTEXT) {	isc_token_t token;	dns_name_t name;	isc_buffer_t buffer;	unsigned int gateway;	struct in_addr addr;	unsigned char addr6[16];	isc_region_t region;	REQUIRE(type == 45);	UNUSED(type);	UNUSED(rdclass);	UNUSED(callbacks);	/*	 * Precedence.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Gateway type.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0x3U)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	gateway = token.value.as_ulong;	/*	 * Algorithm.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Gateway.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	switch (gateway) {	case 0:		if (strcmp(DNS_AS_STR(token), ".") != 0)			RETTOK(DNS_R_SYNTAX);		break;	case 1:		if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)			RETTOK(DNS_R_BADDOTTEDQUAD);		isc_buffer_availableregion(target, &region);		if (region.length < 4)			return (ISC_R_NOSPACE);		memmove(region.base, &addr, 4);		isc_buffer_add(target, 4);		break;	case 2:		if (inet_pton(AF_INET6, DNS_AS_STR(token), addr6) != 1)			RETTOK(DNS_R_BADAAAA);		isc_buffer_availableregion(target, &region);		if (region.length < 16)			return (ISC_R_NOSPACE);		memmove(region.base, addr6, 16);		isc_buffer_add(target, 16);		break;	case 3:		dns_name_init(&name, NULL);		buffer_fromregion(&buffer, &token.value.as_region);		origin = (origin != NULL) ? origin : dns_rootname;		RETTOK(dns_name_fromtext(&name, &buffer, origin,					 options, target));		break;	}	/*	 * Public key.	 */	return (isc_base64_tobuffer(lexer, target, -1));}
开发者ID:enukane,项目名称:netbsd-src,代码行数:90,


示例27: fromtext_hip

static inline isc_result_tfromtext_hip(ARGS_FROMTEXT) {	isc_token_t token;	dns_name_t name;	isc_buffer_t buffer;	isc_buffer_t hit_len;	isc_buffer_t key_len;	unsigned char *start;	size_t len;	REQUIRE(type == dns_rdatatype_hip);	UNUSED(type);	UNUSED(rdclass);	UNUSED(callbacks);	/*	 * Dummy HIT len.	 */	hit_len = *target;	RETERR(uint8_tobuffer(0, target));	/*	 * Algorithm.	 */	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,				      ISC_FALSE));	if (token.value.as_ulong > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer(token.value.as_ulong, target));	/*	 * Dummy KEY len.	 */	key_len = *target;	RETERR(uint16_tobuffer(0, target));	/*	 * HIT (base16).	 */	start = isc_buffer_used(target);	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	RETTOK(isc_hex_decodestring(DNS_AS_STR(token), target));	/*	 * Fill in HIT len.	 */	len = (unsigned char *)isc_buffer_used(target) - start;	if (len > 0xffU)		RETTOK(ISC_R_RANGE);	RETERR(uint8_tobuffer((isc_uint32_t)len, &hit_len));	/*	 * Public key (base64).	 */	start = isc_buffer_used(target);	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,				      ISC_FALSE));	RETTOK(isc_base64_decodestring(DNS_AS_STR(token), target));	/*	 * Fill in KEY len.	 */	len = (unsigned char *)isc_buffer_used(target) - start;	if (len > 0xffffU)		RETTOK(ISC_R_RANGE);	RETERR(uint16_tobuffer((isc_uint32_t)len, &key_len));	/*	 * Rendezvous Servers.	 */	dns_name_init(&name, NULL);	do {		RETERR(isc_lex_getmastertoken(lexer, &token,					      isc_tokentype_string,					      ISC_TRUE));		if (token.type != isc_tokentype_string)			break;		buffer_fromregion(&buffer, &token.value.as_region);		origin = (origin != NULL) ? origin : dns_rootname;		RETTOK(dns_name_fromtext(&name, &buffer, origin, options,					 target));	} while (1);	/*	 * Let upper layer handle eol/eof.	 */	isc_lex_ungettoken(lexer, &token);	return (ISC_R_SUCCESS);}
开发者ID:chris-wood,项目名称:bind-prime,代码行数:92,


示例28: fromtext_in_apl

static inline isc_result_tfromtext_in_apl(ARGS_FROMTEXT) {	isc_token_t token;	unsigned char addr[16];	unsigned long afi;	isc_uint8_t prefix;	isc_uint8_t len;	isc_boolean_t neg;	char *cp, *ap, *slash;	int n;	REQUIRE(type == dns_rdatatype_apl);	REQUIRE(rdclass == dns_rdataclass_in);	UNUSED(type);	UNUSED(rdclass);	UNUSED(origin);	UNUSED(options);	UNUSED(callbacks);	do {		RETERR(isc_lex_getmastertoken(lexer, &token,					      isc_tokentype_string, ISC_TRUE));		if (token.type != isc_tokentype_string)			break;		cp = DNS_AS_STR(token);		neg = ISC_TF(*cp == '!');		if (neg)			cp++;		afi = strtoul(cp, &ap, 10);		if (*ap++ != ':' || cp == ap)			RETTOK(DNS_R_SYNTAX);		if (afi > 0xffffU)			RETTOK(ISC_R_RANGE);		slash = strchr(ap, '/');		if (slash == NULL || slash == ap)			RETTOK(DNS_R_SYNTAX);		RETTOK(isc_parse_uint8(&prefix, slash + 1, 10));		switch (afi) {		case 1:			*slash = '/0';			n = inet_pton(AF_INET, ap, addr);			*slash = '/';			if (n != 1)				RETTOK(DNS_R_BADDOTTEDQUAD);			if (prefix > 32)				RETTOK(ISC_R_RANGE);			for (len = 4; len > 0; len--)				if (addr[len - 1] != 0)					break;			break;		case 2:			*slash = '/0';			n = inet_pton(AF_INET6, ap, addr);			*slash = '/';			if (n != 1)				RETTOK(DNS_R_BADAAAA);			if (prefix > 128)				RETTOK(ISC_R_RANGE);			for (len = 16; len > 0; len--)				if (addr[len - 1] != 0)					break;			break;		default:			RETTOK(ISC_R_NOTIMPLEMENTED);		}		RETERR(uint16_tobuffer(afi, target));		RETERR(uint8_tobuffer(prefix, target));		RETERR(uint8_tobuffer(len | ((neg) ? 0x80 : 0), target));		RETERR(mem_tobuffer(target, addr, len));	} while (1);	/*	 * Let upper layer handle eol/eof.	 */	isc_lex_ungettoken(lexer, &token);	return (ISC_R_SUCCESS);}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:82,



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


C++ uiomove函数代码示例
C++ uint8_t函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。