(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)
(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)))
(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))))
(setq dns-servers (nreverse dns-servers)))))
;;; Interface functions.
-(when (featurep 'xemacs)
- (eval-when-compile (require 'gnus-xmas)))
-
(defmacro dns-make-network-process (server)
(if (featurep 'xemacs)
`(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary))
- (gnus-xmas-open-network-stream "dns" (current-buffer)
- ,server "domain" 'udp))
+ (open-network-stream "dns" (current-buffer)
+ ,server "domain" 'udp))
`(let ((server ,server)
(coding-system-for-read 'binary)
(coding-system-for-write 'binary))
(provide 'dns)
+;;; arch-tag: d0edd0c4-4cce-4538-ae92-06c3356ee80a
;;; dns.el ends here