org.opennms.protocols.dns
Class DNSAddressRR

java.lang.Object
  extended by org.opennms.protocols.dns.DNSAddressRR

public final class DNSAddressRR
extends Object

Holds a DNS resource record which is a DNS response that gives the IP address of a particular hostname. A resource record typically has:

Element Description
Name Domain name that the resource record describes.
Type Type of RR.
Class RR Class.
TTL Time-To-Live for the RR.
RDLEN Length of the following data.
Data Actual data of this RR.

Author:
Sowmya , OpenNMS

Constructor Summary
DNSAddressRR(String name, int type, int clas, long ttl, DNSInputStream dnsIn)
           Constructs an new DNS Address Resource Record with the specified information.
 
Method Summary
 byte[] getAddress()
           Returns the address from the address record as a byte array.
 InetAddress getInetAddress()
           the InetAddress of the address contained for the record.
 int getRRClass()
           Returns the class of this RR.
 String getRRName()
           Returns the name of this RR.
 long getRRTTL()
           Returns the TTL of this RR.
 int getRRType()
           Returns the type of this RR.
 boolean isValid()
           Returns true if still valid i.e.
 String toString()
           Converts the object to a textual string that describes the resource record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DNSAddressRR

public DNSAddressRR(String name,
                    int type,
                    int clas,
                    long ttl,
                    DNSInputStream dnsIn)
             throws IOException

Constructs an new DNS Address Resource Record with the specified information.

Parameters:
name - name of the RR
type - type of the RR
clas - class of the RR
ttl - time for which this RR is valid
dnsIn - inputstream for this RR
Throws:
IOException - Thrown if an error occurs decoding data from the passed DNSInputStream.
Method Detail

getAddress

public byte[] getAddress()

Returns the address from the address record as a byte array.

Returns:
The address as a byte array.

getInetAddress

public InetAddress getInetAddress()
                           throws UnknownHostException

the InetAddress of the address contained for the record.

Returns:
The InetAddress of the address
Throws:
UnknownHostException - Thrown if the InetAddress object cannot be constructed.

toString

public String toString()

Converts the object to a textual string that describes the resource record.

Overrides:
toString in class Object
Returns:
The string describing the object.

getRRName

public String getRRName()

Returns the name of this RR.

Returns:
The name of this RR.

getRRType

public int getRRType()

Returns the type of this RR.

Returns:
The type of this RR.

getRRClass

public int getRRClass()

Returns the class of this RR.

Returns:
The class of this RR.

getRRTTL

public long getRRTTL()

Returns the TTL of this RR.

Returns:
the TTL of this RR

isValid

public boolean isValid()

Returns true if still valid i.e. TTL has not expired.

Returns:
True if valid, false if not.


Copyright © 2009. All Rights Reserved.