Function: dns-read-type
dns-read-type is a byte-compiled function defined in dns.el.gz.
Signature
(dns-read-type STRING TYPE)
Source Code
;; Defined in /usr/src/emacs/lisp/net/dns.el.gz
(defun dns-read-type (string type)
(let ((buffer (current-buffer))
(point (point)))
(prog1
(with-temp-buffer
(set-buffer-multibyte nil)
(insert string)
(goto-char (point-min))
(cond
((eq type 'A)
(let ((bytes nil))
(dotimes (_ 4)
(push (dns-read-bytes 1) bytes))
(mapconcat #'number-to-string (nreverse bytes) ".")))
((eq type 'AAAA)
(let (hextets)
(dotimes (_ 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-bytes 4))
(list 'refresh (dns-read-bytes 4))
(list 'retry (dns-read-bytes 4))
(list 'expire (dns-read-bytes 4))
(list 'minimum (dns-read-bytes 4))))
((eq type 'SRV)
(list (list 'priority (dns-read-bytes 2))
(list 'weight (dns-read-bytes 2))
(list 'port (dns-read-bytes 2))
(list 'target (dns-read-name buffer))))
((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))))