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 Diameter node and the remote Diameter peer 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 Diameter messages that's passed through encode/decode and transport. Fields should not be set in return values except as documented.
A term identifying a transport connection with a Diameter peer.
A tuple representing a Diameter peer connection.
The state maintained by the application callback functions
Invoked to signal the availability of a peer connection.
In particular, capabilities exchange with the peer has indicated
support for the application in question, the RFC 3539 watchdog state
machine for the connection has reached state
A watchdog state machine can reach state
There is no requirement that a callback return before incoming
requests are received:
Invoked to signal that a peer connection is no longer available
following a previous call to
Invoked as a consequence of a call to
The candidate list contains only those peers that have advertised
support for the Diameter application in question during capabilities
exchange, that have not be excluded by a
A callback that returns a peer() will be followed by a
Returning
The return values
The return value
Invoked to return a request for encoding and transport.
Allows the sender to use the selected peer's capabilities
to modify the outgoing request.
Many implementations may simply want to return
A returned
A returned
A returned
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 decoded answer record and undecoded binary are in the
For any given call to
By default, an incoming answer message that cannot be successfully
decoded causes the request process to fail, causing
Invoked when an error occurs before an answer message is received
in response to an outgoing request.
The return value is returned from
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
#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.
In the case of a
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 in the role of a Diameter relay agent.
If a routing loop is detected then the request is answered with
3005 (DIAMETER_LOOP_DETECTED).
Otherwise a Route-Record AVP (containing the sending peer's Origin-Host) is
added to the request and
The returned
Discard the request. No answer message is sent to the peer.
Handle the request as if
Like
Note that protocol errors detected by diameter will result in an
answer message without