Package javax.jmdns.impl
Class HostInfo
- java.lang.Object
-
- javax.jmdns.impl.HostInfo
-
- All Implemented Interfaces:
DNSStatefulObject
public class HostInfo extends java.lang.Object implements DNSStatefulObject
HostInfo information on the local host to be able to cope with change of addresses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classHostInfo.HostInfoState-
Nested classes/interfaces inherited from interface javax.jmdns.impl.DNSStatefulObject
DNSStatefulObject.DefaultImplementation, DNSStatefulObject.DNSStatefulObjectSemaphore
-
-
Field Summary
Fields Modifier and Type Field Description protected java.net.InetAddress_addressprotected java.net.NetworkInterface_interfazeprotected java.lang.String_nameprivate HostInfo.HostInfoState_stateprivate static org.slf4j.Loggerlogger
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadvanceState(DNSTask task)Sets the state and notifies all objects that wait on the ServiceInfo.java.util.Collection<DNSRecord>answers(DNSRecordClass recordClass, boolean unique, int ttl)voidassociateWithTask(DNSTask task, DNSState state)Sets the task associated with this Object.booleancancelState()Sets the state and notifies all objects that wait on the ServiceInfo.booleancloseState()Sets the state and notifies all objects that wait on the ServiceInfo.booleanconflictWithRecord(DNSRecord.Address record)JmDNSImplgetDns()Returns the DNS associated with this object.private DNSRecord.AddressgetDNS4AddressRecord(boolean unique, int ttl)private DNSRecord.PointergetDNS4ReverseAddressRecord(boolean unique, int ttl)private DNSRecord.AddressgetDNS6AddressRecord(boolean unique, int ttl)private DNSRecord.PointergetDNS6ReverseAddressRecord(boolean unique, int ttl)(package private) DNSRecord.AddressgetDNSAddressRecord(DNSRecordType type, boolean unique, int ttl)(package private) DNSRecord.PointergetDNSReverseAddressRecord(DNSRecordType type, boolean unique, int ttl)(package private) java.net.Inet4AddressgetInet4Address()(package private) java.net.Inet6AddressgetInet6Address()java.net.InetAddressgetInetAddress()java.net.NetworkInterfacegetInterface()java.lang.StringgetName()(package private) java.lang.StringincrementHostName()booleanisAnnounced()Returns true, if this is an announced state.booleanisAnnouncing()Returns true, if this is an announcing state.booleanisAssociatedWithTask(DNSTask task, DNSState state)Checks if this object is associated with the task and in the same state.booleanisCanceled()Returns true, if this is a canceled state.booleanisCanceling()Returns true, if this is a canceling state.booleanisClosed()Returns true, if this is a closed state.booleanisClosing()Returns true, if this is a closing state.booleanisProbing()Returns true, if this is a probing state.private static java.net.InetAddressloopbackAddress()static HostInfonewHostInfo(java.net.InetAddress address, JmDNSImpl dns, java.lang.String jmdnsName)booleanrecoverState()Sets the state and notifies all objects that wait on the ServiceInfo.voidremoveAssociationWithTask(DNSTask task)Remove the association of the task with this Object.booleanrevertState()Sets the state and notifies all objects that wait on the ServiceInfo.(package private) booleanshouldIgnorePacket(java.net.DatagramPacket packet)java.lang.StringtoString()booleanwaitForAnnounced(long timeout)Waits for the object to be announced.booleanwaitForCanceled(long timeout)Waits for the object to be canceled.
-
-
-
Field Detail
-
logger
private static org.slf4j.Logger logger
-
_name
protected java.lang.String _name
-
_address
protected java.net.InetAddress _address
-
_interfaze
protected java.net.NetworkInterface _interfaze
-
_state
private final HostInfo.HostInfoState _state
-
-
Constructor Detail
-
HostInfo
private HostInfo(java.net.InetAddress address, java.lang.String name, JmDNSImpl dns)
-
-
Method Detail
-
newHostInfo
public static HostInfo newHostInfo(java.net.InetAddress address, JmDNSImpl dns, java.lang.String jmdnsName)
- Parameters:
address- IP address to binddns- JmDNS instancejmdnsName- JmDNS name- Returns:
- new HostInfo
-
loopbackAddress
private static java.net.InetAddress loopbackAddress()
-
getName
public java.lang.String getName()
-
getInetAddress
public java.net.InetAddress getInetAddress()
-
getInet4Address
java.net.Inet4Address getInet4Address()
-
getInet6Address
java.net.Inet6Address getInet6Address()
-
getInterface
public java.net.NetworkInterface getInterface()
-
conflictWithRecord
public boolean conflictWithRecord(DNSRecord.Address record)
-
incrementHostName
java.lang.String incrementHostName()
-
shouldIgnorePacket
boolean shouldIgnorePacket(java.net.DatagramPacket packet)
-
getDNSAddressRecord
DNSRecord.Address getDNSAddressRecord(DNSRecordType type, boolean unique, int ttl)
-
getDNS4AddressRecord
private DNSRecord.Address getDNS4AddressRecord(boolean unique, int ttl)
-
getDNS6AddressRecord
private DNSRecord.Address getDNS6AddressRecord(boolean unique, int ttl)
-
getDNSReverseAddressRecord
DNSRecord.Pointer getDNSReverseAddressRecord(DNSRecordType type, boolean unique, int ttl)
-
getDNS4ReverseAddressRecord
private DNSRecord.Pointer getDNS4ReverseAddressRecord(boolean unique, int ttl)
-
getDNS6ReverseAddressRecord
private DNSRecord.Pointer getDNS6ReverseAddressRecord(boolean unique, int ttl)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
answers
public java.util.Collection<DNSRecord> answers(DNSRecordClass recordClass, boolean unique, int ttl)
-
getDns
public JmDNSImpl getDns()
Returns the DNS associated with this object.- Specified by:
getDnsin interfaceDNSStatefulObject- Returns:
- DNS resolver
-
advanceState
public boolean advanceState(DNSTask task)
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
advanceStatein interfaceDNSStatefulObject- Parameters:
task- associated task- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
DNSState.advance()
-
removeAssociationWithTask
public void removeAssociationWithTask(DNSTask task)
Remove the association of the task with this Object.- Specified by:
removeAssociationWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated task
-
revertState
public boolean revertState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
revertStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
DNSState.revert()
-
associateWithTask
public void associateWithTask(DNSTask task, DNSState state)
Sets the task associated with this Object.- Specified by:
associateWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated taskstate- state of the task
-
isAssociatedWithTask
public boolean isAssociatedWithTask(DNSTask task, DNSState state)
Checks if this object is associated with the task and in the same state.- Specified by:
isAssociatedWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated taskstate- state of the task- Returns:
trueis the task is associated with this object,falseotherwise.
-
cancelState
public boolean cancelState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
cancelStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
closeState
public boolean closeState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
closeStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
recoverState
public boolean recoverState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
recoverStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
isProbing
public boolean isProbing()
Returns true, if this is a probing state.- Specified by:
isProbingin interfaceDNSStatefulObject- Returns:
trueif probing state,falseotherwise
-
isAnnouncing
public boolean isAnnouncing()
Returns true, if this is an announcing state.- Specified by:
isAnnouncingin interfaceDNSStatefulObject- Returns:
trueif announcing state,falseotherwise
-
isAnnounced
public boolean isAnnounced()
Returns true, if this is an announced state.- Specified by:
isAnnouncedin interfaceDNSStatefulObject- Returns:
trueif announced state,falseotherwise
-
isCanceling
public boolean isCanceling()
Returns true, if this is a canceling state.- Specified by:
isCancelingin interfaceDNSStatefulObject- Returns:
trueif canceling state,falseotherwise
-
isCanceled
public boolean isCanceled()
Returns true, if this is a canceled state.- Specified by:
isCanceledin interfaceDNSStatefulObject- Returns:
trueif canceled state,falseotherwise
-
isClosing
public boolean isClosing()
Returns true, if this is a closing state.- Specified by:
isClosingin interfaceDNSStatefulObject- Returns:
trueif closing state,falseotherwise
-
isClosed
public boolean isClosed()
Returns true, if this is a closed state.- Specified by:
isClosedin interfaceDNSStatefulObject- Returns:
trueif closed state,falseotherwise
-
waitForAnnounced
public boolean waitForAnnounced(long timeout)
Waits for the object to be announced.- Specified by:
waitForAnnouncedin interfaceDNSStatefulObject- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is announced,falseotherwise
-
waitForCanceled
public boolean waitForCanceled(long timeout)
Waits for the object to be canceled.- Specified by:
waitForCanceledin interfaceDNSStatefulObject- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is canceled,falseotherwise
-
-