dk.i1.diameter.node
Class NodeSettings

Object
  extended by dk.i1.diameter.node.NodeSettings

public class NodeSettings
extends Object

Configuration for a node. NodeSettings contain the settings for a node including node ID, capabilities, etc. A NodeSettings instance is required for initializing Node and NodeManager

Example for constructing a NodeSettings instance:

  Capability capability = new Capability();
  capability.addAuthApp(...);
  capability.addAcctApp(...);
  
  NodeSettings node_settings;
  try {
      node_settings  = new NodeSettings(
          "somehost.example.net", "example.net",
          0, //vendor-id. 0 is not a valid value.
          capability,
          3868,
          "ExampleNet gateway", 0x01000000);
  } catch (InvalidSettingException ex) {
      System.out.println(ex.toString());
      return;
  }
Does and donts:


Nested Class Summary
static class NodeSettings.PortRange
          A port range
 
Constructor Summary
NodeSettings(String host_id, String realm, int vendor_id, Capability capabilities, int port, String product_name, int firmware_revision)
          Constructor for NodeSettings.
 
Method Summary
 Capability capabilities()
          Returns the configured capabilities
 int firmwareRevision()
          Returns the firmware revision
 String hostId()
          Returns the configured host ID
 long idleTimeout()
          Returns the idle timeout (in milliseconds)
 int port()
          Returns the configured listen port.
 String productName()
          Returns the product name
 String realm()
          Returns the configured realm
 void setIdleTimeout(long timeout)
          Sets the idle close timeout.
 void setUseSCTP(Boolean use_sctp)
          Change the setting for using SCTP Sets the setting to the spciefied value, which can be null.
 void setUseTCP(Boolean use_tcp)
          Change the setting for using TCP Sets the setting to the spciefied value, which can be null.
 void setWatchdogInterval(long interval)
          Sets the desired DWR/DWA interval.
 NodeSettings.PortRange TCPPortRange()
          Get the source port range for outgoing TCP connections
 void TCPPortRange(int min, int max)
          Set the source port range for outgoing TCP connections
 void TCPPortRange(NodeSettings.PortRange port_range)
          Set the source port range for outgoing TCP connections If the source port range is no tset (default) then the stack will use an ephemeral source port.
 Boolean useSCTP()
          Returns the setting for using SCTP.
 Boolean useTCP()
          Returns the setting for using TCP.
 int vendorId()
          Returns the configured vendor ID
 long watchdogInterval()
          Returns the desired DWR interval (in milliseconds).
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeSettings

public NodeSettings(String host_id,
                    String realm,
                    int vendor_id,
                    Capability capabilities,
                    int port,
                    String product_name,
                    int firmware_revision)
             throws InvalidSettingException
Constructor for NodeSettings.

Parameters:
host_id - The Diameter host identity.
vendor_id - Your IANA-assigned "SMI Network Management Private Enterprise Code"
realm - The Diameter realm.
capabilities - The capabilities of this node.
port - The port to listen on. Use 0 to specify that this node should not listen for incoming connections.
product_name - The name of this product eg. "FooBar gateway"
firmware_revision - The "firmware" revision ie. the version of you product. Use 0 to specify none.
Throws:
InvalidSettingException
Method Detail

hostId

public String hostId()
Returns the configured host ID


realm

public String realm()
Returns the configured realm


vendorId

public int vendorId()
Returns the configured vendor ID


capabilities

public Capability capabilities()
Returns the configured capabilities


port

public int port()
Returns the configured listen port. 0 if not listening


productName

public String productName()
Returns the product name


firmwareRevision

public int firmwareRevision()
Returns the firmware revision


watchdogInterval

public long watchdogInterval()
Returns the desired DWR interval (in milliseconds). The default interval is 30 seconds as per RFC3539 section 3.4.1

Since:
0.9.3

setWatchdogInterval

public void setWatchdogInterval(long interval)
                         throws InvalidSettingException
Sets the desired DWR/DWA interval. The default interval is 30 seconds as per RFC3539 section 3.4.1

Parameters:
interval - DWR interval in milliseconds
Throws:
InvalidSettingException - If the interval is less than 6000 milliseconds
Since:
0.9.3

idleTimeout

public long idleTimeout()
Returns the idle timeout (in milliseconds)

Since:
0.9.3

setIdleTimeout

public void setIdleTimeout(long timeout)
                    throws InvalidSettingException
Sets the idle close timeout. The default idle timeout is 7 days, after which the connection will closed with reason='busy' unless there has been non-watchdog traffic on the connection.

Parameters:
timeout - Timeout in milliseconds. If 0 then idle timeout is disabled and connections will be kept open.
Throws:
InvalidSettingException - If timeout is negative.
Since:
0.9.3

useTCP

public Boolean useTCP()
Returns the setting for using TCP.

Returns:
A boolean object, or null if not set.
Since:
0.9.5

setUseTCP

public void setUseTCP(Boolean use_tcp)
Change the setting for using TCP Sets the setting to the spciefied value, which can be null. When the setting is:
true
then the stack will create a TCP sub-node.
false
then the stack will not create a TCP sub-node.
null
then the stack will use the a property instead (see Node for details}.

Parameters:
use_tcp - New TCP use setting. Can be null.
Since:
0.9.5

useSCTP

public Boolean useSCTP()
Returns the setting for using SCTP.

Returns:
A boolean object, or null if not set.
Since:
0.9.5

setUseSCTP

public void setUseSCTP(Boolean use_sctp)
Change the setting for using SCTP Sets the setting to the spciefied value, which can be null. When the setting is:
true
then the stack will create a SCTP sub-node.
false
then the stack will not create a SCTP sub-node.
null
then the stack will use the a property instead (see Node for details}.

Parameters:
use_sctp - New SCTP use setting. Can be null.
Since:
0.9.5

TCPPortRange

public void TCPPortRange(NodeSettings.PortRange port_range)
                  throws InvalidSettingException
Set the source port range for outgoing TCP connections If the source port range is no tset (default) then the stack will use an ephemeral source port. Specifying the source prot range can be useful in some environments where there are restictive NAT issues, or where the firewall administrator cannot accomodate a free soruce port range.

Parameters:
port_range - A source port range to use for initiating outgoing TCP connections.
Throws:
InvalidSettingException
Since:
0.9.6.8

TCPPortRange

public void TCPPortRange(int min,
                         int max)
                  throws InvalidSettingException
Set the source port range for outgoing TCP connections

Throws:
InvalidSettingException
Since:
0.9.6.8
See Also:
TCPPortRange(PortRange)

TCPPortRange

public NodeSettings.PortRange TCPPortRange()
Get the source port range for outgoing TCP connections

Returns:
A PortRange object, or null
Since:
0.9.6.8