|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ipworks.Dns
The DNS bean is used to query DNS for record information.
The DNS bean queries a DNS server for records as specified in RFC
1035 and other relevant RFCs. The bean property QueryType indicates the record to be queried. Calling Query will
initiate the query.
Once the query is complete, a single Response event
will fire and the record properties will be filled. StatusCode is the server's success or fail code, and Status is a standard
string interpretation of the code.
The records are contained in the Records collection. The programming
interface is designed to
allow a full walk of the records in the DNS response, including provisions for
handling new record types. .
The bean operates synchronously by default (waits for a response before
returning control to the caller), however, the bean may also operate
asynchronously (return control immediately), by setting Timeout to 0.
Please refer to the Timeout property for more information.
| Field Summary | |
static int |
qtAAAA
|
static int |
qtAddress
|
static int |
qtAFSDB
|
static int |
qtCName
|
static int |
qtHostInfo
|
static int |
qtISDN
|
static int |
qtMailBox
|
static int |
qtMailGroup
|
static int |
qtMailInfo
|
static int |
qtMD
|
static int |
qtMF
|
static int |
qtMR
|
static int |
qtMX
|
static int |
qtNAPTR
|
static int |
qtNS
|
static int |
qtNULL
|
static int |
qtPointer
|
static int |
qtRevLookup
|
static int |
qtRP
|
static int |
qtRT
|
static int |
qtSOA
|
static int |
qtSRV
|
static int |
qtText
|
static int |
qtWKS
|
static int |
qtX25
|
static int |
rsAdditionalRecordsSection
|
static int |
rsAnswerSection
|
static int |
rsNameServerSection
|
| Constructor Summary | |
Dns()
|
|
| Method Summary | |
void |
addDnsEventListener(ipworks.DnsEventListener l)
|
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a beanconfiguration setting. |
void |
doEvents()
Processes events from the internal message queue. |
int |
getDNSPort()
The port to connect to on the DNS Server. |
java.lang.String |
getDNSServer()
The address of the DNS Server. |
int |
getQueryType()
The record type to query. |
DNSRecordList |
getRecords()
Collection of records in the last response. |
int |
getRecordSource()
The source of records provided in the Records collection. |
int |
getRequestId()
The id of the current DNS request. |
java.lang.String |
getStatus()
A standard string interpretation of StatusCode . |
int |
getStatusCode()
The success or error code for the DNS query. |
int |
getTimeout()
A timeout for the bean. |
void |
interrupt()
Interrupt the current method. |
boolean |
isIdle()
The current status of the component. |
boolean |
isRecursive()
Determines whether to ask the DNSServer to recursively query other servers. |
void |
query(java.lang.String domain)
Query a Domain. |
void |
removeDnsEventListener(ipworks.DnsEventListener l)
|
void |
setDNSPort(int DNSPort)
The port to connect to on the DNS Server. |
void |
setDNSServer(java.lang.String DNSServer)
The address of the DNS Server. |
void |
setQueryType(int queryType)
The record type to query. |
void |
setRecordSource(int recordSource)
The source of records provided in the Records collection. |
void |
setRecursive(boolean recursive)
Determines whether to ask the DNSServer to recursively query other servers. |
void |
setRequestId(int requestId)
The id of the current DNS request. |
void |
setTimeout(int timeout)
A timeout for the bean. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int qtAddress
public static final int qtNS
public static final int qtMD
public static final int qtMF
public static final int qtCName
public static final int qtSOA
public static final int qtMailBox
public static final int qtMailGroup
public static final int qtMR
public static final int qtNULL
public static final int qtWKS
public static final int qtPointer
public static final int qtHostInfo
public static final int qtMailInfo
public static final int qtMX
public static final int qtText
public static final int qtRP
public static final int qtAFSDB
public static final int qtX25
public static final int qtISDN
public static final int qtRT
public static final int qtAAAA
public static final int qtSRV
public static final int qtNAPTR
public static final int qtRevLookup
public static final int rsAnswerSection
public static final int rsNameServerSection
public static final int rsAdditionalRecordsSection
| Constructor Detail |
public Dns()
| Method Detail |
public int getDNSPort()
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
public void setDNSPort(int DNSPort)
throws IPWorksException
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
IPWorksExceptionpublic java.lang.String getDNSServer()
The bean attempts to find the default
DNS server for the machine where it is installed,
and provide it in the DNSServer property. You may later
change it to any particular DNS server you want to query.
While any internet host running a DNS service will suffice, it is preferable
to use either the DNS server for your network or the DNS server
for the domain which you are querying.
If the bean cannot determine the default DNS server address, the property value will be an empty string.
public void setDNSServer(java.lang.String DNSServer)
throws IPWorksException
The bean attempts to find the default
DNS server for the machine where it is installed,
and provide it in the DNSServer property. You may later
change it to any particular DNS server you want to query.
While any internet host running a DNS service will suffice, it is preferable
to use either the DNS server for your network or the DNS server
for the domain which you are querying.
If the bean cannot determine the default DNS server address, the property value will be an empty string.
IPWorksExceptionpublic boolean isIdle()
Idle will be False if the component is currently busy (communicating
and/or waiting for an answer), and True at all other times.
public int getQueryType()
Before a query is attempted, QueryType must be set to the desired
record type. The records are defined as follows:
public void setQueryType(int queryType)
throws IPWorksException
Before a query is attempted, QueryType must be set to the desired
record type. The records are defined as follows:
IPWorksExceptionpublic DNSRecordList getRecords()
Once the query is complete, a single Response event will fire, and
the following properties will contain the results:
StatusCode Status StatusCode .
Records Records in the last DNS response.
RecordSource Example (Loop through all fields of all records)
For i = 0 to records.Count
\011For j = 0 to records.FieldCount(i)
\011\011records.FieldIndex(i) = j
\011\011DoSomethingWith(records.FieldName(i), records.RecordFieldValue(i))
\011Next j
Next i
This collection is indexed from 0 to Count - 1.
public int getRecordSource()
Records collection.
RecordSource can have one of the following values:
public void setRecordSource(int recordSource)
throws IPWorksException
Records collection.
RecordSource can have one of the following values:
IPWorksExceptionpublic boolean isRecursive()
DNSServer to recursively query other servers.
If Recursive is true, the component will tell the DNS server to perform the query
recursively. This means that if the DNS server does not have information about the
Domain being queried, it will send the request to another DNS server.
public void setRecursive(boolean recursive)
throws IPWorksException
DNSServer to recursively query other servers.
If Recursive is true, the component will tell the DNS server to perform the query
recursively. This means that if the DNS server does not have information about the
Domain being queried, it will send the request to another DNS server.
IPWorksExceptionpublic int getRequestId()
Each time the bean makes a DNS query, it generates a unique request
id to track the response. RequestId is the id of the request that
generated the current response values.
If a custom value is needed for RequestId , the property must be set
before sending a request. The bean increments RequestId automatically after sending each request.
NOTE: The bean throws an IPWorksException raises an IPWorksException exception when a value that is not between 1 and 32,767 is specified.
public void setRequestId(int requestId)
throws IPWorksException
Each time the bean makes a DNS query, it generates a unique request
id to track the response. RequestId is the id of the request that
generated the current response values.
If a custom value is needed for RequestId , the property must be set
before sending a request. The bean increments RequestId automatically after sending each request.
NOTE: The bean throws an IPWorksException raises an IPWorksException exception when a value that is not between 1 and 32,767 is specified.
IPWorksExceptionpublic java.lang.String getStatus()
StatusCode .
For a list of valid error codes and their descriptions, please refer to the Error Messages section.
public int getStatusCode()
For a list of valid error codes and their descriptions, please refer to the Error Messages section.
public int getTimeout()
If the Timeout property is set to 0, all operations return
immediately, potentially failing with an error if they can't be
completed immediately.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean will use DoEvents to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 60 seconds.
public void setTimeout(int timeout)
throws IPWorksException
If the Timeout property is set to 0, all operations return
immediately, potentially failing with an error if they can't be
completed immediately.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean will use DoEvents to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 60 seconds.
IPWorksException
public java.lang.String config(java.lang.String configurationString)
throws IPWorksException
Config is a generic method available in every bean.
It is used to set and retrieveconfiguration settingsfor the
bean.
Configuration settings are similar in functionality to properties,
but they are rarely used. In order to avoid "polluting" the property
namespace of the bean, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.
IPWorksException
public void doEvents()
throws IPWorksException
When DoEvents is called, the bean processes any
available events. If no events are available, it waits for a
preset period of time, and then returns.
IPWorksException
public void interrupt()
throws IPWorksException
If there is no method in progress, Interrupt simply returns doing nothing.
IPWorksException
public void query(java.lang.String domain)
throws IPWorksException
The bean will query the host Domain for any records of the type in QueryType .
Once the query is complete, a single Response event will fire, and
the following properties will contain the results:
StatusCode Status StatusCode .
Records Records in the last DNS response.
RecordSource
IPWorksException
public void addDnsEventListener(ipworks.DnsEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeDnsEventListener(ipworks.DnsEventListener l)
|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||