start/3'> gen_tcp:connect/3'> gen_tcp:listen/2'> inet:ip_address()'> ssl:connect/2'> ssl:connect/3'> ssl:ssl_accept/2'> ssl:listen/2'> gen_tcp(3)'> inet(3)'> ssl(3)'> %also; %here; ]>
20112013 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. diameter_tcp(3) Anders Svensson diameter_tcp.xml
diameter_tcp Diameter transport over TCP.

This module implements diameter transport over TCP using &gen_tcp;. It can be specified as the value of a transport_module option to &mod_add_transport; and implements the behaviour documented in &man_transport;. TLS security is supported, either as an upgrade following capabilities exchange or at connection establishment.

Note that the ssl application is required for TLS and must be started before configuring TLS capability on diameter transports.

start({Type, Ref}, Svc, [Opt]) -> {ok, Pid} | {ok, Pid, [LAddr]} | {error, Reason} Start a transport process. Type = connect | accept Ref = &mod_transport_ref; Svc = #diameter_service{} Opt = OwnOpt | SslOpt | TcpOpt Pid = pid() LAddr = &ip_address; Reason = term() OwnOpt = {raddr, &ip_address;} | {rport, integer()} | {accept, Match} | {port, integer()} | {fragment_timer, infinity | 0..16#FFFFFFFF} SslOpt = {ssl_options, true | list()} TcpOpt = term() Match = &ip_address; | string() | [Match]

The start function required by &man_transport;.

Options raddr and rport specify the remote address and port for a connecting transport and are not valid for a listening transport.

Option accept specifies remote addresses for a listening transport and is not valid for a connecting transport. If specified, a remote address that does not match one of the specified addresses causes the connection to be aborted. Multiple accept options can be specified. A string-valued Match that does not parse as an address is interpreted as a regular expression.

Option ssl_options must be specified for a transport that should support TLS: a value of true results in a TLS handshake immediately upon connection establishment while list() specifies options to be passed to &ssl_connect2; or &ssl_accept2; after capabilities exchange if TLS is negotiated.

Option fragment_timer specifies the timeout, in milliseconds, of a timer used to flush messages from the incoming byte stream even if the number of bytes indicated in the Message Length field of its Diameter Header have not yet been accumulated: such a message is received over the transport interface after two successive timeouts without the reception of additional bytes. Defaults to 1000.

Remaining options are any accepted by &ssl_connect3; or &gen_tcp_connect3; for a connecting transport, or &ssl_listen2; or &gen_tcp_listen2; for a listening transport, depending on whether or not {ssl_options, true} has been specified. Options binary, packet and active cannot be specified. Also, option port can be specified for a listening transport to specify the local listening port, the default being the standardized 3868 if unspecified. Note that the option ip specifies the local address.

An ssl_options list must be specified if and only if the transport in question has set Inband-Security-Id to 1 (TLS), as specified to either &mod_start_service; or &mod_add_transport;, so that the transport process will receive notification of whether or not to commence with a TLS handshake following capabilities exchange. Failing to specify an options list on a TLS-capable transport for which TLS is negotiated will cause TLS handshake to fail. Failing to specify TLS capability when ssl_options has been specified will cause the transport process to wait for a notification that will not be forthcoming, which will eventually cause the RFC 3539 watchdog to take down the connection.

If an ip option is not specified then the first element of a non-empty Host-IP-Address list in Svc provides the local IP address. If neither is specified then the default address selected by &gen_tcp; is used. In all cases, the selected address is either returned from &start; or passed in a connected message over the transport interface.

SEE ALSO

&man_main;, &man_transport;, &gen_tcp;, &inet;, &ssl;