本文整理汇总了C++中dns_name_fromwire函数的典型用法代码示例。如果您正苦于以下问题:C++ dns_name_fromwire函数的具体用法?C++ dns_name_fromwire怎么用?C++ dns_name_fromwire使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dns_name_fromwire函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fromwire_in_px
static inline isc_result_t
fromwire_in_px(ARGS_FROMWIRE) {
dns_name_t name;
isc_region_t sregion;
REQUIRE(type == dns_rdatatype_px);
REQUIRE(rdclass == dns_rdataclass_in);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
/*
* Preference.
*/
isc_buffer_activeregion(source, &sregion);
if (sregion.length < 2)
return (ISC_R_UNEXPECTEDEND);
RETERR(mem_tobuffer(target, sregion.base, 2));
isc_buffer_forward(source, 2);
/*
* MAP822.
*/
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
/*
* MAPX400.
*/
return (dns_name_fromwire(&name, source, dctx, options, target));
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:34,代码来源:px_26.c
示例2: fromwire_soa
static inline isc_result_t
fromwire_soa(ARGS_FROMWIRE) {
dns_name_t mname;
dns_name_t rname;
isc_region_t sregion;
isc_region_t tregion;
REQUIRE(type == 6);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
RETERR(dns_name_fromwire(&mname, source, dctx, options, target));
RETERR(dns_name_fromwire(&rname, source, dctx, options, target));
isc_buffer_activeregion(source, &sregion);
isc_buffer_availableregion(target, &tregion);
if (sregion.length < 20)
return (ISC_R_UNEXPECTEDEND);
if (tregion.length < 20)
return (ISC_R_NOSPACE);
memmove(tregion.base, sregion.base, 20);
isc_buffer_forward(source, 20);
isc_buffer_add(target, 20);
return (ISC_R_SUCCESS);
}
开发者ID:fanf2,项目名称:bind-9,代码行数:34,代码来源:soa_6.c
示例3: fromwire_dnskey
static inline isc_result_t
fromwire_dnskey(ARGS_FROMWIRE) {
unsigned char algorithm;
isc_region_t sr;
REQUIRE(type == 48);
UNUSED(type);
UNUSED(rdclass);
UNUSED(dctx);
UNUSED(options);
isc_buffer_activeregion(source, &sr);
if (sr.length < 4)
return (ISC_R_UNEXPECTEDEND);
algorithm = sr.base[3];
RETERR(mem_tobuffer(target, sr.base, 4));
isc_region_consume(&sr, 4);
isc_buffer_forward(source, 4);
if (algorithm == DNS_KEYALG_PRIVATEDNS) {
dns_name_t name;
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
}
isc_buffer_activeregion(source, &sr);
isc_buffer_forward(source, sr.length);
return (mem_tobuffer(target, sr.base, sr.length));
}
开发者ID:w796933,项目名称:bind99damp,代码行数:31,代码来源:dnskey_48.c
示例4: fromwire_afsdb
static inline isc_result_t
fromwire_afsdb(ARGS_FROMWIRE) {
dns_name_t name;
isc_region_t sr;
isc_region_t tr;
REQUIRE(type == 18);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
isc_buffer_activeregion(source, &sr);
isc_buffer_availableregion(target, &tr);
if (tr.length < 2)
return (ISC_R_NOSPACE);
if (sr.length < 2)
return (ISC_R_UNEXPECTEDEND);
memcpy(tr.base, sr.base, 2);
isc_buffer_forward(source, 2);
isc_buffer_add(target, 2);
return (dns_name_fromwire(&name, source, dctx, options, target));
}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:26,代码来源:afsdb_18.c
示例5: fromwire_in_srv
static inline isc_result_t
fromwire_in_srv(ARGS_FROMWIRE) {
dns_name_t name;
isc_region_t sr;
REQUIRE(type == 33);
REQUIRE(rdclass == 1);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
/*
* Priority, weight, port.
*/
isc_buffer_activeregion(source, &sr);
if (sr.length < 6)
return (ISC_R_UNEXPECTEDEND);
RETERR(mem_tobuffer(target, sr.base, 6));
isc_buffer_forward(source, 6);
/*
* Target.
*/
return (dns_name_fromwire(&name, source, dctx, options, target));
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:29,代码来源:srv_33.c
示例6: fromwire_rp
static inline isc_result_t
fromwire_rp(ARGS_FROMWIRE) {
dns_name_t rmail;
dns_name_t email;
REQUIRE(type == dns_rdatatype_rp);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
RETERR(dns_name_fromwire(&rmail, source, dctx, options, target));
return (dns_name_fromwire(&email, source, dctx, options, target));
}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:18,代码来源:rp_17.c
示例7: fromwire_tkey
static inline isc_result_t
fromwire_tkey(ARGS_FROMWIRE) {
isc_region_t sr;
unsigned long n;
dns_name_t name;
REQUIRE(type == 249);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
/*
* Algorithm.
*/
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
/*
* Inception: 4
* Expiration: 4
* Mode: 2
* Error: 2
*/
isc_buffer_activeregion(source, &sr);
if (sr.length < 12)
return (ISC_R_UNEXPECTEDEND);
RETERR(mem_tobuffer(target, sr.base, 12));
isc_region_consume(&sr, 12);
isc_buffer_forward(source, 12);
/*
* Key Length + Key Data.
*/
if (sr.length < 2)
return (ISC_R_UNEXPECTEDEND);
n = uint16_fromregion(&sr);
if (sr.length < n + 2)
return (ISC_R_UNEXPECTEDEND);
RETERR(mem_tobuffer(target, sr.base, n + 2));
isc_region_consume(&sr, n + 2);
isc_buffer_forward(source, n + 2);
/*
* Other Length + Other Data.
*/
if (sr.length < 2)
return (ISC_R_UNEXPECTEDEND);
n = uint16_fromregion(&sr);
if (sr.length < n + 2)
return (ISC_R_UNEXPECTEDEND);
isc_buffer_forward(source, n + 2);
return (mem_tobuffer(target, sr.base, n + 2));
}
开发者ID:2014-class,项目名称:freerouter,代码行数:55,代码来源:tkey_249.c
示例8: fromwire_mf
static inline isc_result_t
fromwire_mf(ARGS_FROMWIRE) {
dns_name_t name;
REQUIRE(type == dns_rdatatype_mf);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:14,代码来源:mf_4.c
示例9: fromwire_in_nsap_ptr
static inline isc_result_t
fromwire_in_nsap_ptr(ARGS_FROMWIRE) {
dns_name_t name;
REQUIRE(type == 23);
REQUIRE(rdclass == 1);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
}
开发者ID:KaiToTo,项目名称:freebsd,代码行数:15,代码来源:nsap-ptr_23.c
示例10: fromwire_ipseckey
static inline isc_result_t
fromwire_ipseckey(ARGS_FROMWIRE) {
dns_name_t name;
isc_region_t region;
REQUIRE(type == 45);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
isc_buffer_activeregion(source, ®ion);
if (region.length < 3)
return (ISC_R_UNEXPECTEDEND);
switch (region.base[1]) {
case 0:
isc_buffer_forward(source, region.length);
return (mem_tobuffer(target, region.base, region.length));
case 1:
if (region.length < 7)
return (ISC_R_UNEXPECTEDEND);
isc_buffer_forward(source, region.length);
return (mem_tobuffer(target, region.base, region.length));
case 2:
if (region.length < 19)
return (ISC_R_UNEXPECTEDEND);
isc_buffer_forward(source, region.length);
return (mem_tobuffer(target, region.base, region.length));
case 3:
RETERR(mem_tobuffer(target, region.base, 3));
isc_buffer_forward(source, 3);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
isc_buffer_activeregion(source, ®ion);
isc_buffer_forward(source, region.length);
return(mem_tobuffer(target, region.base, region.length));
default:
return (ISC_R_NOTIMPLEMENTED);
}
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:47,代码来源:ipseckey_45.c
示例11: fromwire_naptr
static inline isc_result_t
fromwire_naptr(ARGS_FROMWIRE) {
dns_name_t name;
isc_region_t sr;
unsigned char *regex;
REQUIRE(type == dns_rdatatype_naptr);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
/*
* Order, preference.
*/
isc_buffer_activeregion(source, &sr);
if (sr.length < 4)
return (ISC_R_UNEXPECTEDEND);
RETERR(mem_tobuffer(target, sr.base, 4));
isc_buffer_forward(source, 4);
/*
* Flags.
*/
RETERR(txt_fromwire(source, target));
/*
* Service.
*/
RETERR(txt_fromwire(source, target));
/*
* Regexp.
*/
regex = isc_buffer_used(target);
RETERR(txt_fromwire(source, target));
RETERR(txt_valid_regex(regex));
/*
* Replacement.
*/
return (dns_name_fromwire(&name, source, dctx, options, target));
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:46,代码来源:naptr_35.c
示例12: fromwire_sig
static inline isc_result_t
fromwire_sig(ARGS_FROMWIRE) {
isc_region_t sr;
dns_name_t name;
REQUIRE(type == dns_rdatatype_sig);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
isc_buffer_activeregion(source, &sr);
/*
* type covered: 2
* algorithm: 1
* labels: 1
* original ttl: 4
* signature expiration: 4
* time signed: 4
* key footprint: 2
*/
if (sr.length < 18)
return (ISC_R_UNEXPECTEDEND);
isc_buffer_forward(source, 18);
RETERR(mem_tobuffer(target, sr.base, 18));
/*
* Signer.
*/
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
/*
* Sig.
*/
isc_buffer_activeregion(source, &sr);
isc_buffer_forward(source, sr.length);
return (mem_tobuffer(target, sr.base, sr.length));
}
开发者ID:fatman2021,项目名称:netbsd-src,代码行数:41,代码来源:sig_24.c
示例13: fromwire_cdnskey
static inline isc_result_t
fromwire_cdnskey(ARGS_FROMWIRE) {
unsigned char algorithm;
isc_region_t sr;
REQUIRE(type == dns_rdatatype_cdnskey);
UNUSED(type);
UNUSED(rdclass);
UNUSED(dctx);
UNUSED(options);
isc_buffer_activeregion(source, &sr);
if (sr.length < 4)
return (ISC_R_UNEXPECTEDEND);
algorithm = sr.base[3];
RETERR(mem_tobuffer(target, sr.base, 4));
isc_region_consume(&sr, 4);
isc_buffer_forward(source, 4);
if (algorithm == DNS_KEYALG_PRIVATEDNS) {
dns_name_t name;
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
}
/*
* RSAMD5 computes key ID differently from other
* algorithms: we need to ensure there's enough data
* present for the computation
*/
if (algorithm == DST_ALG_RSAMD5 && sr.length < 3)
return (ISC_R_UNEXPECTEDEND);
isc_buffer_activeregion(source, &sr);
isc_buffer_forward(source, sr.length);
return (mem_tobuffer(target, sr.base, sr.length));
}
开发者ID:chris-wood,项目名称:bind-prime,代码行数:40,代码来源:cdnskey_60.c
示例14: fromwire_hip
static inline isc_result_t
fromwire_hip(ARGS_FROMWIRE) {
isc_region_t region, rr;
dns_name_t name;
isc_uint8_t hit_len;
isc_uint16_t key_len;
REQUIRE(type == dns_rdatatype_hip);
UNUSED(type);
UNUSED(rdclass);
isc_buffer_activeregion(source, ®ion);
if (region.length < 4U)
RETERR(DNS_R_FORMERR);
rr = region;
hit_len = uint8_fromregion(®ion);
if (hit_len == 0)
RETERR(DNS_R_FORMERR);
isc_region_consume(®ion, 2); /* hit length + algorithm */
key_len = uint16_fromregion(®ion);
if (key_len == 0)
RETERR(DNS_R_FORMERR);
isc_region_consume(®ion, 2);
if (region.length < (unsigned) (hit_len + key_len))
RETERR(DNS_R_FORMERR);
RETERR(mem_tobuffer(target, rr.base, 4 + hit_len + key_len));
isc_buffer_forward(source, 4 + hit_len + key_len);
dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
while (isc_buffer_activelength(source) > 0) {
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
}
return (ISC_R_SUCCESS);
}
开发者ID:chris-wood,项目名称:bind-prime,代码行数:38,代码来源:hip_55.c
示例15: test
void
test(unsigned int allowed, dns_name_t *name1, dns_name_t *name2,
dns_name_t *name3, unsigned char *result, unsigned int length)
{
isc_mem_t *mctx = NULL;
dns_compress_t cctx;
dns_decompress_t dctx;
isc_buffer_t source;
isc_buffer_t target;
dns_name_t name;
unsigned char buf1[1024];
unsigned char buf2[1024];
if (verbose) {
const char *s;
switch (allowed) {
case DNS_COMPRESS_NONE: s = "DNS_COMPRESS_NONE"; break;
case DNS_COMPRESS_GLOBAL14: s = "DNS_COMPRESS_GLOBAL14"; break;
/* case DNS_COMPRESS_ALL: s = "DNS_COMPRESS_ALL"; break; */
default: s = "UNKNOWN"; break;
}
fprintf(stdout, "Allowed = %s\n", s);
}
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
isc_buffer_init(&source, buf1, sizeof(buf1));
RUNTIME_CHECK(dns_compress_init(&cctx, -1, mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(dns_name_towire(name1, &cctx, &source) == ISC_R_SUCCESS);
/*
RUNTIME_CHECK(dns_compress_localinit(&cctx, name1, &source) ==
ISC_R_SUCCESS);
*/
dns_compress_setmethods(&cctx, allowed);
RUNTIME_CHECK(dns_name_towire(name2, &cctx, &source) == ISC_R_SUCCESS);
RUNTIME_CHECK(dns_name_towire(name2, &cctx, &source) == ISC_R_SUCCESS);
RUNTIME_CHECK(dns_name_towire(name3, &cctx, &source) == ISC_R_SUCCESS);
/*
dns_compress_localinvalidate(&cctx);
*/
dns_compress_rollback(&cctx, 0); /* testing only */
dns_compress_invalidate(&cctx);
if (raw) {
unsigned int i;
for (i = 0; i < source.used; /* */ ) {
fprintf(stdout, "%02x",
((unsigned char *)source.base)[i]);
if ((++i % 20) == 0)
fputs("\n", stdout);
else
if (i == source.used)
fputs("\n", stdout);
else
fputs(" ", stdout);
}
}
isc_buffer_setactive(&source, source.used);
isc_buffer_init(&target, buf2, sizeof(buf2));
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_STRICT);
dns_name_init(&name, NULL);
RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE,
&target) == ISC_R_SUCCESS);
dns_decompress_setmethods(&dctx, allowed);
/*
dns_decompress_localinit(&dctx, &name, &source);
*/
RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE,
&target) == ISC_R_SUCCESS);
RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE,
&target) == ISC_R_SUCCESS);
RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE,
&target) == ISC_R_SUCCESS);
/*
dns_decompress_localinvalidate(&dctx);
*/
dns_decompress_invalidate(&dctx);
if (raw) {
unsigned int i;
for (i = 0; i < target.used; /* */ ) {
fprintf(stdout, "%02x",
((unsigned char *)target.base)[i]);
if ((++i % 20) == 0)
fputs("\n", stdout);
else
if (i == target.used)
fputs("\n", stdout);
else
fputs(" ", stdout);
}
fputs("\n", stdout);
fflush(stdout);
}
RUNTIME_CHECK(target.used == length);
RUNTIME_CHECK(memcmp(target.base, result, target.used) == 0);
//.........这里部分代码省略.........
开发者ID:edmonds,项目名称:isc-bind9,代码行数:101,代码来源:compress_test.c
示例16: print_yaml
//.........这里部分代码省略.........
if (frame->type != DNSTAP__DNSTAP__TYPE__MESSAGE)
return;
printf("message:\n");
mtype = protobuf_c_enum_descriptor_get_value(
&dnstap__message__type__descriptor,
m->type);
if (mtype == NULL)
return;
printf(" type: %s\n", mtype->name);
if (!isc_time_isepoch(&dt->qtime)) {
char buf[100];
isc_time_formatISO8601(&dt->qtime, buf, sizeof(buf));
printf(" query_time: !!timestamp %s\n", buf);
}
if (!isc_time_isepoch(&dt->rtime)) {
char buf[100];
isc_time_formatISO8601(&dt->rtime, buf, sizeof(buf));
printf(" response_time: !!timestamp %s\n", buf);
}
if (dt->msgdata.base != NULL) {
printf(" message_size: %zdb\n", (size_t) dt->msgdata.length);
} else
printf(" message_size: 0b\n");
if (m->has_socket_family) {
const ProtobufCEnumValue *type =
protobuf_c_enum_descriptor_get_value(
&dnstap__socket_family__descriptor,
m->socket_family);
if (type != NULL)
printf(" socket_family: %s\n", type->name);
}
printf(" socket_protocol: %s\n", dt->tcp ? "TCP" : "UDP");
if (m->has_query_address) {
ProtobufCBinaryData *ip = &m->query_address;
char buf[100];
(void)inet_ntop(ip->len == 4 ? AF_INET : AF_INET6,
ip->data, buf, sizeof(buf));
printf(" query_address: %s\n", buf);
}
if (m->has_response_address) {
ProtobufCBinaryData *ip = &m->response_address;
char buf[100];
(void)inet_ntop(ip->len == 4 ? AF_INET : AF_INET6,
ip->data, buf, sizeof(buf));
printf(" response_address: %s\n", buf);
}
if (m->has_query_port)
printf(" query_port: %u\n", m->query_port);
if (m->has_response_port)
printf(" response_port: %u\n", m->response_port);
if (m->has_query_zone) {
isc_result_t result;
dns_fixedname_t fn;
dns_name_t *name;
isc_buffer_t b;
dns_decompress_t dctx;
dns_fixedname_init(&fn);
name = dns_fixedname_name(&fn);
isc_buffer_init(&b, m->query_zone.data, m->query_zone.len);
isc_buffer_add(&b, m->query_zone.len);
dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_NONE);
result = dns_name_fromwire(name, &b, &dctx, 0, NULL);
if (result == ISC_R_SUCCESS) {
printf(" query_zone: ");
dns_name_print(name, stdout);
printf("\n");
}
}
if (dt->msg != NULL) {
printf(" %s:\n", ((dt->type & DNS_DTTYPE_QUERY) != 0)
? "query_message_data"
: "response_message_data");
print_packet(dt, &dns_master_style_yaml);
printf(" %s: |\n", ((dt->type & DNS_DTTYPE_QUERY) != 0)
? "query_message"
: "response_message");
print_packet(dt, &dns_master_style_indent);
}
};
开发者ID:each,项目名称:bind9-collab,代码行数:101,代码来源:dnstap-read.c
注:本文中的dns_name_fromwire函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论