"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/dns-proto-test.cc" between
c-ares-1.17.1.tar.gz and c-ares-1.17.2.tar.gz

About: c-ares is a C library for asynchronous DNS requests (including name resolves).

dns-proto-test.cc  (c-ares-1.17.1):dns-proto-test.cc  (c-ares-1.17.2)
skipping to change at line 12 skipping to change at line 12
#include "dns-proto.h" #include "dns-proto.h"
#include <vector> #include <vector>
namespace ares { namespace ares {
namespace test { namespace test {
TEST(DNSProto, EncodeQuestions) { TEST(DNSProto, EncodeQuestions) {
DNSPacket pkt; DNSPacket pkt;
pkt.set_qid(0x1234).set_response().set_aa() pkt.set_qid(0x1234).set_response().set_aa()
.add_question(new DNSQuestion("example.com.", ns_t_a)) .add_question(new DNSQuestion("example.com.", T_A))
.add_question(new DNSQuestion("www.example.com", ns_t_aaaa, ns_c_chaos)); .add_question(new DNSQuestion("www.example.com", T_AAAA, C_CHAOS));
std::vector<byte> data = { std::vector<byte> data = {
0x12, 0x34, // qid 0x12, 0x34, // qid
0x84, // response + query + AA + not-TC + not-RD 0x84, // response + query + AA + not-TC + not-RD
0x00, // not-RA + not-Z + not-AD + not-CD + rc=NoError 0x00, // not-RA + not-Z + not-AD + not-CD + rc=NoError
0x00, 0x02, // num questions 0x00, 0x02, // num questions
0x00, 0x00, // num answer RRs 0x00, 0x00, // num answer RRs
0x00, 0x00, // num authority RRs 0x00, 0x00, // num authority RRs
0x00, 0x00, // num additional RRs 0x00, 0x00, // num additional RRs
// Question 1 // Question 1
skipping to change at line 45 skipping to change at line 45
0x00, 0x03, // class CHAOS = 3 0x00, 0x03, // class CHAOS = 3
}; };
EXPECT_EQ(data, pkt.data()); EXPECT_EQ(data, pkt.data());
} }
TEST(DNSProto, EncodeSingleNameAnswers) { TEST(DNSProto, EncodeSingleNameAnswers) {
DNSPacket pkt; DNSPacket pkt;
pkt.qid_ = 0x1234; pkt.qid_ = 0x1234;
pkt.response_ = true; pkt.response_ = true;
pkt.aa_ = true; pkt.aa_ = true;
pkt.opcode_ = ns_o_query; pkt.opcode_ = O_QUERY;
pkt.add_answer(new DNSCnameRR("example.com", 0x01020304, "other.com.")); pkt.add_answer(new DNSCnameRR("example.com", 0x01020304, "other.com."));
pkt.add_auth(new DNSPtrRR("www.example.com", 0x01020304, "www.other.com")); pkt.add_auth(new DNSPtrRR("www.example.com", 0x01020304, "www.other.com"));
std::vector<byte> data = { std::vector<byte> data = {
0x12, 0x34, // qid 0x12, 0x34, // qid
0x84, // response + query + AA + not-TC + not-RD 0x84, // response + query + AA + not-TC + not-RD
0x00, // not-RA + not-Z + not-AD + not-CD + rc=NoError 0x00, // not-RA + not-Z + not-AD + not-CD + rc=NoError
0x00, 0x00, // num questions 0x00, 0x00, // num questions
0x00, 0x01, // num answer RRs 0x00, 0x01, // num answer RRs
0x00, 0x01, // num authority RRs 0x00, 0x01, // num authority RRs
skipping to change at line 90 skipping to change at line 90
0x00, 0x00,
}; };
EXPECT_EQ(data, pkt.data()); EXPECT_EQ(data, pkt.data());
} }
TEST(DNSProto, EncodeAddressAnswers) { TEST(DNSProto, EncodeAddressAnswers) {
DNSPacket pkt; DNSPacket pkt;
pkt.qid_ = 0x1234; pkt.qid_ = 0x1234;
pkt.response_ = true; pkt.response_ = true;
pkt.aa_ = true; pkt.aa_ = true;
pkt.opcode_ = ns_o_query; pkt.opcode_ = O_QUERY;
std::vector<byte> addrv4 = {0x02, 0x03, 0x04, 0x05}; std::vector<byte> addrv4 = {0x02, 0x03, 0x04, 0x05};
pkt.add_answer(new DNSARR("example.com", 0x01020304, addrv4)); pkt.add_answer(new DNSARR("example.com", 0x01020304, addrv4));
byte addrv6[16] = {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, byte addrv6[16] = {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04}; 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04};
pkt.add_additional(new DNSAaaaRR("www.example.com", 0x01020304, addrv6, 16)); pkt.add_additional(new DNSAaaaRR("www.example.com", 0x01020304, addrv6, 16));
std::vector<byte> data = { std::vector<byte> data = {
0x12, 0x34, // qid 0x12, 0x34, // qid
0x84, // response + query + AA + not-TC + not-RD 0x84, // response + query + AA + not-TC + not-RD
0x00, // not-RA + not-Z + not-AD + not-CD + rc=NoError 0x00, // not-RA + not-Z + not-AD + not-CD + rc=NoError
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)