001/*
002 * Copyright 2015-2020 the original author or authors
003 *
004 * This software is licensed under the Apache License, Version 2.0,
005 * the GNU Lesser General Public License version 2 or later ("LGPL")
006 * and the WTFPL.
007 * You may choose either license to govern your use of this software only
008 * upon the condition that you accept all of the terms of either
009 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL.
010 */
011package org.minidns.record;
012
013import java.io.DataInputStream;
014import java.io.IOException;
015
016import org.minidns.constants.DnssecConstants.DigestAlgorithm;
017import org.minidns.constants.DnssecConstants.SignatureAlgorithm;
018
019/**
020 * DLV record payload.
021 *
022 * According to RFC4431, DLV has exactly the same format as DS records.
023 */
024public class DLV extends DelegatingDnssecRR {
025
026    public static DLV parse (DataInputStream dis, int length) throws IOException {
027        SharedData parsedData = DelegatingDnssecRR.parseSharedData(dis, length);
028        return new DLV(parsedData.keyTag, parsedData.algorithm, parsedData.digestType, parsedData.digest);
029    }
030
031    public DLV(int keyTag, byte algorithm, byte digestType, byte[] digest) {
032        super(keyTag, algorithm, digestType, digest);
033    }
034
035    public DLV(int keyTag, SignatureAlgorithm algorithm, DigestAlgorithm digestType, byte[] digest) {
036        super(keyTag, algorithm, digestType, digest);
037    }
038
039    @Override
040    public Record.TYPE getType() {
041        return Record.TYPE.DLV;
042    }
043}