A diameter service as started by
A callback module must export all of the functions documented below. The functions themselves are of three distinct flavours:
The arities given for the the callback functions here assume no extra
arguments.
All functions will also be passed any extra arguments configured with
the callback module itself when calling
A record containing the identities of the local and remote Diameter peers having an established transport connection, as well as the capabilities as determined by capabilities exchange. Each field of the record is a 2-tuple consisting of values for the (local) host and (remote) peer. Optional or possibly multiple values are encoded as lists of values, mandatory values as the bare value.
The representation of a Diameter message as passed to
A third representation allows a message to be specified as a list
whose head is a
A container for incoming and outgoing Diameters message that's passed through encode/decode and transport. Fields of a packet() record should not be set in return values except as documented.
A term identifying a transport connection with a Diameter peer. Should be treated opaquely.
A tuple representing a Diameter peer connection.
The service supporting the Diameter application.
Specified to
The state maintained by the application callback functions
Invoked when a transport connection has been established and a successful capabilities exchange has indicated that the peer supports the Diameter application of the application on which the callback module in question has been configured.
Invoked when a transport connection has been lost following a previous
call to
Invoked as a consequence of a call to
The candidate peers list will only include those
which are selected by any
The return values
Note that there is no guarantee that a
Invoked to return a request for encoding and transport.
Allows the sender to access the selected peer's capabilities
in order to set (for example)
A returned packet() should set the request to be encoded in its
Returning
Invoked to return a request for encoding and retransmission.
Has the same role as
Returning
Invoked when an answer message is received from a peer.
The return value is returned from the call to
The decoded answer record is in the
For any given call to
By default, an incoming answer message that cannot be successfully
decoded causes the request process in question to fail, causing the
relevant call to
Invoked when an error occurs before an answer message is received from
a peer in response to an outgoing request.
The return value is returned from the call to
Reason
Invoked when a request message is received from a peer.
The application in which the callback takes place (that is, the
callback module as configured with
The argument packet() has the following signature.
#diameter_packet{header = #diameter_header{},
avps = [#diameter_avp{}],
msg = record() | undefined,
errors = ['Unsigned32'() | {'Unsigned32'(), #diameter_avp{}}],
bin = binary(),
transport_data = term()}
The
The
The
The semantics of each of the possible return values are as follows.
Send the specified answer message to the peer.
Send an answer message to the peer containing the specified protocol error. Equivalent to
{reply, ['answer-message' | Avps]
where
Note that RFC 3588 mandates that only answers with a 3xxx series
Result-Code (protocol errors) may set the E bit.
Returning a non-3xxx value in a
Relay a request to another peer.
The appropriate Route-Record AVP will be added to the relayed request
by diameter and
The returned
Discard the request.
Handle the request as if
Note that diameter will respond to protocol errors in an incoming
request without invoking