Update of /cvsroot/dnsjava/dnsjava/org/xbill/DNS
In directory sc8-pr-cvs1:/tmp/cvs-serv25549/org/xbill/DNS
Modified Files:
A6Record.java AAAARecord.java ARecord.java CERTRecord.java
CNAMERecord.java Cache.java DNAMERecord.java DSRecord.java
HINFORecord.java KEYRecord.java KXRecord.java LOCRecord.java
MXRecord.java MX_KXRecord.java Master.java NAPTRRecord.java
NSRecord.java NS_CNAME_PTRRecord.java NXTRecord.java
OPTRecord.java PTRRecord.java RPRecord.java RRset.java
Record.java SIGRecord.java SOARecord.java SRVRecord.java
TKEYRecord.java TSIG.java TSIGRecord.java TTL.java
TXTRecord.java UNKRecord.java Update.java ZoneTransferIn.java
Added Files:
InvalidTTLException.java
Log Message:
Store unsigned 32 bit values in longs, not ints.
--- NEW FILE ---
// Copyright (c) 2003 Brian Wellington (bwelling@...)
package org.xbill.DNS;
/**
* An exception thrown when an invalid TTL is specified.
*
* @author Brian Wellington
*/
public class InvalidTTLException extends IllegalArgumentException {
public
InvalidTTLException(long ttl) {
super("Invalid DNS TTL: " + ttl);
}
}
Index: A6Record.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/A6Record.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- A6Record.java 18 Jul 2003 18:28:21 -0000 1.20
+++ A6Record.java 27 Oct 2003 21:37:29 -0000 1.21
@@ -24,7 +24,7 @@
A6Record() {}
private
-A6Record(Name name, int dclass, int ttl) {
+A6Record(Name name, int dclass, long ttl) {
super(name, Type.A6, dclass, ttl);
}
@@ -40,7 +40,7 @@
* @param prefix The name of the prefix
*/
public
-A6Record(Name name, int dclass, int ttl, int prefixBits,
+A6Record(Name name, int dclass, long ttl, int prefixBits,
Inet6Address suffix, Name prefix)
{
this(name, dclass, ttl);
@@ -52,7 +52,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -73,7 +73,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
A6Record rec = new A6Record(name, dclass, ttl);
Index: AAAARecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/AAAARecord.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AAAARecord.java 18 Jul 2003 18:28:21 -0000 1.15
+++ AAAARecord.java 27 Oct 2003 21:37:29 -0000 1.16
@@ -22,7 +22,7 @@
AAAARecord() {}
private
-AAAARecord(Name name, int dclass, int ttl) {
+AAAARecord(Name name, int dclass, long ttl) {
super(name, Type.AAAA, dclass, ttl);
}
@@ -36,13 +36,13 @@
* @param address The address suffix
*/
public
-AAAARecord(Name name, int dclass, int ttl, Inet6Address address) {
+AAAARecord(Name name, int dclass, long ttl, Inet6Address address) {
this(name, dclass, ttl);
this.address = address;
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -58,7 +58,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
AAAARecord rec = new AAAARecord(name, dclass, ttl);
Index: ARecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/ARecord.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- ARecord.java 18 Jul 2003 18:28:22 -0000 1.44
+++ ARecord.java 27 Oct 2003 21:37:29 -0000 1.45
@@ -23,7 +23,7 @@
ARecord() {}
private
-ARecord(Name name, int dclass, int ttl) {
+ARecord(Name name, int dclass, long ttl) {
super(name, Type.A, dclass, ttl);
}
@@ -63,13 +63,13 @@
* @param address The address that the name refers to
*/
public
-ARecord(Name name, int dclass, int ttl, InetAddress address) {
+ARecord(Name name, int dclass, long ttl, InetAddress address) {
this(name, dclass, ttl);
addr = fromArray(address.getAddress());
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -87,7 +87,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
ARecord rec = new ARecord(name, dclass, ttl);
Index: CERTRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/CERTRecord.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- CERTRecord.java 18 Jul 2003 18:28:22 -0000 1.34
+++ CERTRecord.java 27 Oct 2003 21:37:29 -0000 1.35
@@ -33,15 +33,15 @@
private static CERTRecord member = new CERTRecord();
-private short certType, keyTag;
-private byte alg;
+private int certType, keyTag;
+private int alg;
private byte [] cert;
private
CERTRecord() {}
private
-CERTRecord(Name name, int dclass, int ttl) {
+CERTRecord(Name name, int dclass, long ttl) {
super(name, Type.CERT, dclass, ttl);
}
@@ -58,18 +58,21 @@
* @param cert Binary data representing the certificate
*/
public
-CERTRecord(Name name, int dclass, int ttl, int certType, int keyTag,
+CERTRecord(Name name, int dclass, long ttl, int certType, int keyTag,
int alg, byte [] cert)
{
this(name, dclass, ttl);
- this.certType = (short) certType;
- this.keyTag = (short) keyTag;
- this.alg = (byte) alg;
+ checkU16("certType", certType);
+ checkU16("keyTag", keyTag);
+ checkU8("alg", alg);
+ this.certType = certType;
+ this.keyTag = keyTag;
+ this.alg = alg;
this.cert = cert;
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -87,7 +90,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
CERTRecord rec = new CERTRecord(name, dclass, ttl);
@@ -107,7 +110,7 @@
if (cert != null) {
sb.append (certType);
sb.append (" ");
- sb.append (keyTag & 0xFFFF);
+ sb.append (keyTag);
sb.append (" ");
sb.append (alg);
if (cert != null) {
@@ -127,7 +130,7 @@
/**
* Returns the type of certificate
*/
-public short
+public int
getCertType() {
return certType;
}
@@ -135,7 +138,7 @@
/**
* Returns the ID of the associated KEYRecord, if present
*/
-public short
+public int
getKeyTag() {
return keyTag;
}
@@ -143,7 +146,7 @@
/**
* Returns the algorithm of the associated KEYRecord, if present
*/
-public byte
+public int
getAlgorithm() {
return alg;
}
Index: CNAMERecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/CNAMERecord.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- CNAMERecord.java 18 Jul 2003 18:28:22 -0000 1.25
+++ CNAMERecord.java 27 Oct 2003 21:37:29 -0000 1.26
@@ -20,7 +20,7 @@
CNAMERecord() {}
private
-CNAMERecord(Name name, int dclass, int ttl) {
+CNAMERecord(Name name, int dclass, long ttl) {
super(name, Type.CNAME, dclass, ttl);
}
@@ -34,12 +34,12 @@
* @param target The name to which the CNAME alias points
*/
public
-CNAMERecord(Name name, int dclass, int ttl, Name target) {
+CNAMERecord(Name name, int dclass, long ttl, Name target) {
super(name, Type.CNAME, dclass, ttl, target);
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -47,7 +47,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
return rdataFromString(new CNAMERecord(name, dclass, ttl), st, origin);
Index: Cache.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/Cache.java,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- Cache.java 18 Aug 2003 05:20:33 -0000 1.89
+++ Cache.java 27 Oct 2003 21:37:29 -0000 1.90
@@ -28,7 +28,7 @@
setValues(byte credibility, long ttl) {
this.credibility = credibility;
this.expire = (int)((System.currentTimeMillis() / 1000) + ttl);
- if (this.expire < 0)
+ if (this.expire < 0 || this.expire > Integer.MAX_VALUE)
this.expire = Integer.MAX_VALUE;
}
@@ -47,7 +47,7 @@
public
PositiveElement(RRset r, byte cred, long maxttl) {
rrset = r;
- long ttl = ((long) r.getTTL()) & 0xFFFFFFFFL;
+ long ttl = r.getTTL();
if (maxttl >= 0 && maxttl < ttl)
ttl = maxttl;
setValues(cred, ttl);
@@ -82,7 +82,7 @@
this.soa = soa;
long cttl = 0;
if (soa != null) {
- cttl = soa.getMinimum() & 0xFFFFFFFFL;
+ cttl = soa.getMinimum();
if (maxttl >= 0)
cttl = Math.min(cttl, maxttl);
}
@@ -245,7 +245,7 @@
*/
public void
addRRset(RRset rrset, byte cred) {
- long ttl = ((long) rrset.getTTL()) & 0xFFFFFFFFL;
+ long ttl = rrset.getTTL();
Name name = rrset.getName();
int type = rrset.getType();
if (verifier != null)
Index: DNAMERecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/DNAMERecord.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DNAMERecord.java 18 Jul 2003 18:28:22 -0000 1.10
+++ DNAMERecord.java 27 Oct 2003 21:37:29 -0000 1.11
@@ -20,7 +20,7 @@
DNAMERecord() {}
private
-DNAMERecord(Name name, int dclass, int ttl) {
+DNAMERecord(Name name, int dclass, long ttl) {
super(name, Type.DNAME, dclass, ttl);
}
@@ -34,12 +34,12 @@
* @param target The name to which the DNAME alias points
*/
public
-DNAMERecord(Name name, int dclass, int ttl, Name target) {
+DNAMERecord(Name name, int dclass, long ttl, Name target) {
super(name, Type.DNAME, dclass, ttl, target);
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -47,7 +47,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
return rdataFromString(new DNAMERecord(name, dclass, ttl), st, origin);
Index: DSRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/DSRecord.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- DSRecord.java 18 Jul 2003 18:28:22 -0000 1.14
+++ DSRecord.java 27 Oct 2003 21:37:29 -0000 1.15
@@ -29,7 +29,7 @@
private DSRecord() {}
private
-DSRecord(Name name, int dclass, int ttl) {
+DSRecord(Name name, int dclass, long ttl) {
super(name, Type.DS, dclass, ttl);
}
@@ -46,19 +46,13 @@
* @param digest A hash of the original key.
*/
public
-DSRecord(Name name, int dclass, int ttl, int footprint, int alg,
+DSRecord(Name name, int dclass, long ttl, int footprint, int alg,
int digestid, byte [] digest)
{
this(name, dclass, ttl);
- if (footprint < 0 || footprint > 0xFFFF)
- throw new IllegalArgumentException("invalid footprint: " +
- footprint);
- if (alg < 0 || alg > 0xFF)
- throw new IllegalArgumentException("invalid algorithm: " +
- alg);
- if (digestid < 0 || digestid > 0xFF)
- throw new IllegalArgumentException("invalid digest id: " +
- digestid);
+ checkU16("footprint", footprint);
+ checkU8("alg", alg);
+ checkU8("digestid", digestid);
this.footprint = footprint;
this.alg = alg;
this.digestid = digestid;
@@ -66,7 +60,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -86,7 +80,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
DSRecord rec = new DSRecord(name, dclass, ttl);
Index: HINFORecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/HINFORecord.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- HINFORecord.java 18 Jul 2003 18:28:22 -0000 1.31
+++ HINFORecord.java 27 Oct 2003 21:37:29 -0000 1.32
@@ -22,7 +22,7 @@
HINFORecord() {}
private
-HINFORecord(Name name, int dclass, int ttl) {
+HINFORecord(Name name, int dclass, long ttl) {
super(name, Type.HINFO, dclass, ttl);
}
@@ -38,7 +38,7 @@
* @throws IllegalArgumentException One of the strings has invalid escapes
*/
public
-HINFORecord(Name name, int dclass, int ttl, String cpu, String os) {
+HINFORecord(Name name, int dclass, long ttl, String cpu, String os) {
this(name, dclass, ttl);
try {
this.cpu = byteArrayFromString(cpu);
@@ -50,7 +50,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -63,7 +63,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
HINFORecord rec = new HINFORecord(name, dclass, ttl);
Index: KEYRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/KEYRecord.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- KEYRecord.java 18 Jul 2003 18:28:22 -0000 1.47
+++ KEYRecord.java 27 Oct 2003 21:37:29 -0000 1.48
@@ -18,8 +18,7 @@
private static KEYRecord member = new KEYRecord();
-private short flags;
-private byte proto, alg;
+private int flags, proto, alg;
private byte [] key;
private int footprint = -1;
@@ -62,7 +61,7 @@
KEYRecord() {}
private
-KEYRecord(Name name, int dclass, int ttl) {
+KEYRecord(Name name, int dclass, long ttl) {
super(name, Type.KEY, dclass, ttl);
}
@@ -79,18 +78,18 @@
* @param key Binary data representing the key
*/
public
-KEYRecord(Name name, int dclass, int ttl, int flags, int proto, int alg,
+KEYRecord(Name name, int dclass, long ttl, int flags, int proto, int alg,
byte [] key)
{
this(name, dclass, ttl);
- this.flags = (short) flags;
- this.proto = (byte) proto;
- this.alg = (byte) alg;
+ checkU16("flags", flags);
+ checkU8("proto", proto);
+ checkU8("alg", alg);
this.key = key;
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -108,7 +107,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
KEYRecord rec = new KEYRecord(name, dclass, ttl);
@@ -132,21 +131,21 @@
if (key != null || (flags & (FLAG_NOKEY)) == (FLAG_NOKEY) ) {
if (!Options.check("nohex")) {
sb.append("0x");
- sb.append(Integer.toHexString(flags & 0xFFFF));
+ sb.append(Integer.toHexString(flags));
}
else
- sb.append(flags & 0xFFFF);
+ sb.append(flags);
sb.append(" ");
- sb.append(proto & 0xFF);
+ sb.append(proto);
sb.append(" ");
- sb.append(alg & 0xFF);
+ sb.append(alg);
if (key != null) {
if (Options.check("multiline")) {
sb.append(" (\n");
sb.append(base64.formatString(key, 64, "\t",
true));
sb.append(" ; key_tag = ");
- sb.append(getFootprint() & 0xFFFF);
+ sb.append(getFootprint());
} else {
sb.append(" ");
sb.append(base64.toString(key));
@@ -159,7 +158,7 @@
/**
* Returns the flags describing the key's properties
*/
-public short
+public int
getFlags() {
return flags;
}
@@ -167,7 +166,7 @@
/**
* Returns the protocol that the key was created for
*/
-public byte
+public int
getProtocol() {
return proto;
}
@@ -175,7 +174,7 @@
/**
* Returns the key's algorithm
*/
-public byte
+public int
getAlgorithm() {
return alg;
}
Index: KXRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/KXRecord.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- KXRecord.java 18 Jul 2003 18:28:22 -0000 1.7
+++ KXRecord.java 27 Oct 2003 21:37:29 -0000 1.8
@@ -20,7 +20,7 @@
KXRecord() {}
private
-KXRecord(Name name, int dclass, int ttl) {
+KXRecord(Name name, int dclass, long ttl) {
super(name, Type.KX, dclass, ttl);
}
@@ -36,12 +36,12 @@
* @param target The host that authority is delegated to
*/
public
-KXRecord(Name name, int dclass, int ttl, int preference, Name target) {
+KXRecord(Name name, int dclass, long ttl, int preference, Name target) {
super(name, Type.KX, dclass, ttl, preference, target);
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -49,7 +49,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
return rdataFromString(new KXRecord(name, dclass, ttl), st, origin);
Index: LOCRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/LOCRecord.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- LOCRecord.java 18 Jul 2003 18:28:22 -0000 1.17
+++ LOCRecord.java 27 Oct 2003 21:37:29 -0000 1.18
@@ -24,7 +24,7 @@
LOCRecord() {}
private
-LOCRecord(Name name, int dclass, int ttl) {
+LOCRecord(Name name, int dclass, long ttl) {
super(name, Type.LOC, dclass, ttl);
}
@@ -43,7 +43,7 @@
* @param vPrecision The vertical precision of the data, in m.
*/
public
-LOCRecord(Name name, int dclass, int ttl, double latitude, double longitude,
+LOCRecord(Name name, int dclass, long ttl, double latitude, double longitude,
double altitude, double size, double hPrecision, double vPrecision)
{
this(name, dclass, ttl);
@@ -56,7 +56,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -79,7 +79,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
LOCRecord rec = new LOCRecord(name, dclass, ttl);
Index: MXRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/MXRecord.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- MXRecord.java 18 Jul 2003 18:28:22 -0000 1.28
+++ MXRecord.java 27 Oct 2003 21:37:29 -0000 1.29
@@ -20,7 +20,7 @@
MXRecord() {}
private
-MXRecord(Name name, int dclass, int ttl) {
+MXRecord(Name name, int dclass, long ttl) {
super(name, Type.MX, dclass, ttl);
}
@@ -36,13 +36,13 @@
* @param target The host that mail is sent to
*/
public
-MXRecord(Name name, int dclass, int ttl, int priority, Name target)
+MXRecord(Name name, int dclass, long ttl, int priority, Name target)
{
super(name, Type.MX, dclass, ttl, priority, target);
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -50,7 +50,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
return rdataFromString(new MXRecord(name, dclass, ttl), st, origin);
Index: MX_KXRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/MX_KXRecord.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- MX_KXRecord.java 18 Jul 2003 18:28:22 -0000 1.20
+++ MX_KXRecord.java 27 Oct 2003 21:37:29 -0000 1.21
@@ -21,18 +21,16 @@
MX_KXRecord() {}
protected
-MX_KXRecord(Name name, int type, int dclass, int ttl) {
+MX_KXRecord(Name name, int type, int dclass, long ttl) {
super(name, type, dclass, ttl);
}
public
-MX_KXRecord(Name name, int type, int dclass, int ttl, int priority,
+MX_KXRecord(Name name, int type, int dclass, long ttl, int priority,
Name target)
{
super(name, type, dclass, ttl);
- if (priority < 0 || priority > 0xFFFF)
- throw new IllegalArgumentException("invalid priority: " +
- priority);
+ checkU16("priority", priority);
this.priority = priority;
if (!target.isAbsolute())
throw new RelativeNameException(target);
Index: Master.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/Master.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Master.java 23 Aug 2003 07:56:41 -0000 1.25
+++ Master.java 27 Oct 2003 21:37:29 -0000 1.26
@@ -78,7 +78,7 @@
}
while (true) {
Name name;
- int ttl;
+ long ttl;
int type, dclass;
token = st.get(true, false);
Index: NAPTRRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/NAPTRRecord.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- NAPTRRecord.java 18 Jul 2003 18:28:22 -0000 1.21
+++ NAPTRRecord.java 27 Oct 2003 21:37:29 -0000 1.22
@@ -23,7 +23,7 @@
private NAPTRRecord() {}
private
-NAPTRRecord(Name name, int dclass, int ttl) {
+NAPTRRecord(Name name, int dclass, long ttl) {
super(name, Type.NAPTR, dclass, ttl);
}
@@ -46,7 +46,7 @@
* @throws IllegalArgumentException One of the strings has invalid escapes
*/
public
-NAPTRRecord(Name name, int dclass, int ttl, int order, int preference,
+NAPTRRecord(Name name, int dclass, long ttl, int order, int preference,
String flags, String service, String regexp, Name replacement)
{
this(name, dclass, ttl);
@@ -66,7 +66,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -83,7 +83,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
NAPTRRecord rec = new NAPTRRecord(name, dclass, ttl);
Index: NSRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/NSRecord.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- NSRecord.java 18 Jul 2003 18:28:22 -0000 1.26
+++ NSRecord.java 27 Oct 2003 21:37:29 -0000 1.27
@@ -20,7 +20,7 @@
NSRecord() {}
private
-NSRecord(Name name, int dclass, int ttl) {
+NSRecord(Name name, int dclass, long ttl) {
super(name, Type.NS, dclass, ttl);
}
@@ -34,12 +34,12 @@
* @param target The name server for the given domain
*/
public
-NSRecord(Name name, int dclass, int ttl, Name target) {
+NSRecord(Name name, int dclass, long ttl, Name target) {
super(name, Type.NS, dclass, ttl, target);
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -47,7 +47,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
return rdataFromString(new NSRecord(name, dclass, ttl), st, origin);
Index: NS_CNAME_PTRRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/NS_CNAME_PTRRecord.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- NS_CNAME_PTRRecord.java 18 Jul 2003 18:28:22 -0000 1.35
+++ NS_CNAME_PTRRecord.java 27 Oct 2003 21:37:29 -0000 1.36
@@ -20,12 +20,12 @@
NS_CNAME_PTRRecord() {}
protected
-NS_CNAME_PTRRecord(Name name, int type, int dclass, int ttl) {
+NS_CNAME_PTRRecord(Name name, int type, int dclass, long ttl) {
super(name, type, dclass, ttl);
}
public
-NS_CNAME_PTRRecord(Name name, int type, int dclass, int ttl, Name target) {
+NS_CNAME_PTRRecord(Name name, int type, int dclass, long ttl, Name target) {
super(name, type, dclass, ttl);
if (!target.isAbsolute())
throw new RelativeNameException(target);
Index: NXTRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/NXTRecord.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- NXTRecord.java 22 Jun 2003 23:58:08 -0000 1.39
+++ NXTRecord.java 27 Oct 2003 21:37:29 -0000 1.40
@@ -27,7 +27,7 @@
NXTRecord() {}
private
-NXTRecord(Name name, int dclass, int ttl) {
+NXTRecord(Name name, int dclass, long ttl) {
super(name, Type.NXT, dclass, ttl);
}
@@ -42,7 +42,7 @@
* @param bitmap The set of type for which records exist at this name
*/
public
-NXTRecord(Name name, int dclass, int ttl, Name next, BitSet bitmap) {
+NXTRecord(Name name, int dclass, long ttl, Name next, BitSet bitmap) {
this(name, dclass, ttl);
if (!next.isAbsolute())
throw new RelativeNameException(next);
@@ -51,7 +51,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -72,7 +72,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
NXTRecord rec = new NXTRecord(name, dclass, ttl);
Index: OPTRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/OPTRecord.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- OPTRecord.java 27 Jun 2003 23:04:49 -0000 1.36
+++ OPTRecord.java 27 Oct 2003 21:37:29 -0000 1.37
@@ -32,7 +32,7 @@
OPTRecord() {}
private
-OPTRecord(Name name, int dclass, int ttl) {
+OPTRecord(Name name, int dclass, long ttl) {
super(name, Type.OPT, dclass, ttl);
}
@@ -49,6 +49,10 @@
OPTRecord(int payloadSize, byte xrcode, byte version, int flags) {
this(Name.root, payloadSize,
((int)xrcode << 24) + ((int)version << 16) + flags);
+ checkU16("payloadSize", payloadSize);
+ checkU8("xrcode", xrcode);
+ checkU8("version", version);
+ checkU16("flags", flags);
options = null;
}
@@ -62,7 +66,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -84,7 +88,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
throw st.exception("no text format defined for OPT");
@@ -127,19 +131,19 @@
*/
public int
getExtendedRcode() {
- return (ttl >>> 24);
+ return (int)(ttl >>> 24);
}
/** Returns the highest supported EDNS version */
public int
getVersion() {
- return ((ttl >>> 16) & 0xFF);
+ return (int)((ttl >>> 16) & 0xFF);
}
/** Returns the EDNS flags */
public int
getFlags() {
- return (ttl & 0xFFFF);
+ return (int)(ttl & 0xFFFF);
}
void
Index: PTRRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/PTRRecord.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- PTRRecord.java 18 Jul 2003 18:28:22 -0000 1.25
+++ PTRRecord.java 27 Oct 2003 21:37:29 -0000 1.26
@@ -21,7 +21,7 @@
PTRRecord() {}
private
-PTRRecord(Name name, int dclass, int ttl) {
+PTRRecord(Name name, int dclass, long ttl) {
super(name, Type.PTR, dclass, ttl);
}
@@ -35,12 +35,12 @@
* @param target The name of the machine with this address
*/
public
-PTRRecord(Name name, int dclass, int ttl, Name target) {
+PTRRecord(Name name, int dclass, long ttl, Name target) {
super(name, Type.PTR, dclass, ttl, target);
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -48,7 +48,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
return rdataFromString(new PTRRecord(name, dclass, ttl), st, origin);
Index: RPRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/RPRecord.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- RPRecord.java 18 Aug 2003 05:20:33 -0000 1.17
+++ RPRecord.java 27 Oct 2003 21:37:29 -0000 1.18
@@ -25,7 +25,7 @@
RPRecord() {}
private
-RPRecord(Name name, int dclass, int ttl) {
+RPRecord(Name name, int dclass, long ttl) {
super(name, Type.RP, dclass, ttl);
}
@@ -40,7 +40,7 @@
* @param textDomain The address where TXT records can be found
*/
public
-RPRecord(Name name, int dclass, int ttl, Name mailbox, Name textDomain) {
+RPRecord(Name name, int dclass, long ttl, Name mailbox, Name textDomain) {
this(name, dclass, ttl);
if (!mailbox.isAbsolute())
throw new RelativeNameException(mailbox);
@@ -51,7 +51,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -64,7 +64,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
RPRecord rec = new RPRecord(name, dclass, ttl);
Index: RRset.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/RRset.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- RRset.java 18 Jul 2003 18:28:22 -0000 1.27
+++ RRset.java 27 Oct 2003 21:37:29 -0000 1.28
@@ -141,19 +141,19 @@
}
/** Returns the ttl of the records */
-public int
+public long
getTTL() {
synchronized (rrs) {
if (rrs.size() == 0)
return 0;
- int ttl = Integer.MAX_VALUE;
+ long ttl = 0xFFFFFFFFL;
Iterator it = rrs.iterator();
while (it.hasNext()) {
Record r = (Record)it.next();
if (r.getTTL() < ttl)
ttl = r.getTTL();
}
- return (ttl);
+ return ttl;
}
}
Index: Record.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/Record.java,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- Record.java 1 Oct 2003 17:36:30 -0000 1.98
+++ Record.java 27 Oct 2003 21:37:29 -0000 1.99
@@ -20,7 +20,7 @@
protected Name name;
protected int type, dclass;
-protected int ttl;
+protected long ttl;
private boolean empty;
private static final Record [] knownRecords = new Record[256];
@@ -36,11 +36,12 @@
protected
Record() {}
-Record(Name name, int type, int dclass, int ttl) {
+Record(Name name, int type, int dclass, long ttl) {
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
+ TTL.check(ttl);
this.name = name;
this.type = type;
this.dclass = dclass;
@@ -87,12 +88,12 @@
/**
* Converts the type-specific RR to wire format - must be overriden
*/
-abstract Record rrFromWire(Name name, int type, int dclass, int ttl,
+abstract Record rrFromWire(Name name, int type, int dclass, long ttl,
int length, DataByteInputStream in)
throws IOException;
private static Record
-newRecord(Name name, int type, int dclass, int ttl, int length,
+newRecord(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in) throws IOException
{
Record rec;
@@ -123,11 +124,12 @@
* the first length bytes are used.
*/
public static Record
-newRecord(Name name, int type, int dclass, int ttl, int length, byte [] data) {
+newRecord(Name name, int type, int dclass, long ttl, int length, byte [] data) {
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
+ TTL.check(ttl);
DataByteInputStream dbs;
if (data != null)
@@ -152,7 +154,7 @@
* format.
*/
public static Record
-newRecord(Name name, int type, int dclass, int ttl, byte [] data) {
+newRecord(Name name, int type, int dclass, long ttl, byte [] data) {
return newRecord(name, type, dclass, ttl, data.length, data);
}
@@ -165,7 +167,7 @@
* @return An object of a subclass of Record
*/
public static Record
-newRecord(Name name, int type, int dclass, int ttl) {
+newRecord(Name name, int type, int dclass, long ttl) {
return newRecord(name, type, dclass, ttl, 0, (byte []) null);
}
@@ -186,7 +188,7 @@
static Record
fromWire(DataByteInputStream in, int section) throws IOException {
int type, dclass;
- int ttl;
+ long ttl;
int length;
Name name;
Record rec;
@@ -201,7 +203,7 @@
if (section == Section.QUESTION)
return newRecord(name, type, dclass);
- ttl = in.readInt();
+ ttl = in.readUnsignedInt();
length = in.readUnsignedShort();
if (length == 0)
return newRecord(name, type, dclass, ttl);
@@ -226,7 +228,7 @@
out.writeShort(dclass);
if (section == Section.QUESTION)
return;
- out.writeInt(ttl);
+ out.writeUnsignedInt(ttl);
int lengthPosition = out.getPos();
out.writeShort(0); /* until we know better */
if (!empty)
@@ -249,10 +251,11 @@
name.toWireCanonical(out);
out.writeShort(type);
out.writeShort(dclass);
- out.writeInt(ttl);
+ out.writeUnsignedInt(ttl);
int lengthPosition = out.getPos();
out.writeShort(0); /* until we know better */
- rrToWire(out, null, true);
+ if (!empty)
+ rrToWire(out, null, true);
out.writeShortAt(out.getPos() - lengthPosition - 2, lengthPosition);
}
@@ -295,7 +298,7 @@
if (Options.check("BINDTTL"))
sb.append(TTL.format(ttl));
else
- sb.append((long)ttl & 0xFFFFFFFFL);
+ sb.append(ttl);
sb.append("\t");
if (dclass != DClass.IN || !Options.check("noPrintIN")) {
sb.append(DClass.string(dclass));
@@ -313,7 +316,7 @@
* Converts the text format of an RR to the internal format - must be overriden
*/
abstract Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException;
/**
@@ -427,7 +430,7 @@
* @throws IOException The text format was invalid.
*/
public static Record
-fromString(Name name, int type, int dclass, int ttl, Tokenizer st, Name origin)
+fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
Record rec;
@@ -436,6 +439,7 @@
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
+ TTL.check(ttl);
Tokenizer.Token t = st.get();
if (t.type == Tokenizer.IDENTIFIER && t.value.equals("\\#")) {
@@ -470,7 +474,7 @@
* @throws IOException The text format was invalid.
*/
public static Record
-fromString(Name name, int type, int dclass, int ttl, String s, Name origin)
+fromString(Name name, int type, int dclass, long ttl, String s, Name origin)
throws IOException
{
return fromString(name, type, dclass, ttl, new Tokenizer(s), origin);
@@ -523,7 +527,7 @@
/**
* Returns the record's TTL
*/
-public int
+public long
getTTL() {
return ttl;
}
@@ -586,7 +590,7 @@
* class and ttl. This is most useful for dynamic update.
*/
Record
-withDClass(int dclass, int ttl) {
+withDClass(int dclass, long ttl) {
Record rec = cloneRecord();
rec.dclass = dclass;
rec.ttl = ttl;
@@ -639,6 +643,33 @@
public Name
getAdditionalName() {
return null;
+}
+
+/* Checks that an int contains an unsigned 8 bit value */
+static void
+checkU8(String field, int val) {
+ if (val < 0 || val > 0xFF)
+ throw new IllegalArgumentException("\"" + field + "\" " + val +
+ "must be an unsigned 8 " +
+ "bit value");
+}
+
+/* Checks that an int contains an unsigned 16 bit value */
+static void
+checkU16(String field, int val) {
+ if (val < 0 || val > 0xFFFF)
+ throw new IllegalArgumentException("\"" + field + "\" " + val +
+ "must be an unsigned 16 " +
+ "bit value");
+}
+
+/* Checks that a long contains an unsigned 32 bit value */
+static void
+checkU32(String field, long val) {
+ if (val < 0 || val > 0xFFFFFFFFL)
+ throw new IllegalArgumentException("\"" + field + "\" " + val +
+ "must be an unsigned 32 " +
+ "bit value");
}
}
Index: SIGRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/SIGRecord.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- SIGRecord.java 18 Jul 2003 18:28:22 -0000 1.50
+++ SIGRecord.java 27 Oct 2003 21:37:29 -0000 1.51
@@ -24,7 +24,7 @@
private static SIGRecord member = new SIGRecord();
private int covered;
-private byte alg, labels;
+private int alg, labels;
private int origttl;
private Date expire, timeSigned;
private short footprint;
@@ -35,7 +35,7 @@
SIGRecord() {}
private
-SIGRecord(Name name, int dclass, int ttl) {
+SIGRecord(Name name, int dclass, long ttl) {
super(name, Type.SIG, dclass, ttl);
}
@@ -57,12 +57,16 @@
* @param signature Binary data representing the signature
*/
public
-SIGRecord(Name name, int dclass, int ttl, int covered, int alg, int origttl,
+SIGRecord(Name name, int dclass, long ttl, int covered, int alg, int origttl,
Date expire, Date timeSigned, int footprint, Name signer,
byte [] signature)
{
this(name, dclass, ttl);
Type.check(covered);
+ checkU8("alg", alg);
+ checkU8("labels", labels);
+ TTL.check(origttl);
+ checkU16("footprint", footprint);
this.covered = covered;
this.alg = (byte) alg;
this.labels = name.labels();
@@ -77,7 +81,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -99,7 +103,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
SIGRecord rec = new SIGRecord(name, dclass, ttl);
@@ -138,7 +142,7 @@
sb.append (" ");
sb.append (formatDate(timeSigned));
sb.append (" ");
- sb.append ((int)footprint & 0xFFFF);
+ sb.append ((int)footprint);
sb.append (" ");
sb.append (signer);
if (Options.check("multiline")) {
@@ -162,7 +166,7 @@
/**
* Returns the cryptographic algorithm of the key that generated the signature
*/
-public byte
+public int
getAlgorithm() {
return alg;
}
@@ -172,7 +176,7 @@
* different than the record's domain name if the record is a wildcard
* record.
*/
-public byte
+public int
getLabels() {
return labels;
}
Index: SOARecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/SOARecord.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- SOARecord.java 18 Jul 2003 18:28:22 -0000 1.43
+++ SOARecord.java 27 Oct 2003 21:37:29 -0000 1.44
@@ -17,13 +17,13 @@
private static SOARecord member = new SOARecord();
private Name host, admin;
-private int serial, refresh, retry, expire, minimum;
+private long serial, refresh, retry, expire, minimum;
private
SOARecord() {}
private
-SOARecord(Name name, int dclass, int ttl) {
+SOARecord(Name name, int dclass, long ttl) {
super(name, Type.SOA, dclass, ttl);
}
@@ -45,8 +45,8 @@
* @param minimum The minimum TTL for records in the zone
*/
public
-SOARecord(Name name, int dclass, int ttl, Name host, Name admin,
- int serial, int refresh, int retry, int expire, int minimum)
+SOARecord(Name name, int dclass, long ttl, Name host, Name admin,
+ long serial, long refresh, long retry, long expire, long minimum)
{
this(name, dclass, ttl);
if (!host.isAbsolute())
@@ -54,6 +54,11 @@
this.host = host;
if (!admin.isAbsolute())
throw new RelativeNameException(admin);
+ checkU32("serial", serial);
+ checkU32("refresh", refresh);
+ checkU32("retry", retry);
+ checkU32("expire", expire);
+ checkU32("minimum", minimum);
this.admin = admin;
this.serial = serial;
this.refresh = refresh;
@@ -63,7 +68,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -72,16 +77,16 @@
return rec;
rec.host = new Name(in);
rec.admin = new Name(in);
- rec.serial = in.readInt();
- rec.refresh = in.readInt();
- rec.retry = in.readInt();
- rec.expire = in.readInt();
- rec.minimum = in.readInt();
+ rec.serial = in.readUnsignedInt();
+ rec.refresh = in.readUnsignedInt();
+ rec.retry = in.readUnsignedInt();
+ rec.expire = in.readUnsignedInt();
+ rec.minimum = in.readUnsignedInt();
return rec;
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
SOARecord rec = new SOARecord(name, dclass, ttl);
@@ -105,7 +110,7 @@
sb.append(admin);
if (Options.check("multiline")) {
sb.append(" (\n\t\t\t\t\t");
- sb.append(serial & 0xFFFFFFFFL);
+ sb.append(serial);
sb.append("\t; serial\n\t\t\t\t\t");
sb.append(refresh);
sb.append("\t; refresh\n\t\t\t\t\t");
@@ -117,7 +122,7 @@
sb.append(" )\t; minimum");
} else {
sb.append(" ");
- sb.append(serial & 0xFFFFFFFFL);
+ sb.append(serial);
sb.append(" ");
sb.append(refresh);
sb.append(" ");
@@ -144,31 +149,31 @@
}
/** Returns the zone's serial number */
-public int
+public long
getSerial() {
return serial;
}
/** Returns the zone refresh interval */
-public int
+public long
getRefresh() {
return refresh;
}
/** Returns the zone retry interval */
-public int
+public long
getRetry() {
return retry;
}
/** Returns the time until a secondary expires a zone */
-public int
+public long
getExpire() {
return expire;
}
/** Returns the minimum TTL for records in the zone */
-public int
+public long
getMinimum() {
return minimum;
}
@@ -180,11 +185,11 @@
host.toWire(out, c, canonical);
admin.toWire(out, c, canonical);
- out.writeInt(serial);
- out.writeInt(refresh);
- out.writeInt(retry);
- out.writeInt(expire);
- out.writeInt(minimum);
+ out.writeUnsignedInt(serial);
+ out.writeUnsignedInt(refresh);
+ out.writeUnsignedInt(retry);
+ out.writeUnsignedInt(expire);
+ out.writeUnsignedInt(minimum);
}
}
Index: SRVRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/SRVRecord.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- SRVRecord.java 18 Jul 2003 18:28:22 -0000 1.37
+++ SRVRecord.java 27 Oct 2003 21:37:29 -0000 1.38
@@ -25,7 +25,7 @@
SRVRecord() {}
private
-SRVRecord(Name name, int dclass, int ttl) {
+SRVRecord(Name name, int dclass, long ttl) {
super(name, Type.SRV, dclass, ttl);
}
@@ -44,16 +44,13 @@
* @param target The host running the service
*/
public
-SRVRecord(Name name, int dclass, int ttl, int priority,
+SRVRecord(Name name, int dclass, long ttl, int priority,
int weight, int port, Name target)
{
this(name, dclass, ttl);
- if (priority < 0 || priority > 0xFFFF)
- throw new IllegalArgumentException("priority is out of range");
- if (weight < 0 || weight > 0xFFFF)
- throw new IllegalArgumentException("weight is out of range");
- if (port < 0 || port > 0xFFFF)
- throw new IllegalArgumentException("port is out of range");
+ checkU16("priority", priority);
+ checkU16("weight", weight);
+ checkU16("port", port);
this.priority = priority;
this.weight = weight;
this.port = port;
@@ -63,7 +60,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -78,7 +75,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
SRVRecord rec = new SRVRecord(name, dclass, ttl);
Index: TKEYRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/TKEYRecord.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TKEYRecord.java 18 Jul 2003 18:28:22 -0000 1.20
+++ TKEYRecord.java 27 Oct 2003 21:37:29 -0000 1.21
@@ -45,7 +45,7 @@
TKEYRecord() {}
private
-TKEYRecord(Name name, int dclass, int ttl) {
+TKEYRecord(Name name, int dclass, long ttl) {
super(name, Type.TKEY, dclass, ttl);
}
@@ -68,19 +68,15 @@
* responses.
*/
public
-TKEYRecord(Name name, int dclass, int ttl, Name alg,
+TKEYRecord(Name name, int dclass, long ttl, Name alg,
Date timeInception, Date timeExpire, int mode, int error,
byte [] key, byte other[])
{
this(name, dclass, ttl);
if (!alg.isAbsolute())
throw new RelativeNameException(alg);
- if (mode < 0 || mode > 0xFFFF)
- throw new IllegalArgumentException("invalid TKEY mode: " +
- mode);
- if (error < 0 || error > 0xFFFF)
- throw new IllegalArgumentException("invalid TKEY error: " +
- error);
+ checkU16("mode", mode);
+ checkU16("error", error);
this.alg = alg;
this.timeInception = timeInception;
this.timeExpire = timeExpire;
@@ -91,7 +87,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -123,7 +119,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
throw st.exception("no text format defined for TKEY");
Index: TSIG.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/TSIG.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- TSIG.java 18 Jul 2003 18:28:22 -0000 1.52
+++ TSIG.java 27 Oct 2003 21:37:29 -0000 1.53
@@ -279,7 +279,7 @@
DataByteOutputStream out = new DataByteOutputStream();
tsig.getName().toWireCanonical(out);
out.writeShort(tsig.dclass);
- out.writeInt(tsig.ttl);
+ out.writeUnsignedInt(tsig.ttl);
tsig.getAlgorithm().toWireCanonical(out);
long time = tsig.getTimeSigned().getTime() / 1000;
short timeHigh = (short) (time >> 32);
Index: TSIGRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/TSIGRecord.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- TSIGRecord.java 18 Jul 2003 18:28:22 -0000 1.47
+++ TSIGRecord.java 27 Oct 2003 21:37:29 -0000 1.48
@@ -33,7 +33,7 @@
TSIGRecord() {}
private
-TSIGRecord(Name name, int dclass, int ttl) {
+TSIGRecord(Name name, int dclass, long ttl) {
super(name, Type.TSIG, dclass, ttl);
}
@@ -58,15 +58,14 @@
* @see TSIG
*/
public
-TSIGRecord(Name name, int dclass, int ttl, Name alg, Date timeSigned,
+TSIGRecord(Name name, int dclass, long ttl, Name alg, Date timeSigned,
int fudge, byte [] signature, int originalID, short error,
byte other[])
{
this(name, dclass, ttl);
if (!alg.isAbsolute())
throw new RelativeNameException(alg);
- if (fudge < 0 || fudge > 0xFFFF)
- throw new IllegalArgumentException("priority is out of range");
+ checkU16("fudge", fudge);
this.alg = alg;
this.timeSigned = timeSigned;
this.fudge = fudge;
@@ -77,7 +76,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -86,10 +85,9 @@
return rec;
rec.alg = new Name(in);
- int timeHigh = in.readUnsignedShort();
- int timeLow = in.readInt();
- long time = ((long)timeHigh) << 32;
- time += (long)timeLow & 0xFFFFFFFF;
+ long timeHigh = in.readUnsignedShort();
+ long timeLow = in.readUnsignedInt();
+ long time = (timeHigh << 32) + timeLow;
rec.timeSigned = new Date(time * 1000);
rec.fudge = in.readUnsignedShort();
@@ -111,7 +109,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
throw st.exception("no text format defined for TSIG");
Index: TTL.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/TTL.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TTL.java 27 May 2003 06:58:26 -0000 1.7
+++ TTL.java 27 Oct 2003 21:37:29 -0000 1.8
@@ -16,6 +16,12 @@
private
TTL() {}
+static void
+check(long i) {
+ if (i < 0 || i > 0xFFFFFFFFL)
+ throw new InvalidTTLException(i);
+}
+
/**
* Parses a BIND-stype TTL
* @return The TTL as a number of seconds
@@ -49,9 +55,10 @@
}
public static String
-format(int ttl) {
+format(long ttl) {
+ TTL.check(ttl);
StringBuffer sb = new StringBuffer();
- int secs, mins, hours, days, weeks;
+ long secs, mins, hours, days, weeks;
secs = ttl % 60;
ttl /= 60;
mins = ttl % 60;
Index: TXTRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/TXTRecord.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- TXTRecord.java 23 Aug 2003 03:17:27 -0000 1.42
+++ TXTRecord.java 27 Oct 2003 21:37:29 -0000 1.43
@@ -23,7 +23,7 @@
TXTRecord() {}
private
-TXTRecord(Name name, int dclass, int ttl) {
+TXTRecord(Name name, int dclass, long ttl) {
super(name, Type.TXT, dclass, ttl);
}
@@ -38,7 +38,7 @@
* @throws IllegalArgumentException One of the strings has invalid escapes
*/
public
-TXTRecord(Name name, int dclass, int ttl, List strings) {
+TXTRecord(Name name, int dclass, long ttl, List strings) {
this(name, dclass, ttl);
if (strings == null)
throw new IllegalArgumentException
@@ -62,12 +62,12 @@
* @throws IllegalArgumentException The string has invalid escapes
*/
public
-TXTRecord(Name name, int dclass, int ttl, String string) {
+TXTRecord(Name name, int dclass, long ttl, String string) {
this(name, dclass, ttl, Collections.nCopies(1, string));
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -85,7 +85,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
TXTRecord rec = new TXTRecord(name, dclass, ttl);
Index: UNKRecord.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/UNKRecord.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- UNKRecord.java 18 Jul 2003 18:28:22 -0000 1.27
+++ UNKRecord.java 27 Oct 2003 21:37:29 -0000 1.28
@@ -23,7 +23,7 @@
UNKRecord() {}
private
-UNKRecord(Name name, int type, int dclass, int ttl) {
+UNKRecord(Name name, int type, int dclass, long ttl) {
super(name, type, dclass, ttl);
}
@@ -33,7 +33,7 @@
}
Record
-rrFromWire(Name name, int type, int dclass, int ttl, int length,
+rrFromWire(Name name, int type, int dclass, long ttl, int length,
DataByteInputStream in)
throws IOException
{
@@ -50,7 +50,7 @@
}
Record
-rdataFromString(Name name, int dclass, int ttl, Tokenizer st, Name origin)
+rdataFromString(Name name, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
throw st.exception("invalid unknown RR encoding");
Index: Update.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/Update.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Update.java 2 Sep 2003 04:50:52 -0000 1.6
+++ Update.java 27 Oct 2003 21:37:29 -0000 1.7
@@ -132,7 +132,7 @@
* @throws IOException The record could not be parsed.
*/
public void
-add(Name name, int type, int ttl, String record) throws IOException {
+add(Name name, int type, long ttl, String record) throws IOException {
newUpdate(Record.fromString(name, type, dclass, ttl, record, origin));
}
@@ -142,7 +142,7 @@
* @throws IOException The record could not be parsed.
*/
public void
-add(Name name, int type, int ttl, Tokenizer tokenizer) throws IOException {
+add(Name name, int type, long ttl, Tokenizer tokenizer) throws IOException {
newUpdate(Record.fromString(name, type, dclass, ttl, tokenizer,
origin));
}
@@ -248,7 +248,7 @@
* @throws IOException The record could not be parsed.
*/
public void
-replace(Name name, int type, int ttl, String record) throws IOException {
+replace(Name name, int type, long ttl, String record) throws IOException {
delete(name, type);
add(name, type, ttl, record);
}
@@ -260,7 +260,7 @@
* @throws IOException The record could not be parsed.
*/
public void
-replace(Name name, int type, int ttl, Tokenizer tokenizer) throws IOException
+replace(Name name, int type, long ttl, Tokenizer tokenizer) throws IOException
{
delete(name, type);
add(name, type, ttl, tokenizer);
Index: ZoneTransferIn.java
===================================================================
RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/ZoneTransferIn.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ZoneTransferIn.java 22 Jun 2003 23:58:08 -0000 1.3
+++ ZoneTransferIn.java 27 Oct 2003 21:37:29 -0000 1.4
@@ -48,14 +48,14 @@
private SimpleResolver res;
private Name zname;
private int qtype;
-private int ixfr_serial;
+private long ixfr_serial;
private boolean want_fallback;
private SimpleResolver.Stream stream;
private int state;
-private int end_serial;
-private int current_serial;
+private long end_serial;
+private long current_serial;
private Record initialsoa;
private int rtype;
@@ -69,10 +69,10 @@
*/
/** The starting serial number of this delta. */
- public int start;
+ public long start;
/** The ending serial number of this delta. */
- public int end;
+ public long end;
/** A list of records added between the start and end versions */
public List adds;
@@ -92,7 +92,7 @@
private
ZoneTransferIn(SimpleResolver sres, Name zone, int xfrtype,
- int serial, boolean fallback)
+ long serial, boolean fallback)
{
res = sres;
if (zone.isAbsolute())
@@ -174,7 +174,7 @@
* @return The ZoneTransferIn object.
*/
public static ZoneTransferIn
-newIXFR(Name zone, int serial, boolean fallback, SimpleResolver res) {
+newIXFR(Name zone, long serial, boolean fallback, SimpleResolver res) {
return new ZoneTransferIn(res, zone, Type.IXFR, serial, fallback);
}
@@ -191,7 +191,7 @@
* @throws UnknownHostException The host does not exist.
*/
public static ZoneTransferIn
-newIXFR(Name zone, int serial, boolean fallback,
+newIXFR(Name zone, long serial, boolean fallback,
String host, int port, TSIG key)
throws UnknownHostException
{
@@ -210,7 +210,7 @@
* @throws UnknownHostException The host does not exist.
*/
public static ZoneTransferIn
-newIXFR(Name zone, int serial, boolean fallback, String host, TSIG key)
+newIXFR(Name zone, long serial, boolean fallback, String host, TSIG key)
throws UnknownHostException
{
return newIXFR(zone, serial, fallback, newResolver(host, 0, key));
@@ -230,14 +230,14 @@
query.addRecord(question, Section.QUESTION);
if (qtype == Type.IXFR) {
Record soa = new SOARecord(zname, DClass.IN, 0, Name.root,
- Name.root, (int)ixfr_serial,
+ Name.root, ixfr_serial,
0, 0, 0, 0);
query.addRecord(soa, Section.AUTHORITY);
}
stream.send(query);
}
-private int
+private long
getSOASerial(Record rec) {
SOARecord soa = (SOARecord) rec;
return soa.getSerial();
@@ -335,7 +335,7 @@
case IXFR_ADD:
if (type == Type.SOA) {
- int soa_serial = getSOASerial(rec);
+ long soa_serial = getSOASerial(rec);
if (soa_serial == end_serial) {
state = END;
break;
|