From f472ddbedec007b37fff5b40a379b97656f15bce Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Fri, 12 Oct 2012 02:51:34 +0200 Subject: Document transport_opt() disconnect_cb Callback makes sending of DPR configurable. --- lib/diameter/doc/src/diameter.xml | 149 +++++++++++++++++++++++----- lib/diameter/doc/src/diameter_transport.xml | 6 +- 2 files changed, 128 insertions(+), 27 deletions(-) diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml index 80863f8eff..e1442a108e 100644 --- a/lib/diameter/doc/src/diameter.xml +++ b/lib/diameter/doc/src/diameter.xml @@ -822,6 +822,7 @@ request a connection with one peer over SCTP or another To listen on both SCTP and TCP, define one transport for each.

+ {applications, [application_alias()]}

@@ -831,6 +832,7 @@ Defaults to all applications configured on the service in question. Applications not configured on the service in question are ignored.

+ {capabilities, [capability()]}

@@ -845,33 +847,136 @@ TLS is desired over TCP as implemented by diameter_tcp(3).

+ {capabilities_cb, evaluable()}

A callback invoked upon reception of CER/CEA during capabilities exchange in order to ask whether or not the connection should be accepted. -Applied to the relevant transport_ref() and the -#diameter_caps{} record of the connection. -Returning ok accepts the connection. -Returning integer() causes an incoming -CER to be answered with the specified Result-Code. -Returning discard causes an incoming CER to -be discarded. -Returning unknown is equivalent to returning 3010, -DIAMETER_UNKNOWN_PEER. -Returning anything but ok or a 2xxx series result -code causes the transport connection to be broken.

+Applied to the transport_ref() and +#diameter_caps{} record of the connection.

+ +

+The return value can have one of the following types.

+ +ok + +

+Accept the connection.

+
+ +integer() + +

+Causes an incoming CER to be answered with the specified Result-Code.

+
+ +discard + +

+Causes an incoming CER to be discarded without CEA being sent.

+
+ +unknown +

+Equivalent to returning 3010, DIAMETER_UNKNOWN_PEER.

+
+
+ +

+Returning anything but ok or a 2xxx series result +code causes the transport connection to be broken. Multiple capabilities_cb options can be specified, in which case the corresponding callbacks are applied until either all return ok or one does not.

+
- + +{disconnect_cb, evaluable()} + + +

+A callback invoked prior to requesting shutdown of a transport process +for a transport connection having watchdog state OKAY. +Applied to Reason=transport|service|application and the +transport_ref() and +diameter_app:peer() +in question, Reason indicating whether the the diameter +application is being stopped, the service in question is being stopped +at diameter:stop_service/1 or +the transport in question is being removed at diameter:remove_transport/2, +respectively.

+ +

+The return value can have one of the following types.

+ + +{dpr, [option()]} + +

+Causes Disconnect-Peer-Request to be sent to the peer, transport +process shutdown being requested after reception of +Disconnect-Peer-Answer or timeout. +An option() can be one of the following.

+ + +{timeout, integer()} + +

+Transport process shutdown will be requested after this number of +milliseconds if DPA is not received. +Defaults to 1000.

+{cause, 0|rebooting|1|busy|2|goaway} + +

+The Disconnect-Cause to send, REBOOTING, BUSY and +DO_NOT_WANT_TO_TALK_TO_YOU respectively. +Defaults to rebooting for Reason=service|application and +goaway for Reason=transport.

+
+
+
+ +dpr + +

+Equivalent to {dpr, []}.

+
+ +close + +

+Causes transport process shutdown to be requested without +Disconnect-Peer-Request being sent to the peer.

+
+ +ignore + +

+Equivalent to not having configured the callback.

+
+
+ +

+Multiple disconnect_cb options can be specified, in which +case the corresponding callbacks are applied until one of them returns +a value other than ignore. +All callbacks returning ignore is equivalent to not having +configured them.

+ +

+Defaults to a single callback returning dpr.

+
+ + {watchdog_timer, TwInit} @@ -891,10 +996,9 @@ the callback.

An integer value must be at least 6000 as required by RFC 3539. Defaults to 30000 if unspecified.

- -
+ {reconnect_timer, Tc} @@ -1185,15 +1289,12 @@ Pred = {M,F,A}: fun(Ref, Type, Opts) -> apply(M, F, [Ref, Type, Opts | A]) end

-Removing a transport causes all associated transport connections to -be broken. -A DPR message with -Disconnect-Cause DO_NOT_WANT_TO_TALK_TO_YOU will be sent -to each connected peer before disassociating the transport configuration -from the service and terminating the transport upon reception of -DPA or timeout.

- - +Removing a transport causes the corresponding transport processes to +be asked to terminate. +Whether or not a DPR message is sent to a peer is +controlled by +value of disconnect_cb +configured on the transport.

diff --git a/lib/diameter/doc/src/diameter_transport.xml b/lib/diameter/doc/src/diameter_transport.xml index d9b36a1e09..0c8b41397a 100644 --- a/lib/diameter/doc/src/diameter_transport.xml +++ b/lib/diameter/doc/src/diameter_transport.xml @@ -149,9 +149,9 @@ contains the binary to send.

{diameter, {close, Pid}}

-A request to close the transport connection. -The transport process should terminate after closing the -connection. +A request to terminate the transport process after having received DPA +in response to DPR. +The transport process should exit. Pid is the pid() of the parent process.

-- cgit v1.2.3