本文整理汇总了C++中dns_name_rdatacompare函数的典型用法代码示例。如果您正苦于以下问题:C++ dns_name_rdatacompare函数的具体用法?C++ dns_name_rdatacompare怎么用?C++ dns_name_rdatacompare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dns_name_rdatacompare函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compare_in_nsap_ptr
static inline int
compare_in_nsap_ptr(ARGS_COMPARE) {
dns_name_t name1;
dns_name_t name2;
isc_region_t region1;
isc_region_t region2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == dns_rdatatype_nsap_ptr);
REQUIRE(rdata1->rdclass == dns_rdataclass_in);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_rdata_toregion(rdata1, ®ion1);
dns_rdata_toregion(rdata2, ®ion2);
dns_name_fromregion(&name1, ®ion1);
dns_name_fromregion(&name2, ®ion2);
return (dns_name_rdatacompare(&name1, &name2));
}
示例2: compare_afsdb
static inline int
compare_afsdb(ARGS_COMPARE) {
int result;
dns_name_t name1;
dns_name_t name2;
isc_region_t region1;
isc_region_t region2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 18);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
result = memcmp(rdata1->data, rdata2->data, 2);
if (result != 0)
return (result < 0 ? -1 : 1);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_rdata_toregion(rdata1, ®ion1);
dns_rdata_toregion(rdata2, ®ion2);
isc_region_consume(®ion1, 2);
isc_region_consume(®ion2, 2);
dns_name_fromregion(&name1, ®ion1);
dns_name_fromregion(&name2, ®ion2);
return (dns_name_rdatacompare(&name1, &name2));
}
示例3: compare_tkey
static inline int
compare_tkey(ARGS_COMPARE) {
isc_region_t r1;
isc_region_t r2;
dns_name_t name1;
dns_name_t name2;
int order;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 249);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
/*
* Algorithm.
*/
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_name_fromregion(&name1, &r1);
dns_name_fromregion(&name2, &r2);
if ((order = dns_name_rdatacompare(&name1, &name2)) != 0)
return (order);
isc_region_consume(&r1, name_length(&name1));
isc_region_consume(&r2, name_length(&name2));
return (isc_region_compare(&r1, &r2));
}
示例4: compare_soa
static inline int
compare_soa(ARGS_COMPARE) {
isc_region_t region1;
isc_region_t region2;
dns_name_t name1;
dns_name_t name2;
int order;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 6);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_rdata_toregion(rdata1, ®ion1);
dns_rdata_toregion(rdata2, ®ion2);
dns_name_fromregion(&name1, ®ion1);
dns_name_fromregion(&name2, ®ion2);
order = dns_name_rdatacompare(&name1, &name2);
if (order != 0)
return (order);
isc_region_consume(®ion1, name_length(&name1));
isc_region_consume(®ion2, name_length(&name2));
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_name_fromregion(&name1, ®ion1);
dns_name_fromregion(&name2, ®ion2);
order = dns_name_rdatacompare(&name1, &name2);
if (order != 0)
return (order);
isc_region_consume(®ion1, name_length(&name1));
isc_region_consume(®ion2, name_length(&name2));
return (isc_region_compare(®ion1, ®ion2));
}
示例5: casecompare_hip
static inline int
casecompare_hip(ARGS_COMPARE) {
isc_region_t r1;
isc_region_t r2;
dns_name_t name1;
dns_name_t name2;
int order;
isc_uint8_t hit_len;
isc_uint16_t key_len;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 55);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
INSIST(r1.length > 4);
INSIST(r2.length > 4);
r1.length = 4;
r2.length = 4;
order = isc_region_compare(&r1, &r2);
if (order != 0)
return (order);
hit_len = uint8_fromregion(&r1);
isc_region_consume(&r1, 2); /* hit length + algorithm */
key_len = uint16_fromregion(&r1);
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
isc_region_consume(&r1, 4);
isc_region_consume(&r2, 4);
INSIST(r1.length >= (unsigned) (hit_len + key_len));
INSIST(r2.length >= (unsigned) (hit_len + key_len));
order = isc_region_compare(&r1, &r2);
if (order != 0)
return (order);
isc_region_consume(&r1, hit_len + key_len);
isc_region_consume(&r2, hit_len + key_len);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
while (r1.length != 0 && r2.length != 0) {
dns_name_fromregion(&name1, &r1);
dns_name_fromregion(&name2, &r2);
order = dns_name_rdatacompare(&name1, &name2);
if (order != 0)
return (order);
isc_region_consume(&r1, name_length(&name1));
isc_region_consume(&r2, name_length(&name2));
}
return (isc_region_compare(&r1, &r2));
}
示例6: compare_sig
static inline int
compare_sig(ARGS_COMPARE) {
isc_region_t r1;
isc_region_t r2;
dns_name_t name1;
dns_name_t name2;
int order;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == dns_rdatatype_sig);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
INSIST(r1.length > 18);
INSIST(r2.length > 18);
r1.length = 18;
r2.length = 18;
order = isc_region_compare(&r1, &r2);
if (order != 0)
return (order);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
isc_region_consume(&r1, 18);
isc_region_consume(&r2, 18);
dns_name_fromregion(&name1, &r1);
dns_name_fromregion(&name2, &r2);
order = dns_name_rdatacompare(&name1, &name2);
if (order != 0)
return (order);
isc_region_consume(&r1, name_length(&name1));
isc_region_consume(&r2, name_length(&name2));
return (isc_region_compare(&r1, &r2));
}
示例7: compare_in_srv
static inline int
compare_in_srv(ARGS_COMPARE) {
dns_name_t name1;
dns_name_t name2;
isc_region_t region1;
isc_region_t region2;
int order;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 33);
REQUIRE(rdata1->rdclass == 1);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
/*
* Priority, weight, port.
*/
order = memcmp(rdata1->data, rdata2->data, 6);
if (order != 0)
return (order < 0 ? -1 : 1);
/*
* Target.
*/
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_rdata_toregion(rdata1, ®ion1);
dns_rdata_toregion(rdata2, ®ion2);
isc_region_consume(®ion1, 6);
isc_region_consume(®ion2, 6);
dns_name_fromregion(&name1, ®ion1);
dns_name_fromregion(&name2, ®ion2);
return (dns_name_rdatacompare(&name1, &name2));
}
示例8: casecompare_ipseckey
static inline int
casecompare_ipseckey(ARGS_COMPARE) {
isc_region_t region1;
isc_region_t region2;
dns_name_t name1;
dns_name_t name2;
int order;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 45);
REQUIRE(rdata1->length >= 3);
REQUIRE(rdata2->length >= 3);
dns_rdata_toregion(rdata1, ®ion1);
dns_rdata_toregion(rdata2, ®ion2);
if (memcmp(region1.base, region2.base, 3) != 0 || region1.base[1] != 3)
return (isc_region_compare(®ion1, ®ion2));
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
isc_region_consume(®ion1, 3);
isc_region_consume(®ion2, 3);
dns_name_fromregion(&name1, ®ion1);
dns_name_fromregion(&name2, ®ion2);
order = dns_name_rdatacompare(&name1, &name2);
if (order != 0)
return (order);
isc_region_consume(®ion1, name_length(&name1));
isc_region_consume(®ion2, name_length(&name2));
return (isc_region_compare(®ion1, ®ion2));
}
示例9: compare_naptr
static inline int
compare_naptr(ARGS_COMPARE) {
dns_name_t name1;
dns_name_t name2;
isc_region_t region1;
isc_region_t region2;
int order, len;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == dns_rdatatype_naptr);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_rdata_toregion(rdata1, ®ion1);
dns_rdata_toregion(rdata2, ®ion2);
/*
* Order, preference.
*/
order = memcmp(region1.base, region2.base, 4);
if (order != 0)
return (order < 0 ? -1 : 1);
isc_region_consume(®ion1, 4);
isc_region_consume(®ion2, 4);
/*
* Flags.
*/
len = ISC_MIN(region1.base[0], region2.base[0]);
order = memcmp(region1.base, region2.base, len + 1);
if (order != 0)
return (order < 0 ? -1 : 1);
isc_region_consume(®ion1, region1.base[0] + 1);
isc_region_consume(®ion2, region2.base[0] + 1);
/*
* Service.
*/
len = ISC_MIN(region1.base[0], region2.base[0]);
order = memcmp(region1.base, region2.base, len + 1);
if (order != 0)
return (order < 0 ? -1 : 1);
isc_region_consume(®ion1, region1.base[0] + 1);
isc_region_consume(®ion2, region2.base[0] + 1);
/*
* Regexp.
*/
len = ISC_MIN(region1.base[0], region2.base[0]);
order = memcmp(region1.base, region2.base, len + 1);
if (order != 0)
return (order < 0 ? -1 : 1);
isc_region_consume(®ion1, region1.base[0] + 1);
isc_region_consume(®ion2, region2.base[0] + 1);
/*
* Replacement.
*/
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_name_fromregion(&name1, ®ion1);
dns_name_fromregion(&name2, ®ion2);
return (dns_name_rdatacompare(&name1, &name2));
}