From 98836f68bd01ef82df5b9816a3ff065f02e50156 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Thu, 4 Oct 2012 19:12:05 +0200 Subject: Document eval_packet --- lib/diameter/doc/src/diameter_app.xml | 67 +++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 18 deletions(-) (limited to 'lib/diameter') diff --git a/lib/diameter/doc/src/diameter_app.xml b/lib/diameter/doc/src/diameter_app.xml index 4a4b212787..98c8b8c807 100644 --- a/lib/diameter/doc/src/diameter_app.xml +++ b/lib/diameter/doc/src/diameter_app.xml @@ -325,32 +325,44 @@ or peer_down/3 callback.

Packet = packet() SvcName = diameter:service_name() Peer = peer() -Action = {send, packet() | message()} | {discard, Reason} | discard +Action = Send | Discard | {eval_packet, Action, PostF} +Send = {send, packet() + | message()} +Discard = {discard, Reason} | discard +PostF = + diameter:evaluable()}

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) Destination-Host and/or -Destination-Realm in the outgoing request, although the -callback need not be limited to this usage. +Allows the sender to use the selected peer's capabilities +to modify the outgoing request. Many implementations may simply want to return {send, Packet}

-A returned packet() should set the request to be encoded in its +A returned packet() should set the +request to be encoded in its msg field and can set the transport_data field in order -to pass information to the transport module. +to pass information to the transport process. Extra arguments passed to diameter:call/4 can be used to -communicate transport data to the callback. -A returned packet() can also set the header field to a -#diameter_header{} record in order to specify values that should -be preserved in the outgoing request, although this should typically -not be necessary and allows the callback to set header values -inappropriately. +communicate transport (or any other) data to the callback.

+ +

+A returned packet() can set +the header field to a +#diameter_header{} in order to specify values that should +be preserved in the outgoing request, values otherwise being those in +the header record contained in Packet. A returned length, cmd_code or application_id is ignored.

+

+A returned PostF will be evaluated on any encoded +#diameter_packet{} prior to transmission, the bin field +of this record containing the encoded binary. +The return value is ignored.

+

Returning {discard, Reason} causes the request to be aborted and the .

-Mod:prepare_retransmit(Packet, SvcName, Peer) -> Result +Mod:prepare_retransmit(Packet, SvcName, Peer) -> Action Return a request for encoding and retransmission. Packet = packet() SvcName = diameter:service_name() -Peer = peer() -Result = {send, packet() | message()} | {discard, Reason} | discard +Peer = peer() +Action = Send | Discard | {eval_packet, Action, PostF} +Send = {send, packet() + | message()} +Discard = {discard, Reason} | discard +PostF = + diameter:evaluable()}

@@ -484,7 +501,11 @@ callback returned false.

Packet = packet() SvcName = term() Peer = peer() -Action = Reply | {relay, [Opt]} | discard | {eval, Action, PostF} +Action = Reply + | {relay, [Opt]} + | discard + | {eval, Action, PostF} + | {eval_packet, Action, PostF} Reply = {reply, message()} | {protocol_error, 3000..3999} Opt = diameter:call_opt() @@ -610,7 +631,17 @@ Discard the request.

Handle the request as if Action has been returned and then -evaluate PostF in the request process.

+evaluate PostF in the request process. +The return value is ignored.

+
+ +{eval_packet, Action, PostF} + +

+Like eval but evaluate PostF on any encoded +#diameter_packet{} prior to transmission, the bin field +of this record containing the encoded binary. +The return value is ignored.

-- cgit v1.2.3