001/*
002 * Copyright 2015-2018 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.edns;
012
013import org.minidns.edns.Edns.OptionCode;
014import org.minidns.util.Hex;
015
016public class Nsid extends EdnsOption {
017
018    public static final Nsid REQUEST = new Nsid();
019
020    private Nsid() {
021        this(new byte[0]);
022    }
023
024    public Nsid(byte[] payload) {
025        super(payload);
026    }
027
028    @Override
029    public OptionCode getOptionCode() {
030        return OptionCode.NSID;
031    }
032
033    @Override
034    protected CharSequence toStringInternal() {
035        String res = OptionCode.NSID + ": ";
036        res += new String(optionData);
037        return res;
038    }
039
040    @Override
041    protected CharSequence asTerminalOutputInternal() {
042        return Hex.from(optionData);
043    }
044
045}