net.clackrouter.packets
Class DNSPacket

java.lang.Object
  extended by net.clackrouter.protocol.data.VNSData
      extended by net.clackrouter.packets.VNSPacket
          extended by net.clackrouter.packets.DNSPacket

public class DNSPacket
extends VNSPacket

Represents a Domain Name System (DNS) packet.

Currently supports simple requests and responses with Query, Answer, Authority and Additional record types.


Nested Class Summary
static class DNSPacket.Answer
          Contains DNS Answer information
static class DNSPacket.Query
          Contains DNS Query information
 
Field Summary
static int CLASS_INET
           
static int DNS_PORT
           
static int FLAGS_QUERY_RESPONSE_NO_ERROR
           
static int FLAGS_QUERY_STANDARD
           
static short HEADER_SIZE
           
static int TYPE_A
           
static int TYPE_CNAME
           
static int TYPE_MX
           
static int TYPE_NS
           
 
Fields inherited from class net.clackrouter.packets.VNSPacket
m_inputInterfaceName, m_length, m_level2Type, m_local_packet, m_nextHopIPAddr, m_nextHopMacAddr, m_outputInterfaceName, m_packetByteBuffer, mParentHeader
 
Constructor Summary
DNSPacket(java.nio.ByteBuffer buf)
           
DNSPacket(int transactionID, int flags)
           
 
Method Summary
 void addAdditionalRecord(DNSPacket.Answer a)
           
 void addAnswerRecord(DNSPacket.Answer a)
           
 void addAuthorityRecord(DNSPacket.Answer a)
           
 void addQueryRecord(DNSPacket.Query q)
           
 DNSPacket.Answer getAdditionalRecord(int i)
           
 int getAdditionalRecordCount()
           
 DNSPacket.Answer getAnswerRecord(int i)
           
 int getAnswerRecordCount()
           
 DNSPacket.Answer getAuthorityRecord(int i)
           
 int getAuthorityRecordCount()
           
 short getFlags()
           
 short getID()
           
static byte[] getQNameArray(java.lang.String name)
           
 DNSPacket.Query getQueryRecord(int i)
           
 int getQueryRecordCount()
           
 void pack()
           
 void setFlags(short f)
           
 void setID(short id)
           
 
Methods inherited from class net.clackrouter.packets.VNSPacket
addToPath, get16bit, get32bit, getByteBuffer, getInputInterfaceName, getLength, getLevel2Type, getNextHopIPAddress, getNextHopMacAddress, getOutputInterfaceName, getParentHeader, getStringBuffer, isPacket, needsSourceAddress, setByteBuffer, setInputInterfaceName, setLevel2Type, setNeedsSourceAddress, setNextHopIPAddress, setNextHopMacAddress, setOutputInterfaceName, setParentHeader, toString
 
Methods inherited from class net.clackrouter.protocol.data.VNSData
isBanner, isClose, isHWInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DNS_PORT

public static final int DNS_PORT
See Also:
Constant Field Values

HEADER_SIZE

public static final short HEADER_SIZE
See Also:
Constant Field Values

FLAGS_QUERY_RESPONSE_NO_ERROR

public static final int FLAGS_QUERY_RESPONSE_NO_ERROR
See Also:
Constant Field Values

FLAGS_QUERY_STANDARD

public static final int FLAGS_QUERY_STANDARD
See Also:
Constant Field Values

TYPE_A

public static final int TYPE_A
See Also:
Constant Field Values

TYPE_NS

public static final int TYPE_NS
See Also:
Constant Field Values

TYPE_CNAME

public static final int TYPE_CNAME
See Also:
Constant Field Values

TYPE_MX

public static final int TYPE_MX
See Also:
Constant Field Values

CLASS_INET

public static final int CLASS_INET
See Also:
Constant Field Values
Constructor Detail

DNSPacket

public DNSPacket(java.nio.ByteBuffer buf)
          throws java.lang.Exception
Throws:
java.lang.Exception

DNSPacket

public DNSPacket(int transactionID,
                 int flags)
          throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

addQueryRecord

public void addQueryRecord(DNSPacket.Query q)

addAnswerRecord

public void addAnswerRecord(DNSPacket.Answer a)

addAuthorityRecord

public void addAuthorityRecord(DNSPacket.Answer a)

addAdditionalRecord

public void addAdditionalRecord(DNSPacket.Answer a)

getQueryRecord

public DNSPacket.Query getQueryRecord(int i)

getAnswerRecord

public DNSPacket.Answer getAnswerRecord(int i)

getAuthorityRecord

public DNSPacket.Answer getAuthorityRecord(int i)

getAdditionalRecord

public DNSPacket.Answer getAdditionalRecord(int i)

getQueryRecordCount

public int getQueryRecordCount()

getAnswerRecordCount

public int getAnswerRecordCount()

getAuthorityRecordCount

public int getAuthorityRecordCount()

getAdditionalRecordCount

public int getAdditionalRecordCount()

getFlags

public short getFlags()

setFlags

public void setFlags(short f)

getID

public short getID()

setID

public void setID(short id)

pack

public void pack()

getQNameArray

public static byte[] getQNameArray(java.lang.String name)