diameter_sctp

Diameter transport over SCTP.

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).

Functions


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

  • Type = connect | accept
  • Ref = reference()
  • Svc = #diameter_service{}
  • Opt = {raddr, ip_address()} | {rport, integer()} | term()
  • Pid = pid()
  • LAddr = 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 connector and not valid for a listener. The former is required while latter defaults to 3868 if unspecified. More than one raddr option can be specified, in which case the connector 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 on the service are used. (In particular, one of these must be specified.) Option port defaults to 3868 for a listener and 0 for a connector.

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 of by specifying 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 then increments this modulo the total number outbound streams. That is, successive values of undefined cycle through all outbound streams.

View Functions