dns example packets added by klm` on Thu May 1 17:33:15 2014
;; something for Moritz to enjoy (test-group "parse-dns-name" (test "simple parse-dns-name" '("a" "b") (parse (parse-dns-name) "\x01a\x01b\x00")) (test "compressed labels" '("W" "a" "b") (pr-value ((parse-dns-name) (make-byter "\x01a\x01b\x00\x01W\xC0\x00" 5)))) (test "empty qname" '() (parse (parse-dns-name) "\x00")) (test '("a" "ab" "abc") (parse (parse-dns-name) "\x01a\x02ab\x03abc\x00")) (test "parse spotify mDNS packet" '("_spotify-connect" "_tcp" "local") (parse (parse-dns-name) "\x10_spotify-connect\x04_tcp\x05local\x00")) (test "compressed name before" ;; ,-- pointer to byte # 4 '("b" "a") (parse (parse-dns-name) "\x01b\xC0\x04\x01a\x00")) (test "compressed name after" '("_beacon" "local") (parse (parse-dns-name) (update-offset (make-byter "\x05local\x00\x00\f\x00\x01\x07_beacon\xC0\x00") 11))) ;; <-- starting at byte #11 (test "parse-dns-name returns correct remaining input" '(("a" "b") #\W) (parse (sequence (parse-dns-name) (parse-char)) (make-byter "\x01b\x00..\x01a\xC0\x00W" 5))) ;; TODO how to distinguish failure? ;;(test '(#f "invalid") (parse (parse-dns-name) "\xFFa")) )