You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/09/17 05:19:47 UTC
svn commit: r289693 - in
/directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records:
QuestionRecord.java Record.java ResourceRecord.java
Author: erodriguez
Date: Fri Sep 16 20:19:45 2005
New Revision: 289693
URL: http://svn.apache.org/viewcvs?rev=289693&view=rev
Log:
Split the hierarchy of records. The behavior of question and resource records is fundamentally different.
Removed:
directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/Record.java
Modified:
directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/QuestionRecord.java
directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/ResourceRecord.java
Modified: directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/QuestionRecord.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/QuestionRecord.java?rev=289693&r1=289692&r2=289693&view=diff
==============================================================================
--- directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/QuestionRecord.java (original)
+++ directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/QuestionRecord.java Fri Sep 16 20:19:45 2005
@@ -34,11 +34,34 @@
* | QCLASS |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*/
-public class QuestionRecord extends Record
+public class QuestionRecord
{
+ /**
+ * A domain name represented as a sequence of labels, where
+ * each label consists of a length octet followed by that
+ * number of octets. The domain name terminates with the
+ * zero length octet for the null label of the root. Note
+ * that this field may be an odd number of octets; no
+ * padding is used.
+ */
+ private String domainName;
+
+ /**
+ * A two octet code which specifies the type.
+ */
+ private RecordType recordType;
+
+ /**
+ * A two octet code that specifies the class.
+ * For example, the CLASS field is IN for the Internet.
+ */
+ private RecordClass recordClass;
+
public QuestionRecord( String domainName, RecordType recordType, RecordClass recordClass )
{
- super( domainName, recordType, recordClass );
+ this.domainName = domainName;
+ this.recordType = recordType;
+ this.recordClass = recordClass;
}
/**
Modified: directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/ResourceRecord.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/ResourceRecord.java?rev=289693&r1=289692&r2=289693&view=diff
==============================================================================
--- directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/ResourceRecord.java (original)
+++ directory/protocol-providers/dns/trunk/src/java/org/apache/dns/records/ResourceRecord.java Fri Sep 16 20:19:45 2005
@@ -17,8 +17,6 @@
package org.apache.dns.records;
-import java.nio.ByteBuffer;
-
/**
* The answer, authority, and additional sections all share the same
* format: a variable number of resource records, where the number of
@@ -45,27 +43,92 @@
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*/
-public abstract class ResourceRecord extends Record
+public class ResourceRecord
{
- protected int timeToLive;
- protected byte[] resourceData;
+ /**
+ * An owner name, i.e., the name of the node to which this
+ * resource record pertains.
+ */
+ private String domainName;
+
+ /**
+ * Two octets containing one of the resource record TYPE codes.
+ */
+ private RecordType recordType;
+
+ /**
+ * Two octets containing one of the resource record CLASS codes.
+ * For example, the CLASS field is IN for the Internet.
+ */
+ private RecordClass recordClass;
+
+ /**
+ * A 32 bit signed integer that specifies the time interval
+ * that the resource record may be cached before the source
+ * of the information should again be consulted. Zero
+ * values are interpreted to mean that the resource record can only be
+ * used for the transaction in progress, and should not be
+ * cached. For example, SOA records are always distributed
+ * with a zero TTL to prohibit caching. Zero values can
+ * also be used for extremely volatile data.
+ */
+ private int timeToLive;
+
+ /**
+ * A variable length string of octets that describes the
+ * resource. The format of this information varies
+ * according to the TYPE and CLASS of the resource record.
+ */
+ private byte[] resourceData;
public ResourceRecord( String domainName, RecordType recordType, RecordClass recordClass, int timeToLive,
byte[] resourceData )
{
- super( domainName, recordType, recordClass );
-
+ this.domainName = domainName;
+ this.recordType = recordType;
+ this.recordClass = recordClass;
this.timeToLive = timeToLive;
this.resourceData = resourceData;
}
- protected void dataToByteBuffer( ByteBuffer byteBuffer )
+ /**
+ * @return Returns the domainName.
+ */
+ public String getDomainName()
{
- super.dataToByteBuffer( byteBuffer );
+ return domainName;
+ }
- byteBuffer.putInt( timeToLive );
- byteBuffer.putShort( (short) resourceData.length );
- byteBuffer.put( resourceData );
+ /**
+ * @return Returns the recordClass.
+ */
+ public RecordClass getRecordClass()
+ {
+ return recordClass;
+ }
+
+ /**
+ * @return Returns the recordType.
+ */
+ public RecordType getRecordType()
+ {
+ return recordType;
+ }
+
+ /**
+ * @return Returns the resourceData.
+ */
+ public byte[] getResourceData()
+ {
+ return resourceData;
+ }
+
+ /**
+ * @return Returns the timeToLive.
+ */
+ public int getTimeToLive()
+ {
+ return timeToLive;
}
public String toString()