2004-01-04 Mario Lang <lang@zid.tugraz.at>
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 4 Jan 2004 22:44:04 +0000 (22:44 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 4 Jan 2004 22:44:04 +0000 (22:44 +0000)
* dns.el: Add support for AAAA records (see RFC 3596)

* Fix typo PRT -> PTR

* Parse MX, PTR and SOA replies (see RFC 1035)

lisp/ChangeLog
lisp/dns.el

index 3b41c87..76c7f71 100644 (file)
@@ -1,3 +1,11 @@
+2004-01-04  Mario Lang  <lang@zid.tugraz.at>
+
+       * dns.el: Add support for AAAA records (see RFC 3596)
+
+       * Fix typo PRT -> PTR
+
+       * Parse MX, PTR and SOA replies (see RFC 1035)
+
 2004-01-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus.el (gnus-logo-color-style): Changed colors to `no'.
index 5d572fa..e24245a 100644 (file)
@@ -50,11 +50,12 @@ If nil, /etc/resolv.conf will be consulted.")
     (MR 9)
     (NULL 10)
     (WKS 11)
-    (PRT 12)
+    (PTR 12)
     (HINFO 13)
     (MINFO 14)
     (MX 15)
     (TXT 16)
+    (AAAA 28) ; RFC3596
     (AXFR 252)
     (MAILB 253)
     (MAILA 254)
@@ -251,6 +252,12 @@ If TCP-P, the first two bytes of the package with be the length field."
        (push (list slot qs) spec)))
     (nreverse spec))))
 
+(defun dns-read-int32 ()
+  ;; Full 32 bit Integers can't be handled by Emacs.  If we use
+  ;; floats, it works.
+  (format "%.0f" (+ (* (dns-read-bytes 1) 16777216.0)
+                   (dns-read-bytes 3))))
+
 (defun dns-read-type (string type)
   (let ((buffer (current-buffer))
        (point (point)))
@@ -264,9 +271,22 @@ If TCP-P, the first two bytes of the package with be the length field."
              (dotimes (i 4)
                (push (dns-read-bytes 1) bytes))
              (mapconcat 'number-to-string (nreverse bytes) ".")))
-          ((eq type 'NS)
-           (dns-read-string-name string buffer))
-          ((eq type 'CNAME)
+          ((eq type 'AAAA)
+           (let (hextets)
+             (dotimes (i 8)
+               (push (dns-read-bytes 2) hextets))
+             (mapconcat (lambda (n) (format "%x" n)) (nreverse hextets) ":")))
+          ((eq type 'SOA)
+           (list (list 'mname (dns-read-name buffer))
+                 (list 'rname (dns-read-name buffer))
+                 (list 'serial (dns-read-int32))
+                 (list 'refresh (dns-read-int32))
+                 (list 'retry (dns-read-int32))
+                 (list 'expire (dns-read-int32))
+                 (list 'minimum (dns-read-int32))))
+          ((eq type 'MX)
+           (cons (dns-read-bytes 2) (dns-read-name buffer)))
+          ((or (eq type 'CNAME) (eq type 'NS) (eq type 'PTR))
            (dns-read-string-name string buffer))
           (t string)))
       (goto-char point))))