smtp_relayserver
Class DNSPackageReader

java.lang.Object
  |
  +--smtp_relayserver.DNSPackageReader

public class DNSPackageReader
extends java.lang.Object

This class allows you to read userfriendly a DNS package in a form of a byte array.

Copyright (C) 1998 Valentin Koch

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Field Summary
static short CQUERYM
           
static short CQUERYU
           
static short IQUERY
           
static short QUERY
           
 
Constructor Summary
DNSPackageReader(byte[] dnsPackage)
          Creates a DNSPackageReader.
 
Method Summary
 short ansCount()
          The number of entries int the answer section.
 short arCount()
          The number of entries int the additional records section.
 short getOpcode()
          The opcode of the query defined in RFC 883.
 short getQueryID()
          The identifier of this package.
 java.util.Vector getRecords()
          Returns the records int the DNS package
 short getRespCode()
          The response code of this package.
 boolean isAuthority()
          If this response comes from a authority server for the domain in the corresponding query.
 boolean isResponse()
          If this package is a response or a query.
 boolean isTruncated()
          If this package is truncated to 512 bytes.
 short nsCount()
          The number of name server res.rec.
 short queCount()
          The number of entries int the question section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY

public static final short QUERY

IQUERY

public static final short IQUERY

CQUERYM

public static final short CQUERYM

CQUERYU

public static final short CQUERYU
Constructor Detail

DNSPackageReader

public DNSPackageReader(byte[] dnsPackage)
Creates a DNSPackageReader.
Parameters:
dnsPackage - The DNS package wich want to be read from
Method Detail

getQueryID

public short getQueryID()
The identifier of this package.
Returns:
A short value which has to correspond with your programm.

isResponse

public boolean isResponse()
If this package is a response or a query.
Returns:
true if it is a response, false if it is a query.

getOpcode

public short getOpcode()
The opcode of the query defined in RFC 883.
Returns:
A short constant like QUERY, IQUERY, CQUERYM, CQUERYU.

isAuthority

public boolean isAuthority()
If this response comes from a authority server for the domain in the corresponding query.
Returns:
true if the server is authority.

isTruncated

public boolean isTruncated()
If this package is truncated to 512 bytes.
Returns:
true if it is truncated.

getRespCode

public short getRespCode()
The response code of this package.
Returns:
  • 0 - No error condition
  • 1 - Format error
  • 2 - Server failure
  • 3 - Name error
  • 4 - Not implemented
  • 5 - Refused
  • 6-15 - Rreserved

queCount

public short queCount()
The number of entries int the question section.

ansCount

public short ansCount()
The number of entries int the answer section.

nsCount

public short nsCount()
The number of name server res.rec. int the authority rec. section.

arCount

public short arCount()
The number of entries int the additional records section.

getRecords

public java.util.Vector getRecords()
Returns the records int the DNS package
Returns:
A Vector containig three arrays of type DNSResRecord. 1.Record == Answer section, 2.Record == Authority section, 3.Record == Additional section