本文整理汇总了C++中dns_name_init函数的典型用法代码示例。如果您正苦于以下问题:C++ dns_name_init函数的具体用法?C++ dns_name_init怎么用?C++ dns_name_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dns_name_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fromtext_dname
static inline isc_result_t
fromtext_dname(ARGS_FROMTEXT) {
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
REQUIRE(type == 39);
UNUSED(type);
UNUSED(rdclass);
UNUSED(callbacks);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
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));
return (ISC_R_SUCCESS);
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:21,代码来源:dname_39.c
示例2: checknames_ch_a
static inline isc_boolean_t
checknames_ch_a(ARGS_CHECKNAMES) {
isc_region_t region;
dns_name_t name;
REQUIRE(rdata->type == 1);
REQUIRE(rdata->rdclass == dns_rdataclass_ch);
UNUSED(owner);
dns_rdata_toregion(rdata, ®ion);
dns_name_init(&name, NULL);
dns_name_fromregion(&name, ®ion);
if (!dns_name_ishostname(&name, ISC_FALSE)) {
if (bad != NULL)
dns_name_clone(&name, bad);
return (ISC_FALSE);
}
return (ISC_TRUE);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:21,代码来源:a_1.c
示例3: ns_lwsearchlist_append
isc_result_t
ns_lwsearchlist_append(ns_lwsearchlist_t *list, dns_name_t *name) {
dns_name_t *newname;
isc_result_t result;
REQUIRE(VALID_LWSEARCHLIST(list));
REQUIRE(name != NULL);
newname = isc_mem_get(list->mctx, sizeof(dns_name_t));
if (newname == NULL)
return (ISC_R_NOMEMORY);
dns_name_init(newname, NULL);
result = dns_name_dup(name, list->mctx, newname);
if (result != ISC_R_SUCCESS) {
isc_mem_put(list->mctx, newname, sizeof(dns_name_t));
return (result);
}
ISC_LINK_INIT(newname, link);
ISC_LIST_APPEND(list->names, newname, link);
return (ISC_R_SUCCESS);
}
开发者ID:pecharmin,项目名称:bind9,代码行数:21,代码来源:lwsearch.c
示例4: fromwire_mx
static inline isc_result_t
fromwire_mx(ARGS_FROMWIRE) {
dns_name_t name;
isc_region_t sregion;
REQUIRE(type == 15);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
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);
return (dns_name_fromwire(&name, source, dctx, options, target));
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:21,代码来源:mx_15.c
示例5: 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
示例6: fromtext_afsdb
static inline isc_result_t
fromtext_afsdb(ARGS_FROMTEXT) {
isc_token_t token;
isc_buffer_t buffer;
dns_name_t name;
isc_boolean_t ok;
REQUIRE(type == 18);
UNUSED(type);
UNUSED(rdclass);
UNUSED(callbacks);
/*
* Subtype.
*/
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));
/*
* Hostname.
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
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));
ok = ISC_TRUE;
if ((options & DNS_RDATA_CHECKNAMES) != 0)
ok = dns_name_ishostname(&name, ISC_FALSE);
if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0)
RETTOK(DNS_R_BADNAME);
if (!ok && callbacks != NULL)
warn_badname(&name, lexer, callbacks);
return (ISC_R_SUCCESS);
}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:40,代码来源:afsdb_18.c
示例7: additionaldata_rt
static inline isc_result_t
additionaldata_rt(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
isc_result_t result;
REQUIRE(rdata->type == 21);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, ®ion);
isc_region_consume(®ion, 2);
dns_name_fromregion(&name, ®ion);
result = (add)(arg, &name, dns_rdatatype_x25);
if (result != ISC_R_SUCCESS)
return (result);
result = (add)(arg, &name, dns_rdatatype_isdn);
if (result != ISC_R_SUCCESS)
return (result);
return ((add)(arg, &name, dns_rdatatype_a));
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:22,代码来源:rt_21.c
示例8: get_key_struct
/*%
* Allocates a key structure and fills in some of the fields.
*/
static dst_key_t *
get_key_struct(dns_name_t *name, unsigned int alg,
unsigned int flags, unsigned int protocol,
unsigned int bits, dns_rdataclass_t rdclass,
isc_mem_t *mctx)
{
dst_key_t *key;
isc_result_t result;
key = (dst_key_t *) isc_mem_get(mctx, sizeof(dst_key_t));
if (key == NULL)
return (NULL);
memset(key, 0, sizeof(dst_key_t));
key->magic = KEY_MAGIC;
key->key_name = isc_mem_get(mctx, sizeof(dns_name_t));
if (key->key_name == NULL) {
isc_mem_put(mctx, key, sizeof(dst_key_t));
return (NULL);
}
dns_name_init(key->key_name, NULL);
result = dns_name_dup(name, mctx, key->key_name);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, key->key_name, sizeof(dns_name_t));
isc_mem_put(mctx, key, sizeof(dst_key_t));
return (NULL);
}
key->key_alg = alg;
key->key_flags = flags;
key->key_proto = protocol;
key->mctx = mctx;
key->opaque = NULL;
key->key_size = bits;
key->key_class = rdclass;
key->func = dst_t_func[alg];
return (key);
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:41,代码来源:dst_api.c
示例9: main
int
main(int argc, char *argv[]) {
isc_result_t result;
dns_name_t origin;
isc_buffer_t source;
isc_buffer_t target;
unsigned char name_buf[255];
dns_rdatacallbacks_t callbacks;
UNUSED(argc);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
if (argv[1]) {
isc_buffer_init(&source, argv[1], strlen(argv[1]));
isc_buffer_add(&source, strlen(argv[1]));
isc_buffer_setactive(&source, strlen(argv[1]));
isc_buffer_init(&target, name_buf, 255);
dns_name_init(&origin, NULL);
result = dns_name_fromtext(&origin, &source, dns_rootname,
0, &target);
if (result != ISC_R_SUCCESS) {
fprintf(stdout, "dns_name_fromtext: %s\n",
dns_result_totext(result));
exit(1);
}
dns_rdatacallbacks_init_stdio(&callbacks);
callbacks.add = print_dataset;
result = dns_master_loadfile(argv[1], &origin, &origin,
dns_rdataclass_in, 0,
&callbacks, mctx);
fprintf(stdout, "dns_master_loadfile: %s\n",
dns_result_totext(result));
}
return (0);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:38,代码来源:master_test.c
示例10: fromtext_ch_a
static inline isc_result_t fromtext_ch_a (ARGS_FROMTEXT)
{
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
REQUIRE (type == 1);
REQUIRE (rdclass == dns_rdataclass_ch); /* 3 */
UNUSED (type);
UNUSED (callbacks);
RETERR (isc_lex_getmastertoken (lexer, &token, isc_tokentype_string, ISC_FALSE));
/* get domain name */
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));
if ((options & DNS_RDATA_CHECKNAMES) != 0 && (options & DNS_RDATA_CHECKREVERSE) != 0)
{
isc_boolean_t ok;
ok = dns_name_ishostname (&name, ISC_FALSE);
if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0)
RETTOK (DNS_R_BADNAME);
if (!ok && callbacks != NULL)
warn_badname (&name, lexer, callbacks);
}
/* 16-bit octal address */
RETERR (isc_lex_getoctaltoken (lexer, &token, ISC_FALSE));
if (token.value.as_ulong > 0xffffU)
RETTOK (ISC_R_RANGE);
return (uint16_tobuffer (token.value.as_ulong, target));
}
开发者ID:274914765,项目名称:C,代码行数:38,代码来源:a_1.c
示例11: 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
示例12: dns_ns_buildrdata
isc_result_t ATTR_NONNULLS
dns_ns_buildrdata(dns_name_t *origin, dns_name_t *ns_name,
dns_rdataclass_t rdclass,
unsigned char *buffer,
dns_rdata_t *rdata) {
dns_rdata_ns_t ns;
isc_buffer_t rdatabuf;
REQUIRE(origin != NULL);
REQUIRE(ns_name != NULL);
memset(buffer, 0, DNS_SOA_BUFFERSIZE);
isc_buffer_init(&rdatabuf, buffer, DNS_SOA_BUFFERSIZE);
ns.common.rdtype = dns_rdatatype_ns;
ns.common.rdclass = rdclass;
ns.mctx = NULL;
dns_name_init(&ns.name, NULL);
dns_name_clone(ns_name, &ns.name);
return (dns_rdata_fromstruct(rdata, rdclass, dns_rdatatype_ns,
&ns, &rdatabuf));
}
开发者ID:pspacek,项目名称:bind-dyndb-ldap,代码行数:23,代码来源:ldap_driver.c
示例13: make_querymessage
/*
* Common routine to make query data
*/
static isc_result_t
make_querymessage(dns_message_t *message, dns_name_t *qname0,
dns_rdatatype_t rdtype)
{
dns_name_t *qname = NULL;
dns_rdataset_t *qrdataset = NULL;
isc_result_t result;
message->opcode = dns_opcode_query;
message->rdclass = dns_rdataclass_in;
result = dns_message_gettempname(message, &qname);
if (result != ISC_R_SUCCESS)
goto cleanup;
result = dns_message_gettemprdataset(message, &qrdataset);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_name_init(qname, NULL);
dns_name_clone(qname0, qname);
dns_rdataset_init(qrdataset);
dns_rdataset_makequestion(qrdataset, message->rdclass, rdtype);
ISC_LIST_APPEND(qname->list, qrdataset, link);
dns_message_addname(message, qname, DNS_SECTION_QUESTION);
return (ISC_R_SUCCESS);
cleanup:
if (qname != NULL)
dns_message_puttempname(message, &qname);
if (qrdataset != NULL)
dns_message_puttemprdataset(message, &qrdataset);
if (message != NULL)
dns_message_destroy(&message);
return (result);
}
开发者ID:pombredanne,项目名称:NetBSD,代码行数:40,代码来源:nsprobe.c
示例14: add_ns
static isc_result_t
add_ns(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
const dns_name_t *nsname)
{
dns_dbnode_t *node = NULL;
dns_rdata_ns_t ns;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdatalist_t rdatalist;
dns_rdataset_t rdataset;
isc_result_t result;
isc_buffer_t b;
unsigned char buf[DNS_NAME_MAXWIRE];
isc_buffer_init(&b, buf, sizeof(buf));
dns_rdataset_init(&rdataset);
dns_rdatalist_init(&rdatalist);
ns.common.rdtype = dns_rdatatype_ns;
ns.common.rdclass = dns_db_class(db);
ns.mctx = NULL;
dns_name_init(&ns.name, NULL);
dns_name_clone(nsname, &ns.name);
CHECK(dns_rdata_fromstruct(&rdata, dns_db_class(db), dns_rdatatype_ns,
&ns, &b));
rdatalist.type = rdata.type;
rdatalist.covers = 0;
rdatalist.rdclass = rdata.rdclass;
rdatalist.ttl = 86400;
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset));
CHECK(dns_db_findnode(db, name, ISC_TRUE, &node));
CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL));
cleanup:
if (node != NULL)
dns_db_detachnode(db, &node);
return (result);
}
开发者ID:pecharmin,项目名称:bind9,代码行数:37,代码来源:db.c
示例15: towire_sig
static inline isc_result_t
towire_sig(ARGS_TOWIRE) {
isc_region_t sr;
dns_name_t name;
dns_offsets_t offsets;
REQUIRE(rdata->type == dns_rdatatype_sig);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
dns_rdata_toregion(rdata, &sr);
/*
* type covered: 2
* algorithm: 1
* labels: 1
* original ttl: 4
* signature expiration: 4
* time signed: 4
* key footprint: 2
*/
RETERR(mem_tobuffer(target, sr.base, 18));
isc_region_consume(&sr, 18);
/*
* Signer.
*/
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
isc_region_consume(&sr, name_length(&name));
RETERR(dns_name_towire(&name, cctx, target));
/*
* Signature.
*/
return (mem_tobuffer(target, sr.base, sr.length));
}
开发者ID:fatman2021,项目名称:netbsd-src,代码行数:36,代码来源:sig_24.c
示例16: towire_rt
static inline isc_result_t
towire_rt(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
isc_region_t tr;
REQUIRE(rdata->type == 21);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
isc_buffer_availableregion(target, &tr);
dns_rdata_toregion(rdata, ®ion);
if (tr.length < 2)
return (ISC_R_NOSPACE);
memmove(tr.base, region.base, 2);
isc_region_consume(®ion, 2);
isc_buffer_add(target, 2);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, ®ion);
return (dns_name_towire(&name, cctx, target));
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:24,代码来源:rt_21.c
示例17: checknames_ptr
static inline isc_boolean_t
checknames_ptr(ARGS_CHECKNAMES) {
isc_region_t region;
dns_name_t name;
REQUIRE(rdata->type == 12);
if (rdata->rdclass != dns_rdataclass_in)
return (ISC_TRUE);
if (dns_name_issubdomain(owner, &in_addr_arpa) ||
dns_name_issubdomain(owner, &ip6_arpa) ||
dns_name_issubdomain(owner, &ip6_int)) {
dns_rdata_toregion(rdata, ®ion);
dns_name_init(&name, NULL);
dns_name_fromregion(&name, ®ion);
if (!dns_name_ishostname(&name, ISC_FALSE)) {
if (bad != NULL)
dns_name_clone(&name, bad);
return (ISC_FALSE);
}
}
return (ISC_TRUE);
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:24,代码来源:ptr_12.c
示例18: name_to_gbuffer
static inline void
name_to_gbuffer(dns_name_t *name, isc_buffer_t *buffer,
gss_buffer_desc *gbuffer)
{
dns_name_t tname, *namep;
isc_region_t r;
isc_result_t result;
if (!dns_name_isabsolute(name))
namep = name;
else
{
unsigned int labels;
dns_name_init(&tname, NULL);
labels = dns_name_countlabels(name);
dns_name_getlabelsequence(name, 0, labels - 1, &tname);
namep = &tname;
}
result = dns_name_toprincipal(namep, buffer);
isc_buffer_putuint8(buffer, 0);
isc_buffer_usedregion(buffer, &r);
REGION_TO_GBUFFER(r, *gbuffer);
}
开发者ID:coapp-packages,项目名称:bind,代码行数:24,代码来源:gssapictx.c
示例19: towire_in_srv
static inline isc_result_t
towire_in_srv(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t sr;
REQUIRE(rdata->type == 33);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
/*
* Priority, weight, port.
*/
dns_rdata_toregion(rdata, &sr);
RETERR(mem_tobuffer(target, sr.base, 6));
isc_region_consume(&sr, 6);
/*
* Target.
*/
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
return (dns_name_towire(&name, cctx, target));
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:24,代码来源:srv_33.c
示例20: tostruct_tkey
static inline isc_result_t
tostruct_tkey(ARGS_TOSTRUCT) {
dns_rdata_tkey_t *tkey = target;
dns_name_t alg;
isc_region_t sr;
REQUIRE(rdata->type == 249);
REQUIRE(target != NULL);
REQUIRE(rdata->length != 0);
tkey->common.rdclass = rdata->rdclass;
tkey->common.rdtype = rdata->type;
ISC_LINK_INIT(&tkey->common, link);
dns_rdata_toregion(rdata, &sr);
/*
* Algorithm Name.
*/
dns_name_init(&alg, NULL);
dns_name_fromregion(&alg, &sr);
dns_name_init(&tkey->algorithm, NULL);
RETERR(name_duporclone(&alg, mctx, &tkey->algorithm));
isc_region_consume(&sr, name_length(&tkey->algorithm));
/*
* Inception.
*/
tkey->inception = uint32_fromregion(&sr);
isc_region_consume(&sr, 4);
/*
* Expire.
*/
tkey->expire = uint32_fromregion(&sr);
isc_region_consume(&sr, 4);
/*
* Mode.
*/
tkey->mode = uint16_fromregion(&sr);
isc_region_consume(&sr, 2);
/*
* Error.
*/
tkey->error = uint16_fromregion(&sr);
isc_region_consume(&sr, 2);
/*
* Key size.
*/
tkey->keylen = uint16_fromregion(&sr);
isc_region_consume(&sr, 2);
/*
* Key.
*/
tkey->key = mem_maybedup(mctx, sr.base, tkey->keylen);
if (tkey->key == NULL)
goto cleanup;
isc_region_consume(&sr, tkey->keylen);
/*
* Other size.
*/
tkey->otherlen = uint16_fromregion(&sr);
isc_region_consume(&sr, 2);
/*
* Other.
*/
tkey->other = mem_maybedup(mctx, sr.base, tkey->otherlen);
if (tkey->other == NULL)
goto cleanup;
tkey->mctx = mctx;
return (ISC_R_SUCCESS);
cleanup:
if (mctx != NULL)
dns_name_free(&tkey->algorithm, mctx);
if (mctx != NULL && tkey->key != NULL)
isc_mem_free(mctx, tkey->key);
return (ISC_R_NOMEMORY);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:86,代码来源:tkey_249.c
注:本文中的dns_name_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论