|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ivmaidns.dns.DNSMsgHeader
public final class DNSMsgHeader
Class for representing DNS msg header (as defined in RFC1035).
Field Summary | |
---|---|
static int |
AA
NOTE: This is a bit mask for 'AA' DNS message flag (defined in RFC1035). |
static int |
AD
NOTE: This is a bit mask for 'AD' DNS message flag (defined in RFC2535). |
protected short |
anCount
NOTE: An unsigned short integer specifying the number of entries in the answer section. |
protected short |
arCount
NOTE: An unsigned short integer specifying the number of entries in the additional section. |
static int |
BADALG
NOTE: This extended rCode value (defined in RFC2930) indicates that the key exhange algorithm referenced in the TKEY resource record is invalid ('BADALG'). |
static int |
BADKEY
NOTE: This extended rCode value (defined in RFC2845) indicates that the key referenced in the TSIG resource record is invalid ('BADKEY'). |
static int |
BADMODE
NOTE: This extended rCode value (defined in RFC2930) indicates that the key exhange mode referenced in the TKEY resource record is invalid ('BADMODE'). |
static int |
BADNAME
NOTE: This extended rCode value (defined in RFC2930) indicates that the key name referenced in the TKEY resource record is invalid ('BADNAME'). |
static int |
BADSIG
NOTE: This extended rCode value (defined in RFC2845) indicates that the digital signature referenced in the TSIG resource record is invalid ('BADSIG'); this value also indicates an invalid OPT record version error (as defined in RFC2671). |
static int |
BADTIME
NOTE: This extended rCode value (defined in RFC2845) indicates that the time stamp referenced in the TSIG or TKEY resource record is invalid ('BADTIME'). |
static int |
CD
NOTE: This is a bit mask for 'CD' DNS message flag (defined in RFC2535). |
static int |
COUNT_LENGTH
|
protected short |
flags
NOTE: flags field consists of QR, opCode, AA, TC, RD, RA, a reserved flag (should be zero), AD, CD and rCode. opCode field (which is set by the originator of a query and copied into the response) specifies the kind of query. rCode field (response code) is set as part of responses. |
static int |
FLAGS_LENGTH
|
static int |
FORMERR
NOTE: This rCode value (defined in RFC1035) indicates that the name server was unable to interpret the request due to a format error ('FORMERR'). |
static int |
HEADER_LEN
NOTE: This is total length (in bytes) of header. |
protected short |
id
NOTE: An unsigned identifier assigned by the client that generates a query message. |
static int |
ID_LENGTH
NOTE: These are fields lengthes (in bytes). |
static int |
IQUERY
NOTE: This opCode value (defined in RFC1035) indicates an inverse query ('IQUERY'). |
static int |
MAX_COUNT
|
static int |
MAX_FLAGS
|
static int |
MAX_ID
NOTE: These are fields bit masks. |
static int |
MAX_OPCODE
|
static int |
MAX_RCODE
|
static int |
NOERROR
NOTE: This rCode value (defined in RFC1035) indicates no error condition ('NOERROR'). |
static int |
NOTAUTH
NOTE: This rCode value (defined in RFC2136) indicates that the name server is not authoritative for the requested zone ('NOTAUTH'). |
static int |
NOTIFY
NOTE: This opCode value (defined in RFC1996) indicates a slave server notification on zone changings ('NOTIFY'). |
static int |
NOTIMP
NOTE: This rCode value (defined in RFC1035) indicates that the name server does not support the requested kind of query ('NOTIMP'). |
static int |
NOTZONE
NOTE: This rCode value (defined in RFC2136) indicates that the specified name is not within the denoted zone ('NOTZONE'). |
protected short |
nsCount
NOTE: An unsigned short integer specifying the number of entries in the authority section. |
static int |
NXDOMAIN
NOTE: This rCode value (defined in RFC1035) indicates that the name referenced in the query ought to exist but does not exist ('NXDOMAIN'). |
static int |
NXRRSET
NOTE: This rCode value (defined in RFC2136) indicates that the referenced resource records set ought to exist but does not exist ('NXRRSET'). |
static java.lang.String |
OPCODE_ABBREVS
NOTE: This is the opCode abbreviations list string. |
static int |
OPCODE_SHIFT
|
protected short |
qdCount
NOTE: An unsigned short integer specifying the number of entries in the question section. |
static int |
QR
NOTE: This is a bit mask for 'QR' DNS message flag (defined in RFC1035). |
static int |
QUERY
NOTE: This opCode value (defined in RFC1035) indicates a standard/normal query ('QUERY'). |
static int |
RA
NOTE: This is a bit mask for 'RA' DNS message flag (defined in RFC1035). |
static java.lang.String |
RCODE_ABBREVS
NOTE: This is the rCode abbreviations list string. |
static int |
RD
NOTE: This is a bit mask for 'RD' DNS message flag (defined in RFC1035). |
static int |
REFUSED
NOTE: This rCode value (defined in RFC1035) indicates that the name server refuses to perform the specified operation for policy or security reasons ('REFUSED'). |
static int |
SERVFAIL
NOTE: This rCode value (defined in RFC1035) indicates that the name server encountered an internal failure while processing this request ('SERVFAIL'). |
static int |
STATUS
NOTE: This opCode value (defined in RFC1035) indicates a server status request ('STATUS'). |
static int |
TC
NOTE: This is a bit mask for 'TC' DNS message flag (defined in RFC1035). |
static int |
UDP_PACKET_LEN
NOTE: This is the default/maximum DNS UDP packet length (PACKET_LEN > HEADER_LEN). |
static int |
UPDATE
NOTE: This opCode value (defined in RFC2136) indicates an 'UPDATE' DNS message. |
static int |
YXDOMAIN
NOTE: This rCode value (defined in RFC2136) indicates that the referenced name ought not to exist but does exist ('YXDOMAIN'). |
static int |
YXRRSET
NOTE: This rCode value (defined in RFC2136) indicates that the referenced resource records set ought not to exist but does exist ('YXRRSET'). |
Constructor Summary | |
---|---|
DNSMsgHeader()
NOTE: DNS status query header constructor. |
|
DNSMsgHeader(byte[] msgBytes)
NOTE: msgBytes must be ! |
|
DNSMsgHeader(int id,
int flags,
int qdCount,
int anCount,
int nsCount,
int arCount)
NOTE: Primary DNS message header constructor. id, flags, qdCount, anCount, nsCount and arCount are unsigned (must be valid). |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates and returns a copy of this object. |
static DNSMsgHeader |
construct(int opCode,
boolean isRecursionDesired,
int qdCount,
int anCount,
int nsCount,
int arCount,
boolean isCheckingDisabled)
NOTE: Any query message header constructor. opCode must be valid. |
DNSMsgHeader |
constructResponse(int rCode,
boolean isAuthoritativeAnswer,
boolean isTruncated,
boolean isRecursionAvailable,
boolean isAuthenticData,
int qdCount,
int anCount,
int nsCount,
int arCount)
NOTE: Server response message header constructor. rCode must be valid. qdCount, anCount, nsCount and arCount are unsigned (must be valid). |
boolean |
equals(java.lang.Object obj)
|
static java.lang.String |
flagBitsAbbreviation(int flags)
NOTE: flags value is unsigned. |
int |
getAnCount()
NOTE: Result is unsigned. |
int |
getArCount()
NOTE: Result is unsigned. |
java.lang.Object |
getAt(int index)
NOTE: Result is new UnsignedInt((new int[] { getId(), getFlags(), getQdCount(), getAnCount(), getNsCount(), getArCount() })[index]). |
int |
getFlags()
NOTE: Result is unsigned. |
int |
getId()
NOTE: May be 0 in AXFR response messages (starting from the second message). |
int |
getNsCount()
NOTE: Result is unsigned. |
int |
getOpCode()
NOTE: Result >= 0. |
int |
getQdCount()
NOTE: Result is unsigned. |
static int |
getQdCount(byte[] msgBytes)
NOTE: msgBytes must be ! |
int |
getRCode()
NOTE: Result >= 0. |
static int |
getTotalCount(byte[] msgBytes)
NOTE: msgBytes must be ! |
int |
hashCode()
|
boolean |
isAuthenticData()
NOTE: Result is the same as of ((getFlags() & AD) ! |
boolean |
isAuthoritativeAnswer()
|
boolean |
isCheckingDisabled()
NOTE: Result is the same as of ((getFlags() & CD) ! |
boolean |
isRecursionAvailable()
|
boolean |
isRecursionDesired()
|
boolean |
isResponse()
|
boolean |
isTruncated()
|
static boolean |
isTruncated(byte[] msgBytes)
NOTE: msgBytes must be ! |
int |
length()
NOTE: Result is the number of elements accessible through getAt(int). |
void |
putTo(byte[] msgBytes)
NOTE: msgBytes must be ! |
static void |
setTruncated(byte[] msgBytes)
NOTE: msgBytes must be ! |
java.lang.String |
toString()
NOTE: Result ! |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int QUERY
public static final int IQUERY
public static final int STATUS
public static final int NOTIFY
public static final int UPDATE
public static final int NOERROR
public static final int FORMERR
public static final int SERVFAIL
public static final int NXDOMAIN
public static final int NOTIMP
public static final int REFUSED
public static final int YXDOMAIN
public static final int YXRRSET
public static final int NXRRSET
public static final int NOTAUTH
public static final int NOTZONE
public static final int BADSIG
public static final int BADKEY
public static final int BADTIME
public static final int BADMODE
public static final int BADNAME
public static final int BADALG
public static final int QR
public static final int AA
public static final int TC
public static final int RD
public static final int RA
public static final int AD
public static final int CD
public static final int ID_LENGTH
public static final int FLAGS_LENGTH
public static final int COUNT_LENGTH
public static final int HEADER_LEN
public static final int UDP_PACKET_LEN
public static final int MAX_ID
public static final int MAX_FLAGS
public static final int MAX_COUNT
public static final int MAX_OPCODE
public static final int MAX_RCODE
public static final int OPCODE_SHIFT
public static final java.lang.String OPCODE_ABBREVS
public static final java.lang.String RCODE_ABBREVS
protected final short id
protected final short flags
protected final short qdCount
protected final short anCount
protected final short nsCount
protected final short arCount
Constructor Detail |
---|
public DNSMsgHeader()
public DNSMsgHeader(int id, int flags, int qdCount, int anCount, int nsCount, int arCount) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public DNSMsgHeader(byte[] msgBytes) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
Method Detail |
---|
public void putTo(byte[] msgBytes) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
public static final void setTruncated(byte[] msgBytes) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
public static final boolean isTruncated(byte[] msgBytes) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
public static final int getQdCount(byte[] msgBytes) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
public static final int getTotalCount(byte[] msgBytes) throws java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException
public static DNSMsgHeader construct(int opCode, boolean isRecursionDesired, int qdCount, int anCount, int nsCount, int arCount, boolean isCheckingDisabled) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public DNSMsgHeader constructResponse(int rCode, boolean isAuthoritativeAnswer, boolean isTruncated, boolean isRecursionAvailable, boolean isAuthenticData, int qdCount, int anCount, int nsCount, int arCount) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public final int getId()
public final int getFlags()
public final boolean isResponse()
public final int getOpCode()
public final boolean isAuthoritativeAnswer()
public final boolean isTruncated()
public final boolean isRecursionDesired()
public final boolean isRecursionAvailable()
public final boolean isAuthenticData()
public final boolean isCheckingDisabled()
public final int getRCode()
public final int getQdCount()
public final int getAnCount()
public final int getNsCount()
public final int getArCount()
public int length()
length
in interface Indexable
Indexable.getAt(int)
public java.lang.Object getAt(int index) throws java.lang.ArrayIndexOutOfBoundsException
getAt
in interface Indexable
index
- the index (must be in the range) at which to return an element.
null
) at index.
java.lang.ArrayIndexOutOfBoundsException
- if index is negative or is not less than
length()
.Indexable.length()
public static final java.lang.String flagBitsAbbreviation(int flags)
public java.lang.Object clone()
ReallyCloneable
this
object.
By the clone()
standard definition, this method
creates a new instance of the class of this object and
initializes all its fields with exactly the contents of the
corresponding fields of this object. Typically, native
clone()
method of Object
class is used
inside this method.
clone
in interface ReallyCloneable
clone
in class java.lang.Object
null
and != this
) of
this
instance.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |