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

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

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

public class FirewallDescriptor
extends Object

todo: add a type for the open internet

Author:
Emil Ivov

Field Summary
static int TYPE_FULL_CONE
          Full cone NAT or firewall.
static int TYPE_OPEN_INTERNET
          Means no firewall or nat.
static int TYPE_PORT_RESTRICTED_CONE
          Port restricted cone NAT or firewall.
static int TYPE_RESTRICTED_CONE
          Restricted cone NAT or firewall.
static int TYPE_SYMMETRIC
          Symmetric NAT or firewall.
 
Constructor Summary
FirewallDescriptor()
          Constructs an empty firewall descirptor
 
Method Summary
 AddressPreference getAddressPreferenceSubtrahend()
          Returns the address preference subtrahend corresponding to the firewall referenced by this descriptor.
 int getBindingsLifetime()
          Returns the time (in seconds) that address port bindings remain active on this firewall without the node sendind any packets.
 InetAddress getPublicAddress()
          Returns the public IP address of the firewall.
 int getType()
          Returns the type of the firewall referenced by this desciptor
 boolean isTranslatingAddresses()
          Determines whether this is an address translating firewall (NAT) or not.
(package private)  void setBindingsLifetime(int lifetime)
          Sets the time (in seconds) that address port bindings remain active on this firewall without the node sendind any packets.
(package private)  void setPreferenceSubtrahend(AddressPreference subtrahend)
          Sets the address preference subtrahend corresponding to the firewall referenced by this descriptor.
(package private)  void setPublicAddress(InetAddress address)
          Sets the public IP address of the firewall.
(package private)  void setTranslatingAddresses(boolean isNAT)
          Specifies whether this is an address translating firewall (NAT) or not.
(package private)  void setType(int type)
          Set the type of this firewall.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_OPEN_INTERNET

public static final int TYPE_OPEN_INTERNET
Means no firewall or nat. In the case of a privvate IPv4 address this would meand no internet connectivity through this address. The same applies to IPv6 link local addresses. In the case of a public (IPv4 or IPv6) address this means that there is unlimited connectivity.

See Also:
Constant Field Values

TYPE_FULL_CONE

public static final int TYPE_FULL_CONE
Full cone NAT or firewall.

See Also:
Constant Field Values

TYPE_RESTRICTED_CONE

public static final int TYPE_RESTRICTED_CONE
Restricted cone NAT or firewall.

See Also:
Constant Field Values

TYPE_PORT_RESTRICTED_CONE

public static final int TYPE_PORT_RESTRICTED_CONE
Port restricted cone NAT or firewall.

See Also:
Constant Field Values

TYPE_SYMMETRIC

public static final int TYPE_SYMMETRIC
Symmetric NAT or firewall.

See Also:
Constant Field Values
Constructor Detail

FirewallDescriptor

FirewallDescriptor()
Constructs an empty firewall descirptor

Method Detail

setType

void setType(int type)
Set the type of this firewall.

Parameters:
type - the type of the firewall referenced by this descriptor.

getType

public int getType()
Returns the type of the firewall referenced by this desciptor

Returns:
the type of the firewall referenced by this desciptor. One of the TYPE_XXX fields of this class.

setPreferenceSubtrahend

void setPreferenceSubtrahend(AddressPreference subtrahend)
Sets the address preference subtrahend corresponding to the firewall referenced by this descriptor. The subtrahend is a value that is subtracted from AddressPreference-s of addresses behind this firewall.

Parameters:
subtrahend - the amount of address preference points that need to be subtracted from address preferences of oaddresses behind this firewall.

getAddressPreferenceSubtrahend

public AddressPreference getAddressPreferenceSubtrahend()
Returns the address preference subtrahend corresponding to the firewall referenced by this descriptor. The subtrahend is a value that is subtracted from AddressPreference-s of addresses behind this firewall.

Returns:
the amount of address preference points that need to be subtracted from address preferences of oaddresses behind this firewall.

setPublicAddress

void setPublicAddress(InetAddress address)
Sets the public IP address of the firewall. In the case of a NAT this is the address that others would have to use to contact us.

Parameters:
address - the ip address of the nat

getPublicAddress

public InetAddress getPublicAddress()
Returns the public IP address of the firewall. In the case of a NAT this is the address that others would have to use to contact us.

Returns:
the ip address of the nat

setBindingsLifetime

void setBindingsLifetime(int lifetime)
Sets the time (in seconds) that address port bindings remain active on this firewall without the node sendind any packets. Bindings may and most probably will change during runtime. They are initially set to be equal to net.java.sip.communicator.service.netaddr.INITIAL_BINDINGS_LIFETIME.

Parameters:
lifetime - the number of seconds that bindings on this firewall remain active

getBindingsLifetime

public int getBindingsLifetime()
Returns the time (in seconds) that address port bindings remain active on this firewall without the node sendind any packets. Bindings may and most probably will change during runtime. They are initially set to be equal to net.java.sip.communicator.service.netaddr.INITIAL_BINDINGS_LIFETIME.

Returns:
lifetime the number of seconds that bindings on this firewall remain active

setTranslatingAddresses

void setTranslatingAddresses(boolean isNAT)
Specifies whether this is an address translating firewall (NAT) or not.

Parameters:
isNAT - a boolean specifying whether the firewall referenced by this descriptor is a NAT.

isTranslatingAddresses

public boolean isTranslatingAddresses()
Determines whether this is an address translating firewall (NAT) or not.

Returns:
true if the firewall referenced by this descriptor is a NAT and false otherwise.

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

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