Package org.xbill.DNS
Class Header
java.lang.Object
org.xbill.DNS.Header
- All Implemented Interfaces:
Cloneable
A DNS message header
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckFlag(int bit) clone()(package private) voiddecCount(int field) intgetCount(int field) Retrieves the record count for the given sectionbooleangetFlag(int bit) Retrieves a flag(package private) static booleangetFlag(int flags, int bit) (package private) boolean[]getFlags()(package private) intintgetID()Retrieves the message IDintRetrieves the mesasge's opcodeintgetRcode()Retrieves the mesasge's rcode(package private) voidincCount(int field) Converts the header's flags into a Stringprivate void(package private) voidsetCount(int field, int value) voidsetFlag(int bit) Sets a flag to the supplied value(package private) static intsetFlag(int flags, int bit, boolean value) voidsetID(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 String(package private) StringtoStringWithRcode(int newrcode) byte[]toWire()(package private) voidvoidunsetFlag(int bit) Sets a flag to the supplied valueprivate static booleanvalidFlag(int bit)
-
Field Details
-
id
private int id -
flags
private int flags -
counts
private int[] counts -
random
-
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
Header(DNSInput in) throws IOException Parses a Header from a stream containing DNS wire format.- Throws:
IOException
-
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
-
toWire
public byte[] toWire() -
validFlag
private static boolean validFlag(int bit) -
checkFlag
private static void checkFlag(int bit) -
setFlag
static int setFlag(int flags, int bit, boolean value) -
getFlag
static boolean getFlag(int flags, int bit) -
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:
-
getFlags
boolean[] getFlags() -
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:
-
setCount
void setCount(int field, int value) -
incCount
void incCount(int field) -
decCount
void decCount(int field) -
getCount
public int getCount(int field) Retrieves the record count for the given section- See Also:
-
getFlagsByte
int getFlagsByte() -
printFlags
Converts the header's flags into a String -
printFlags
-
toStringWithRcode
-
toString
Converts the header into a String -
clone
-