| Modifier and Type | Field and Description |
|---|---|
static int |
LENGTH
The length of a DNS Header in wire format.
|
| Constructor and Description |
|---|
Header()
Create a new empty header with a random message id
|
Header(byte[] b)
Creates a new Header from its DNS wire format representation
|
Header(int id)
Create a new empty header.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
int |
getCount(int field)
Retrieves the record count for the given section
|
boolean |
getFlag(int bit)
Retrieves a flag
|
int |
getID()
Retrieves the message ID
|
int |
getOpcode()
Retrieves the mesasge's opcode
|
int |
getRcode()
Retrieves the mesasge's rcode
|
String |
printFlags()
Converts the header's flags into a String
|
void |
setFlag(int bit)
Sets a flag to the supplied value
|
void |
setID(int id)
Sets the message ID
|
void |
setOpcode(int value)
Sets the message's opcode
|
void |
setRcode(int value)
Sets the message's rcode
|
String |
toString()
Converts the header into a String
|
byte[] |
toWire() |
void |
unsetFlag(int bit)
Sets a flag to the supplied value
|
public static final int LENGTH
public Header(int id)
id - The message idpublic Header()
public Header(byte[] b)
throws IOException
b - A byte array containing the DNS Header.IOExceptionpublic byte[] toWire()
public void setFlag(int bit)
Flagspublic void unsetFlag(int bit)
Flagspublic boolean getFlag(int bit)
Flagspublic int getID()
public void setID(int id)
public void setRcode(int value)
Rcodepublic int getRcode()
Rcodepublic void setOpcode(int value)
Opcodepublic int getOpcode()
Opcodepublic int getCount(int field)
Sectionpublic String printFlags()
public String toString()