[bind10-dev] DNS message API: a preliminary prototype of the message object

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Wed Sep 30 08:47:04 UTC 2009


I've committed an experimental prototype of the DNS message object
implementation (under the experiments/jinmei-messageapi directory).
It can currently construct a simple DNS query as shown in its sample
test program "dnsmessage-test".  It's as simple as this snippet:

    Message msg;
    [... getaddrinfo(), and create a socket]
    msg.set_qid(42);            // can be omitted, then QID will be 0
    msg.set_rd(true);
    msg.add_question(Name(argv[0]), RdataClass::IN, RdataType(type_name));
    msg.to_wire();
    msg.get_renderer().send_to(s, *res->ai_addr, res->ai_addrlen);

and if you run the test program like this:
% ./dnsmessage-test -s 172.16.1.10 www.isc.org
(the address is my local recursive server)

you'll see a query and (hopefully) a response as follows:
01:35:38.037399 IP 172.16.1.61.55626 > 172.16.1.10.53: 42+ A? www.isc.org. (29)
01:35:38.038436 IP 172.16.1.10.53 > 172.16.1.61.55626: 42 1/4/2 A 149.20.64.42 (176)

Getting the response indicates the code performs rendering
correctly:-)

I'll explain the API in more detail tomorrow.

---
JINMEI, Tatuya



More information about the bind10-dev mailing list