|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xbill.DNS.Message
public class Message
A DNS Message. A message is the basic unit of communication between the client and server of a DNS operation. A message consists of a Header and 4 message sections.
Resolver,
Header,
Section| Field Summary | |
|---|---|
static int |
MAXLENGTH
The maximum length of a message in wire format. |
| Constructor Summary | |
|---|---|
Message()
Creates a new Message with a random Message ID |
|
Message(byte[] b)
Creates a new Message from its DNS wire format representation |
|
Message(int id)
Creates a new Message with the specified Message ID |
|
| Method Summary | |
|---|---|
void |
addRecord(Record r,
int section)
Adds a record to a section of the Message, and adjusts the header. |
Object |
clone()
Creates a copy of this Message. |
boolean |
findRecord(Record r)
Determines if the given record is already present in any section. |
boolean |
findRecord(Record r,
int section)
Determines if the given record is already present in the given section. |
boolean |
findRRset(Name name,
int type)
Determines if an RRset with the given name and type is already present in any section. |
boolean |
findRRset(Name name,
int type,
int section)
Determines if an RRset with the given name and type is already present in the given section. |
Header |
getHeader()
Retrieves the Header. |
OPTRecord |
getOPT()
Returns the OPT record from the ADDITIONAL section, if one is present. |
Record |
getQuestion()
Returns the first record in the QUESTION section. |
int |
getRcode()
Returns the message's rcode (error code). |
Record[] |
getSectionArray(int section)
Returns an array containing all records in the given section, or an empty array if the section is empty. |
RRset[] |
getSectionRRsets(int section)
Returns an array containing all records in the given section grouped into RRsets. |
TSIGRecord |
getTSIG()
Returns the TSIG record from the ADDITIONAL section, if one is present. |
boolean |
isSigned()
Was this message signed by a TSIG? |
boolean |
isVerified()
If this message was signed by a TSIG, was the TSIG verified? |
static Message |
newQuery(Record r)
Creates a new Message with a random Message ID suitable for sending as a query. |
static Message |
newUpdate(Name zone)
Creates a new Message to contain a dynamic update. |
int |
numBytes()
Returns the size of the message. |
void |
removeAllRecords(int section)
Removes all records from a section of the Message, and adjusts the header. |
boolean |
removeRecord(Record r,
int section)
Removes a record from a section of the Message, and adjusts the header. |
String |
sectionToString(int i)
Converts the given section of the Message to a String. |
void |
setHeader(Header h)
Replaces the Header with a new one. |
void |
setTSIG(TSIG key,
int error,
TSIGRecord querytsig)
Sets the TSIG key and other necessary information to sign a message. |
String |
toString()
Converts the Message to a String. |
byte[] |
toWire()
Returns an array containing the wire format representation of the Message. |
byte[] |
toWire(int maxLength)
Returns an array containing the wire format representation of the Message with the specified maximum length. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MAXLENGTH
| Constructor Detail |
|---|
public Message(int id)
public Message()
public Message(byte[] b)
throws IOException
b - A byte array containing the DNS Message.
IOException| Method Detail |
|---|
public static Message newQuery(Record r)
r - A record containing the questionpublic static Message newUpdate(Name zone)
zone - The zone to be updatedpublic void setHeader(Header h)
Headerpublic Header getHeader()
Header
public void addRecord(Record r,
int section)
Record,
Section
public boolean removeRecord(Record r,
int section)
Record,
Sectionpublic void removeAllRecords(int section)
Record,
Section
public boolean findRecord(Record r,
int section)
Record,
Sectionpublic boolean findRecord(Record r)
Record,
Section
public boolean findRRset(Name name,
int type,
int section)
RRset,
Section
public boolean findRRset(Name name,
int type)
RRset,
Sectionpublic Record getQuestion()
Record,
Sectionpublic TSIGRecord getTSIG()
TSIGRecord,
TSIG,
Sectionpublic boolean isSigned()
TSIGpublic boolean isVerified()
TSIGpublic OPTRecord getOPT()
OPTRecord,
Sectionpublic int getRcode()
public Record[] getSectionArray(int section)
Record,
Sectionpublic RRset[] getSectionRRsets(int section)
RRset,
Sectionpublic byte[] toWire()
public byte[] toWire(int maxLength)
maxLength - The maximum length of the message.
Flags,
TSIG
public void setTSIG(TSIG key,
int error,
TSIGRecord querytsig)
key - The TSIG key.error - The value of the TSIG error field.querytsig - If this is a response, the TSIG from the request.public int numBytes()
public String sectionToString(int i)
Sectionpublic String toString()
toString in class Objectpublic Object clone()
clone in class ObjectResolver,
TSIGRecord,
OPTRecord
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||