public class ZoneTransferIn
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
ZoneTransferIn.BasicHandler |
static class |
ZoneTransferIn.Delta
All changes between two versions of a zone in an IXFR response.
|
static interface |
ZoneTransferIn.ZoneTransferHandler
Handles a Zone Transfer.
|
Modifier and Type | Field and Description |
---|---|
private java.net.SocketAddress |
address |
private static int |
AXFR |
private TCPClient |
client |
private long |
current_serial |
private int |
dclass |
private static int |
END |
private long |
end_serial |
private static int |
FIRSTDATA |
private ZoneTransferIn.ZoneTransferHandler |
handler |
private Record |
initialsoa |
private static int |
INITIALSOA |
private static int |
IXFR_ADD |
private static int |
IXFR_ADDSOA |
private static int |
IXFR_DEL |
private static int |
IXFR_DELSOA |
private long |
ixfr_serial |
private java.net.SocketAddress |
localAddress |
private int |
qtype |
private int |
rtype |
private int |
state |
private java.time.Duration |
timeout |
private TSIG |
tsig |
private TSIG.StreamVerifier |
verifier |
private boolean |
want_fallback |
private Name |
zname |
Modifier | Constructor and Description |
---|---|
private |
ZoneTransferIn() |
private |
ZoneTransferIn(Name zone,
int xfrtype,
long serial,
boolean fallback,
java.net.SocketAddress address,
TSIG key) |
Modifier and Type | Method and Description |
---|---|
private void |
closeConnection() |
private void |
doxfr() |
private void |
fail(java.lang.String s) |
private void |
fallback() |
java.util.List<Record> |
getAXFR()
Gets the AXFR-style response.
|
private ZoneTransferIn.BasicHandler |
getBasicHandler() |
java.util.List<ZoneTransferIn.Delta> |
getIXFR()
Gets the IXFR-style response.
|
Name |
getName()
Gets the name of the zone being transferred.
|
private static long |
getSOASerial(Record rec) |
int |
getType()
Gets the type of zone transfer (either AXFR or IXFR).
|
boolean |
isAXFR()
Returns true if the response is an AXFR-style response (List of Records).
|
boolean |
isCurrent()
Returns true if the response indicates that the zone is up to date.
|
boolean |
isIXFR()
Returns true if the response is an IXFR-style response (List of Deltas).
|
private void |
logxfr(java.lang.String s) |
static ZoneTransferIn |
newAXFR(Name zone,
java.net.SocketAddress address,
TSIG key)
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer).
|
static ZoneTransferIn |
newAXFR(Name zone,
java.lang.String host,
int port,
TSIG key)
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer).
|
static ZoneTransferIn |
newAXFR(Name zone,
java.lang.String host,
TSIG key)
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer).
|
static ZoneTransferIn |
newIXFR(Name zone,
long serial,
boolean fallback,
java.net.SocketAddress address,
TSIG key)
Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).
|
static ZoneTransferIn |
newIXFR(Name zone,
long serial,
boolean fallback,
java.lang.String host,
int port,
TSIG key)
Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).
|
static ZoneTransferIn |
newIXFR(Name zone,
long serial,
boolean fallback,
java.lang.String host,
TSIG key)
Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).
|
private void |
openConnection() |
private Message |
parseMessage(byte[] b) |
private void |
parseRR(Record rec) |
void |
run()
Does the zone transfer using an internal handler.
|
void |
run(ZoneTransferIn.ZoneTransferHandler handler)
Does the zone transfer.
|
private void |
sendQuery() |
void |
setDClass(int dclass)
Sets an alternate DNS class for this zone transfer.
|
void |
setLocalAddress(java.net.SocketAddress addr)
Sets the local address to bind to when sending messages.
|
void |
setTimeout(java.time.Duration t)
Sets a timeout on this zone transfer.
|
void |
setTimeout(int secs)
Deprecated.
|
private static final int INITIALSOA
private static final int FIRSTDATA
private static final int IXFR_DELSOA
private static final int IXFR_DEL
private static final int IXFR_ADDSOA
private static final int IXFR_ADD
private static final int AXFR
private static final int END
private Name zname
private int qtype
private int dclass
private long ixfr_serial
private boolean want_fallback
private ZoneTransferIn.ZoneTransferHandler handler
private java.net.SocketAddress localAddress
private java.net.SocketAddress address
private TCPClient client
private TSIG tsig
private TSIG.StreamVerifier verifier
private java.time.Duration timeout
private int state
private long end_serial
private long current_serial
private Record initialsoa
private int rtype
public static ZoneTransferIn newAXFR(Name zone, java.net.SocketAddress address, TSIG key)
zone
- The zone to transfer.address
- The host/port from which to transfer the zone.key
- The TSIG key used to authenticate the transfer, or null.public static ZoneTransferIn newAXFR(Name zone, java.lang.String host, int port, TSIG key)
zone
- The zone to transfer.host
- The host from which to transfer the zone.port
- The port to connect to on the server, or 0 for the default.key
- The TSIG key used to authenticate the transfer, or null.public static ZoneTransferIn newAXFR(Name zone, java.lang.String host, TSIG key)
zone
- The zone to transfer.host
- The host from which to transfer the zone.key
- The TSIG key used to authenticate the transfer, or null.public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, java.net.SocketAddress address, TSIG key)
zone
- The zone to transfer.serial
- The existing serial number.fallback
- If true, fall back to AXFR if IXFR is not supported.address
- The host/port from which to transfer the zone.key
- The TSIG key used to authenticate the transfer, or null.public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, java.lang.String host, int port, TSIG key)
zone
- The zone to transfer.serial
- The existing serial number.fallback
- If true, fall back to AXFR if IXFR is not supported.host
- The host from which to transfer the zone.port
- The port to connect to on the server, or 0 for the default.key
- The TSIG key used to authenticate the transfer, or null.public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, java.lang.String host, TSIG key)
zone
- The zone to transfer.serial
- The existing serial number.fallback
- If true, fall back to AXFR if IXFR is not supported.host
- The host from which to transfer the zone.key
- The TSIG key used to authenticate the transfer, or null.public Name getName()
public int getType()
@Deprecated public void setTimeout(int secs)
setTimeout(Duration)
secs
- The maximum amount of time that this zone transfer can take.public void setTimeout(java.time.Duration t)
t
- The maximum amount of time that this zone transfer can take.public void setDClass(int dclass)
dclass
- The class to use instead of class IN.public void setLocalAddress(java.net.SocketAddress addr)
addr
- The local address to send messages from.private void openConnection() throws java.io.IOException
java.io.IOException
private void sendQuery() throws java.io.IOException
java.io.IOException
private static long getSOASerial(Record rec)
private void logxfr(java.lang.String s)
private void fail(java.lang.String s) throws ZoneTransferException
ZoneTransferException
private void fallback() throws ZoneTransferException
ZoneTransferException
private void parseRR(Record rec) throws ZoneTransferException
ZoneTransferException
private void closeConnection()
private Message parseMessage(byte[] b) throws WireParseException
WireParseException
private void doxfr() throws java.io.IOException, ZoneTransferException
java.io.IOException
ZoneTransferException
public void run(ZoneTransferIn.ZoneTransferHandler handler) throws java.io.IOException, ZoneTransferException
handler
- The callback object that handles the zone transfer data.java.io.IOException
- The zone transfer failed to due an IO problem.ZoneTransferException
- The zone transfer failed to due a problem with the zone transfer
itself.public void run() throws java.io.IOException, ZoneTransferException
getAXFR()
or getIXFRjava.io.IOException
- The zone transfer failed to due an IO problem.ZoneTransferException
- The zone transfer failed to due a problem with the zone transfer
itself.private ZoneTransferIn.BasicHandler getBasicHandler() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public boolean isAXFR()
public java.util.List<Record> getAXFR()
java.lang.IllegalArgumentException
- The transfer used the callback interface, so the response was
not stored.public boolean isIXFR()
public java.util.List<ZoneTransferIn.Delta> getIXFR()
java.lang.IllegalArgumentException
- The transfer used the callback interface, so the response was
not stored.public boolean isCurrent()
java.lang.IllegalArgumentException
- The transfer used the callback interface, so the response was
not stored.