public class Header
extends java.lang.Object
implements java.lang.Cloneable
Message
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 |
---|---|
java.lang.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
|
java.lang.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
|
java.lang.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 java.io.IOException
b
- A byte array containing the DNS Header.java.io.IOException
public byte[] toWire()
public void setFlag(int bit)
Flags
public void unsetFlag(int bit)
Flags
public boolean getFlag(int bit)
Flags
public int getID()
public void setID(int id)
public void setRcode(int value)
Rcode
public int getRcode()
Rcode
public void setOpcode(int value)
Opcode
public int getOpcode()
Opcode
public int getCount(int field)
Section
public java.lang.String printFlags()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
Copyright © 2019 dnsjava.org. All rights reserved.