com.jscape.inet.dns

## Class DnsResponse

- java.lang.Object
- - com.jscape.inet.dns.DnsResponse

- All Implemented Interfaces:
    java.io.Serializable

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

  Implements the basic functionality of a DNS response.

  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

    Constructors
    Constructor and Description
    `DnsResponse()` Constructs a new `DnsResponse` instance.
    `DnsResponse(DnsRequest request, java.util.Vector answers, java.util.Vector authorities, java.util.Vector additional)` Constructs a new `DnsResponse` instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Enumeration` | `getAdditional()` Gets additional information about query.
    `java.util.Enumeration` | `getAnswers()` Gets answers to query.
    `java.util.Enumeration` | `getAuthorities()` Gets authoritative nameservers for query.
    `DnsRequest` | `getRequest()` Gets the `DnsRequest` used to generated this `DnsResponse`.
    `boolean` | `isAuthoritative()` Checks if DNS response was issued by an authoritative DNS nameserver.
    `boolean` | `isRecursive()` Checks if query response is recursive.
    `boolean` | `isTruncated()` Checks if query response is truncated.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DnsResponse

          public DnsResponse()

      Constructs a new `DnsResponse` instance.

    - #### DnsResponse

          public DnsResponse(DnsRequest request,
                             java.util.Vector answers,
                             java.util.Vector authorities,
                             java.util.Vector additional)

      Constructs a new `DnsResponse` instance.
      Parameters:
        `request` - the `DnsRequest` used to generated this `DnsResponse`
        `answers` - a `Vector` of `DnsRecord` returned in response to `DnsRequest`
        `authorities` - a `Vector` of `DnsRecord` indicating authoritative nameserver(s) for this `DnsResponse`
        `additional` - a `Vector` of `DnsRecord` containing additional information about this `DnsResponse`
      See Also:
        `DnsRecord`, `DnsRequest`

  - ### Method Detail

    - #### getAuthorities

          public java.util.Enumeration getAuthorities()

      Gets authoritative nameservers for query. Returns an Enumeration of `DnsRecord`.
      Returns:
        Enumeration of DnsRecord
      See Also:
        `DnsRecord`

    - #### getAnswers

          public java.util.Enumeration getAnswers()

      Gets answers to query. Returns an Enumeration of `DnsRecord`.
      Returns:
        Enumeration of DnsRecord
      See Also:
        `DnsRecord`

    - #### getAdditional

          public java.util.Enumeration getAdditional()

      Gets additional information about query. Returns an Enumeration of `DnsRecord`.
      Returns:
        Enumeration of DnsRecord
      See Also:
        `DnsRecord`

    - #### getRequest

          public DnsRequest getRequest()

      Gets the `DnsRequest` used to generated this `DnsResponse`.
      Returns:
        a `DnsRequest`
      See Also:
        `DnsRequest`

    - #### isAuthoritative

          public boolean isAuthoritative()

      Checks if DNS response was issued by an authoritative DNS nameserver.
      Returns:
        `true` if authoritative `false` otherwise

    - #### isTruncated

          public boolean isTruncated()

      Checks if query response is truncated.
      Returns:
        `true` if reponse is truncated `false` otherwise

    - #### isRecursive

          public boolean isRecursive()

      Checks if query response is recursive.
      Returns:
        `true` if response is recursive `false` otherwise

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