Package org.xbill.DNS
Class Header
java.lang.Object
org.xbill.DNS.Header
- All Implemented Interfaces:
Cloneable
A DNS message header
- Author:
- Brian Wellington
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe length of a DNS Header in wire format. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()intgetCount(int field) Retrieves the record count for the given sectionbooleangetFlag(int bit) Retrieves a flagintgetID()Retrieves the message IDintRetrieves the mesasge's opcodeintgetRcode()Retrieves the mesasge's rcodeConverts the header's flags into a StringvoidsetFlag(int bit) Sets a flag to the supplied valuevoidsetID(int id) Sets the message IDvoidsetOpcode(int value) Sets the message's opcodevoidsetRcode(int value) Sets the message's rcodetoString()Converts the header into a Stringbyte[]toWire()voidunsetFlag(int bit) Sets a flag to the supplied value
-
Field Details
-
LENGTH
public static final int LENGTHThe length of a DNS Header in wire format.- See Also:
-
-
Constructor Details
-
Header
public Header(int id) Create a new empty header.- Parameters:
id- The message id
-
Header
public Header()Create a new empty header with a random message id -
Header
Creates a new Header from its DNS wire format representation- Parameters:
b- A byte array containing the DNS Header.- Throws:
IOException
-
-
Method Details
-
toWire
public byte[] toWire() -
setFlag
public void setFlag(int bit) Sets a flag to the supplied value- See Also:
-
unsetFlag
public void unsetFlag(int bit) Sets a flag to the supplied value- See Also:
-
getFlag
public boolean getFlag(int bit) Retrieves a flag- See Also:
-
getID
public int getID()Retrieves the message ID -
setID
public void setID(int id) Sets the message ID -
setRcode
public void setRcode(int value) Sets the message's rcode- See Also:
-
getRcode
public int getRcode()Retrieves the mesasge's rcode- See Also:
-
setOpcode
public void setOpcode(int value) Sets the message's opcode- See Also:
-
getOpcode
public int getOpcode()Retrieves the mesasge's opcode- See Also:
-
getCount
public int getCount(int field) Retrieves the record count for the given section- See Also:
-
printFlags
Converts the header's flags into a String -
toString
Converts the header into a String -
clone
-