User's Guide
Reference Manual
Release Notes
PDF
Top

Diameter
Reference Manual
Version 1.2

Expand All
Contract All

Table of Contents

- diameter
  - Top of manual page
  - add_transport/2
  - call/4
  - origin_state_id/0
  - remove_transport/2
  - service_info/2
  - services/0
  - session_id/1
  - start/0
  - start_service/2
  - stop/0
  - stop_service/1
  - subscribe/1
  - unsubscribe/1
- diameterc
- diameter_app
  - Top of manual page
  - Mod:peer_up/3
  - Mod:peer_down/3
  - Mod:pick_peer/4
  - Mod:prepare_request/3
  - Mod:prepare_retransmit/3
  - Mod:handle_answer/4
  - Mod:handle_error/4
  - Mod:handle_request/3
- diameter_dict
- diameter_transport
  - Top of manual page
  - Mod:start/3
- diameter_tcp
  - Top of manual page
  - start/3
- diameter_sctp
  - Top of manual page
  - start/3

# diameter_sctp

### MODULE

diameter_sctp

### MODULE SUMMARY

Diameter transport over SCTP.

### DESCRIPTION

This module implements diameter transport over SCTP using gen_sctp. It can be specified as the value of a transport_module option to diameter:add_transport/2 and implements the behaviour documented in diameter_transport(3).

### EXPORTS

start({Type, Ref}, Svc, [Opt]) -> {ok, Pid, [LAddr]} | {error, Reason}

Types:

Type = connect | accept
Ref = diameter:transport_ref()
Svc = #diameter_service{}
Opt = {raddr, inet:ip_address()} | {rport, integer()} | term()
Pid = pid()
LAddr = inet:ip_address()
Reason = term()

The start function required by diameter_transport(3).

The only diameter_sctp-specific argument is the options list. Options raddr and rport specify the remote address and port for a connecting transport and not valid for a listening transport: the former is required while latter defaults to 3868 if unspecified. More than one raddr option can be specified, in which case the connecting transport in question attempts each in sequence until an association is established. Remaining options are any accepted by gen_sctp:open/1, with the exception of options mode, binary, list, active and sctp_events. Note that options ip and port specify the local address and port respectively.

Multiple ip options can be specified for a multihomed peer. If none are specified then the values of Host-IP-Address in the #diameter_service{} record are used. (In particular, one of these must be specified.) Option port defaults to 3868 for a listening transport and 0 for a connecting transport.

Warning

An insufficiently large receive buffer may result in a peer having to resend incoming messages: set the inet(3) option recbuf to increase the buffer size.

An insufficiently large send buffer may result in outgoing messages being discarded: set the inet(3) option sndbuf to increase the buffer size.

diameter_sctp uses the transport_data field of the #diameter_packet{} record to communicate the stream on which an inbound message has been received, or on which an outbound message should be sent: the value will be of the form {stream, Id} on an inbound message passed to a handle_request or handle_answer callback. For an outbound message, either undefined (explicitly or by receiving the outbound message as a binary()) or a tuple should be set in the return value of handle_request (typically by retaining the value passed into this function) or prepare_request. The value undefined uses a "next outbound stream" id and increments this modulo the total number outbound streams. That is, successive values of undefined cycle through all outbound streams.

### SEE ALSO

diameter_transport(3), gen_sctp(3), inet(3)