SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.netaddr
Class AddressPoolEntry

java.lang.Object
  extended by net.java.sip.communicator.impl.netaddr.AddressPoolEntry

public class AddressPoolEntry
extends Object

An entry in the Address Pool. An addresspool entry contains an address belonging to any of the local network interfaces together with properties that characterize them, such as - whether or not the address is publicly routable or not, It's corresponding NAT entry obtained by stun. The type of NAT that the address is located behind (if any). The lifetime of the bindings behind this NAT. Any TURN bindings. Whether or not TCP connections seem to be supported. Whether or not UDP connections seem to be supported, and etc. etc. Concerning the address, this is an immutable object, in other words, the address of a single entry is not supposed to change once it has been created. In case this address is modified while the application is running we'll rather have a new address entry instead of modifying this one. The only thing that can change about an address pool entry is its properties.

Author:
Emil Ivov

Constructor Summary
AddressPoolEntry(InetAddress address, NetworkInterface ownerIface)
           
 
Method Summary
 AddressPreference getAddressPreference()
          Returns the AddressPreference assigned to this AddressEntry.
 InetAddress getInetAddress()
          Returns the ip address that this address pool entry represents.
 NetworkInterface getOwnerInterface()
          Returns the interface that this address belongs to.
 boolean is6to4()
          Determines whether the adderss encapsulated by this address entry is a 6to4 translation address (2002::/16)
 boolean isGloballyRoutable()
          Determines whether the adderss encapsulated by this address entry is a globally routable inet address, or in other words is it possible (at least in theory) to directly send packets to it from any point of the internet.
 boolean isIPv4LinkLocalAutoconf()
          Determines whether the address encapsulated by this entry is the result of windows auto configuration (i.e.
static boolean isIPv4LinkLocalAutoconf(InetAddress add)
          Determines whether the address is the result of windows auto configuration.
 boolean isIPv6()
          Determines whether or not the address pool entry represents an IPv6 address.
 boolean isLinkLocal()
          Determines whether this is a link local or publicly routable address.
 boolean isLinkLocalIPv4Address()
          Determines whether the address encapsulated by this entry is an IPv4 link local address.
static boolean isLinkLocalIPv4Address(InetAddress add)
          Determines whether the address is an IPv4 link local address.
 boolean isLinkLocalIPv6Address()
          Determines whether the address encapsulated by this entry is an IPv6 link local address.
 boolean isLoopback()
          Determines whether this is the localhost address (127.0.0.1 or ::1).
(package private)  void setAddressPreference(AddressPreference preference)
          Sets the AddressPreference that address diagnostics have calculated for the address corresponding to this entry.
(package private)  void setLinkLocal(boolean linkLocal)
          Specifies whether or not the address is an IPv4 link local address.
 String toString()
          Returns a string representation of this address entry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AddressPoolEntry

public AddressPoolEntry(InetAddress address,
                        NetworkInterface ownerIface)
Method Detail

getInetAddress

public InetAddress getInetAddress()
Returns the ip address that this address pool entry represents.

Returns:
InetAddress

isIPv6

public boolean isIPv6()
Determines whether or not the address pool entry represents an IPv6 address.

Returns:
true if the address is ipv6 and false in case of ipv4.

isLinkLocal

public boolean isLinkLocal()
Determines whether this is a link local or publicly routable address. Works for both IPv4 and IPv6 addresses.

Returns:
true if the address is link local and thus not globally routable and false if otherwise.

setLinkLocal

void setLinkLocal(boolean linkLocal)
Specifies whether or not the address is an IPv4 link local address.

Parameters:
linkLocal - true if t

isIPv4LinkLocalAutoconf

public static boolean isIPv4LinkLocalAutoconf(InetAddress add)
Determines whether the address is the result of windows auto configuration. (i.e. One that is in the 169.254.0.0 network)

Parameters:
add - the address to inspect
Returns:
true if the address is autoconfigured by windows, false otherwise.

isIPv4LinkLocalAutoconf

public boolean isIPv4LinkLocalAutoconf()
Determines whether the address encapsulated by this entry is the result of windows auto configuration (i.e. One that is in the 169.254.0.0 network)

Returns:
true if the address is autoconfigured by windows, false otherwise.

isLinkLocalIPv4Address

public static boolean isLinkLocalIPv4Address(InetAddress add)
Determines whether the address is an IPv4 link local address. IPv4 link local addresses are those in the following networks: 10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255

Parameters:
add - the address to inspect
Returns:
true if add is a link local ipv4 address and false if not.

isLinkLocalIPv4Address

public boolean isLinkLocalIPv4Address()
Determines whether the address encapsulated by this entry is an IPv4 link local address. IPv4 link local addresses are those in the following networks: 10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255

Returns:
true if add is a link local ipv4 address and false if not.

isLinkLocalIPv6Address

public boolean isLinkLocalIPv6Address()
Determines whether the address encapsulated by this entry is an IPv6 link local address. IPv6 link local addresses are briefly those that start with fe80.

Returns:
true if add is a link local ipv6 address and false if not.

isLoopback

public boolean isLoopback()
Determines whether this is the localhost address (127.0.0.1 or ::1). This is a simple wrapper of the InetAddress.isLoopbackAddress() method.

Returns:
true if this is and IPv6 or IPv4 loopback address and false otherwise.

isGloballyRoutable

public boolean isGloballyRoutable()
Determines whether the adderss encapsulated by this address entry is a globally routable inet address, or in other words is it possible (at least in theory) to directly send packets to it from any point of the internet.

Returns:
true if this is a public ip addr and false otherwise.

is6to4

public boolean is6to4()
Determines whether the adderss encapsulated by this address entry is a 6to4 translation address (2002::/16)

Returns:
true if this is a 6to4 ip addr (belongs to 2002::/16) and false otherwise.

getOwnerInterface

public NetworkInterface getOwnerInterface()
Returns the interface that this address belongs to.

Returns:
a reference to the interface that this address belongs to.

toString

public String toString()
Returns a string representation of this address entry

Overrides:
toString in class Object
Returns:
a String containing key characteristics of this address pool entry

setAddressPreference

void setAddressPreference(AddressPreference preference)
Sets the AddressPreference that address diagnostics have calculated for the address corresponding to this entry.

Parameters:
preference - the preference to assign to this entry

getAddressPreference

public AddressPreference getAddressPreference()
Returns the AddressPreference assigned to this AddressEntry. The AddressPreference is what establishes an order in the "usability" of the addresses on the local machine.

Returns:
AddressPreference the AddressPreference assigned to this entry.

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.