Package org.xbill.DNS
Class ZoneTransferIn
java.lang.Object
org.xbill.DNS.ZoneTransferIn
An incoming DNS Zone Transfer. To use this class, first initialize an object, then call the run()
method. If run() doesn't throw an exception the result will either be an IXFR-style response, an
AXFR-style response, or an indication that the zone is up to date.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic classAll changes between two versions of a zone in an IXFR response.static interfaceHandles a Zone Transfer. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SocketAddressprivate static final intprivate TCPClientprivate longprivate intprivate static final intprivate longprivate static final intprivate static final intprivate Recordprivate static final intprivate static final intprivate static final intprivate static final intprivate final longprivate SocketAddressprivate intprivate intprivate intprivate Durationprivate final TSIGprivate TSIG.StreamVerifierprivate final booleanprivate final Name -
Constructor Summary
ConstructorsConstructorDescriptionZoneTransferIn(Name zone, int xfrtype, long serial, boolean fallback, SocketAddress address, TSIG key) -
Method Summary
Modifier and TypeMethodDescriptionprivate void(package private) TCPClientcreateTcpClient(Duration timeout) private voiddoxfr()private voidprivate voidfallback()getAXFR()Gets the AXFR-style response.private ZoneTransferIn.BasicHandlergetIXFR()Gets the IXFR-style response.getName()Gets the name of the zone being transferred.private static longgetSOASerial(Record rec) intgetType()Gets the type of zone transfer (either AXFR or IXFR).booleanisAXFR()Returns true if the response is an AXFR-style response (List of Records).booleanReturns true if the response indicates that the zone is up to date.booleanisIXFR()Returns true if the response is an IXFR-style response (List of Deltas).private voidstatic ZoneTransferInInstantiates a ZoneTransferIn object to do an AXFR (full zone transfer).static ZoneTransferInInstantiates a ZoneTransferIn object to do an AXFR (full zone transfer).static ZoneTransferInnewAXFR(Name zone, SocketAddress address, TSIG key) Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer).static ZoneTransferInInstantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).static ZoneTransferInInstantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).static ZoneTransferInnewIXFR(Name zone, long serial, boolean fallback, SocketAddress address, TSIG key) Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).private voidprivate MessageparseMessage(byte[] b) private voidvoidrun()Does the zone transfer using an internal handler.voidrun(ZoneTransferIn.ZoneTransferHandler handler) Does the zone transfer.private voidvoidsetDClass(int dclass) Sets an alternate DNS class for this zone transfer.voidsetLocalAddress(SocketAddress addr) Sets the local address to bind to when sending messages.voidsetTimeout(int secs) Deprecated.voidSets a timeout on this zone transfer.
-
Field Details
-
INITIALSOA
private static final int INITIALSOA- See Also:
-
FIRSTDATA
private static final int FIRSTDATA- See Also:
-
IXFR_DELSOA
private static final int IXFR_DELSOA- See Also:
-
IXFR_DEL
private static final int IXFR_DEL- See Also:
-
IXFR_ADDSOA
private static final int IXFR_ADDSOA- See Also:
-
IXFR_ADD
private static final int IXFR_ADD- See Also:
-
AXFR
private static final int AXFR- See Also:
-
END
private static final int END- See Also:
-
zname
-
qtype
private int qtype -
dclass
private int dclass -
ixfrSerial
private final long ixfrSerial -
wantFallback
private final boolean wantFallback -
handler
-
localAddress
-
address
-
client
-
tsig
-
verifier
-
timeout
-
state
private int state -
endSerial
private long endSerial -
currentSerial
private long currentSerial -
initialSoaRecord
-
rtype
private int rtype
-
-
Constructor Details
-
ZoneTransferIn
ZoneTransferIn(Name zone, int xfrtype, long serial, boolean fallback, SocketAddress address, TSIG key)
-
-
Method Details
-
newAXFR
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer).- Parameters:
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.- Returns:
- The ZoneTransferIn object.
-
newAXFR
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer).- Parameters:
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.- Returns:
- The ZoneTransferIn object.
-
newAXFR
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer).- Parameters:
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.- Returns:
- The ZoneTransferIn object.
-
newIXFR
public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, SocketAddress address, TSIG key) Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).- Parameters:
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.- Returns:
- The ZoneTransferIn object.
-
newIXFR
public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, String host, int port, TSIG key) Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).- Parameters:
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.- Returns:
- The ZoneTransferIn object.
-
newIXFR
public static ZoneTransferIn newIXFR(Name zone, long serial, boolean fallback, String host, TSIG key) Instantiates a ZoneTransferIn object to do an IXFR (incremental zone transfer).- Parameters:
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.- Returns:
- The ZoneTransferIn object.
-
getName
Gets the name of the zone being transferred. -
getType
public int getType()Gets the type of zone transfer (either AXFR or IXFR). -
setTimeout
Deprecated.Sets a timeout on this zone transfer. The default is 900 seconds (15 minutes).- Parameters:
secs- The maximum amount of time that this zone transfer can take.
-
setTimeout
Sets a timeout on this zone transfer. The default is 900 seconds (15 minutes).- Parameters:
t- The maximum amount of time that this zone transfer can take.
-
setDClass
public void setDClass(int dclass) Sets an alternate DNS class for this zone transfer.- Parameters:
dclass- The class to use instead of class IN.
-
setLocalAddress
Sets the local address to bind to when sending messages.- Parameters:
addr- The local address to send messages from.
-
openConnection
- Throws:
IOException
-
createTcpClient
- Throws:
IOException
-
sendQuery
- Throws:
IOException
-
getSOASerial
-
logxfr
-
fail
- Throws:
ZoneTransferException
-
fallback
- Throws:
ZoneTransferException
-
parseRR
- Throws:
ZoneTransferException
-
closeConnection
private void closeConnection() -
parseMessage
- Throws:
WireParseException
-
doxfr
- Throws:
IOExceptionZoneTransferException
-
run
public void run(ZoneTransferIn.ZoneTransferHandler handler) throws IOException, ZoneTransferException Does the zone transfer.- Parameters:
handler- The callback object that handles the zone transfer data.- Throws:
IOException- The zone transfer failed to due an IO problem.ZoneTransferException- The zone transfer failed to due a problem with the zone transfer itself.
-
run
Does the zone transfer using an internal handler. Results can be obtained by callinggetAXFR()or getIXFR- Throws:
IOException- The zone transfer failed to due an IO problem.ZoneTransferException- The zone transfer failed to due a problem with the zone transfer itself.
-
getBasicHandler
- Throws:
IllegalArgumentException
-
isAXFR
public boolean isAXFR()Returns true if the response is an AXFR-style response (List of Records). This will be true if either an IXFR was performed, an IXFR was performed and the server provided a full zone transfer, or an IXFR failed and fallback to AXFR occurred. -
getAXFR
Gets the AXFR-style response.- Throws:
IllegalArgumentException- The transfer used the callback interface, so the response was not stored.
-
isIXFR
public boolean isIXFR()Returns true if the response is an IXFR-style response (List of Deltas). This will be true only if an IXFR was performed and the server provided an incremental zone transfer. -
getIXFR
Gets the IXFR-style response.- Throws:
IllegalArgumentException- The transfer used the callback interface, so the response was not stored.
-
isCurrent
public boolean isCurrent()Returns true if the response indicates that the zone is up to date. This will be true only if an IXFR was performed.- Throws:
IllegalArgumentException- The transfer used the callback interface, so the response was not stored.
-
setTimeout(Duration)