Return 'unsupported-message-type if message type is unknown, return

'unsupported-message-class if message class is unknown.

This makes it possible to parse replies that contain IP6 addresses in
the additional section.
This commit is contained in:
mainzelm 2004-03-24 20:52:12 +00:00
parent a65a5c5f86
commit 222f5c5052
1 changed files with 15 additions and 4 deletions

View File

@ -565,15 +565,26 @@
(values (make-question name type class) start)))))) (values (make-question name type class) start))))))
;; parses a resourcerecord in a message. returns the rr and the rest of the message. ;; parses a resourcerecord in a message. returns the rr and the rest of the message.
(define (type-number->type type-number)
(if (>= type-number (vector-length the-message-types))
'unsupported-message-type
(vector-ref the-message-types type-number)))
(define (class-number->class class-number)
(if (>= class-number (vector-length the-message-classes))
'unsupported-message-class
(vector-ref the-message-classes class-number)))
(define (parse-rr start message) (define (parse-rr start message)
(call-with-values (call-with-values
(lambda () (parse-name start message)) (lambda () (parse-name start message))
(lambda (name start) (lambda (name start)
(let ((type (vector-ref the-message-types (let ((type (type-number->type
(octet-pair->number (car start) (cadr start)))) (octet-pair->number (car start) (cadr start))))
(start (cddr start))) (start (cddr start)))
(let ((class (vector-ref the-message-classes (let ((class (class-number->class
(octet-pair->number (car start) (cadr start)))) (octet-pair->number (car start) (cadr start))))
(start (cddr start))) (start (cddr start)))
(let ((ttl (octet-quad->number (car start) (cadr start) (let ((ttl (octet-quad->number (car start) (cadr start)
(caddr start) (cadddr start))) (caddr start) (cadddr start)))