Revision: 14704
Author: adrian.chadd
Date: Fri May 28 22:43:29 2010
Log: Merge in r13269 from /branches/ipv6_dns - import Husni's AAAA query routine from his Squid-2.6 work.

This code is currently not linked in anywhere.


http://code.google.com/p/lusca-cache/source/detail?r=14704

Modified:
 /branches/LUSCA_HEAD/include/rfc1035.h
 /branches/LUSCA_HEAD/lib/rfc1035.c

=======================================
--- /branches/LUSCA_HEAD/include/rfc1035.h      Fri Apr 28 03:17:23 2006
+++ /branches/LUSCA_HEAD/include/rfc1035.h      Fri May 28 22:43:29 2010
@@ -83,6 +83,11 @@
 extern ssize_t rfc1035BuildAQuery(const char *hostname,
     char *buf,
     size_t sz,
+    unsigned short qid,
+    rfc1035_query * query);
+extern ssize_t rfc1035BuildAAAAQuery(const char *hostname,
+    char *buf,
+    size_t sz,
     unsigned short qid,
     rfc1035_query * query);
 extern ssize_t rfc1035BuildPTRQuery(const struct in_addr,
@@ -101,6 +106,7 @@

 #define RFC1035_TYPE_A 1
 #define RFC1035_TYPE_CNAME 5
+#define        RFC1035_TYPE_AAAA 28
 #define RFC1035_TYPE_PTR 12
 #define RFC1035_CLASS_IN 1

=======================================
--- /branches/LUSCA_HEAD/lib/rfc1035.c  Thu Feb  4 19:12:26 2010
+++ /branches/LUSCA_HEAD/lib/rfc1035.c  Fri May 28 22:43:29 2010
@@ -660,6 +660,32 @@
     assert(offset <= sz);
     return offset;
 }
+
+ssize_t
+rfc1035BuildAAAAQuery(const char *hostname, char *buf, size_t sz, unsigned short qid, rfc1035_query * query)
+{
+       static rfc1035_message h;
+       size_t offset = 0;
+       memset(&h, '\0', sizeof(h));
+       h.id = qid;
+       h.qr = 0;
+       h.rd = 1;
+       h.opcode = 0;           /* QUERY */
+       h.qdcount = 1;
+       offset += rfc1035HeaderPack(buf + offset, sz - offset, &h);
+       offset += rfc1035QuestionPack(buf + offset,
+           sz - offset,
+           hostname,
+           RFC1035_TYPE_AAAA,
+           RFC1035_CLASS_IN);
+       if (query) {
+               query->qtype = RFC1035_TYPE_AAAA;
+               query->qclass = RFC1035_CLASS_IN;
+               xstrncpy(query->name, hostname, sizeof(query->name));
+       }
+       assert(offset <= sz);
+       return offset;
+}

 /*
  * rfc1035BuildPTRQuery()

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to