App Config (TCP/UDP/SCTP Sub-Classes)
Overview
Serveral Application types implement UDP or TCP/SCTP connectivity based on the TcpApp base class.
In addition to the common Application configuration parameters
and their application-specific attributes, all of these Applications typically require UDP/TCP/SCTP configuration
as indicated here.
<?xml version="1.0" encoding="utf-8"?>
<n2svcd>
...
<applications>
...
<application name="(name)" module="(module)">
<include><lib>/path/to/library</lib></include>
<parameters>
<!-- application-specific parameters -->
...
<!-- TCP/UDP application parameters (server example) -->
<parameter name="listen_queue" value="20"/>
<parameter name="local_hosts" value="192.168.10.10"/>
<parameter name="local_port" value="8118"/>
<parameter name="local_timeout_secs" value="2.5"/>
...
<!-- TCP/UDP application parameters (client example, identical) -->
<parameter name="num_client_connections" value="5"/>
<parameter name="local_hosts" value="192.168.10.10"/>
<parameter name="remote_hosts" value="192.168.10.44"/>
<parameter name="remote_port" value="8080"/>
<parameter name="reconnect_interval" value="60"/>
<parameter name="request_unassigned_timeout" value="2"/>
<parameter name="request_remote_timeout" value="5"/>
...
<!-- TCP application parameters (client example, disparate) -->
<parameter name="local_hosts" value="192.168.10.10"/>
<parameter name="remote_hosts" value="prod-prim.telco.com"/>
<parameter name="reconnect_interval" value="60"/>
<parameter name="request_unassigned_timeout" value="2"/>
<parameter name="request_remote_timeout" value="5"/>
...
<!-- SSL configuration for a simple SSL-encrypted server -->
<parameter name="ssl" value="yes"/>
<parameter name="ssl.SSL_cert_file" value="../etc/ssl/localhost.crt"/>
<parameter name="ssl.SSL_key_file" value="../etc/ssl/localhost.key"/>
...
<!-- SSL configuration for a simple SSL-encrypted client using self-generated CA -->
<parameter name="ssl" value="yes"/>
<parameter name="ssl.SSL_ca_file" value="../etc/ssl/localhost.crt"/>
</parameters>
<config>
<client_connections>
<client_connection remote_port="8080"/>
<client_connection remote_port="8081"/>
<client_connection remote_port="8082"/>
<client_connection remote_port="8080"
remote_hosts="prod-sec.telco.com" local_hosts="192.168.11.10" priority="2"/>
</client_connections>
</config>
</application>
...
</applications>
...
</n2svcd>
Here are the currently-available productised sub-classes of TcpApp.
| Application | UDP or Stream | Transient or Permanent | Socket Mode | Request Direction | Ping Supported | Multiplexed |
|---|---|---|---|---|---|---|
| DnsClientApp | UDP | N/A | N/A | Outbound-Only | No | Yes |
| DnsServerApp | UDP | N/A | N/A | Inbound-Only | No | Yes |
| RadiusApp | UDP | N/A | N/A | Inbound-or Outbound | No | Yes |
| RestClientApp | Stream | Transient | Client-Only | Outbound-Only | Configurable | No |
| SoapClientApp | Stream | Transient | Client-Only | Outbound-Only | No | No |
| RestServerApp | Stream | Transient | Server-Only | Inbound-Only | No | No |
| SoapServerApp | Stream | Transient | Server-Only | Inbound-Only | No | No |
| DiameterApp | Stream | Permanent | Client-or-Server | Inbound-or-Outbound | Yes | Yes |
| SMPPApp | Stream | Permanent | Client-or-Server | Inbound-or-Outbound | Yes | Yes |
The following applications are UDP-only. They bind to a local UDP port and use that to send and receive messages via UDP datagrams.
DnsClientAppDnsServerAppRadiusApp
The following applications are TCP/SCTP Stream Transient Client-mode only.
They perform outbound socket connect on-demand.
They do not pre-establish or maintain Permanent connections.
RestClientAppSoapClientApp
The following applications are TCP/SCTP Stream Transient Server-mode only.
They accept inbound socket requests on-demand, including the potential for keep-alive if requested by the far-end Client.
They do not pre-establish or maintain Permanent connections.
RestServerAppSoapServerApp
The following applications are TCP/SCTP Stream Permanent connections in either Client or Server socket mode. Run-time configuration determines if Client or Socket mode is used.
DiameterAppSMPPApp
Note that the terms “client” and “server” in this context apply purely to the TCP/SCTP socket establishment mode, i.e. a “client” will perform a socket “connect” and a “server” will perform a socket “listen”/“accept”.
Furthermore, each application has specific capabilities in terms of whether they can support the sending of an Outbound Request message, and/or receive an Inbound Request message. Applications such as DiameterApp and SMPPApp for example can support Inbound and/or Outbout Requests, regardless of the direction of the initial socket establishment.
Configuration Details
The application element attributes for all TCP Application instances are as below. For details of the various parameter
types used, refer to Common Configuration.
| Parameter Name | Type | XML Type | Description |
|---|---|---|---|
parameters
|
Array | Element |
[Required] As per Common Configuration Application
parameters.
|
socket_mode
|
connect / listen
|
Attribute |
Applies To: **Stream, Permanent, Client-or-Server** (not UDP, not Transient, not Server-Only, not Client-Only). Such applications must be configured to use either Server sockets or Client sockets at run-time (not mixed). Not applicable to Transient connection applications, nor to UDP, nor single-direction applications. (Default = connect)
|
stream_proto
|
TCP / SCTP
|
Attribute |
Applies To: **Stream** (not UDP). Specify which stream protocol will be used for all connections in this application. It is not possible to mix TCP and SCTP connections within a configuration application. (Default = TCP)
|
listen_queue
|
Integer | Attribute |
Applies To: **Stream, Server, TCP** (not UDP, not Client, not SCTP). Backlog of pending accepts on the listen socket when socket_mode is listen.This value may need to be increased when operating under heavy load. (Default = 10)
|
local_hosts /local_host
|
String | Attribute |
Applies To: **All**. Local Host Names or A.B.C.D IPv4 Addresses for socket local address binding. For TCP only one entry is permitted. For SCTP, multiple local bind hosts may be specified. (Default = 0.0.0.0)
|
local_port
|
1> - 65535
|
Attribute |
Applies To: **All**. Local IPv4 Port Number. Using this option in TCP/SCTP Client mode will cause a port confict if num_client_connections is > 1.(Server Default = application-specific default) (Client Default = system-allocated ephemeral port) |
remote_hosts /remote_host
|
String | Attribute |
Applies To: **UDP or Stream Client**. Remote Host Names or A.B.C.D IPv4 Addresses for socket remote address binding. For TCP only one entry is permitted. For SCTP, multiple remote connect hosts may be specified. [Required] for TCP/SCTP Client unless using the client_connections configuration.
|
remote_port
|
1> - 65535
|
Attribute |
Applies To: **UDP or Stream Client**. IPv4 Port Number to connect to. [Required] for TCP Client unless using the client_connections configuration.
|
default_udp_so_rcvbufdefault_so_rcvbuf
|
Positive Integer | Attribute |
Applies To: **UDP**. The default value to apply for Socket Option so_rcvbuf for new UDP sockets.(Default = The default operating-system-configured settings apply) |
default_udp_so_sndbuf
default_so_sndbuf
|
Positive Integer | Attribute |
Applies To: **UDP**. The default value to apply for Socket Option so_sndbuf for new UDP sockets.(Default = The default operating-system-configured settings apply) |
default_tcp_so_rcvbuf
default_so_rcvbuf
|
Positive Integer | Attribute |
Applies To: **TCP** (not SCTP). The default value to apply for Socket Option so_rcvbuf for new TCP connections.This value will be applied to both client and server TCP socket connections. (Default = The default operating-system-configured settings apply) |
default_tcp_so_sndbuf
default_so_sndbuf
|
Positive Integer | Attribute |
Applies To: **TCP** (not SCTP). The default value to apply for Socket Option so_sndbuf for new TCP connections.This value will be applied to both client and server TCP socket connections. (Default = The default operating-system-configured settings apply) |
default_tcp_nodelay
|
Boolean | Attribute |
Applies To: **TCP** (not SCTP). Set to a "true" value to enable TCP No-Delay by default on TCP our TCP endpoint sockets. This value will be applied to both client and server TCP socket connections. (Default = The default operating-system-configured settings apply) |
default_sctp_sndrcv_buffer
|
Positive Integer | Attribute |
Applies To: **SCTP** (not TCP). The default value to apply for SCTP Socket Option sndrcv_buffer for new connections.This value will be applied to both client and server SCTP socket connections. (Default = The default operating-system-configured settings apply) |
ssl
|
Boolean | Attribute |
Applies To: **Stream** (not UDP). Set to a "true" value for the Application to apply SSL/TLS all client and server connections. SSL is not supported for UDP sockets. (Default = false)
|
ssl.SSL_verify_mode
|
0 / 1
|
Attribute |
Applies To: **Stream with SSL** (not UDP). Whether the Application should verify the Peer's certificate. 1 (Verify Server's Certificate) or 0 (Do not verify Server's Certificate).Not supported for UDP. (Server Default = 0, Client Default = 1)
|
ssl.SSL_ca_file
|
String | Attribute |
Applies To: **Stream with SSL** (not UDP). Use the Certificate Authority certificates contained in the indicated file. Not supported for UDP. (Default = Use system default Certificate Authorities) |
ssl.SSL_ca_path
|
String | Attribute |
Applies To: **Stream with SSL** (not UDP). Use all Certificate Authority files contained in the indicated directory. Multiple directories may be delimited by the : character.Not supported for UDP. (Default = Use system default Certificate Authorities) |
ssl.SSL_cert_file
|
String | Attribute |
Applies To: **Stream with SSL** (not UDP). Use the certificate contained in this file. Not supported for UDP. (Server Default = Use system default certificate, Client Default = Do not present a certificate) |
ssl.SSL_key_file
|
String | Attribute |
Applies To: **Stream with SSL** (not UDP). Use the key contained in this file. Not supported for UDP. (Server Default = Use system default key, Client Default = Do not use a key file) |
ssl.SSL_server_name
|
String | Attribute |
Applies To: **Stream Client with SSL** (not UDP, not Server). Include a Server Name Indication (SNI) extension with this value in the SSL/TLS ClientHello message. Not supported for UDP. (Default = Do not include an SNI extension in the SSL/TLS ClientHello message.) |
num_client_connections
|
Positive Integer | Attribute |
Applies To: **Stream Client with SSL** (not UDP, not Server). Number of simultaneous TCP client connections opened when socket_mode = connect.(Default = 1)
|
ping_interval
|
Integer | Attribute |
Applies To: **Permanent Connection, or Transient Client**. Time in seconds between sending the Application's protocol-specific ping message to check each Permanent connection or Transient end-point. Note that not all applications support sending pings. Refer to the table above. Ping is never enabled by default even for applications which support Ping - you must explicitly configure a ping_interval with a value greater than zero in order to enable ping functionality.(Default = 0)
|
ping_always
|
Boolean | Attribute |
Applies To: **Permanent Connection, or Transient Client**. Whether the Application's protocol-specific ping message should always be sent, even when the connection is active with user messages. When ping_always is set to true then only Ping messages will count
for the purpose of determining that a Permanent connection or Transient endpoint is active.When ping_always is set to false then User messages count as Ping messages
for the purpose of determining that a Permanent connection or Transient endpoint is active.(Default = false, User messages are counted as Ping messages)
|
reconnect_interval
|
1 - 3600
|
Attribute |
Applies To: **Permanent Client, Transient Clients without Ping** (not Server). For Permanent Client connections (with or without Ping) this is the per-connection hold-off time between attempts to establish each individual outbound stream connection. For Transient Client connections to end-points where Ping is not used, this is the hold-off time during which we will not attempt to open any new Transient connection to an endpoint following connection failure. For Transient Client connections using Ping, the ping_interval parameter is used instead of this value.(Default = 5 seconds)
|
request_unassigned_timeout /
backlog_timeout
|
Positive Integer | Attribute |
Applies To: **Outbound Requests**. Maximum time an Outbound Request may sit in the "unassigned requests queue" waiting for a free connection before the send attempt is considered to have failed. When `max_send_attempts > 1` then this specifies the maximum pre-assignment delay per each send attempt. (Default = 5 seconds)
|
request_remote_timeout /
server_timeout
|
Positive Integer | Attribute |
Applies To: **Outbound Requests**. Maximum time from the sending of an Outbound Request into the connection with no received Response before the Request send attempt is considered to have failed. The maximum total possible delay for each Request send attempt is the sum of request_unassigned_timeout + request_remote_timeout.When `max_send_attempts > 1` then this specifies the maximum sent-no-response delay per each send attempt. (Default = 5)
|
request_max_send_attempts /
max_send_attempts
|
Positive Integer | Attribute |
Applies To: **Outbound Requests**. Maximum number of attempts for sending each User request. This includes the original attempt, plus none or more retries. A value of 1 means that only one attempt is made for each Outbound User Request, with no retries.This parameter is not applicable for Ping, Login, or Logout Requests (these Requests are sent only once). This parameter is not applicable for Response sending (each Response is sent only once). An error during the process of encoding the Outbound Request is considered fatal and will not be retried. The request_unassigned_timeout and request_remote_timeout timers are
reset for each attempt, hence the maximum total delay which the request initiator should expect
to wait for the entire request/response process including retries will be
(request_unassigned_timeout + request_remote_timeout) * request_max_send_attempts,
plus IPC message-queue latency and timer granularity margins.(Default = 2, being one initial attempt plus one retry)
|
request_connection_backlog /
connection_backlog
|
Positive Integer | Attribute |
Applies To: **Outbound Requests** for multiplexed protocols. Number of simultaneous in-progress Outbound User Requests that may be in-flight per stream connection, or globally for UDP. Once this number of outstanding Outbound User Requests is reached, no further Requests will be assigned until outstanding requests are completed or timed-out. This does not apply to Responses, nor to Ping, Login, or Logout Requests. (Default = 50 global for UDP, 10 per-connection for stream, or other application-specific value)
|
local_timeout_secs /
local_timeout
|
0.1 - 300
|
Attribute |
Applies To: **Inbound Requests**. Number of seconds to wait for internal processing of an inbound User Request to complete before abandoning the Request and performing timeout handling (which typically will return an error Response). (Default = 5.0)
|
warning_queue_above
|
Positive Integer | Attribute |
Any Sub-Class Supporting Outbound Requests. Generate a warning if the number of backlog unqueued requests rises to this value. (Default = 20)
|
notice_queue_below
|
Positive Integer | Attribute |
Any Sub-Class Supporting Outbound Requests. Generate a notice if the number of backlog unqueued requests falls below this value. (Default = 15)
|
report_queue_warning_period
|
Positive Integer | Attribute |
Any Sub-Class Supporting Outbound Requests. The number of seconds between reporting on the queue warning state. (Default = 30)
|
config
|
Object | Element |
Any Sub-Class Supporting Outbound Requests. This is a container for extended configuration for the LogicApp. |
client_connections
|
Array of client_connection Objects
|
Element |
Permanent or Transient Client Connections. Defines the configured static Client Connections for this App. This mechanism is used when the client connections are NOT identical within an application, for example when a single TCP Client application is connecting to more than one different remote port and/or remote host. |
client_connection
|
Object | Element | Defines a single Client connection. |
TCP Client Connection
In the simplest case, a TCP Client application will create a single client connection, or will
create multiple identical client connections. In that case the parameters mechanism
will suffice.
However, there are cases where an TCP Client application wishes to connect to disparate remote hosts
and/or ports. In this case the config.client_connections element must be configured
to define two or more client_connection elements.
A client_connection entry within the config.client_connections element of a TCP Client application
has the following attributes:
| Parameter Name | Type | XML Type | Description |
|---|---|---|---|
local_hostslocal_host
|
String | Attribute |
TCP/SCTP Server or TCP/SCTP Client. Local Host Names or A.B.C.D IPv4 Addresses for the explicit TCP/SCTP client connection. For TCP only one entry is permitted. For SCTP, multiple local bind hosts may be specified. (Default = the parameters application default)
|
local_port
|
Positive Integer | Attribute |
TCP Server or TCP Client. Local IPv4 Port Number. Using this option in TCP Client mode will cause a port confict if num_client_connections is > 1.(Default = the parameters application default)
|
remote_hostsremote_host
|
String | Attribute |
TCP/SCTP Client only. Remote Host Names or A.B.C.D IPv4 Addresses to connect to. For TCP only one entry is permitted. For SCTP, multiple remote connect hosts may be specified. (Default = the parameters application default)
|
remote_port
|
Positive Integer | Attribute |
TCP Client only. IPv4 Port Number to connect to. (Default = the parameters application default)
|
priority
|
Integer 1 - 99
|
Attribute |
The priority of this connection compared to the other connections within this application. This is an integer value from 1 (top priority) to 99 (lowest priority).The use of this "priority" for connection selection will vary from application to application. Some applications (particularly those which use transient TCP connections) may ignore this priority value. (Default = 1 best priority)
|
Note that the num_client_connections parameter is incompatible with config.client_connections.