From 7d38b593e8b1624e1ce2cda8fa57a42cdf2d3068 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Fri, 23 Sep 2011 19:55:01 +0200 Subject: Fix and clarify semantics of peer filters An eval filter returning a non-true value caused the call process to fail and the doc was vague on how an exception was treated. Clarify that the non-tuple host/realm filters assume messages of a certain form. Various minor corrections to align code and doc. --- lib/diameter/doc/src/diameter.xml | 37 +++++++++++++++++++++++++++-------- lib/diameter/doc/src/diameter_app.xml | 7 ++++++- 2 files changed, 35 insertions(+), 9 deletions(-) (limited to 'lib/diameter/doc') diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml index 36b6cbf0cf..2cad70e3bc 100644 --- a/lib/diameter/doc/src/diameter.xml +++ b/lib/diameter/doc/src/diameter.xml @@ -277,6 +277,10 @@ callback.

+

+An invalid option will cause call/4 +to fail.

+ @@ -405,6 +409,8 @@ sense.

eval([{M,F,A} | T]) -> apply(M, F, T ++ A); +eval([[F|A] | T]) -> + eval([F | T ++ A]); eval([F|A]) -> apply(F, A); eval(F) -> @@ -461,14 +467,14 @@ or any peer if the request does not contain a Destination-Realm AVP.

-{host, any|UTF8String()} +{host, any|DiameterIdentity()}

Matches only those peers whose Origin-Host has the specified value, or all peers if the atom any.

-{realm, any|UTF8String() +{realm, any|DiameterIdentity()

Matches only those peers whose Origin-Realm has the @@ -478,8 +484,9 @@ value, or all peers if the atom any.

{eval, evaluable()}

-Matches only those peers for which the specified evaluable() evaluates -to true on the peer's diameter_caps record.

+Matches only those peers for which the specified evaluable() returns +true on the connection's diameter_caps record. +Any other return value or exception is equivalent to false.

{neg, peer_filter()} @@ -503,6 +510,21 @@ specified list.

+

+Note that the host and realm filters examine the +outgoing request as passed to call/4, +assuming that this is a record- or list-valued message() as documented +in diameter_app(3), and that +the message contains at most one of each AVP. +If this is not the case then the {host|realm, DiameterIdentity()} +filters must be used to achieve the desired result. +Note also that an empty host/realm (which should not be typical) +is equivalent to an unspecified one for the purposes of filtering.

+ +

+An invalid filter is equivalent to {any, []}, a filter +that matches no peer.

+
@@ -787,7 +809,7 @@ transports.

SvcName = service_name() App = application_alias() -Request = diameter_app:message() +Request = diameter_app:message() | term() Answer = term() Options = [call_opt()] @@ -819,9 +841,8 @@ If there are no suitable peers, or if pick_peer/4 rejects them by returning 'false', then {error, no_connection} is returned. -If pick_peer/4 -selects a candidate peer then a request process is spawned for the -outgoing request, in which there is a +Otherwise pick_peer/4 +is followed by a prepare_request/3 callback, the message is encoded and sent.

diff --git a/lib/diameter/doc/src/diameter_app.xml b/lib/diameter/doc/src/diameter_app.xml index fc359b9d1d..f2bada84ae 100644 --- a/lib/diameter/doc/src/diameter_app.xml +++ b/lib/diameter/doc/src/diameter_app.xml @@ -269,7 +269,12 @@ The candidate peers list will only include those which are selected by any filter option specified in the call to diameter:call/4, and only those which have indicated support for the Diameter application in -question.

+question. +The order of the elements is unspecified except that any +peers whose Origin-Host and Origin-Realm matches that of the +outgoing request (in the sense of a {filter, {all, [host, realm]}} +option to diameter:call/4) +will be placed at the head of the list.

The return values false and {false, State} are -- cgit v1.2.3