cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit 4e92402f4aa026fb30171b7da76c4506c350b6ed
parent 700bebacf7e5dd2b820c23d201caca83f25f9f4d
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun,  2 Nov 2014 15:23:34 +0100

s/hostname/name in dns

Diffstat:
Mdns.lisp | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/dns.lisp b/dns.lisp @@ -230,7 +230,7 @@ (let ((*name-from-position* #'cb)) (next-$message (rw:shorter-reader (rw:reader b) len)))))))) -(defun query (hostname server &key (type 'A) (class 'IN) (port 53)) +(defun query (name server &key (type 'A) (class 'IN) (port 53)) (let* ((n 512) ;; TODO minus IP/UDP headers (b (rw.wire::make-octet-buffer n))) (write-$message @@ -242,9 +242,7 @@ :nanswer 0 :nauthority 0 :nadditional 0 - :question (list (make-$question :name hostname - :type type - :class class)) + :question (list (make-$question :name name :type type :class class)) :answer nil :authority nil :additional nil)) @@ -262,12 +260,13 @@ ;;(print (query "mx1.logand.com" #(8 8 8 8) :type 'MX)) ;;(print (query "seznam.cz" #(8 8 8 8) :type 'MX)) ;;(print (query "www.google.com" #(8 8 8 8) :type 'MX)) ;; TODO SOA follow authoritative nameservers +;;(print (query "com" #(8 8 8 8) :type 'A)) #+nil ;; TODO dns over tcp doesnt seem to work, depends on server? -(defun tcp-query (hostname server &key (port 53)) +(defun tcp-query (name server &key (port 53)) (with-open-stream (s (rw.socket:make-tcp-client-socket server port)) (let ((w (rw.wire:packet-writer s))) - (write-dns-question-packet w hostname) + (write-dns-question-packet w name) (rw.wire:flush w) (rw:next-u8 (rw:byte-reader s)))))