Secure iNet Factory

com.jscape.inet.dns
Class DnsRequest

java.lang.Object
  extended by com.jscape.inet.dns.DnsRequest
All Implemented Interfaces:
java.io.Serializable

public class DnsRequest
extends java.lang.Object
implements java.io.Serializable

Implements the basic functionality of a DNS request. Example Usage:

 // create new instance
 Dns dns = new Dns();

 // creates DNS request with nameserver and domain as arguments
 DnsRequest request = new DnsRequest("ns.myserver.com","myserver.com");
 // retrieve only MX (mail exchanger) records
 request.setRecordType(Dns.TYPE_MX);

 // gets DNS response
 DnsResponse response = dns.getResponse(request);

 // print out records for response to console

 Enumeration e = response.getAnswers();
 while(e.hasMoreElements()) {
   DnsRecord record = (DnsRecord) e.nextElement();
   System.out.println(record);
 }
 

See Also:
Serialized Form

Constructor Summary
DnsRequest(java.lang.String nameserver, java.lang.String domain)
          Constructs a new DnsRequest instance.
DnsRequest(java.lang.String nameserver, java.lang.String domain, int recordType)
          Constructs a new DnsRequest instance.
DnsRequest(java.lang.String nameserver, java.lang.String domain, int recordType, int classType)
          Constructs a new DnsRequest instance The constants for recordType and classType are defind in Dns class.
 
Method Summary
 int getClassType()
          Gets class type to retrieve for this DnsRequest.
 java.lang.String getDomain()
          Gets hostname or IP address to lookup for this DnsRequest.
 java.lang.String getNameserver()
          Gets nameserver used to perform this DnsRequest.
 int getQueryId()
          Gets query id for this DnsRequest.
 int getRecordType()
          Gets record type to retrieve for this DnsRequest.
 int getTimeout()
          Gets the timeout for opening connection to DNS server.
 void setClassType(int classType)
          Sets class type to retrieve for this DnsRequest.
 void setDomain(java.lang.String domain)
          Sets hostname or IP address to lookup for this DnsRequest.
 void setNameserver(java.lang.String nameserver)
          Sets nameserver used to perform this DnsRequest.
 void setRecordType(int recordType)
          Sets record type to retrieve for this DnsRequest.
 void setTimeout(int timeout)
          Sets the timeout for opening connection to DNS server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DnsRequest

public DnsRequest(java.lang.String nameserver,
                  java.lang.String domain)
Constructs a new DnsRequest instance.

Parameters:
nameserver - the hostname or IP address of the DNS server
domain - the hostname or IP address to lookup

DnsRequest

public DnsRequest(java.lang.String nameserver,
                  java.lang.String domain,
                  int recordType)
Constructs a new DnsRequest instance. The constants for recordType are defind in Dns class.

Parameters:
nameserver - the hostname or IP address of the DNS server
domain - the hostname or IP address to lookup
recordType - the type of records to retrieve
See Also:
Dns

DnsRequest

public DnsRequest(java.lang.String nameserver,
                  java.lang.String domain,
                  int recordType,
                  int classType)
Constructs a new DnsRequest instance The constants for recordType and classType are defind in Dns class.

Parameters:
nameserver - the hostname or IP address of the DNS server
domain - the hostname or IP address to lookup
recordType - the type of records to retrieve
classType - the class of records to retrieve
See Also:
Dns
Method Detail

getNameserver

public java.lang.String getNameserver()
Gets nameserver used to perform this DnsRequest.

Returns:
nameserver

setNameserver

public void setNameserver(java.lang.String nameserver)
Sets nameserver used to perform this DnsRequest.

Parameters:
nameserver - the nameserver used to perform this DnsRequest

getRecordType

public int getRecordType()
Gets record type to retrieve for this DnsRequest.

Returns:
record type

setRecordType

public void setRecordType(int recordType)
Sets record type to retrieve for this DnsRequest.

Parameters:
recordType - the record type to retrieve for this DnsRequest

getClassType

public int getClassType()
Gets class type to retrieve for this DnsRequest.

Returns:
class type

setClassType

public void setClassType(int classType)
Sets class type to retrieve for this DnsRequest.

Parameters:
classType - the class type to retrieve for this DnsRequest

getDomain

public java.lang.String getDomain()
Gets hostname or IP address to lookup for this DnsRequest.

Returns:
domain

setDomain

public void setDomain(java.lang.String domain)
Sets hostname or IP address to lookup for this DnsRequest.

Parameters:
domain - the hostname or IP address to lookup for this DnsRequest

getQueryId

public int getQueryId()
Gets query id for this DnsRequest.

Returns:
query id

setTimeout

public void setTimeout(int timeout)
Sets the timeout for opening connection to DNS server.

Parameters:
timeout - the timeout in milliseconds

getTimeout

public int getTimeout()
Gets the timeout for opening connection to DNS server.

Returns:
timeout in milliseconds

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved