diff --git a/zscan_rr.go b/zscan_rr.go index 02e271de..aac2d217 100644 --- a/zscan_rr.go +++ b/zscan_rr.go @@ -69,6 +69,8 @@ func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError) { return setNSEC3PARAM(h, c, f) case TypeDS: return setDS(h, c, f) + case TypeDLV: + return setDLV(h, c, f) case TypeTLSA: return setTLSA(h, c, f) case TypeTXT: @@ -780,6 +782,47 @@ func setDS(h RR_Header, c chan lex, f string) (RR, *ParseError) { return rr, nil } +func setDLV(h RR_Header, c chan lex, f string) (RR, *ParseError) { + rr := new(RR_DLV) + rr.Hdr = h + l := <-c + if i, e := strconv.Atoi(l.token); e != nil { + return nil, &ParseError{f, "bad DLV KeyTag", l} + } else { + rr.KeyTag = uint16(i) + } + <-c // _BLANK + l = <-c + if i, e := strconv.Atoi(l.token); e != nil { + return nil, &ParseError{f, "bad DLV Algorithm", l} + } else { + rr.Algorithm = uint8(i) + } + <-c // _BLANK + l = <-c + if i, e := strconv.Atoi(l.token); e != nil { + return nil, &ParseError{f, "bad DLV DigestType", l} + } else { + rr.DigestType = uint8(i) + } + // There can be spaces here... + l = <-c + s := "" + for l.value != _NEWLINE && l.value != _EOF { + switch l.value { + case _STRING: + s += l.token + case _BLANK: + // Ok + default: + return nil, &ParseError{f, "bad DLV Digest", l} + } + l = <-c + } + rr.Digest = s + return rr, nil +} + func setTLSA(h RR_Header, c chan lex, f string) (RR, *ParseError) { rr := new(RR_TLSA) rr.Hdr = h