diff options
Diffstat (limited to 'lib/diameter/doc/src')
-rw-r--r-- | lib/diameter/doc/src/.gitignore | 1 | ||||
-rw-r--r-- | lib/diameter/doc/src/Makefile | 19 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter.xml | 871 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_app.xml | 445 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_codec.xml | 389 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_compile.xml | 62 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_dict.xml | 190 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_intro.xml | 11 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_make.xml | 144 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_sctp.xml | 53 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_soc.xml | 30 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_tcp.xml | 69 | ||||
-rw-r--r-- | lib/diameter/doc/src/diameter_transport.xml | 140 | ||||
-rw-r--r-- | lib/diameter/doc/src/files.mk | 4 | ||||
-rw-r--r-- | lib/diameter/doc/src/notes.xml | 214 | ||||
-rw-r--r-- | lib/diameter/doc/src/ref_man.xml | 3 | ||||
-rw-r--r-- | lib/diameter/doc/src/seealso.ent | 132 | ||||
-rw-r--r-- | lib/diameter/doc/src/seehere.sed | 35 |
18 files changed, 1966 insertions, 846 deletions
diff --git a/lib/diameter/doc/src/.gitignore b/lib/diameter/doc/src/.gitignore index feeb378fd8..5776e1cc76 100644 --- a/lib/diameter/doc/src/.gitignore +++ b/lib/diameter/doc/src/.gitignore @@ -1,2 +1,3 @@ /depend.mk +/seehere.ent diff --git a/lib/diameter/doc/src/Makefile b/lib/diameter/doc/src/Makefile index 59ca660797..8ad38ba0d5 100644 --- a/lib/diameter/doc/src/Makefile +++ b/lib/diameter/doc/src/Makefile @@ -16,13 +16,8 @@ # # %CopyrightEnd% -ifneq ($(ERL_TOP),) include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/make/$(TARGET)/otp.mk -else -include $(DIAMETER_TOP)/make/target.mk -include $(DIAMETER_TOP)/make/$(TARGET)/rules.mk -endif include ../../vsn.mk @@ -39,7 +34,8 @@ XML_REF_FILES = $(XML_REF1_FILES) $(XML_REF3_FILES) $(XML_REF4_FILES) XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) \ $(XML_REF_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) + $(XML_PART_FILES) $(XML_CHAPTER_FILES) \ + seealso.ent INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) @@ -98,7 +94,7 @@ html: gifs $(HTML_REF_MAN_FILE) clean clean_docs: clean_pdf clean_html clean_man rm -f errs core *~ - rm -f depend.mk + rm -f depend.mk seehere.ent clean_pdf: rm -f $(PDFDIR)/* @@ -155,11 +151,8 @@ info: # ---------------------------------------------------- # Release Target # ---------------------------------------------------- -ifneq ($(ERL_TOP),) + include $(ERL_TOP)/make/otp_release_targets.mk -else -include $(DIAMETER_TOP)/make/release_targets.mk -endif release_docs_spec: $(LOCAL)docs $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" @@ -178,7 +171,9 @@ release_docs_spec: $(LOCAL)docs release_spec: -depend.mk: depend.sed $(XML_REF_FILES) $(XML_CHAPTER_FILES) Makefile +depend.mk: depend.sed Makefile seealso.ent \ + $(XML_REF_FILES) $(XML_CHAPTER_FILES) + sed -f seehere.sed seealso.ent > seehere.ent (for f in $(XML_REF_FILES) $(XML_CHAPTER_FILES); do \ sed -f $< $$f | sed "s@%FILE%@`basename $$f .xml`@g"; \ done) \ diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml index b8652a7482..b7669b760b 100644 --- a/lib/diameter/doc/src/diameter.xml +++ b/lib/diameter/doc/src/diameter.xml @@ -1,5 +1,16 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY make_ref + '<seealso marker="erts:erlang#make_ref-0">erlang:make_ref/0</seealso>'> + <!ENTITY transport_module + '<seealso marker="diameter_transport">transport module</seealso>'> + <!ENTITY dictionary + '<seealso marker="diameter_dict">dictionary</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -45,19 +56,16 @@ under the License. <p> This module provides the interface with which a user can implement a Diameter node that sends and receives messages using the -Diameter protocol as defined in RFC 3588.</p> +Diameter protocol as defined in &the_rfc;.</p> <p> Basic usage consists of creating a representation of a -locally implemented Diameter node and its capabilities with <seealso -marker="#start_service">start_service/2</seealso>, adding transport -capability using <seealso -marker="#add_transport">add_transport/2</seealso> and sending Diameter -requests and receiving Diameter answers with <seealso -marker="#call">call/4</seealso>. +locally implemented Diameter node and its capabilities with +&start_service;, adding transport capability using +&add_transport; and sending Diameter +requests and receiving Diameter answers with &call;. Incoming Diameter requests are communicated as callbacks to a -<seealso -marker="diameter_app">diameter_app(3)</seealso> callback modules as +&man_app; callback modules as specified in the service configuration.</p> <p> @@ -65,7 +73,7 @@ Beware the difference between <em>diameter</em> (not capitalised) and <em>Diameter</em> (capitalised). The former refers to the Erlang application named diameter whose main api is defined here, the latter to Diameter protocol in the sense of -RFC 3588.</p> +&the_rfc;.</p> <p> The diameter application must be started before calling most functions @@ -89,8 +97,8 @@ in this module.</p> <tag><c>UTF8String()</c></tag> <item> <p> -Types corresponding to RFC 3588 AVP Data Formats. -Defined in <seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso>.</p> +Types corresponding to &the_rfc; AVP Data Formats. +Defined in &dict_data_types;.</p> <marker id="application_alias"/> </item> @@ -100,7 +108,7 @@ Defined in <seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso> <p> A name identifying a Diameter application in service configuration. -Passed to <seealso marker="#call">call/4</seealso> when sending requests +Passed to &call; when sending requests defined by the application.</p> <marker id="application_module"/> @@ -110,23 +118,22 @@ defined by the application.</p> | [Mod | ExtraArgs] | #diameter_callback{}</c></tag> <item> -<code> +<pre> Mod = atom() ExtraArgs = list() -</code> +</pre> <p> -A module implementing the callback interface defined in <seealso -marker="diameter_app">diameter_app(3)</seealso>, along with any +A module implementing the callback interface defined in &man_app;, +along with any extra arguments to be appended to those documented for the interface. Note that extra arguments specific to an outgoing request can be -specified to <seealso marker="#call">call/4</seealso>, in which case +specified to &call;, in which case those are are appended to any module-specific extra arguments.</p> <p> Specifying a <c>#diameter_callback{}</c> record allows individual -functions to be configured in place of the usual <seealso -marker="diameter_app">diameter_app(3)</seealso> callbacks. +functions to be configured in place of the usual &man_app; callbacks. See that module for details.</p> <marker id="application_opt"/> @@ -141,7 +148,7 @@ Has one the following types.</p> <taglist> -<tag><c>{alias, <seealso marker="#application_alias">application_alias()</seealso>}</c></tag> +<tag><c>{alias, &application_alias;}</c></tag> <item> <p> An unique identifier for the application in the scope of the @@ -156,17 +163,15 @@ unspecified.</p> The name of an encode/decode module for the Diameter messages defined by the application. These modules are generated from a specification file whose format is -documented in <seealso -marker="diameter_dict">diameter_dict(4)</seealso>.</p> +documented in &man_dict;.</p> </item> -<tag><c>{module, <seealso marker="#application_module">application_module()</seealso>}</c></tag> +<tag><c>{module, &application_module;}</c></tag> <item> <p> The callback module with which messages of the Diameter application are handled. -See <seealso marker="diameter_app">diameter_app(3)</seealso> for -the required interface and semantics.</p> +See &man_app; for the required interface and semantics.</p> </item> <tag><c>{state, term()}</c></tag> @@ -174,7 +179,7 @@ the required interface and semantics.</p> <p> The initial callback state. The prevailing state is passed to some -<seealso marker="diameter_app">diameter_app(3)</seealso> +&man_app; callbacks, which can then return a new state. Defaults to the value of the <c>alias</c> option if unspecified.</p> </item> @@ -182,14 +187,13 @@ Defaults to the value of the <c>alias</c> option if unspecified.</p> <tag><c>{call_mutates_state, true|false}</c></tag> <item> <p> -Specifies whether or not the <seealso -marker="diameter_app#pick_peer">pick_peer/4</seealso> +Specifies whether or not the &app_pick_peer; application callback can modify the application state, Defaults to <c>false</c> if unspecified.</p> <note> <p> -<seealso marker="diameter_app#pick_peer">pick_peer</seealso> callbacks +&app_pick_peer; callbacks are serialized when these are allowed to modify state, which is a potential performance bottleneck. A simple Diameter client may suffer no ill effects from using mutable @@ -203,10 +207,8 @@ probably avoid it.</p> <p> Determines the manner in which incoming answer messages containing decode errors are handled. -If <c>callback</c> then errors result in a <seealso -marker="diameter_app#handle_answer">handle_answer/4</seealso> -callback in the same fashion as for <seealso -marker="diameter_app#handle_request">handle_request/3</seealso>, with +If <c>callback</c> then errors result in a &app_handle_answer; +callback in the same fashion as for &app_handle_request;, with errors communicated in the <c>errors</c> field of the <c>#diameter_packet{}</c> record passed to the callback. If <c>report</c> then an answer containing errors is discarded @@ -214,7 +216,7 @@ without a callback and a warning report is written to the log. If <c>discard</c> then an answer containing errors is silently discarded without a callback. In both the <c>report</c> and <c>discard</c> cases the return value -for the <seealso marker="#call">call/4</seealso> invocation in +for the &call; invocation in question is as if a callback had taken place and returned <c>{error, failure}</c>.</p> @@ -231,7 +233,7 @@ Defaults to <c>report</c> if unspecified.</p> <item> <p> -Options available to <seealso marker="#call">call/4</seealso> when +Options available to &call; when sending an outgoing Diameter request. Has one of the following types.</p> @@ -247,18 +249,18 @@ itself. Multiple options append to the argument list.</p> </item> -<tag><c>{filter, <seealso marker="#peer_filter">peer_filter()</seealso>}</c></tag> +<tag><c>{filter, &peer_filter;}</c></tag> <item> <p> A filter to apply to the list of available peers before passing them to -the <seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> +the &app_pick_peer; callback for the application in question. Multiple options are equivalent a single <c>all</c> filter on the corresponding list of filters. Defaults to <c>none</c>.</p> </item> -<tag><c>{timeout, <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{timeout, &dict_Unsigned32;}</c></tag> <item> <p> The number of milliseconds after which the request should @@ -269,21 +271,17 @@ Defaults to 5000.</p> <tag><c>detach</c></tag> <item> <p> -Causes <seealso marker="#call">call/4</seealso> to return <c>ok</c> as +Causes &call; to return <c>ok</c> as soon as the request in question has been encoded instead of waiting for and returning -the result from a subsequent -<seealso marker="diameter_app#handle_answer">handle_answer/4</seealso> -or <seealso -marker="diameter_app#handle_error">handle_error/4</seealso> -callback.</p> +the result from a subsequent &app_handle_answer; or +&app_handle_error; callback.</p> </item> </taglist> <p> -An invalid option will cause <seealso marker="#call">call/4</seealso> -to fail.</p> +An invalid option will cause &call; to fail.</p> <marker id="capability"/> </item> @@ -300,36 +298,35 @@ Has one of the following types.</p> <taglist> -<tag><c>{'Origin-Host', <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag> -<tag><c>{'Origin-Realm', <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag> -<tag><c>{'Host-IP-Address', [<seealso marker="diameter_dict#DATA_TYPES">Address()</seealso>]}</c></tag> +<tag><c>{'Origin-Host', &dict_DiameterIdentity;}</c></tag> +<tag><c>{'Origin-Realm', &dict_DiameterIdentity;}</c></tag> +<tag><c>{'Host-IP-Address', [&dict_Address;]}</c></tag> <item> <p> An address list is available to the start function of a -<seealso marker="diameter_transport">transport module</seealso>, which +&transport_module;, which can return a new list for use in the subsequent CER or CEA. Host-IP-Address need not be specified if the transport start function returns an address list.</p> </item> -<tag><c>{'Vendor-Id', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> -<tag><c>{'Product-Name', <seealso marker="diameter_dict#DATA_TYPES">UTF8String()</seealso>}</c></tag> -<tag><c>{'Origin-State-Id', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{'Vendor-Id', &dict_Unsigned32;}</c></tag> +<tag><c>{'Product-Name', &dict_UTF8String;}</c></tag> +<tag><c>{'Origin-State-Id', &dict_Unsigned32;}</c></tag> <item> <p> Origin-State-Id is optional but will be included in outgoing messages sent by diameter itself: CER/CEA, DWR/DWA and DPR/DPA. Setting a value of <c>0</c> (zero) is equivalent to not setting a -value as documented in RFC 3588. -The function <seealso -marker="#origin_state_id">origin_state_id/0</seealso> +value as documented in &the_rfc;. +The function &origin_state_id; can be used as to retrieve a value that is computed when the diameter application is started.</p> </item> -<tag><c>{'Supported-Vendor-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> -<tag><c>{'Auth-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> -<tag><c>{'Inband-Security-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> +<tag><c>{'Supported-Vendor-Id', [&dict_Unsigned32;]}</c></tag> +<tag><c>{'Auth-Application-Id', [&dict_Unsigned32;]}</c></tag> +<tag><c>{'Inband-Security-Id', [&dict_Unsigned32;]}</c></tag> <item> <p> Inband-Security-Id defaults to the empty list, which is equivalent to a @@ -338,9 +335,9 @@ If 1 (= TLS) is specified then TLS is selected if the CER/CEA received from the peer offers it.</p> </item> -<tag><c>{'Acct-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>]}</c></tag> -<tag><c>{'Vendor-Specific-Application-Id', [<seealso marker="diameter_dict#DATA_TYPES">Grouped()</seealso>]}</c></tag> -<tag><c>{'Firmware-Revision', <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{'Acct-Application-Id', [&dict_Unsigned32;]}</c></tag> +<tag><c>{'Vendor-Specific-Application-Id', [&dict_Grouped;]}</c></tag> +<tag><c>{'Firmware-Revision', &dict_Unsigned32;}</c></tag> </taglist> @@ -357,7 +354,7 @@ It is an error to specify duplicate tuples.</p> An expression that can be evaluated as a function in the following sense.</p> -<code> +<pre> eval([{M,F,A} | T]) -> apply(M, F, T ++ A); eval([[F|A] | T]) -> @@ -366,19 +363,21 @@ eval([F|A]) -> apply(F, A); eval(F) -> eval([F]). -</code> +</pre> <p> -Applying an <c><seealso marker="#evaluable">evaluable()</seealso></c> +Applying an <c>&evaluable;</c> <c>E</c> to an argument list <c>A</c> is meant in the sense of <c>eval([E|A])</c>.</p> <warning> <p> -Beware of using fun expressions of the form <c>fun Name/Arity</c> (not -fun Mod:Name/Arity) in situations in which the fun is not short-lived +Beware of using fun expressions of the form <c>fun Name/Arity</c> in +situations in which the fun is not short-lived and code is to be upgraded at runtime since any processes retaining -such a fun will have a reference to old code.</p> +such a fun will have a reference to old code. +In particular, such a value is typically inappropriate in +configuration passed to &start_service; or &add_transport;.</p> </warning> <marker id="peer_filter"/> @@ -387,10 +386,8 @@ such a fun will have a reference to old code.</p> <tag><c>peer_filter() = term()</c></tag> <item> <p> -A filter passed to <seealso marker="#call">call/4</seealso> -in order to select candidate peers for a -<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> -callback. +A filter passed to &call; in order to select candidate peers for a +&app_pick_peer; callback. Has one of the following types.</p> <taglist> @@ -421,42 +418,42 @@ or any peer if the request does not contain a <c>Destination-Realm</c> AVP.</p> </item> -<tag><c>{host, any|<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c></tag> +<tag><c>{host, any|&dict_DiameterIdentity;}</c></tag> <item> <p> Matches only those peers whose <c>Origin-Host</c> has the specified value, or all peers if the atom <c>any</c>.</p> </item> -<tag><c>{realm, any|<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></c></tag> +<tag><c>{realm, any|&dict_DiameterIdentity;</c></tag> <item> <p> Matches only those peers whose <c>Origin-Realm</c> has the specified value, or all peers if the atom <c>any</c>.</p> </item> -<tag><c>{eval, <seealso marker="#evaluable">evaluable()</seealso>}</c></tag> +<tag><c>{eval, &evaluable;}</c></tag> <item> <p> -Matches only those peers for which the specified <c><seealso -marker="#evaluable">evaluable()</seealso></c> returns +Matches only those peers for which the specified +<c>&evaluable;</c> returns <c>true</c> on the connection's <c>diameter_caps</c> record. Any other return value or exception is equivalent to <c>false</c>.</p> </item> -<tag><c>{neg, <seealso marker="#peer_filter">peer_filter()</seealso>}</c></tag> +<tag><c>{neg, &peer_filter;}</c></tag> <item> <p> Matches only those peers not matched by the specified filter.</p> </item> -<tag><c>{all, [<seealso marker="#peer_filter">peer_filter()</seealso>]}</c></tag> +<tag><c>{all, [&peer_filter;]}</c></tag> <item> <p> Matches only those peers matched by each filter in the specified list.</p> </item> -<tag><c>{any, [<seealso marker="#peer_filter">peer_filter()</seealso>]}</c></tag> +<tag><c>{any, [&peer_filter;]}</c></tag> <item> <p> Matches only those peers matched by at least one filter in the @@ -472,15 +469,12 @@ that matches no peer.</p> <note> <p> The <c>host</c> and <c>realm</c> filters examine the -outgoing request as passed to <seealso marker="#call">call/4</seealso>, -assuming that this is a record- or list-valued <c><seealso -marker="diameter_app#message">diameter_app:message()</seealso></c>, +outgoing request as passed to &call;, +assuming that this is a record- or list-valued <c>&codec_message;</c>, and that the message contains at most one of each AVP. -If this is not the case then the <c>{host|realm, <seealso -marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>}</c> +If this is not the case then the <c>{host|realm, &dict_DiameterIdentity;}</c> filters must be used to achieve the desired result. -An empty <c><seealso -marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></c> +An empty <c>&dict_DiameterIdentity;</c> (which should not be typical) matches all hosts/realms for the purposes of filtering.</p> </note> @@ -499,7 +493,7 @@ candidates list.</p> <item> <p> An event message sent to processes that have subscribed to these using -<seealso marker="#subscribe">subscribe/1</seealso>.</p> +&subscribe;.</p> <p> The <c>info</c> field of the event record can have one of the @@ -507,16 +501,27 @@ following types.</p> <taglist> +<tag><c>start</c></tag> +<tag><c>stop</c></tag> + +<item> +<p> +The service is being started or stopped. +No event precedes a <c>start</c> event. +No event follows a <c>stop</c> event and this event +implies the termination of all transport processes.</p> +</item> + <tag><c>{up, Ref, Peer, Config, Pkt}</c></tag> <tag><c>{up, Ref, Peer, Config}</c></tag> <tag><c>{down, Ref, Peer, Config}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -Peer = <seealso marker="diameter_app#peer">diameter_app:peer()</seealso> -Config = {connect|listen, [<seealso marker="#transport_opt">transport_opt()</seealso>]} +<pre> +Ref = &transport_ref; +Peer = &app_peer; +Config = {connect|listen, [&transport_opt;]} Pkt = #diameter_packet{} -</code> +</pre> <p> The RFC 3539 watchdog state machine has @@ -530,7 +535,7 @@ connectivity.</p> <p> Note that a single <c>up</c>/<c>down</c> event for a given peer -corresponds to one <seealso marker="diameter_app#peer_up">peer_up/peer_down</seealso> +corresponds to one &app_peer_up;/&app_peer_down; callback for each of the Diameter applications negotiated during capablilities exchange. That is, the event communicates connectivity with the @@ -540,25 +545,23 @@ respect to individual Diameter applications.</p> <tag><c>{reconnect, Ref, Opts}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -Opts = [<seealso marker="#transport_opt">transport_opt()</seealso>] -</code> +<pre> +Ref = &transport_ref; +Opts = [&transport_opt;] +</pre> <p> A connecting transport is attempting to establish/reestablish a -transport connection with a peer following <seealso -marker="#reconnect_timer">reconnect_timer</seealso> or -<seealso marker="#watchdog_timer">watchdog_timer</seealso> -expiry.</p> +transport connection with a peer following &reconnect_timer; or +&watchdog_timer; expiry.</p> </item> <tag><c>{closed, Ref, Reason, Config}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -Config = {connect|listen, [<seealso marker="#transport_opt">transport_opt()</seealso>]} -</code> +<pre> +Ref = &transport_ref; +Config = {connect|listen, [&transport_opt;]} +</pre> <p> Capabilities exchange has failed. @@ -568,13 +571,13 @@ Capabilities exchange has failed. <tag><c>{'CER', Result, Caps, Pkt}</c></tag> <item> -<code> +<pre> Result = ResultCode | {capabilities_cb, CB, ResultCode|discard} Caps = #diameter_caps{} Pkt = #diameter_packet{} ResultCode = integer() -CB = <seealso marker="#evaluable">evaluable()</seealso> -</code> +CB = &evaluable; +</pre> <p> An incoming CER has been answered with the indicated result code or @@ -588,11 +591,11 @@ contains the rejecting callback.</p> <tag><c>{'CER', Caps, {ResultCode, Pkt}}</c></tag> <item> -<code> +<pre> ResultCode = integer() Caps = #diameter_caps{} Pkt = #diameter_packet{} -</code> +</pre> <p> An incoming CER contained errors and has been answered with the @@ -601,14 +604,21 @@ indicated result code. <c>Pkt</c> contains the CER in question.</p> </item> +<tag><c>{'CER', timeout}</c></tag> +<item> +<p> +An expected CER was not received within &capx_timeout; of +connection establishment.</p> +</item> + <tag><c>{'CEA', Result, Caps, Pkt}</c></tag> <item> -<code> +<pre> Result = integer() | atom() | {capabilities_cb, CB, ResultCode|discard} Caps = #diameter_caps{} Pkt = #diameter_packet{} ResultCode = integer() -</code> +</pre> <p> An incoming CEA has been rejected for the indicated reason. @@ -623,10 +633,10 @@ contains the rejecting callback.</p> <tag><c>{'CEA', Caps, Pkt}</c></tag> <item> -<code> +<pre> Caps = #diameter_caps{} Pkt = #diameter_packet{} -</code> +</pre> <p> An incoming CEA contained errors and has been rejected. @@ -634,17 +644,24 @@ An incoming CEA contained errors and has been rejected. <c>Pkt</c> contains the CEA in question.</p> </item> +<tag><c>{'CEA', timeout}</c></tag> +<item> +<p> +An expected CEA was not received within &capx_timeout; +of connection establishment.</p> +</item> + </taglist> </item> <tag><c>{watchdog, Ref, PeerRef, {From, To}, Config}</c></tag> <item> -<code> -Ref = <seealso marker="#transport_ref">transport_ref()</seealso> -PeerRef = <seealso marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso> +<pre> +Ref = &transport_ref; +PeerRef = &app_peer_ref; From, To = initial | okay | suspect | down | reopen Config = {connect|listen, [transport_opt()]} -</code> +</pre> <p> An RFC 3539 watchdog state machine has changed state.</p> @@ -662,11 +679,10 @@ info fields of forms other than the above.</p> <tag><c>service_name() = term()</c></tag> <item> <p> -The name of a service as passed to <seealso -marker="#start_service">start_service/2</seealso> and with which the +The name of a service as passed to &start_service; and with which the service is identified. There can be at most one service with a given name on a given node. -Note that <seealso marker="erts:erlang#make_ref-0">erlang:make_ref/0</seealso> +Note that &make_ref; can be used to generate a service name that is somewhat unique.</p> <marker id="service_opt"/> @@ -675,91 +691,96 @@ can be used to generate a service name that is somewhat unique.</p> <tag><c>service_opt()</c></tag> <item> <p> -An option passed to <seealso -marker="#start_service">start_service/2</seealso>. -Can be any <c><seealso marker="#capability">capability()</seealso></c> as -well as the following.</p> +An option passed to &start_service;. +Can be any <c>&capability;</c> as well as the following.</p> <taglist> -<tag><c>{application, [<seealso marker="#application_opt">application_opt()</seealso>]}</c></tag> +<tag><c>{application, [&application_opt;]}</c></tag> <item> <p> Defines a Diameter application supported by the service.</p> <p> -A service must configure one <c>application</c> for each Diameter +A service must configure one tuple for each Diameter application it intends to support. -For an outgoing Diameter request, the relevant <c><seealso -marker="#application_alias">application_alias()</seealso></c> is -passed to <seealso marker="#call">call/4</seealso>, while for an +For an outgoing Diameter request, the relevant <c>&application_alias;</c> is +passed to &call;, while for an incoming request the application identifier in the message header determines the application, the identifier being specified in -the application's <seealso marker="diameter_dict">dictionary</seealso> -file.</p> +the application's &dictionary; file.</p> </item> -</taglist> - -<marker id="transport_opt"/> -</item> - -<tag><c>transport_opt()</c></tag> +<tag><c>{restrict_connections, false + | node + | nodes + | [node()] + | evaluable()}</c></tag> <item> <p> -An option passed to <seealso -marker="#add_transport">add_transport/2</seealso>. -Has one of the following types.</p> +Specifies the degree to which multiple transport connections to the +same peer are accepted by the service.</p> -<taglist> -<tag><c>{transport_module, atom()}</c></tag> -<item> <p> -A module implementing a transport process as defined in <seealso -marker="diameter_transport">diameter_transport(3)</seealso>. -Defaults to <c>diameter_tcp</c> if unspecified.</p> +If type <c>[node()]</c> then a connection is rejected if another already +exists on any of the specified nodes. +Values of type <c>false</c>, <c>node</c>, <c>nodes</c> or +&evaluable; are equivalent to +values <c>[]</c>, <c>[node()]</c>, <c>[node()|nodes()]</c> and the +evaluated value, respectively, evaluation of each expression taking +place whenever a new connection is to be established. +Note that <c>false</c> allows an unlimited number of connections to be +established with the same peer.</p> <p> -Multiple <c>transport_module</c> and <c>transport_config</c> -options are allowed. -The order of these is significant in this case (and only in this case), -a <c>transport_module</c> being paired with the first -<c>transport_config</c> following it in the options list, or the -default value for trailing modules. -Transport starts will be attempted with each of the -modules in order until one establishes a connection within the -corresponding timeout (see below) or all fail.</p> +Multiple connections are independent and governed +by their own peer and watchdog state machines.</p> + +<p> +Defaults to <c>nodes</c>.</p> </item> -<tag><c>{transport_config, term()}</c></tag> -<tag><c>{transport_config, term(), <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>}</c></tag> +<tag><c>{sequence, {H,N} | &evaluable;}</c></tag> <item> <p> -A term passed as the third argument to the <seealso -marker="diameter_transport#start">start/3</seealso> function of -the relevant <c>transport_module</c> in order to start a transport process. -Defaults to the empty list if unspecified.</p> - +Specifies a constant value <c>H</c> for the topmost <c>32-N</c> bits of +of 32-bit End-to-End and Hop-by-Hop identifiers generated +by the service, either explicity or as a return value of a function +to be evaluated at &start_service;. +In particular, an identifier <c>Id</c> is mapped to a new identifier +as follows.</p> +<pre> +(H bsl N) bor (Id band ((1 bsl N) - 1)) +</pre> <p> -The 3-tuple form additionally specifies an interval, in milliseconds, -after which a started transport process should be terminated if it has -not yet established a connection. -For example, the following options on a connecting transport -request a connection with one peer over SCTP or another -(typically the same) over TCP.</p> +Note that &the_rfc; requires that End-to-End identifiers remain unique +for a period of at least 4 minutes and that this and the call rate +places a lower bound on the appropriate values of <c>N</c>: +at a rate of <c>R</c> requests per second an <c>N</c>-bit counter +traverses all of its values in <c>(1 bsl N) div (R*60)</c> minutes so +the bound is <c>4*R*60 =< 1 bsl N</c>.</p> -<code> -{transport_module, diameter_sctp} -{transport_config, SctpOpts, 5000} -{transport_module, diameter_tcp} -{transport_config, TcpOpts} -</code> +<p><c>N</c> must lie in the range <c>0..32</c> and <c>H</c> must be a +non-negative integer less than <c>1 bsl (32-N)</c>.</p> <p> -To listen on both SCTP and TCP, define one transport for each.</p> +Defaults to <c>{0,32}</c>.</p> +</item> + +</taglist> + +<marker id="transport_opt"/> </item> -<tag><c>{applications, [<seealso marker="#application_alias">application_alias()</seealso>]}</c></tag> +<tag><c>transport_opt()</c></tag> +<item> +<p> +An option passed to &add_transport;. +Has one of the following types.</p> + +<taglist> +<marker id="applications"/> +<tag><c>{applications, [&application_alias;]}</c></tag> <item> <p> The list of Diameter applications to which the transport should be @@ -768,7 +789,8 @@ Defaults to all applications configured on the service in question. Applications not configured on the service in question are ignored.</p> </item> -<tag><c>{capabilities, [<seealso marker="#capability">capability()</seealso>]}</c></tag> +<marker id="capabilities"/> +<tag><c>{capabilities, [&capability;]}</c></tag> <item> <p> AVP's used to construct outgoing CER/CEA messages. @@ -778,98 +800,260 @@ question.</p> <p> Specifying a capability as a transport option may be particularly appropriate for Inband-Security-Id, in case -TLS is desired over TCP as implemented by -<seealso marker="diameter_tcp">diameter_tcp(3)</seealso>.</p> +TLS is desired over TCP as implemented by &man_tcp;.</p> </item> -<tag><c>{capabilities_cb, <seealso marker="#evaluable">evaluable()</seealso>}</c></tag> +<marker id="capabilities_cb"/> +<tag><c>{capabilities_cb, &evaluable;}</c></tag> <item> <p> 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 <c><seealso -marker="#transport_ref">transport_ref()</seealso></c> and the -<c>#diameter_caps{}</c> record of the connection. -Returning <c>ok</c> accepts the connection. -Returning <c>integer()</c> causes an incoming -CER to be answered with the specified Result-Code. -Returning <c>discard</c> causes an incoming CER to -be discarded. -Returning <c>unknown</c> is equivalent to returning <c>3010</c>, -DIAMETER_UNKNOWN_PEER. -Returning anything but <c>ok</c> or a 2xxx series result -code causes the transport connection to be broken.</p> +Applied to the <c>&transport_ref;</c> and +<c>#diameter_caps{}</c> record of the connection.</p> + +<p> +The return value can have one of the following types.</p> + +<taglist> +<tag><c>ok</c></tag> +<item> +<p> +Accept the connection.</p> +</item> + +<tag><c>integer()</c></tag> +<item> +<p> +Causes an incoming CER to be answered with the specified Result-Code.</p> +</item> + +<tag><c>discard</c></tag> +<item> +<p> +Causes an incoming CER to be discarded without CEA being sent.</p> +</item> + +<tag><c>unknown</c></tag> +<item> +<p> +Equivalent to returning <c>3010</c>, DIAMETER_UNKNOWN_PEER.</p> +</item> +</taglist> <p> -Multiple <c>capabilities_cb</c> options can be specified, in which +Returning anything but <c>ok</c> 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 <c>ok</c> or one does not.</p> +</item> -<marker id="watchdog_timer"/> +<marker id="capx_timeout"/> +<tag><c>{capx_timeout, &dict_Unsigned32;}</c></tag> +<item> +<p> +The number of milliseconds after which a transport process having an +established transport connection will be terminated if the expected +capabilities exchange message (CER or CEA) is not received from the peer. +For a connecting transport, the timing reconnection attempts is +governed by &watchdog_timer; or +&reconnect_timer; expiry. +For a listening transport, the peer determines the timing.</p> + +<p> +Defaults to 10000.</p> </item> -<tag><c>{watchdog_timer, TwInit}</c></tag> +<marker id="disconnect_cb"/> +<tag><c>{disconnect_cb, &evaluable;}</c></tag> + <item> -<code> -TwInit = <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso> - | {M,F,A} -</code> +<p> +A callback invoked prior to terminating the transport process of a +transport connection having watchdog state <c>OKAY</c>. +Applied to <c>Reason=transport|service|application</c> and the +<c>&transport_ref;</c> and +<c>&app_peer;</c> +in question, <c>Reason</c> indicating whether the the diameter +application is being stopped, the service in question is being stopped +at &stop_service; or +the transport in question is being removed at &remove_transport;, +respectively.</p> <p> -The RFC 3539 watchdog timer. -An integer value is interpreted as the RFC's TwInit in milliseconds, -a jitter of ± 2 seconds being added at each rearming of the -timer to compute the RFC's Tw. -An MFA is expected to return the RFC's Tw directly, with jitter -applied, allowing the jitter calculation to be performed by -the callback.</p> +The return value can have one of the following types.</p> +<taglist> +<tag><c>{dpr, [option()]}</c></tag> +<item> <p> -An integer value must be at least 6000 as required by RFC 3539. -Defaults to 30000 if unspecified.</p> +Causes Disconnect-Peer-Request to be sent to the peer, the transport +process being terminated following reception of +Disconnect-Peer-Answer or timeout. +An <c>option()</c> can be one of the following.</p> -<marker id="reconnect_timer"/> +<taglist> +<tag><c>{cause, 0|rebooting|1|busy|2|goaway}</c></tag> +<item> +<p> +The Disconnect-Cause to send, <c>REBOOTING</c>, <c>BUSY</c> and +<c>DO_NOT_WANT_TO_TALK_TO_YOU</c> respectively. +Defaults to <c>rebooting</c> for <c>Reason=service|application</c> and +<c>goaway</c> for <c>Reason=transport</c>.</p> +</item> + +<tag><c>{timeout, &dict_Unsigned32;}</c></tag> +<item> +<p> +The number of milliseconds after which the transport process is +terminated if DPA has not been received. +Defaults to 1000.</p> +</item> +</taglist> +</item> + +<tag><c>dpr</c></tag> +<item> +<p> +Equivalent to <c>{dpr, []}</c>.</p> +</item> + +<tag><c>close</c></tag> +<item> +<p> +Causes the transport process to be terminated without +Disconnect-Peer-Request being sent to the peer.</p> +</item> + +<tag><c>ignore</c></tag> +<item> +<p> +Equivalent to not having configured the callback.</p> +</item> +</taglist> + +<p> +Multiple &disconnect_cb; +options can be specified, in which +case the corresponding callbacks are applied until one of them returns +a value other than <c>ignore</c>. +All callbacks returning <c>ignore</c> is equivalent to not having +configured them.</p> + +<p> +Defaults to a single callback returning <c>dpr</c>.</p> </item> +<marker id="reconnect_timer"/> <tag><c>{reconnect_timer, Tc}</c></tag> <item> -<code> -Tc = <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso> -</code> +<pre> +Tc = &dict_Unsigned32; +</pre> <p> -For a connecting transport, the RFC 3588 Tc timer, in milliseconds. +For a connecting transport, the &the_rfc; Tc timer, in milliseconds. Note that this timer determines the frequency with which a transport will attempt to establish a connection with its peer only <em>before</em> an initial connection is established: once there is an initial -connection it's watchdog_timer that determines the frequency of -reconnection attempts, as required by RFC 3539.</p> +connection it's &watchdog_timer; that determines the +frequency of reconnection attempts, as required by RFC 3539.</p> <p> For a listening transport, the timer specifies the time after which a previously connected peer will be forgotten: a connection after this time is regarded as an initial connection rather than a reestablishment, -causing the RFC 3539 state machine to pass to state OPEN rather than +causing the RFC 3539 state machine to pass to state OKAY rather than REOPEN. -Note that these semantics are not goverened by the RFC and -that a listening transport's <c>reconnect_timer</c> should be greater +Note that these semantics are not governed by the RFC and +that a listening transport's &reconnect_timer; should be greater than its peer's Tw plus jitter.</p> <p> Defaults to 30000 for a connecting transport and 60000 for a listening transport.</p> +</item> + +<marker id="transport_config"/> +<tag><c>{transport_config, term()}</c></tag> +<tag><c>{transport_config, term(), &dict_Unsigned32;}</c></tag> +<item> +<p> +A term passed as the third argument to the &transport_start; function of +the relevant &transport_module; in order to +start a transport process. +Defaults to the empty list if unspecified.</p> + +<p> +The 3-tuple form additionally specifies an interval, in milliseconds, +after which a started transport process should be terminated if it has +not yet established a connection. +For example, the following options on a connecting transport +request a connection with one peer over SCTP or another +(typically the same) over TCP.</p> + +<pre> +{transport_module, diameter_sctp} +{transport_config, SctpOpts, 5000} +{transport_module, diameter_tcp} +{transport_config, TcpOpts} +</pre> + +<p> +To listen on both SCTP and TCP, define one transport for each.</p> +</item> + +<marker id="transport_module"/> +<tag><c>{transport_module, atom()}</c></tag> +<item> +<p> +A module implementing a transport process as defined in &man_transport;. +Defaults to <c>diameter_tcp</c> if unspecified.</p> + +<p> +Multiple <c>transport_module</c> and &transport_config; +options are allowed. +The order of these is significant in this case (and only in this case), +a <c>transport_module</c> being paired with the first +&transport_config; +following it in the options list, or the default value for trailing +modules. +Transport starts will be attempted with each of the +modules in order until one establishes a connection within the +corresponding timeout (see below) or all fail.</p> +</item> + +<marker id="watchdog_timer"/> +<tag><c>{watchdog_timer, TwInit}</c></tag> +<item> +<pre> +TwInit = &dict_Unsigned32; + | {M,F,A} +</pre> + +<p> +The RFC 3539 watchdog timer. +An integer value is interpreted as the RFC's TwInit in milliseconds, +a jitter of ± 2 seconds being added at each rearming of the +timer to compute the RFC's Tw. +An MFA is expected to return the RFC's Tw directly, with jitter +applied, allowing the jitter calculation to be performed by +the callback.</p> +<p> +An integer value must be at least 6000 as required by RFC 3539. +Defaults to 30000 if unspecified.</p> </item> </taglist> <p> Unrecognized options are silently ignored but are returned unmodified -by <seealso -marker="#service_info">service_info/2</seealso> and can be referred to -in predicate functions passed to <seealso -marker="#remove_transport">remove_transport/2</seealso>.</p> +by &service_info; and can be referred to +in predicate functions passed to &remove_transport;.</p> <marker id="transport_ref"/> </item> @@ -877,8 +1061,7 @@ marker="#remove_transport">remove_transport/2</seealso>.</p> <tag><c>transport_ref() = reference()</c></tag> <item> <p> -An reference returned by <seealso -marker="#add_transport">add_transport/2</seealso> that +An reference returned by &add_transport; that identifies the configuration.</p> </item> @@ -886,7 +1069,6 @@ identifies the configuration.</p> </section> -<marker id="add_transport"/> <funcs> <!-- ===================================================================== --> @@ -896,9 +1078,9 @@ identifies the configuration.</p> -> {ok, Ref} | {error, Reason}</name> <fsummary>Add transport capability to a service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>Opt = <seealso marker="#transport_opt">transport_opt()</seealso></v> -<v>Ref = <seealso marker="#transport_ref">transport_ref()</seealso></v> +<v>SvcName = &service_name;</v> +<v>Opt = &transport_opt;</v> +<v>Ref = &transport_ref;</v> <v>Reason = term()</v> </type> <desc> @@ -917,8 +1099,7 @@ one peer, an listening transport potentially with many.</p> The diameter application takes responsibility for exchanging CER/CEA with the peer. Upon successful completion of capabilities exchange the service -calls each relevant application module's <seealso -marker="diameter_app#peer_up">peer_up/3</seealso> callback +calls each relevant application module's &app_peer_up; callback after which the caller can exchange Diameter messages with the peer over the transport. In addition to CER/CEA, the service takes responsibility for the @@ -937,7 +1118,6 @@ been configured: a service can be started after configuring its transports.</p> </note> -<marker id="call"/> </desc> </func> @@ -947,11 +1127,11 @@ its transports.</p> <name>call(SvcName, App, Request, [Opt]) -> Answer | ok | {error, Reason}</name> <fsummary>Send a Diameter request message.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>App = <seealso marker="#application_alias">application_alias()</seealso></v> -<v>Request = <seealso marker="diameter_app#message">diameter_app:message()</seealso></v> +<v>SvcName = &service_name;</v> +<v>App = &application_alias;</v> +<v>Request = &codec_message;</v> <v>Answer = term()</v> -<v>Opt = <seealso marker="#call_opt">call_opt()</seealso></v> +<v>Opt = &call_opt;</v> </type> <desc> <p> @@ -960,37 +1140,29 @@ Send a Diameter request message.</p> <p> <c>App</c> specifies the Diameter application in which the request is defined and callbacks to the corresponding callback module -will follow as described below and in <seealso -marker="diameter_app">diameter_app(3)</seealso>. +will follow as described below and in &man_app;. Unless the <c>detach</c> option is specified, the call returns either when an answer message is received from the peer or an error occurs. In the answer case, the return value is as returned by a -<seealso -marker="diameter_app#handle_answer">handle_answer/4</seealso> -callback. +&app_handle_answer; callback. In the error case, whether or not the error is returned directly -by diameter or from a <seealso -marker="diameter_app#handle_error">handle_error/4</seealso> +by diameter or from a &app_handle_error; callback depends on whether or not the outgoing request is successfully encoded for transmission to the peer, the cases being documented below.</p> <p> If there are no suitable peers, or if -<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> +&app_pick_peer; rejects them by returning <c>false</c>, then <c>{error,no_connection}</c> is returned. -Otherwise <seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> -is followed by a -<seealso -marker="diameter_app#prepare_request">prepare_request/3</seealso> -callback, the message is encoded and then sent.</p> +Otherwise &app_pick_peer; is followed by a +&app_prepare_request; callback, the message is encoded and then sent.</p> <p> There are several error cases which may prevent an answer from being received and passed to a -<seealso marker="diameter_app#handle_answer">handle_answer/4</seealso> -callback:</p> +&app_handle_answer; callback:</p> <list> @@ -1005,16 +1177,14 @@ is returned.</p> <p> If the request is successfully encoded and sent but the answer times out then a -<seealso marker="diameter_app#handle_error">handle_error/4</seealso> -callback takes place with <c>Reason = timeout</c>.</p> +&app_handle_error; callback takes place with <c>Reason = timeout</c>.</p> </item> <item> <p> If the request is successfully encoded and sent but the service in question is stopped before an answer is received then a -<seealso marker="diameter_app#handle_error">handle_error/4</seealso> -callback takes place with <c>Reason = cancel</c>.</p> +&app_handle_error; callback takes place with <c>Reason = cancel</c>.</p> </item> <item> @@ -1023,18 +1193,11 @@ If the transport connection with the peer goes down after the request has been sent but before an answer has been received then an attempt is made to resend the request to an alternate peer. If no such peer is available, or if the subsequent -<seealso marker="diameter_app#pick_peer">pick_peer/4</seealso> -callback rejects the candidates, then a -<seealso marker="diameter_app#handle_error">handle_error/4</seealso> -callback takes place with <c>Reason = failover</c>. -If a peer is selected then a -<seealso -marker="diameter_app#prepare_retransmit">prepare_retransmit/3</seealso> +&app_pick_peer; callback rejects the candidates, then a +&app_handle_error; callback takes place with <c>Reason = failover</c>. +If a peer is selected then a &app_prepare_retransmit; callback takes place, after which the semantics are the same as -following an initial -<seealso marker="diameter_app#prepare_request"> -prepare_request/3</seealso> -callback.</p> +following an initial &app_prepare_request; callback.</p> </item> <item> @@ -1061,14 +1224,13 @@ Note that <c>{error,encode}</c> is the only return value which guarantees that the request has <em>not</em> been sent over the transport connection.</p> -<marker id="origin_state_id"/> </desc> </func> <!-- ===================================================================== --> <func> -<name>origin_state_id() -> <seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso></name> +<name>origin_state_id() -> &dict_Unsigned32;</name> <fsummary>Returns a reasonable Origin-State-Id.</fsummary> <desc> <p> @@ -1077,26 +1239,26 @@ outgoing messages.</p> <p> The value returned is the number of seconds since 19680120T031408Z, -the first value that can be encoded as a Diameter <c><seealso marker="diameter_dict#DATA_TYPES">Time()</seealso></c>, +the first value that can be encoded as a Diameter <c>&dict_Time;</c>, at the time the diameter application was started.</p> -<marker id="remove_transport"/> </desc> </func> <!-- ===================================================================== --> <func> -<name>remove_transport(SvcName, Pred) -> ok</name> +<name>remove_transport(SvcName, Pred) -> ok | {error, Reason}</name> <fsummary>Remove previously added transports.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>Pred = Fun | MFA | <seealso marker="#transport_ref">transport_ref()</seealso> | list() | true | false</v> +<v>SvcName = &service_name;</v> +<v>Pred = Fun | MFA | &transport_ref; | list() | true | false</v> <v></v> -<v>Fun = fun((<seealso marker="#transport_ref">transport_ref()</seealso>, connect|listen, list()) -> boolean())</v> -<v> | fun((<seealso marker="#transport_ref">transport_ref()</seealso>, list()) -> boolean())</v> +<v>Fun = fun((&transport_ref;, connect|listen, list()) -> boolean())</v> +<v> | fun((&transport_ref;, list()) -> boolean())</v> <v> | fun((list()) -> boolean())</v> <v>MFA = {atom(), atom(), list()}</v> +<v>Reason = term()</v> </type> <desc> <p> @@ -1106,12 +1268,11 @@ Remove previously added transports.</p> <c>Pred</c> determines which transports to remove. An arity-3-valued <c>Pred</c> removes all transports for which <c>Pred(Ref, Type, Opts)</c> returns <c>true</c>, where <c>Type</c> and -<c>Opts</c> are as passed to <seealso -marker="#add_transport">add_transport/2</seealso> and <c>Ref</c> is +<c>Opts</c> are as passed to &add_transport; and <c>Ref</c> is as returned by it. The remaining forms are equivalent to an arity-3 fun as follows.</p> -<code> +<pre> Pred = fun(transport_ref(), list()): fun(Ref, _, Opts) -> Pred(Ref, Opts) end Pred = fun(list()): fun(_, _, Opts) -> Pred(Opts) end Pred = transport_ref(): fun(Ref, _, _) -> Pred == Ref end @@ -1119,20 +1280,15 @@ Pred = list(): fun(_, _, Opts) -> [] == Pred -- Opts end Pred = true: fun(_, _, _) -> true end Pred = false: fun(_, _, _) -> false end Pred = {M,F,A}: fun(Ref, Type, Opts) -> apply(M, F, [Ref, Type, Opts | A]) end -</code> +</pre> <p> -Removing a transport causes all associated transport connections to -be broken. -A DPR message with -Disconnect-Cause <c>DO_NOT_WANT_TO_TALK_TO_YOU</c> 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.</p> - -<!-- TODO: document the timeout value, possibly make configurable. --> +Removing a transport causes the corresponding transport processes to +be terminated. +Whether or not a DPR message is sent to a peer is +controlled by value of &disconnect_cb; +configured on the transport.</p> -<marker id="service_info"/> </desc> </func> @@ -1142,13 +1298,19 @@ DPA or timeout.</p> <name>service_info(SvcName, Info) -> term()</name> <fsummary>Return information about a started service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> <v>Info = Item | [Info]</v> <v>Item = atom()</v> </type> <desc> <p> Return information about a started service. +Requesting info for an unknown service causes <c>undefined</c> to be +returned. +Requesting a list of items causes a tagged list to be +returned.</p> + +<p> <c>Item</c> can be one of the following.</p> <taglist> @@ -1167,15 +1329,13 @@ Return information about a started service. <tag><c>'Firmware-Revision'</c></tag> <item> <p> -Return a capability value as configured with <seealso -marker="#start_service">start_service/2</seealso>.</p> +Return a capability value as configured with &start_service;.</p> </item> <tag><c>applications</c></tag> <item> <p> -Return the list of applications as configured with <seealso -marker="#start_service">start_service/2</seealso>. +Return the list of applications as configured with &start_service;. </p> </item> @@ -1183,23 +1343,21 @@ marker="#start_service">start_service/2</seealso>. <item> <p> Return a tagged list of all capabilities values as configured with -<seealso -marker="#start_service">start_service/2</seealso>.</p> +&start_service;.</p> </item> <tag><c>transport</c></tag> <item> <p> Return a list containing one entry for each of the service's transport -as configured with <seealso -marker="#add_transport">add_transport/2</seealso>. +as configured with &add_transport;. Each entry is a tagged list containing both configuration and information about established peer connections. An example return value with for a client service with Origin-Host "client.example.com" configured with a single transport connected to "server.example.com" might look as follows.</p> -<code> +<pre> [[{ref,#Ref<0.0.0.93>}, {type,connect}, {options,[{transport_module,diameter_tcp}, @@ -1244,23 +1402,18 @@ An example return value with for a client service with Origin-Host {{{0,258,0},recv,{'Result-Code',2001}},3}, {{{0,280,1},recv},2}, {{{0,280,0},send},2}]}]] -</code> +</pre> <p> -Here <c>ref</c> is a <c><seealso -marker="#transport_ref">transport_ref()</seealso></c> and <c>options</c> -the corresponding <c><seealso -marker="#transport_opt">transport_opt()</seealso></c> list passed to <seealso -marker="#add_transport">add_transport/2</seealso>. +Here <c>ref</c> is a <c>&transport_ref;</c> and <c>options</c> +the corresponding <c>&transport_opt;</c> list passed to +&add_transport;. The <c>watchdog</c> entry shows the state of a connection's RFC 3539 watchdog state machine. -The <c>peer</c> entry identifies the <c><seealso -marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso></c> for -which there will have been <seealso -marker="diameter_app#peer_up">peer_up</seealso> callbacks for the +The <c>peer</c> entry identifies the <c>&app_peer_ref;</c> for +which there will have been &app_peer_up; callbacks for the Diameter applications identified by the <c>apps</c> entry, -<c>common</c> being the <c><seealso -marker="#application_alias">application_alias()</seealso></c>. +<c>common</c> being the <c>&application_alias;</c>. The <c>caps</c> entry identifies the capabilities sent by the local node and received from the peer during capabilities exchange. The <c>port</c> entry displays socket-level information about the @@ -1279,12 +1432,12 @@ during the lifetime of the transport configuration.</p> <p> A listening transport presents its information slightly differently -since there may be multiple accepted connections for the same <c><seealso -marker="#transport_ref">transport_ref()</seealso></c>. +since there may be multiple accepted connections for the same +<c>&transport_ref;</c>. The <c>transport</c> info returned by a server with a single client connection might look as follows.</p> -<code> +<pre> [[{ref,#Ref<0.0.0.61>}, {type,listen}, {options,[{transport_module,diameter_tcp}, @@ -1331,7 +1484,7 @@ connection might look as follows.</p> {{{0,280,0},send},5}, {{{0,257,1},recv},1}, {{{0,257,0},send},1}]}]] -</code> +</pre> <p> The information presented here is as in the <c>connect</c> case except @@ -1350,7 +1503,7 @@ connections and for which Diameter-level statistics are accumulated only for the lifetime of the transport connection. A return value for the server above might look as follows.</p> -<code> +<pre> [[{ref,#Ref<0.0.0.61>}, {type,accept}, {options,[{transport_module,diameter_tcp}, @@ -1396,7 +1549,7 @@ A return value for the server above might look as follows.</p> {{{0,280,0},send},66}, {{{0,257,1},recv},1}, {{{0,257,0},send},1}]}]] -</code> +</pre> <p> Note that there may be multiple entries with the same <c>ref</c>, in @@ -1407,27 +1560,37 @@ contrast to <c>transport</c> info.</p> <item> <p> Return a <c>{{Counter, Ref}, non_neg_integer()}</c> list of counter values. -<c>Ref</c> can be either a <c><seealso -marker="#transport_ref">transport_ref()</seealso></c> -or a <c><seealso -marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso></c>. +<c>Ref</c> can be either a <c>&transport_ref;</c> +or a <c>&app_peer_ref;</c>. Entries for the latter are folded into corresponding entries for the former as peer connections go down. -Entries for both are removed at <seealso -marker="#remove_transport">remove_transport/2</seealso>. +Entries for both are removed at &remove_transport;. The Diameter-level statistics returned by <c>transport</c> and <c>connections</c> info are based upon these entries.</p> </item> -</taglist> - +<tag><c>&app_peer_ref;</c></tag> +<item> <p> -Requesting info for an unknown service causes <c>undefined</c> to be -returned. -Requesting a list of items causes a tagged list to be -returned.</p> +Return transport configuration associated with a single peer, as +passed to &add_transport;. +The returned list is empty if the peer is unknown. +Otherwise it contains the <c>ref</c>, <c>type</c> and <c>options</c> +tuples as in <c>transport</c> and <c>connections</c> info above. +For example:</p> + +<pre> +[{ref,#Ref<0.0.0.61>}, + {type,accept}, + {options,[{transport_module,diameter_tcp}, + {transport_config,[{reuseaddr,true}, + {ip,{127,0,0,1}}, + {port,3868}]}]}] +</pre> +</item> + +</taglist> -<marker id="services"/> </desc> </func> @@ -1437,34 +1600,32 @@ returned.</p> <name>services() -> [SvcName]</name> <fsummary>Return the list of started services.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> </type> <desc> <p> Return the list of started services.</p> -<marker id="session_id"/> </desc> </func> <!-- ===================================================================== --> <func> -<name>session_id(Ident) -> <seealso marker="diameter_dict#DATA_TYPES">OctetString()</seealso></name> +<name>session_id(Ident) -> &dict_OctetString;</name> <fsummary>Return a value for a Session-Id AVP.</fsummary> <type> -<v>Ident = <seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso></v> +<v>Ident = &dict_DiameterIdentity;</v> </type> <desc> <p> Return a value for a Session-Id AVP.</p> <p> -The value has the form required by section 8.8 of RFC 3588. +The value has the form required by section 8.8 of &the_rfc;. Ident should be the Origin-Host of the peer from which the message containing the returned value will be sent.</p> -<marker id="start"/> </desc> </func> @@ -1481,7 +1642,6 @@ The diameter application must be started before starting a service. In a production system this is typically accomplished by a boot file, not by calling <c>start/0</c> explicitly.</p> -<marker id="start_service"/> </desc> </func> @@ -1490,8 +1650,8 @@ file, not by calling <c>start/0</c> explicitly.</p> <name>start_service(SvcName, Options) -> ok | {error, Reason}</name> <fsummary>Start a Diameter service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> -<v>Options = [<seealso marker="#service_opt">service_opt()</seealso>]</v> +<v>SvcName = &service_name;</v> +<v>Options = [&service_opt;]</v> <v>Reason = term()</v> </type> <desc> @@ -1501,8 +1661,7 @@ Start a diameter service.</p> <p> A service defines a locally-implemented Diameter node, specifying the capabilities to be advertised during capabilities exchange. -Transports are added to a service using <seealso -marker="#add_transport">add_transport/2</seealso>. +Transports are added to a service using &add_transport;. </p> <note> @@ -1513,7 +1672,6 @@ capabilities and restrict its supported Diameter applications so necessarily the case.</p> </note> -<marker id="stop_service"/> </desc> </func> @@ -1528,7 +1686,6 @@ Stop the diameter application.</p> <p> </p> -<marker id="stop_service"/> </desc> </func> @@ -1537,7 +1694,7 @@ Stop the diameter application.</p> <name>stop_service(SvcName) -> ok | {error, Reason}</name> <fsummary>Stop a Diameter service.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> <v>Reason = term()</v> </type> <desc> @@ -1547,17 +1704,15 @@ Stop a diameter service.</p> <p> Stopping a service causes all associated transport connections to be broken. -A DPR message with be sent as in the case of <seealso -marker="#remove_transport">remove_transport/2</seealso>.</p> +A DPR message with be sent as in the case of &remove_transport;.</p> <note> <p> -Stopping a transport does not remove any associated transports: -<seealso marker="#remove_transport">remove_transport/2</seealso> must +Stopping a service does not remove any associated transports: +&remove_transport; must be called to remove transport configuration.</p> </note> -<marker id="subscribe"/> </desc> </func> @@ -1567,12 +1722,11 @@ be called to remove transport configuration.</p> <name>subscribe(SvcName) -> true</name> <fsummary>Subscribe to event messages.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> </type> <desc> <p> -Subscribe to <c><seealso -marker="#service_event">service_event()</seealso></c> messages from +Subscribe to <c>&service_event;</c> messages from a service.</p> <p> @@ -1581,7 +1735,6 @@ that does not yet exist. Doing so before adding transports is required to guarantee the reception of all related events.</p> -<marker id="unsubscribe"/> </desc> </func> @@ -1591,7 +1744,7 @@ reception of all related events.</p> <name>unsubscribe(SvcName) -> true</name> <fsummary>Unsubscribe to event messages.</fsummary> <type> -<v>SvcName = <seealso marker="#service_name">service_name()</seealso></v> +<v>SvcName = &service_name;</v> </type> <desc> <p> @@ -1608,9 +1761,7 @@ Unsubscribe to event messages from a service.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_app">diameter_app(3)</seealso>, -<seealso marker="diameter_transport">diameter_transport(3)</seealso>, -<seealso marker="diameter_dict">diameter_dict(4)</seealso></p> +&man_app;, &man_transport;, &man_dict;</p> </section> diff --git a/lib/diameter/doc/src/diameter_app.xml b/lib/diameter/doc/src/diameter_app.xml index 4a4b212787..f4db625c71 100644 --- a/lib/diameter/doc/src/diameter_app.xml +++ b/lib/diameter/doc/src/diameter_app.xml @@ -1,5 +1,13 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY message '<seealso marker="#message">message()</seealso>'> + <!ENTITY dict + '<seealso marker="diameter_dict#MESSAGE_RECORDS">diameter_dict(4)</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -41,15 +49,13 @@ Callback module of a Diameter application.</modulesummary> <description> <p> -A diameter service as started by <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> +A diameter service as started by &mod_start_service; configures one of more Diameter applications, each of whose configuration specifies a callback that handles messages specific to the application. The messages and AVPs of the application are defined in a dictionary file whose format is documented in -<seealso marker="diameter_dict">diameter_dict(4)</seealso> -while the callback module is documented here. +&man_dict; while the callback module is documented here. The callback module implements the Diameter application-specific functionality of a service.</p> @@ -60,26 +66,24 @@ The functions themselves are of three distinct flavours:</p> <list> <item> <p> -<seealso marker="#peer_up">peer_up/3</seealso> and -<seealso marker="#peer_down">peer_down/3</seealso> signal the +&peer_up; and &peer_down; signal the attainment or loss of connectivity with a Diameter peer.</p> </item> <item> <p> -<seealso marker="#pick_peer">pick_peer/4</seealso>, -<seealso marker="#prepare_request">prepare_request/3</seealso>, -<seealso marker="#prepare_retransmit">prepare_retransmit/3</seealso>, -<seealso marker="#handle_answer">handle_answer/4</seealso> -and <seealso marker="#handle_error">handle_error/4</seealso> are (or may -be) called as a consequence of a call to <seealso -marker="diameter#call">diameter:call/4</seealso> to send an outgoing +&pick_peer;, +&prepare_request;, +&prepare_retransmit;, +&handle_answer; +and &handle_error; are (or may be) called as a consequence of a call +to &mod_call; to send an outgoing Diameter request message.</p> </item> <item> <p> -<seealso marker="#handle_request">handle_request/3</seealso> +&handle_request; is called in response to an incoming Diameter request message.</p> </item> @@ -92,10 +96,9 @@ is called in response to an incoming Diameter request message.</p> 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 <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> +the callback module itself when calling &mod_start_service; and, for the call-specific callbacks, any extra arguments passed to -<seealso marker="diameter#call">diameter:call/4</seealso>.</p> +&mod_call;.</p> </note> <!-- ===================================================================== --> @@ -112,7 +115,8 @@ and, for the call-specific callbacks, any extra arguments passed to <item> <p> A record containing the identities of -the local Diameter node and the remote Diameter peer having an established transport +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 @@ -123,39 +127,17 @@ mandatory values as the bare value.</p> <marker id="message"/> -<tag><c>message() = record() | list()</c></tag> +<tag><c>message() = &codec_message;</c></tag> <item> <p> The representation of a Diameter message as passed to -<seealso marker="diameter#call">diameter:call/4</seealso>. -The record representation is as outlined in -<seealso -marker="diameter_dict#MESSAGE_RECORDS">diameter_dict(4)</seealso>: -a message as defined in a dictionary file is encoded as a record with -one field for each component AVP. -Equivalently, a message can also be encoded as a list whose head is -the atom-valued message name (the record name minus any -prefix specified in the relevant dictionary file) and whose tail is a -list of <c>{FieldName, FieldValue}</c> pairs.</p> - -<p> -A third representation allows a message to be specified as a list -whose head is a <c>#diameter_header{}</c> record and whose tail is a list -of <c>#diameter_avp{}</c> records. -This representation is used by diameter itself when relaying requests -as directed by the return value of a -<seealso marker="#handle_request">handle_request/3</seealso> -callback. -It differs from the other other two in that it bypasses the checks for -messages that do not agree with their definitions in the dictionary in -question (since relays agents must handle arbitrary request): messages -are sent exactly as specified.</p> +&mod_call; or returned from a &handle_request; callback.</p> </item> <marker id="packet"/> -<tag><c>packet() = #diameter_packet{}</c></tag> +<tag><c>packet() = &codec_packet;</c></tag> <item> <p> A container for incoming and outgoing Diameter messages that's passed @@ -168,13 +150,12 @@ Fields should not be set in return values except as documented.</p> <tag><c>peer_ref() = term()</c></tag> <item> <p> -A term identifying a transport connection with a Diameter peer. -Should be treated opaquely.</p> +A term identifying a transport connection with a Diameter peer.</p> </item> <marker id="peer"/> -<tag><c>peer() = {<seealso marker="#peer_ref">peer_ref()</seealso>, <seealso marker="#capabilities">capabilities()</seealso>}</c></tag> +<tag><c>peer() = {&peer_ref;, &capabilities;}</c></tag> <item> <p> A tuple representing a Diameter peer connection.</p> @@ -186,13 +167,9 @@ A tuple representing a Diameter peer connection.</p> <item> <p> The state maintained by the application callback functions -<seealso marker="#peer_up">peer_up/3</seealso>, -<seealso marker="#peer_down">peer_down/3</seealso> and (optionally) -<seealso marker="#pick_peer">pick_peer/4</seealso>. +&peer_up;, &peer_down; and (optionally) &pick_peer;. The initial state is configured in the call to -<seealso -marker="diameter#start_service">diameter:start_service/2</seealso> -that configures the application on a service. +&mod_start_service; that configures the application on a service. Callback functions returning a state are evaluated in a common service-specific process while those not returning state are evaluated in a request-specific @@ -213,18 +190,33 @@ process.</p> <name>Mod:peer_up(SvcName, Peer, State) -> NewState</name> <fsummary>Invoked when a transport connection has been established</fsummary> <type> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> -<v>State = NewState = <seealso marker="#state">state()</seealso></v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> +<v>State = NewState = &state;</v> </type> <desc> <p> -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.</p> +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 <c>OKAY</c> and Diameter +messages can be both sent and received.</p> + +<note> +<p> +A watchdog state machine can reach state <c>OKAY</c> from state +<c>SUSPECT</c> without a new capabilities exchange taking place. +A new transport connection (and capabilities exchange) results in a +new peer_ref().</p> +</note> + +<note> +<p> +There is no requirement that a callback return before incoming +requests are received: &handle_request; callbacks must be +handled independently of &peer_up; and &peer_down;.</p> +</note> -<marker id="peer_down"/> </desc> </func> @@ -232,88 +224,87 @@ the callback module in question has been configured.</p> <name>Mod:peer_down(SvcName, Peer, State) -> NewState</name> <fsummary>Invoked when a transport connection has been lost.</fsummary> <type> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> -<v>State = NewState = <seealso marker="#state">state()</seealso></v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> +<v>State = NewState = &state;</v> </type> <desc> <p> -Invoked when a transport connection has been lost following a previous -call to <seealso marker="#peer_up">peer_up/3</seealso>.</p> +Invoked to signal that a peer connection is no longer available +following a previous call to &peer_up;. +In particular, that the RFC 3539 watchdog state machine for the +connection has left state <c>OKAY</c> and the peer will no longer be a +candidate in &pick_peer; callbacks.</p> -<marker id="pick_peer"/> </desc> </func> <func> -<name>Mod:pick_peer(Candidates, Reserved, SvcName, State) - -> {ok, Peer} | {Peer, NewState} | false</name> +<name>Mod:pick_peer(Candidates, _Reserved, SvcName, State) + -> Selection | false</name> <fsummary>Select a target peer for an outgoing request.</fsummary> <type> -<v>Candidates = [<seealso marker="#peer">peer()</seealso>]</v> -<v>Peer = <seealso marker="#peer">peer()</seealso> | false</v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>State = NewState = <seealso marker="#state">state()</seealso></v> +<v>Candidates = [&peer;]</v> +<v>SvcName = &mod_service_name;</v> +<v>State = NewState = &state;</v> +<v>Selection = {ok, Peer} | {Peer, NewState}</v> +<v>Peer = &peer; | false</v> </type> <desc> <p> -Invoked as a consequence of a call to <seealso -marker="diameter#call">diameter:call/4</seealso> to select a destination -peer for an outgoing request, the return value indicating the selected -peer.</p> +Invoked as a consequence of a call to &mod_call; to select a destination +peer for an outgoing request. +The return value indicates the selected peer.</p> <p> -The candidate peers list will only include those -which are selected by any <c>filter</c> option specified in the call to -<seealso marker="diameter#call">diameter:call/4</seealso>, and only -those which have indicated support for the Diameter application in -question. +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 <c>filter</c> option in +the call to &mod_call; +and whose watchdog state machine is in the <c>OKAY</c> state. 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 <c>{filter, {all, [host, realm]}}</c> -option to <seealso marker="diameter#call">diameter:call/4</seealso>) +option to &mod_call;) will be placed at the head of the list.</p> <p> -The return values <c>false</c> and <c>{false, State}</c> are -equivalent when callback state is mutable, as are -<c>{ok, Peer}</c> and <c>{Peer, State}</c>. -Returning a peer as <c>false</c> causes <c>{error, no_connection}</c> -to be returned from <seealso marker="diameter#call">diameter:call/4</seealso>. -Returning a <seealso marker="#peer">peer()</seealso> from an initial -pick_peer/4 callback will result in a -<seealso marker="#prepare_request">prepare_request/3</seealso> callback -followed by either <seealso -marker="#handle_answer">handle_answer/4</seealso> -or <seealso marker="#handle_error">handle_error/4</seealso> depending +A callback that returns a peer() will be followed by a +&prepare_request; +callback and, if the latter indicates that the request should be sent, +by either &handle_answer; +or &handle_error; depending on whether or not an answer message is received from the peer. -If transport with the peer is lost before this then a new <seealso -marker="#pick_peer">pick_peer/4</seealso> callback takes place to -select an alternate peer.</p> - -<p> -Note that there is no guarantee that a <seealso -marker="#pick_peer">pick_peer/4</seealso> callback to select -an alternate peer will be followed by any additional callbacks, only -that the initial <seealso -marker="#pick_peer">pick_peer/4</seealso> will be, since a +If the transport becomes unavailable after &prepare_request; then a +new &pick_peer; callback may take place to +failover to an alternate peer, after which &prepare_retransmit; takes the +place of &prepare_request; in resending the +request. +There is no guarantee that a &pick_peer; callback to select +an alternate peer will be followed by any additional callbacks since a retransmission to an alternate peer is abandoned if an answer is received from a previously selected peer.</p> +<p> +Returning <c>false</c> or <c>{false, NewState}</c> causes <c>{error, +no_connection}</c> to be returned from &mod_call;.</p> + +<p> +The return values <c>false</c> and <c>{false, State}</c> (that is, +<c>NewState = State</c>) are equivalent, as are <c>{ok, Peer}</c> and +<c>{Peer, State}</c>.</p> + <note> <p> -<c>{Peer, NewState}</c> and its equivalents can only be returned if -the Diameter application in question was -configured with the <seealso -marker="diameter#application_opt">diameter:application_opt()</seealso> -<c>{call_mutates_state, true}</c>. +The return value <c>{Peer, NewState}</c> is only allowed if +the Diameter application in question was configured with the +&mod_application_opt; <c>{call_mutates_state, true}</c>. Otherwise, the <c>State</c> argument is always the intial value as configured on the application, not any subsequent -value returned by a <seealso marker="#peer_up">peer_up/3</seealso> -or <seealso marker="#peer_down">peer_down/3</seealso> callback.</p> +value returned by a &peer_up; +or &peer_down; callback.</p> </note> -<marker id="prepare_request"/> </desc> </func> @@ -322,74 +313,81 @@ or <seealso marker="#peer_down">peer_down/3</seealso> callback.</p> <name>Mod:prepare_request(Packet, SvcName, Peer) -> Action</name> <fsummary>Return a request for encoding and transport.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> -<v>Action = {send, <seealso marker="#packet">packet()</seealso> | <seealso marker="#message">message()</seealso>} | {discard, Reason} | discard</v> +<v>Packet = &packet;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> +<v>Action = Send | Discard | {eval_packet, Action, PostF}</v> +<v>Send = {send, &packet; | &message;}</v> +<v>Discard = {discard, Reason} | discard</v> +<v>PostF = &mod_evaluable;}</v> </type> <desc> <p> 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) <c>Destination-Host</c> and/or -<c>Destination-Realm</c> 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 <c>{send, Packet}</c></p> <p> -A returned <seealso marker="#packet">packet()</seealso> should set the request to be encoded in its +A returned &packet; should set the +request to be encoded in its <c>msg</c> field and can set the <c>transport_data</c> field in order -to pass information to the transport module. -Extra arguments passed to <seealso -marker="diameter#call">diameter:call/4</seealso> can be used to -communicate transport data to the callback. -A returned <seealso marker="#packet">packet()</seealso> can also set the <c>header</c> field to a -<c>#diameter_header{}</c> 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. +to pass information to the transport process. +Extra arguments passed to &mod_call; can be used to +communicate transport (or any other) data to the callback.</p> + +<p> +A returned &packet; can set +the <c>header</c> field to a +<c>#diameter_header{}</c> to specify values that should +be preserved in the outgoing request, values otherwise being those in +the header record contained in <c>Packet</c>. A returned <c>length</c>, <c>cmd_code</c> or <c>application_id</c> is ignored.</p> <p> +A returned <c>PostF</c> will be evaluated on any encoded +<c>#diameter_packet{}</c> prior to transmission, the <c>bin</c> field +containing the encoded binary. +The return value is ignored.</p> + +<p> Returning <c>{discard, Reason}</c> causes the request to be aborted -and the <seealso -marker="diameter#call">diameter:call/4</seealso> for which the +and the &mod_call; for which the callback has taken place to return <c>{error, Reason}</c>. Returning <c>discard</c> is equivalent to returning <c>{discard, discarded}</c>.</p> -<marker id="prepare_retransmit"/> </desc> </func> <func> -<name>Mod:prepare_retransmit(Packet, SvcName, Peer) -> Result</name> +<name>Mod:prepare_retransmit(Packet, SvcName, Peer) -> Action</name> <fsummary>Return a request for encoding and retransmission.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> -<v>Result = {send, <seealso marker="#packet">packet()</seealso> | <seealso marker="#message">message()</seealso>} | {discard, Reason} | discard</v> +<v>Packet = &packet;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> +<v>Action = Send | Discard | {eval_packet, Action, PostF}</v> +<v>Send = {send, &packet; | &message;}</v> +<v>Discard = {discard, Reason} | discard</v> +<v>PostF = &mod_evaluable;}</v> </type> <desc> <p> Invoked to return a request for encoding and retransmission. -Has the same role as <seealso -marker="#prepare_request">prepare_request/3</seealso> in the case that +Has the same role as &prepare_request; in the case that a peer connection is lost an an alternate peer selected but the -argument <seealso marker="#packet">packet()</seealso> is as returned by the initial -<c>prepare_request/3</c>.</p> +argument &packet; is as returned +by the initial &prepare_request;.</p> <p> Returning <c>{discard, Reason}</c> causes the request to be aborted -and a <seealso -marker="#handle_error">handle_error/4</seealso> callback to +and a &handle_error; callback to take place with <c>Reason</c> as initial argument. Returning <c>discard</c> is equivalent to returning <c>{discard, discarded}</c>.</p> -<marker id="handle_answer"/> </desc> </func> @@ -397,51 +395,43 @@ discarded}</c>.</p> <name>Mod:handle_answer(Packet, Request, SvcName, Peer) -> Result</name> <fsummary>Receive an answer message from a peer.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> -<v>Request = <seealso marker="#message">message()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> +<v>Packet = &packet;</v> +<v>Request = &message;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> <v>Result = term()</v> </type> <desc> <p> Invoked when an answer message is received from a peer. -The return value is returned from the call to <seealso -marker="diameter#call">diameter:call/4</seealso> for which the -callback takes place unless the <c>detach</c> option was -specified.</p> +The return value is returned from &mod_call; unless the +<c>detach</c> option was specified.</p> <p> -The decoded answer record is in the <c>msg</c> field of the argument -<seealso marker="#packet">packet()</seealso>, -the undecoded binary in the <c>packet</c> field. +The decoded answer record and undecoded binary are in the <c>msg</c> +and <c>bin</c> fields of the argument +&packet; respectively. <c>Request</c> is the outgoing request message as was returned from -<seealso marker="#prepare_request">prepare_request/3</seealso> or -<seealso marker="#prepare_retransmit">prepare_retransmit/3</seealso> -before the request was passed to the transport.</p> +&prepare_request; or &prepare_retransmit;.</p> <p> -For any given call to <seealso -marker="diameter#call">diameter:call/4</seealso> there is at most one -call to the handle_answer callback of the application in question: any +For any given call to &mod_call; there is at most one +&handle_answer; callback: any duplicate answer (due to retransmission or otherwise) is discarded. -Similarly, only one of <c>handle_answer/4</c> or <c>handle_error/4</c> is -called for any given request.</p> +Similarly, only one of &handle_answer; or +&handle_error; is called.</p> <p> By default, an incoming answer message that cannot be successfully -decoded causes the request process in question to fail, causing the -relevant call to <seealso -marker="diameter#call">diameter:call/4</seealso> -to return <c>{error, failure} (unless the <c>detach</c> option was -specified)</c>. -In particular, there is no <c>handle_error/4</c> callback in this +decoded causes the request process to fail, causing +&mod_call; +to return <c>{error, failure}</c> unless the <c>detach</c> option was +specified. +In particular, there is no &handle_error; callback in this case. -Application configuration may change this behaviour as described for -<seealso -marker="diameter#start_service">diameter:start_service/2</seealso>.</p> +The &mod_application_opt; +<c>answer_errors</c> can be set to change this behaviour.</p> -<marker id="handle_error"/> </desc> </func> @@ -450,30 +440,26 @@ marker="diameter#start_service">diameter:start_service/2</seealso>.</p> <fsummary>Return an error from a outgoing request.</fsummary> <type> <v>Reason = timeout | failover | term()</v> -<v>Request = <seealso marker="#message">message()</seealso></v> -<v>SvcName = <seealso marker="diameter#service_name">diameter:service_name()</seealso></v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> +<v>Request = &message;</v> +<v>SvcName = &mod_service_name;</v> +<v>Peer = &peer;</v> <v>Result = term()</v> </type> <desc> <p> -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 <seealso -marker="diameter#call">diameter:call/4</seealso> for which the -callback takes place (unless the <c>detach</c> option was -specified).</p> +Invoked when an error occurs before an answer message is received +in response to an outgoing request. +The return value is returned from &mod_call; unless the +<c>detach</c> option was specified.</p> <p> Reason <c>timeout</c> indicates that an answer message has not been -received within the required time. +received within the time specified with the corresponding &mod_call_opt;. Reason <c>failover</c> indicates that the transport connection to the peer to which the request has -been sent has been lost but that not alternate node was available, -possibly because a <seealso marker="#pick_peer">pick_peer/4</seealso> -callback returned false.</p> +been sent has become unavailable and that not alternate peer was +not selected.</p> -<marker id="handle_request"/> </desc> </func> @@ -481,54 +467,54 @@ callback returned false.</p> <name>Mod:handle_request(Packet, SvcName, Peer) -> Action</name> <fsummary>Receive an incoming request.</fsummary> <type> -<v>Packet = <seealso marker="#packet">packet()</seealso></v> +<v>Packet = &packet;</v> <v>SvcName = term()</v> -<v>Peer = <seealso marker="#peer">peer()</seealso></v> -<v>Action = Reply | {relay, [Opt]} | discard | {eval, Action, PostF}</v> -<v>Reply = {reply, <seealso marker="#message">message()</seealso>} +<v>Peer = &peer;</v> +<v>Action = Reply + | {relay, [Opt]} + | discard + | {eval|eval_packet, Action, PostF}</v> +<v>Reply = {reply, &packet; | &message;} | {protocol_error, 3000..3999}</v> -<v>Opt = <seealso marker="diameter#call_opt">diameter:call_opt()</seealso></v> -<v>PostF = <seealso marker="diameter#evaluable">diameter:evaluable()</seealso></v> +<v>Opt = &mod_call_opt;</v> +<v>PostF = &mod_evaluable;</v> </type> <desc> <p> 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 <seealso -marker="diameter#start_service">diameter:start_service/2</seealso>) +callback module as configured with &mod_start_service;) is determined by the Application Identifier in the header of the incoming request message, the selected module being the one -whose corresponding <seealso -marker="diameter_dict#MESSAGE_RECORDS">dictionary</seealso> declares +whose corresponding dictionary declares itself as defining either the application in question or the Relay application.</p> <p> -The argument <seealso marker="#packet">packet()</seealso> has the following signature.</p> +The argument &packet; has the following signature.</p> -<code> +<pre> #diameter_packet{header = #diameter_header{}, avps = [#diameter_avp{}], msg = record() | undefined, - errors = [<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso> | {<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>, #diameter_avp{}}], + errors = [&dict_Unsigned32; | {&dict_Unsigned32;, #diameter_avp{}}], bin = binary(), transport_data = term()} -</code> +</pre> <p> -The <c>msg</c> field will be <c>undefined</c> only in case the request has +The <c>msg</c> field will be <c>undefined</c> in case the request has been received in the relay application. Otherwise it contains the record representing the request as outlined -in <seealso -marker="diameter_dict#MESSAGE_RECORDS">diameter_dict(4)</seealso>.</p> +in &dict;.</p> <p> The <c>errors</c> field specifies any Result-Code's identifying errors that were encountered in decoding the request. In this case diameter will set both Result-Code and Failed-AVP AVP's in a returned -answer <seealso marker="#message">message()</seealso> before sending it to the peer: -the returned <seealso marker="#message">message()</seealso> need only set any other required AVP's. +answer &message; before sending it to the peer: +the returned &message; need only set any other required AVP's. Note that the errors detected by diameter are all of the 5xxx series (Permanent Failures). The <c>errors</c> list is empty if the request has been received in @@ -538,19 +524,24 @@ the relay application.</p> The <c>transport_data</c> field contains an arbitrary term passed into diameter from the transport module in question, or the atom <c>undefined</c> if the transport specified no data. -The term is preserved in the <seealso marker="#packet">packet()</seealso> containing any answer message -sent back to the transport process unless another value is explicitly -specified.</p> +The term is preserved if a &message; is returned but must be set +explicitly in a returned &packet;.</p> <p> The semantics of each of the possible return values are as follows.</p> <taglist> -<tag><c>{reply, <seealso marker="#message">message()</seealso>}</c></tag> +<tag><c>{reply, &packet; | &message;}</c></tag> <item> <p> -Send the specified answer message to the peer.</p> +Send the specified answer message to the peer. +In the case of a &packet;, the +message to be sent must be set in the +<c>msg</c> field and the <c>header</c> field can be set to a +<c>#diameter_header{}</c> to specify values that should be +preserved in the outgoing answer, appropriate values otherwise +being set by diameter.</p> </item> <tag><c>{protocol_error, 3000..3999}</c></tag> @@ -559,15 +550,15 @@ Send the specified answer message to the peer.</p> Send an answer message to the peer containing the specified protocol error. Equivalent to</p> -<code> +<pre> {reply, ['answer-message' | Avps] -</code> +</pre> <p> where <c>Avps</c> sets the Origin-Host, Origin-Realm, the specified Result-Code and (if the request sent one) Session-Id AVP's.</p> <p> -Note that RFC 3588 mandates that only answers with a 3xxx series +Note that &the_rfc; mandates that only answers with a 3xxx series Result-Code (protocol errors) may set the E bit. Returning a non-3xxx value in a <c>protocol_error</c> tuple will cause the request process in question to fail.</p> @@ -580,37 +571,47 @@ 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 <seealso marker="#pick_peer">pick_peer/4</seealso> -and subsequent callbacks take place just as if <seealso -marker="diameter#call">diameter:call/4</seealso> had been called +added to the request and &pick_peer; +and subsequent callbacks take place just as if &mod_call; had been called explicitly. The End-to-End Identifier of the incoming request is preserved in the header of the relayed request.</p> <p> The returned <c>Opts</c> should not specify <c>detach</c>. -A subsequent <seealso marker="#handle_answer">handle_answer/4</seealso> +A subsequent &handle_answer; callback for the relayed request must return its first argument, the <c>#diameter_packet{}</c> record containing the answer message. Note that the <c>extra</c> option can be specified to supply arguments that can distinguish the relay case from others if so desired. Any other return value (for example, from a -<seealso marker="#handle_error">handle_error/4</seealso> callback) +&handle_error; callback) causes the request to be answered with 3002 (DIAMETER_UNABLE_TO_DELIVER).</p> </item> <tag><c>discard</c></tag> <item> <p> -Discard the request.</p> +Discard the request. +No answer message is sent to the peer.</p> </item> <tag><c>{eval, Action, PostF}</c></tag> <item> <p> Handle the request as if <c>Action</c> has been returned and then -evaluate <c>PostF</c> in the request process.</p> +evaluate <c>PostF</c> in the request process. +The return value is ignored.</p> +</item> + +<tag><c>{eval_packet, Action, PostF}</c></tag> +<item> +<p> +Like <c>eval</c> but evaluate <c>PostF</c> on any encoded +<c>#diameter_packet{}</c> prior to transmission, the <c>bin</c> field +containing the encoded binary. +The return value is ignored.</p> </item> </taglist> diff --git a/lib/diameter/doc/src/diameter_codec.xml b/lib/diameter/doc/src/diameter_codec.xml new file mode 100644 index 0000000000..4a77d5435b --- /dev/null +++ b/lib/diameter/doc/src/diameter_codec.xml @@ -0,0 +1,389 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY records + '<seealso marker="diameter_dict#MESSAGE_RECORDS">diameter_dict(4)</seealso>'> + <!ENTITY types + '<seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> + +<erlref> +<header> +<copyright> +<year>2012</year> +<holder>Ericsson AB. All Rights Reserved.</holder> +</copyright> +<legalnotice> +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. + +</legalnotice> + +<title>diameter_codec(3)</title> +<prepared>Anders Svensson</prepared> +<responsible></responsible> +<docno></docno> +<approved></approved> +<checked></checked> +<date></date> +<rev></rev> +<file>diameter_codec.xml</file> +</header> + +<module>diameter_codec</module> +<modulesummary>Decode and encode of Diameter messages.</modulesummary> + +<description> + +<p> +Incoming Diameter messages are decoded from binary() before being +communicated to &man_app; callbacks. +Similarly, outgoing Diameter messages are encoded into binary() before +being passed to the appropriate &man_transport; module for +transmission. +The functions in this module implement this encode/decode.</p> + +<note> +<p> +Calls to this module are made by diameter itself as a consequence of +configuration passed to &mod_start_service;. +The encode/decode functions may also be useful for other purposes (eg. +test) but the diameter user does not need to call them explicitly when +sending and receiving messages using &mod_call; and the callback +interface documented in &man_app;.</p> +</note> + +<p> +The &header; and &packet; records below +are defined in diameter.hrl, which can be included as follows.</p> + +<pre> +-include_lib("diameter/include/diameter.hrl"). +</pre> + +<p> +Application-specific records are definied in the hrl +files resulting from dictionary file compilation.</p> + +</description> + +<!-- ===================================================================== --> + +<section> +<title>DATA TYPES</title> + +<p></p> + +<taglist> + +<marker id="integers"/> + +<tag><c>uint8() = 0..255</c></tag> +<tag><c>uint24() = 0..16777215</c></tag> +<tag><c>uint32() = 0..4294967295</c></tag> +<item> +<p> +8-bit, 24-bit and 32-bit integers occurring in Diameter and AVP +headers.</p> +</item> + +<marker id="avp"/> + +<tag><c>avp() = #diameter_avp{}</c></tag> +<item> +<p> +The application-neutral representation of an AVP. +Primarily intended for use by relay applications that need to handle +arbitrary Diameter applications. +A service implementing a specific Diameter application +(for which it configures a dictionary) can manipulate values of type +&message; instead.</p> + +<p> +Fields have the following types.</p> + +<taglist> + +<tag><c>code = uint32()</c></tag> +<tag><c>is_mandatory = boolean()</c></tag> +<tag><c>need_encryption = boolean()</c></tag> +<tag><c>vendor_id = uint32() | undefined</c></tag> +<item> +<p> +Values in the AVP header, corresponding to AVP Code, the M flag, P +flags and Vendor-ID respectivelty. +A Vendor-ID other than <c>undefined</c> implies a set V flag.</p> +</item> + +<tag><c>data = iolist()</c></tag> +<item> +<p> +The data bytes of the AVP.</p> +</item> + +<tag><c>name = atom()</c></tag> +<item> +<p> +The name of the AVP as defined in the dictionary file in question, or +<c>undefined</c> if the AVP is unknown to the dictionary file in +question.</p> +</item> + +<tag><c>value = term()</c></tag> +<item> +<p> +The decoded value of an AVP. +Will be <c>undefined</c> on decode if the data bytes could +not be decoded or the AVP is unknown. +The type of a decoded value is as document in &types;.</p> +</item> + +<tag><c>type = atom()</c></tag> +<item> +<p> +The type of the AVP as specified in the dictionary file in question +(or one it inherits). +Possible types are <c>undefined</c> and the Diameter types: +<c>OctetString</c>, <c>Integer32</c>, <c>Integer64</c>, +<c>Unsigned32</c>, <c>Unsigned64</c>, <c>Float32</c>, <c>Float64</c>, +<c>Grouped</c>, <c>Enumerated</c>, <c>Address</c>, <c>Time</c>, +<c>UTF8String</c>, <c>DiameterIdentity</c>, <c>DiameterURI</c>, +<c>IPFilterRule</c> and <c>QoSFilterRule</c>.</p> +</item> + +</taglist> + +</item> + +<marker id="dictionary"/> + +<tag><c>dictionary() = module()</c></tag> +<item> + +<p> +The name of a generated dictionary module as generated by &man_compile; +or &make_codec;. +The interface provided by a dictionary module is an +implementation detail that may change.</p> +</item> + +<marker id="header"/> + +<tag><c>header() = #diameter_header{}</c></tag> +<item> +<p> +The record representation of the Diameter header. +Values in a &packet; returned by &decode; are as extracted from the +incoming message. +Values set in an &packet; passed to &encode; are preserved in the +encoded binary(), with the exception of <c>length</c>, <c>cmd_code</c> +and <c>application_id</c>, all of which are determined by the +&dictionary; in question.</p> + +<note> +<p> +It is not necessary to set header fields explicitly in outgoing +messages as diameter itself will set appropriate values. +Setting inappropriate values can be useful for test purposes.</p> +</note> + +<p> +Fields have the following types.</p> + +<taglist> + +<tag><c>version = uint8()</c></tag> +<tag><c>length = uint24()</c></tag> +<tag><c>cmd_code = uint24()</c></tag> +<tag><c>application_id = uint32()</c></tag> +<tag><c>hop_by_hop_id = uint32()</c></tag> +<tag><c>end_to_end_id = uint32()</c></tag> +<item> +<p> +Values of the Version, Message Length, Command-Code, Application-ID, +Hop-by-Hop Identifier and End-to-End Identifier fields of the Diameter +header.</p> +</item> + +<tag><c>is_request = boolean()</c></tag> +<tag><c>is_proxiable = boolean()</c></tag> +<tag><c>is_error = boolean()</c></tag> +<tag><c>is_retransmitted = boolean()</c></tag> +<item> +<p> +Values correspoding to the R(equest), P(roxiable), E(rror) +and T(Potentially re-transmitted message) flags of the Diameter +header.</p> +</item> + +</taglist> + +</item> + +<marker id="message"/> + +<tag><c>message() = record() | list()</c></tag> +<item> +<p> +The representation of a Diameter message as passed to +&mod_call; or returned from a &app_handle_request; callback. +The record representation is as outlined in &records;: +a message as defined in a dictionary file is encoded as a record with +one field for each component AVP. +Equivalently, a message can also be encoded as a list whose head is +the atom-valued message name (as specified in the relevant dictionary +file) and whose tail is a list of <c>{AvpName, AvpValue}</c> pairs.</p> + +<p> +Another list-valued representation allows a message to be specified +as a list whose head is a &header; and whose tail is an &avp; list. +This representation is used by diameter itself when relaying requests +as directed by the return value of a &app_handle_request; callback. +It differs from the other other two in that it bypasses the checks for +messages that do not agree with their definitions in the dictionary in +question: messages are sent exactly as specified.</p> + +</item> + +<marker id="packet"/> + +<tag><c>packet() = #diameter_packet{}</c></tag> +<item> +<p> +A container for incoming and outgoing Diameter messages. +Fields have the following types.</p> + +<taglist> + +<tag><c>header = &header; | undefined</c></tag> +<item> +<p> +The Diameter header of the message. +Can be (and typically should be) <c>undefined</c> for an outgoing +message in a non-relay application, in which case diameter provides +appropriate values.</p> +</item> + +<tag><c>avps = [&avp;] | undefined</c></tag> +<item> +<p> +The AVPs of the message. +Ignored for an outgoing message if the <c>msg</c> field is set to a +value other than <c>undefined</c>.</p> +</item> + +<tag><c>msg = &message; | undefined</c></tag> +<item> +<p> +The incoming/outgoing message. +For an incoming message, a record if the message can be +decoded in a non-relay application, <c>undefined</c> otherwise. +For an outgoing message, setting a <c>[&header; | &avp;]</c> list is +equivalent to setting the <c>header</c> and <c>avps</c> fields to the +corresponding values.</p> + +<warning> +<p> +A record-valued <c>msg</c> field does <b>not</b> imply an absence of +decode errors. +The <c>errors</c> field should also be examined.</p> +</warning> + +</item> + +<tag><c>bin = binary()</c></tag> +<item> +<p> +The incoming message prior to encode or the outgoing message after +encode.</p> +</item> + +<tag><c>errors = [5000..5999 | {5000..5999, avp()}]</c></tag> +<item> +<p> +Errors detected at decode of an incoming message, as identified by +a corresponding 5xxx series Result-Code (Permanent Failures). +For an incoming request, these should be used to formulate an +appropriate answer as documented for the &app_handle_request; +callback in &man_app;. +For an incoming answer, the &mod_application_opt; +<c>answer_errors</c> determines the behaviour.</p> +</item> + +<tag><c>transport_data = term()</c></tag> +<item> +<p> +An arbitrary term of meaning only to the transport process in +question, as documented in &man_transport;.</p> +</item> + +</taglist> + +</item> + +</taglist> + +</section> + +<!-- ===================================================================== --> + +<funcs> + +<func> +<name>decode(Mod, Bin) -> Pkt</name> +<fsummary>Decode a Diameter message.</fsummary> +<type> +<v>Mod = &dictionary;</v> +<v>Bin = binary()</v> +<v>Pkt = &packet;</v> +</type> +<desc> + +<p> +Decode a Diameter message.</p> + +</desc> +</func> + +<func> +<name>encode(Mod, Msg) -> Pkt</name> +<fsummary>Encode a Diameter message.</fsummary> +<type> +<v>Mod = &dictionary;</v> +<v>Msg = &message; | &packet;</v> +<v>Pkt = &packet;</v> +</type> +<desc> + +<p> +Encode a Diameter message. +</p> + +</desc> +</func> + +</funcs> + +<!-- ===================================================================== --> +<!-- ===================================================================== --> + +<section> +<title>SEE ALSO</title> + +<p> +&man_compile;, &man_app;, &man_dict;, &man_make;</p> + +</section> + +</erlref> diff --git a/lib/diameter/doc/src/diameter_compile.xml b/lib/diameter/doc/src/diameter_compile.xml index 7a6ca48798..0bd7ad1789 100644 --- a/lib/diameter/doc/src/diameter_compile.xml +++ b/lib/diameter/doc/src/diameter_compile.xml @@ -1,5 +1,12 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!DOCTYPE comref SYSTEM "comref.dtd"> +<!DOCTYPE comref SYSTEM "comref.dtd" [ + <!ENTITY dictionary + '<seealso marker="diameter_dict">dictionary file</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <comref> <header> @@ -31,12 +38,14 @@ supplied. <description> <p> -The diameterc utility is used to compile diameter -<seealso marker="diameter_dict">dictionary files</seealso> -into Erlang source. -The resulting source implements the interface diameter requires +The diameterc utility is used to compile a diameter +&dictionary; into Erlang source. +The resulting source implements the interface diameter required to encode and decode the dictionary's messages and AVP's.</p> +<p> +The module &man_make; provides an alternate compilation interface.</p> + </description> <section> @@ -47,53 +56,52 @@ to encode and decode the dictionary's messages and AVP's.</p> <tag><![CDATA[diameterc [<options>] <file>]]></tag> <item> <p> -Compiles a single dictionary file. Valid options are as follows.</p> - -<!-- Leave -h/d/v undocumented, except for the usage message from the - utility itself. --> - -<taglist> -<tag><![CDATA[-o <dir>]]></tag> -<item> -<p> -Specifies the directory into which the generated source should be written. -Defaults to the current working directory.</p> -</item> +Compile a single dictionary file to Erlang source. +Valid options are as follows.</p> <tag><![CDATA[-i <dir>]]></tag> <item> <p> -Specifies a directory to add to the code path. +Prepend the specified directory to the code path. Use to point at beam files compiled from inherited dictionaries, -<c>@inherits</c> in a dictionary file creating a beam dependency, not -an erl/hrl dependency.</p> +<c>&dict_inherits;</c> in a dictionary file creating a beam +dependency, not an erl/hrl dependency.</p> <p> Multiple <c>-i</c> options can be specified.</p> </item> +<taglist> +<tag><![CDATA[-o <dir>]]></tag> +<item> +<p> +Write generated source to the specified directory. +Defaults to the current working directory.</p> +</item> + <tag><![CDATA[-E]]></tag> <tag><![CDATA[-H]]></tag> <item> <p> -Supresses erl and hrl generation, respectively.</p> +Supress erl and hrl generation, respectively.</p> </item> <tag><![CDATA[--name <name>]]></tag> <tag><![CDATA[--prefix <prefix>]]></tag> <item> <p> -Set <c>@name</c> and <c>@prefix</c> in the dictionary, -respectively. +Set <c>&dict_name;</c> or <c>&dict_prefix;</c> to the specified +string. Overrides any setting in the file itself.</p> </item> <tag><![CDATA[--inherits <dict>]]></tag> <item> <p> -Append an <c>@inherits</c> to the dictionary before compiling. -Specifying <c>'-'</c> as the dictionary has the effect of clearing any -previous inherits, causing them to be ignored.</p> +Append &dict_inherits; of the specified module. +Specifying <c>"-"</c> has the effect of discarding clearing any +previous inherits, both in the dictionary file and on the options +list.</p> <p> Multiple <c>--inherits</c> options can be specified.</p> @@ -122,7 +130,7 @@ Returns 0 on success, non-zero on failure.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_dict">diameter_dict(4)</seealso></p> +&man_make;, &man_dict;</p> </section> diff --git a/lib/diameter/doc/src/diameter_dict.xml b/lib/diameter/doc/src/diameter_dict.xml index 98adebf145..8b0687a22e 100644 --- a/lib/diameter/doc/src/diameter_dict.xml +++ b/lib/diameter/doc/src/diameter_dict.xml @@ -1,5 +1,16 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "fileref.dtd"> +<!DOCTYPE erlref SYSTEM "fileref.dtd" [ + <!ENTITY format + '<seealso marker="#FILE_FORMAT">FILE FORMAT</seealso>'> + <!ENTITY records + '<seealso marker="#MESSAGE_RECORDS">MESSAGE RECORDS</seealso>'> + <!ENTITY types + '<seealso marker="#DATA_TYPES">DATA TYPES</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <fileref> <header> @@ -40,36 +51,33 @@ under the License. <description> <p> -A diameter service as configured with <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> +A diameter service, as configured with &mod_start_service;, specifies one or more supported Diameter applications. Each Diameter application specifies a dictionary module that knows how to encode and decode its messages and AVPs. The dictionary module is in turn generated from a file that defines these messages and AVPs. -The format of such a file is defined in -<seealso marker="#FILE_FORMAT">FILE FORMAT</seealso> below. +The format of such a file is defined in &format; below. Users add support for their specific applications by creating dictionary files, compiling them to Erlang modules using -<seealso marker="diameterc">diameterc</seealso> and configuring the +either &man_compile; or &man_make; and configuring the resulting dictionaries modules on a service.</p> <p> -The codec generation also results in a hrl file that defines records -for the messages and grouped AVPs defined for the application, these -records being what a user of the diameter application sends and receives. -(Modulo other available formats as discussed in <seealso -marker="diameter_app">diameter_app(3)</seealso>.) +Dictionary module generation also results in a hrl file that defines +records for the messages and Grouped AVPs defined by the +dictionary, these records being what a user of the diameter +application sends and receives, modulo other possible formats as +discussed in &man_app;. These records and the underlying Erlang data types corresponding to -Diameter data formats are discussed in <seealso -marker="#MESSAGE_RECORDS">MESSAGE RECORDS</seealso> and <seealso -marker="#DATA_TYPES">DATA TYPES</seealso> respectively. -The generated hrl also contains defines for the possible values of +Diameter data formats are discussed in &records; and &types; +respectively. +The generated hrl also contains macro definitions for the possible values of AVPs of type Enumerated.</p> <p> The diameter application includes three dictionary modules -corresponding to applications defined in section 2.4 of RFC 3588: +corresponding to applications defined in section 2.4 of &the_rfc;: <c>diameter_gen_base_rfc3588</c> for the Diameter Common Messages application with application identifier 0, <c>diameter_gen_accounting</c> for the Diameter Base Accounting @@ -108,6 +116,8 @@ The order in which sections are specified is unimportant.</p> <taglist> +<marker id="id"/> + <tag><c>@id Number</c></tag> <item> <p> @@ -125,12 +135,14 @@ is used to identify the relevant dictionary module.</p> <p> Example:</p> -<code> +<pre> @id 16777231 -</code> +</pre> </item> +<marker id="name"/> + <tag><c>@name Mod</c></tag> <item> <p> @@ -146,12 +158,14 @@ with existing modules in the system.</p> <p> Example:</p> -<code> +<pre> @name etsi_e2 -</code> +</pre> </item> +<marker id="prefix"/> + <tag><c>@prefix Name</c></tag> <item> <p> @@ -169,12 +183,14 @@ different Diameter applications.</p> <p> Example:</p> -<code> +<pre> @prefix etsi_e2 -</code> +</pre> </item> +<marker id="vendor"/> + <tag><c>@vendor Number Name</c></tag> <item> <p> @@ -189,12 +205,14 @@ The section has empty content.</p> <p> Example:</p> -<code> +<pre> @vendor 13019 ETSI -</code> +</pre> </item> +<marker id="avp_vendor_id"/> + <tag><c>@avp_vendor_id Number</c></tag> <item> <p> @@ -205,16 +223,18 @@ The section content consists of AVP names.</p> <p> Example:</p> -<code> +<pre> @avp_vendor_id 2937 WWW-Auth Domain-Index Region-Set -</code> +</pre> </item> +<marker id="inherits"/> + <tag><c>@inherits Mod</c></tag> <item> <p> @@ -238,18 +258,20 @@ is equivalent to using <c>@avp_vendor_id</c> with a copy of the dictionary's definitions but the former makes for easier reuse.</p> <p> -All dictionaries should typically inherit RFC3588 AVPs from +All dictionaries should typically inherit &the_rfc; AVPs from <c>diameter_gen_base_rfc3588</c>.</p> <p> Example:</p> -<code> +<pre> @inherits diameter_gen_base_rfc3588 -</code> +</pre> </item> +<marker id="avp_types"/> + <tag><c>@avp_types</c></tag> <item> <p> @@ -260,7 +282,7 @@ The section consists of definitions of the form</p> <p> where Code is the integer AVP code, Type identifies an AVP Data Format -as defined in <seealso marker="#DATA_TYPES">DATA TYPES</seealso> below, +as defined in section &types; below, and Flags is a string of V, M and P characters indicating the flags to be set on an outgoing AVP or a single <c>'-'</c> (minus) character if none are to be set.</p> @@ -268,22 +290,22 @@ none are to be set.</p> <p> Example:</p> -<code> +<pre> @avp_types Location-Information 350 Grouped MV Requested-Information 353 Enumerated V -</code> +</pre> <warning> <p> -The P flag has been deprecated by the Diameter Maintenance -and Extensions Working Group of the IETF and should be omitted -to conform to the current draft standard.</p> +The P flag has been deprecated by &the_rfc;.</p> </warning> </item> +<marker id="custom_types"/> + <tag><c>@custom_types Mod</c></tag> <item> <p> @@ -298,13 +320,15 @@ encode/decode.</p> <p> Example:</p> -<code> +<pre> @custom_types rfc4005_avps Framed-IP-Address -</code> +</pre> </item> +<marker id="codecs"/> + <tag><c>@codecs Mod</c></tag> <item> <p> @@ -315,22 +339,24 @@ Like <c>@custom_types</c> but requires the specified module to export <p> Example:</p> -<code> +<pre> @codecs rfc4005_avps Framed-IP-Address -</code> +</pre> </item> +<marker id="messages"/> + <tag><c>@messages</c></tag> <item> <p> Defines the messages of the application. The section content consists of definitions of the form specified in -section 3.2 of RFC 3588, "Command Code ABNF specification".</p> +section 3.2 of &the_rfc;, "Command Code Format Specification".</p> <!-- RFC 4740 RTR/RTA --> -<code> +<pre> @messages RTR ::= < Diameter Header: 287, REQ, PXY > @@ -363,35 +389,39 @@ RTA ::= < Diameter Header: 287, PXY > * [ Proxy-Info ] * [ Route-Record ] * [ AVP ] -</code> +</pre> </item> +<marker id="grouped"/> + <tag><c>@grouped</c></tag> <item> <p> Defines the contents of the AVPs of the application having type Grouped. The section content consists of definitions of the form specified in -section 4.4 of RFC 3588, "Grouped AVP Values".</p> +section 4.4 of &the_rfc;, "Grouped AVP Values".</p> <p> Example:</p> -<code> +<pre> @grouped SIP-Deregistration-Reason ::= < AVP Header: 383 > { SIP-Reason-Code } [ SIP-Reason-Info ] * [ AVP ] -</code> +</pre> <p> Specifying a Vendor-Id in the definition of a grouped AVP is equivalent to specifying it with <c>@avp_vendor_id</c>.</p> </item> +<marker id="enum"/> + <tag><c>@enum Name</c></tag> <item> <p> @@ -408,16 +438,18 @@ otherwise defined in another dictionary.</p> <p> Example:</p> -<code> +<pre> @enum SIP-Reason-Code PERMANENT_TERMINATION 0 NEW_SIP_SERVER_ASSIGNED 1 SIP_SERVER_CHANGE 2 REMOVE_SIP_SERVER 3 -</code> +</pre> </item> +<marker id="end"/> + <tag><c>@end</c></tag> <item> <p> @@ -444,28 +476,28 @@ The hrl generated from a dictionary specification defines records for the messages and grouped AVPs defined in <c>@messages</c> and <c>@grouped</c> sections. For each message or grouped AVP definition, a record is defined whose -name is the message or AVP name prefixed with any dictionary prefix -defined with <c>@prefix</c> and whose fields are the names of the AVPs +name is the message or AVP name, prefixed with any dictionary prefix +defined with <c>@prefix</c>, and whose fields are the names of the AVPs contained in the message or grouped AVP in the order specified in the definition in question. For example, the grouped AVP</p> -<code> +<pre> SIP-Deregistration-Reason ::= < AVP Header: 383 > { SIP-Reason-Code } [ SIP-Reason-Info ] * [ AVP ] -</code> +</pre> <p> will result in the following record definition given an empty prefix.</p> -<code> +<pre> -record('SIP-Deregistration-Reason' {'SIP-Reason-Code', 'SIP-Reason-Info', 'AVP'}). -</code> +</pre> <p> The values encoded in the fields of generated records depends on the @@ -473,7 +505,7 @@ type and number of times the AVP can occur. In particular, an AVP which is specified as occurring exactly once is encoded as a value of the AVP's type while an AVP with any other specification is encoded as a list of values of the AVP's type. -The AVP's type is as specified in the AVP definition, the RFC 3588 +The AVP's type is as specified in the AVP definition, the &the_rfc; types being described below.</p> <marker id="DATA_TYPES"/> @@ -486,13 +518,11 @@ types being described below.</p> <p> The data formats defined in sections 4.2 ("Basic AVP Data -Formats") and 4.3 ("Derived AVP Data Formats") of RFC 3588 are encoded +Formats") and 4.3 ("Derived AVP Data Formats") of &the_rfc; are encoded as values of the types defined here. -Values are passed to <seealso -marker="diameter#call">diameter:call/4</seealso> +Values are passed to &mod_call; in a request record when sending a request, returned in a resulting -answer record and passed to a <seealso -marker="diameter_app#handle_request">handle_request</seealso> +answer record and passed to a &app_handle_request; callback upon reception of an incoming request.</p> <p> @@ -507,7 +537,7 @@ callback upon reception of an incoming request.</p> <marker id="Float64"/> <marker id="Grouped"/> -<code> +<pre> OctetString() = [0..255] Integer32() = -2147483647..2147483647 Integer64() = -9223372036854775807..9223372036854775807 @@ -516,7 +546,7 @@ Unsigned64() = 0..18446744073709551615 Float32() = '-infinity' | float() | infinity Float64() = '-infinity' | float() | infinity Grouped() = record() -</code> +</pre> <p> On encode, an OctetString() can be specified as an iolist(), @@ -530,10 +560,10 @@ section.</p> <em>Derived AVP Data Formats</em></p> <marker id="Address"/> -<code> +<pre> Address() = OctetString() | tuple() -</code> +</pre> <p> On encode, an OctetString() IPv4 address is parsed in the usual @@ -545,7 +575,7 @@ An IPv6 tuple() has length 8 and contains values of type 0..65535. The tuple representation is used on decode.</p> <marker id="Time"/> -<code> +<pre> Time() = {date(), time()} where @@ -559,19 +589,19 @@ where Hour = 0..23 Minute = 0..59 Second = 0..59 -</code> +</pre> <p> Additionally, values that can be encoded are -limited by way of their encoding as four octets as required by RFC -3588 with the required extension from RFC 2030. +limited by way of their encoding as four octets as required by +&the_rfc; with the required extension from RFC 2030. In particular, only values between <c>{{1968,1,20},{3,14,8}}</c> and <c>{{2104,2,26},{9,42,23}}</c> (both inclusive) can be encoded.</p> <marker id="UTF8String"/> -<code> +<pre> UTF8String() = [integer()] -</code> +</pre> <p> List elements are the UTF-8 encodings of the individual characters @@ -579,15 +609,15 @@ in the string. Invalid codepoints will result in encode/decode failure.</p> <marker id="DiameterIdentity"/> -<code> +<pre> DiameterIdentity() = OctetString() -</code> +</pre> <p> A value must have length at least 1.</p> <marker id="DiameterURI"/> -<code> +<pre> DiameterURI() = OctetString() | #diameter_URI{type = Type, fqdn = FQDN, @@ -602,19 +632,19 @@ where Port = integer() Transport = sctp | tcp Protocol = diameter | radius | 'tacacs+' -</code> +</pre> <p> On encode, fields port, transport and protocol default to 3868, sctp and diameter respectively. The grammar of an OctetString-valued DiameterURI() is as specified in -section 4.3 of RFC 3588. +section 4.3 of &the_rfc;. The record representation is used on decode.</p> <marker id="Enumerated"/> -<code> +<pre> Enumerated() = Integer32() -</code> +</pre> <p> On encode, values can be specified using the macros defined in a @@ -622,10 +652,10 @@ dictionary's hrl file.</p> <marker id="IPFilterRule"/> <marker id="QoSFilterRule"/> -<code> +<pre> IPFilterRule() = OctetString() QoSFilterRule() = OctetString() -</code> +</pre> <p> Values of these types are not currently parsed by diameter.</p> @@ -639,9 +669,7 @@ Values of these types are not currently parsed by diameter.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameterc">diameterc(1)</seealso>, -<seealso marker="diameter">diameter(3)</seealso>, -<seealso marker="diameter_app">diameter_app(3)</seealso></p> +&man_compile;, &man_main;, &man_app;, &man_codec;, &man_make;</p> </section> diff --git a/lib/diameter/doc/src/diameter_intro.xml b/lib/diameter/doc/src/diameter_intro.xml index bc2afbd453..fd578ccf45 100644 --- a/lib/diameter/doc/src/diameter_intro.xml +++ b/lib/diameter/doc/src/diameter_intro.xml @@ -1,5 +1,8 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> +<!DOCTYPE chapter SYSTEM "chapter.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent"> + %also; +]> <chapter> <header> @@ -35,7 +38,7 @@ under the License. <p> The diameter application is an implementation of the Diameter protocol -as defined by RFC 3588. +as defined by &the_rfc;. It supports arbitrary Diameter applications by way of a <em>dictionary</em> interface that allows messages and AVP's to be defined and input into diameter as configuration. @@ -86,9 +89,9 @@ dictionary module that provide encode/decode functionality for outgoing/incoming Diameter messages belonging to the application. A dictionary module is generated from a <seealso -marker="diameter_dict">specification file</seealso> using the <seealso +marker="diameter_dict">dictionary file</seealso> using the <seealso marker="diameterc">diameterc</seealso> utility. -Dictionaries for the RFC 3588 Diameter Common Messages, Base +Dictionaries for the &the_rfc; Diameter Common Messages, Base Accounting and Relay applications are provided with the diameter application.</p> diff --git a/lib/diameter/doc/src/diameter_make.xml b/lib/diameter/doc/src/diameter_make.xml new file mode 100644 index 0000000000..da6124310e --- /dev/null +++ b/lib/diameter/doc/src/diameter_make.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY filename + '<seealso marker="kernel:file#type-name">file:name()</seealso>'> + <!ENTITY dictionary + '<seealso marker="diameter_dict">dictionary file</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> + +<erlref> +<header> +<copyright> +<year>2012</year> +<holder>Ericsson AB. All Rights Reserved.</holder> +</copyright> +<legalnotice> +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. + +</legalnotice> + +<title>diameter_make(3)</title> +<prepared>Anders Svensson</prepared> +<responsible></responsible> +<docno></docno> +<approved></approved> +<checked></checked> +<date></date> +<rev></rev> +<file>diameter_make.xml</file> +</header> + +<module>diameter_make</module> +<modulesummary>Diameter dictionary compilation.</modulesummary> + +<description> + +<p> +The function &codec; is used to compile a diameter +&dictionary; into Erlang source. +The resulting source implements the interface diameter required +to encode and decode the dictionary's messages and AVP's.</p> + +<p> +The utility &man_compile; provides an alternate compilation +interface.</p> + +</description> + +<!-- ===================================================================== --> + +<funcs> + +<func> +<name>codec(Path::string(), [Opt]) -> ok | {error, Reason}</name> +<fsummary>Compile a dictionary file into Erlang source.</fsummary> +<desc> + +<p> +Compile a single dictionary file to Erlang source. +<c>Opt</c> can have the following types.</p> + +<taglist> + +<tag><c>{include, Dir::string()}</c></tag> +<item> +<p> +Prepend the specified directory to the code path. +Use to point at beam files compiled from inherited dictionaries, +<c>&dict_inherits;</c> in a dictionary file creating a beam +dependency, not an erl/hrl dependency.</p> + +<p> +Multiple <c>include</c> options can be specified.</p> +</item> + +<tag><c>{outdir, Dir::string()}</c></tag> +<item> +<p> +Write generated source to the specified directory. +Defaults to the current working directory.</p> +</item> + +<tag><c>{name|prefix, string()}</c></tag> +<item> +<p> +Set <c>&dict_name;</c> or <c>&dict_prefix;</c> to the specified +string. +Overrides any setting in the file itself.</p> +</item> + +<tag><c>{inherits, Mod::string()}</c></tag> +<item> +<p> +Append &dict_inherits; of the specified module. +Specifying <c>"-"</c> has the effect of discarding clearing any +previous inherits, both in the dictionary file and on the options +list.</p> + +<p> +Multiple <c>inherits</c> options can be specified.</p> +</item> + +</taglist> + +</desc> +</func> + +</funcs> + +<!-- ===================================================================== --> + +<section> +<title>BUGS</title> + +<p> +All options are string-valued. +In particular, it is not currently possible to +an &dict_inherits; module as an atom() or a path as a &filename;</p> + +</section> + +<!-- ===================================================================== --> + +<section> +<title>SEE ALSO</title> + +<p> +&man_compile;, &man_dict;</p> + +</section> + +</erlref> diff --git a/lib/diameter/doc/src/diameter_sctp.xml b/lib/diameter/doc/src/diameter_sctp.xml index 955169349c..5e3fd5eaf1 100644 --- a/lib/diameter/doc/src/diameter_sctp.xml +++ b/lib/diameter/doc/src/diameter_sctp.xml @@ -1,5 +1,16 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY gen_sctp '<seealso marker="kernel:gen_sctp">gen_sctp(3)</seealso>'> + <!ENTITY gen_sctp_open1 + '<seealso marker="kernel:gen_sctp#open-1">gen_sctp:open/1</seealso>'> + <!ENTITY ip_address + '<seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>'> + <!ENTITY inet '<seealso marker="kernel:inet">inet(3)</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -38,12 +49,11 @@ under the License. <description> <p> -This module implements diameter transport over SCTP using gen_sctp. +This module implements diameter transport over SCTP using &gen_sctp;. It can be specified as the value of a transport_module option to -<seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +&mod_add_transport; and implements the behaviour documented in -<seealso marker="diameter_transport">diameter_transport(3)</seealso>.</p> +&man_transport;.</p> <marker id="start"/> </description> @@ -58,18 +68,17 @@ and implements the behaviour documented in <fsummary>Start a transport process.</fsummary> <type> <v>Type = connect | accept</v> -<v>Ref = <seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso></v> +<v>Ref = &mod_transport_ref;</v> <v>Svc = #diameter_service{}</v> -<v>Opt = {raddr, <seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>} | {rport, integer()} | term()</v> +<v>Opt = {raddr, &ip_address;} | {rport, integer()} | term()</v> <v>Pid = pid()</v> -<v>LAddr = <seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso></v> +<v>LAddr = &ip_address;</v> <v>Reason = term()</v> </type> <desc> <p> -The start function required by <seealso -marker="diameter_transport#start">diameter_transport(3)</seealso>.</p> +The start function required by &man_transport;.</p> <p> The only diameter_sctp-specific argument is the options list. @@ -80,8 +89,7 @@ unspecified. More than one <c>raddr</c> option can be specified, in which case the connecting transport in question attempts each in sequence until an association is established. -Remaining options are any accepted by <seealso -marker="kernel:gen_sctp#open-1">gen_sctp:open/1</seealso>, with the exception +Remaining options are any accepted by &gen_sctp_open1;, with the exception of options <c>mode</c>, <c>binary</c>, <c>list</c>, <c>active</c> and <c>sctp_events</c>. Note that options <c>ip</c> and <c>port</c> specify the local address @@ -98,14 +106,12 @@ connecting transport.</p> <warning> <p> An insufficiently large receive buffer may result in a peer having to -resend incoming messages: set the <seealso -marker="kernel:inet">inet(3)</seealso> option <c>recbuf</c> to increase +resend incoming messages: set the &inet; option <c>recbuf</c> to increase the buffer size.</p> <p> An insufficiently large send buffer may result in outgoing messages -being discarded: set the <seealso -marker="kernel:inet">inet(3)</seealso> option <c>sndbuf</c> to increase +being discarded: set the &inet; option <c>sndbuf</c> to increase the buffer size.</p> </warning> @@ -114,16 +120,13 @@ diameter_sctp uses the <c>transport_data</c> field of the <c>#diameter_packet{}</c> record to communicate the stream on which an inbound message has been received, or on which an outbound message should be sent: the value will be of the form <c>{stream, Id}</c> -on an inbound message passed to a <seealso -marker="diameter_app#handle_request">handle_request</seealso> or <seealso -marker="diameter_app#handle_answer">handle_answer</seealso> callback. +on an inbound message passed to a &app_handle_request; or +&app_handle_answer; callback. For an outbound message, either <c>undefined</c> (explicitly or by receiving the outbound message as a <c>binary()</c>) or a tuple -should be set in the return value of <seealso -marker="diameter_app#handle_request">handle_request</seealso> +should be set in the return value of &app_handle_request; (typically by retaining the value passed into this function) -or <seealso -marker="diameter_app#prepare_request">prepare_request</seealso>. +or &app_prepare_request;. The value <c>undefined</c> uses a "next outbound stream" id and increments this modulo the total number outbound streams. That is, successive values of <c>undefined</c> cycle through all @@ -144,9 +147,7 @@ outbound streams.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_transport">diameter_transport(3)</seealso>, -<seealso marker="kernel:gen_sctp">gen_sctp(3)</seealso>, -<seealso marker="kernel:inet">inet(3)</seealso></p> +&man_main;, &man_transport;, &gen_sctp;, &inet;</p> </section> diff --git a/lib/diameter/doc/src/diameter_soc.xml b/lib/diameter/doc/src/diameter_soc.xml index 6b9ef9f756..16f6b9d5bb 100644 --- a/lib/diameter/doc/src/diameter_soc.xml +++ b/lib/diameter/doc/src/diameter_soc.xml @@ -1,11 +1,15 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> +<!DOCTYPE chapter SYSTEM "chapter.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + %also; +]> <chapter> <header> <copyright> <year>2011</year> +<year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> @@ -41,38 +45,20 @@ Known points of questionable or non-compliance.</p> <!-- ===================================================================== --> <section> -<title>RFC 3588</title> +<title>&the_rfc;</title> <list> <item> <p> -The End-to-End Security framework (section 2.9) isn't implemented -since it is largely unspecified. -The document that was to describe it -(reference [AAACMS]) was abandoned in an uncompleted state several -years ago and the current draft RFC deprecates the framework, -including the P Flag in the AVP header.</p> -</item> - -<item> -<p> -There is no TLS support over SCTP. -RFC 3588 requires that a Diameter server support TLS but in -practise this seems to mean TLS over SCTP since there are limitations -with running over SCTP: see RFC 6083 (DTLS over SCTP), which is a -response to RFC 3436 (TLS over SCTP). -The current RFC 3588 draft acknowledges this by equating -TLS with TLS/TCP and DTLS/SCTP but we do not yet support DTLS.</p> +There is no support for DTLS over SCTP.</p> </item> <item> <p> There is no explicit support for peer discovery (section 5.2). It can possibly be implemented on top of diameter as is but this is -probably something that diameter should do. -The current draft deprecates portions of the original RFC's mechanisms -however.</p> +probably something that diameter should do.</p> </item> <item> diff --git a/lib/diameter/doc/src/diameter_tcp.xml b/lib/diameter/doc/src/diameter_tcp.xml index 3ffcebfd90..e3b8c733b7 100644 --- a/lib/diameter/doc/src/diameter_tcp.xml +++ b/lib/diameter/doc/src/diameter_tcp.xml @@ -1,5 +1,27 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY gen_tcp_connect3 + '<seealso marker="kernel:gen_tcp#connect-3">gen_tcp:connect/3</seealso>'> + <!ENTITY gen_tcp_listen2 + '<seealso marker="kernel:gen_tcp#listen-2">gen_tcp:listen/2</seealso>'> + <!ENTITY ip_address + '<seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>'> + <!ENTITY ssl_connect2 + '<seealso marker="ssl:ssl#connect-2">ssl:connect/2</seealso>'> + <!ENTITY ssl_connect3 + '<seealso marker="ssl:ssl#connect-3">ssl:connect/3</seealso>'> + <!ENTITY ssl_accept2 + '<seealso marker="ssl:ssl#ssl_accept-2">ssl:ssl_accept/2</seealso>'> + <!ENTITY ssl_listen2 + '<seealso marker="ssl:ssl#listen-2">ssl:listen/2</seealso>'> + <!ENTITY gen_tcp '<seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>'> + <!ENTITY inet '<seealso marker="kernel:inet">inet(3)</seealso>'> + <!ENTITY ssl '<seealso marker="ssl:ssl">ssl(3)</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -38,15 +60,13 @@ under the License. <description> <p> -This module implements diameter transport over TCP using <seealso -marker="kernel:gen_tcp">gen_tcp</seealso>. +This module implements diameter transport over TCP using &gen_tcp;. It can be specified as the value of a <c>transport_module</c> option to -<seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +&mod_add_transport; and implements the behaviour documented in -<seealso marker="diameter_transport">diameter_transport(3)</seealso>. +&man_transport;. TLS security is supported, both as an upgrade following -capabilities exchange as specified by RFC 3588 and +capabilities exchange as specified by &the_rfc; and at connection establishment as in the current draft standard.</p> <p> @@ -66,13 +86,13 @@ before configuring TLS capability on diameter transports.</p> <fsummary>Start a transport process.</fsummary> <type> <v>Type = connect | accept</v> -<v>Ref = <seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso></v> +<v>Ref = &mod_transport_ref;</v> <v>Svc = #diameter_service{}</v> <v>Opt = OwnOpt | SslOpt | TcpOpt</v> <v>Pid = pid()</v> -<v>LAddr = <seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso></v> +<v>LAddr = &ip_address;</v> <v>Reason = term()</v> -<v>OwnOpt = {raddr, <seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>} +<v>OwnOpt = {raddr, &ip_address;} | {rport, integer()} | {port, integer()}</v> <v>SslOpt = {ssl_options, true | list()}</v> @@ -81,8 +101,7 @@ before configuring TLS capability on diameter transports.</p> <desc> <p> -The start function required by <seealso -marker="diameter_transport#start">diameter_transport(3)</seealso>.</p> +The start function required by &man_transport;.</p> <p> The only diameter_tcp-specific argument is the options list. @@ -92,16 +111,12 @@ transport. Option <c>ssl_options</c> must be specified for a transport that should support TLS: a value of <c>true</c> results in a TLS handshake immediately upon connection establishment while -<c>list()</c> specifies options to be passed to <seealso -marker="ssl:ssl#connect-2">ssl:connect/2</seealso> or -<seealso marker="ssl:ssl#ssl_accept-2">ssl:ssl_accept/2</seealso> +<c>list()</c> specifies options to be passed to &ssl_connect2; or +&ssl_accept2; after capabilities exchange if TLS is negotiated. -Remaining options are any accepted by <seealso -marker="ssl:ssl#connect-3">ssl:connect/3</seealso> or <seealso -marker="kernel:gen_tcp#connect-3">gen_tcp:connect/3</seealso> for -a connecting transport, or <seealso -marker="ssl:ssl#listen-2">ssl:listen/2</seealso> or <seealso -marker="kernel:gen_tcp#listen-2">gen_tcp:listen/2</seealso> for +Remaining options are any accepted by &ssl_connect3; or +&gen_tcp_connect3; for +a connecting transport, or &ssl_listen2; or &gen_tcp_listen2; for a listening transport, depending on whether or not <c>{ssl_options, true}</c> has been specified. Options <c>binary</c>, @@ -115,10 +130,8 @@ Note that the option <c>ip</c> specifies the local address.</p> An <c>ssl_options</c> list must be specified if and only if the transport in question has set <c>Inband-Security-Id</c> to 1 (<c>TLS</c>), as -specified to either <seealso -marker="diameter#start_service">start_service/2</seealso> or -<seealso -marker="diameter#add_transport">add_transport/2</seealso>, +specified to either &mod_start_service; or +&mod_add_transport;, so that the transport process will receive notification of whether or not to commence with a TLS handshake following capabilities exchange. @@ -149,11 +162,7 @@ The returned local address list has length one.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter">diameter(3)</seealso>, -<seealso marker="diameter_transport">diameter_transport(3)</seealso>, -<seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>, -<seealso marker="kernel:inet">inet(3)</seealso>, -<seealso marker="ssl:ssl">ssl(3)</seealso></p> +&man_main;, &man_transport;, &gen_tcp;, &inet;, &ssl;</p> </section> diff --git a/lib/diameter/doc/src/diameter_transport.xml b/lib/diameter/doc/src/diameter_transport.xml index 9ab750e560..55b531155f 100644 --- a/lib/diameter/doc/src/diameter_transport.xml +++ b/lib/diameter/doc/src/diameter_transport.xml @@ -1,5 +1,13 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<!DOCTYPE erlref SYSTEM "erlref.dtd" [ + <!ENTITY message '<seealso marker="#message">message()</seealso>'> + <!ENTITY ip_address + '<seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>'> + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <erlref> <header> @@ -38,82 +46,116 @@ under the License. <description> <p> -A module specified as a <c>transport_module</c> to <seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +A module specified as a <c>transport_module</c> to &mod_add_transport; must implement the interface documented here. The interface consists of a function with which diameter starts a transport process and a message interface with which the transport process communicates with the process that starts it (aka its parent).</p> -<marker id="start"/> </description> <!-- ===================================================================== --> +<section> +<title>DATA TYPES</title> + +<taglist> + +<marker id="message"/> + +<tag><c>message() = binary() | &codec_packet;</c></tag> +<item> +<p> +A Diameter message as passed over the transport interface.</p> + +<p> +For an inbound message from a transport process, a &codec_packet; must +contain the received message in its <c>bin</c> field. +In the case of an inbound request, any value set in the +<c>transport_data</c> field will passed back to the transport module +in the corresponding answer message, unless the sender supplies +another value.</p> + +<p> +For an outbound message to a transport process, a &codec_packet; has a +value other than <c>undefined</c> in its <c>transport_data</c> field +and has the binary() to send in its <c>bin</c> field.</p> +</item> + +</taglist> + +</section> + +<!-- ===================================================================== --> + <funcs> <func> -<name>Mod:start({Type, Ref}, Svc, Opts) - -> {ok, Pid} | {ok, Pid, LAddrs} | {error, Reason}</name> +<name>Mod:start({Type, Ref}, Svc, Config) + -> {ok, Pid} + | {ok, Pid, LAddrs} + | {error, Reason}</name> <fsummary>Start a transport process.</fsummary> <type> <v>Type = connect | accept</v> -<v>Ref = <seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso></v> +<v>Ref = &mod_transport_ref;</v> <v>Svc = #diameter_service{}</v> -<v>Opts = term()</v> +<v>Config = term()</v> <v>Pid = pid()</v> -<v>LAddrs = [<seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>]</v> +<v>LAddrs = [&ip_address;]</v> <v>Reason = term()</v> </type> <desc> <p> Start a transport process. -Called by diameter as a consequence of a call to <seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> in +Called by diameter as a consequence of a call to &mod_add_transport; in order to establish or accept a transport connection respectively. A transport process maintains a connection with a single remote peer.</p> <p> -The first argument indicates whether the transport process in question -is being started for a connecting (<c>connect</c>) or listening -(<c>accept</c>) transport. +<c>Type</c> indicates whether the transport process in question +is being started for a connecting (<c>Type=connect</c>) or listening +(<c>Type=accept</c>) transport. In the latter case, transport processes are started as required to -accept connections from multiple peers. -Ref is in each case the same value that was returned from the -call to <seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso> +accept connections from multiple peers.</p> + +<p> +Ref is the value that was returned from the call to &mod_add_transport; that has lead to starting of a transport process.</p> <p> -A transport process must implement the message interface documented below. -It should retain the pid of its parent, monitor the parent and terminate if -it dies. -It should not link to the parent. -It should exit if its transport connection with its peer is lost.</p> +<c>Svc</c> contains the capabilities passed to &mod_start_service; and +&mod_add_transport;, values passed to the latter overriding those +passed to the former.</p> + +<p> +<c>Config</c> is as passed in <c>transport_config</c> tuple in the +&mod_transport_opt; list passed to &mod_add_transport;.</p> <p> -The capabilities in the <c>#diameter_service{}</c> record are as -passed to <seealso -marker="diameter#start_service">diameter:start_service/2</seealso> and -<seealso -marker="diameter#add_transport">diameter:add_transport/2</seealso>, -values passed to the latter overriding those passed to the former. The start function should use the <c>Host-IP-Address</c> list and/or -<c>Opts</c> to select an appropriate list of local IP addresses, +<c>Config</c> to select an appropriate list of local IP addresses, and should return this list if different from the <c>#diameter_service{}</c> addresses. The returned list is used to populate <c>Host-IP-Address</c> AVPs in outgoing capabilities exchange messages, the <c>#diameter_service{}</c> addresses being used otherwise.</p> -<marker id="MESSAGES"/> +<p> +A transport process must implement the message interface documented below. +It should retain the pid of its parent, monitor the parent and terminate if +it dies. +It should not link to the parent. +It should exit if its transport connection with its peer is lost.</p> + </desc> </func> </funcs> <!-- ===================================================================== --> +<marker id="MESSAGES"/> <section> <title>MESSAGES</title> @@ -123,27 +165,23 @@ All messages sent over the transport interface are of the form <c>{diameter, term()}</c>.</p> <p> -A transport process can expect the following messages from -diameter.</p> +A transport process can expect messages of the following types from +its parent.</p> <taglist> -<tag><c>{diameter, {send, Packet}}</c></tag> +<tag><c>{diameter, {send, &message;}}</c></tag> <item> <p> -An outbound Diameter message. -<c>Packet</c> can be either binary() (the message to be sent) -or a <c>#diameter_packet{}</c> record whose <c>transport_data</c> -field contains a value other than undefined and whose <c>bin</c> field -contains the binary to send.</p> +An outbound Diameter message.</p> </item> <tag><c>{diameter, {close, Pid}}</c></tag> <item> <p> -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. <c>Pid</c> is the pid() of the parent process.</p> </item> @@ -178,7 +216,7 @@ TLS.</p> </taglist> <p> -A transport process should send the following messages +A transport process should send messages of the following types to its parent.</p> <taglist> @@ -201,19 +239,10 @@ Not sent if the transport process has <c>Type=accept</c>. endpoint to which the transport has connected.</p> </item> -<tag><c>{diameter, {recv, Packet}}</c></tag> +<tag><c>{diameter, {recv, &message;}}</c></tag> <item> <p> -An inbound Diameter message. -<c>Packet</c> can be either binary() (the received message) -or a <c>#diameter_packet{}</c> record -whose <c>bin</c> field contains the received binary(). -Any value (other than <c>undefined</c>) set in -the <c>transport_data</c> field will be passed back with a -corresponding answer message in the case that the inbound message is a -request unless the sender sets another value. -How <c>transport_data</c> is used/interpreted is up to the -transport module.</p> +An inbound Diameter message.</p> </item> <tag><c>{diameter, {tls, Ref}}</c></tag> @@ -237,8 +266,7 @@ A transport must exit if a handshake is not successful.</p> <title>SEE ALSO</title> <p> -<seealso marker="diameter_tcp">diameter_tcp(3)</seealso>, -<seealso marker="diameter_sctp">diameter_sctp(3)</seealso></p> +&man_tcp;, &man_sctp;</p> </section> diff --git a/lib/diameter/doc/src/files.mk b/lib/diameter/doc/src/files.mk index 79d53abceb..00ced3d91e 100644 --- a/lib/diameter/doc/src/files.mk +++ b/lib/diameter/doc/src/files.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2010-2011. All Rights Reserved. +# Copyright Ericsson AB 2010-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -26,6 +26,8 @@ XML_REF1_FILES = \ XML_REF3_FILES = \ diameter.xml \ diameter_app.xml \ + diameter_codec.xml \ + diameter_make.xml \ diameter_transport.xml \ diameter_tcp.xml \ diameter_sctp.xml diff --git a/lib/diameter/doc/src/notes.xml b/lib/diameter/doc/src/notes.xml index e57958ac09..d241e2bd19 100644 --- a/lib/diameter/doc/src/notes.xml +++ b/lib/diameter/doc/src/notes.xml @@ -1,11 +1,17 @@ <?xml version="1.0" encoding="latin1" ?> -<!DOCTYPE chapter SYSTEM "chapter.dtd"> +<!DOCTYPE chapter SYSTEM "chapter.dtd" [ + <!ENTITY % also SYSTEM "seealso.ent" > + <!ENTITY % here SYSTEM "seehere.ent" > + %also; + %here; +]> <chapter> <header> <copyright> <year>2011</year> +<year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -36,6 +42,179 @@ first.</p> <!-- ===================================================================== --> +<section><title>Diameter 1.3.1</title> + + <section><title>Known Bugs and Problems</title> + <list> + <item> + <p> + Fix function clause resulting from use of an eval + callback.</p> + <p> + Own Id: OTP-10685</p> + </item> + </list> + </section> + +</section> + +<section><title>Diameter 1.3</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fix faulty handling of Origin-State-Id and faulty config + values.</p> + <p> + The former was expected in a list despite the + documentation requiring (correctly) an integer. A bare + value for a list-valued capability was not handled.</p> + <p> + Own Id: OTP-10440</p> + </item> + <item> + <p> + Fix timing of up/down events.</p> + <p> + Previously, a call to diameter:call/4 following a peer_up + callback might incorrectly return {error, no_connection}, + depending on timing. Both events now follow the + corresponding callbacks.</p> + <p> + Own Id: OTP-10459</p> + </item> + <item> + <p> + Make diameter:service_info/2 usable in peer_up, peer_down + and pick_peer callbacks.</p> + <p> + Except for in pick_peer when {call_mutates_state, false}, + it would previously hang indefinitely.</p> + <p> + Own Id: OTP-10460</p> + </item> + <item> + <p> + Verify that End-to-End and Hop-by-Hop Identifiers in an + incoming CEA/DPA match those sent in the corresponding + CER/DPR.</p> + <p> + The values were previously ignored. Answers whose + identifiers do not match are handled as unexpected.</p> + <p> + Own Id: OTP-10565</p> + </item> + <item> + <p> + Fix formatting problems in PDF documentation.</p> + <p> + In particular, text corresponding to links in HTML was + omitted in preformatted blocks. There are still issues + with indentation but this is not diameter-specific.</p> + <p> + Own Id: OTP-10583</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Let prepare_request, prepare_retransmit and + handle_request callbacks return a function to be invoked + on outgoing messages after encode.</p> + <p> + This allows encoded messages to be logged for example.</p> + <p> + Own Id: OTP-10441</p> + </item> + <item> + <p> + Add service_opt() 'restrict_connections' to allow + multiple transport connections with the same peer.</p> + <p> + Own Id: OTP-10443</p> + </item> + <item> + <p> + Add service_opt() 'sequence' to allow the masking of a + constant onto the topmost bits of End-to-End and + Hop-by-Hop identifiers.</p> + <p> + This allows the same service on different nodes to use + distinct values in outgoing request messages.</p> + <p> + Own Id: OTP-10445</p> + </item> + <item> + <p> + Add diameter:service_info(PeerRef) to return the + transport_ref() and transport_opt() list of the + corresponding transport.</p> + <p> + This allows easy access to these from diameter_app + callbacks that only get peer_ref() as an argument.</p> + <p> + Own Id: OTP-10470</p> + </item> + <item> + <p> + Add reference pages diameter_codec(3) and + diameter_make(3).</p> + <p> + Own Id: OTP-10471</p> + </item> + <item> + <p> + Add events for service start and stop.</p> + <p> + Own Id: OTP-10492</p> + </item> + <item> + <p> + Add transport_opt() 'disconnect_cb' to make the sending + of DPR configurable.</p> + <p> + Whether or not DPR should be sent at application stop, + service stop or transport removal is determined by the + value returned by the callback, as is the + Disconnect-Cause and timeout if DPA is not received.</p> + <p> + Own Id: OTP-10493</p> + </item> + <item> + <p> + Add transport_opt() 'capx_timeout' for the timeout + associated with non-reception of CER/CEA.</p> + <p> + Own Id: OTP-10554</p> + </item> + <item> + <p> + Allow a handle_request callback to return a + #diameter_packet{}.</p> + <p> + This allows an answer to set transport_data and header + fields.</p> + <p> + Own Id: OTP-10566</p> + </item> + <item> + <p> + Update documentation for RFC 6733.</p> + <p> + RFC 3588 is now obsolete.</p> + <p> + Own Id: OTP-10568</p> + </item> + </list> + </section> + +</section> + <section><title>Diameter 1.2</title> <section><title>Fixed Bugs and Malfunctions</title> @@ -136,6 +315,33 @@ first.</p> </section> +<section><title>Diameter 1.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fix fault in sending of 'closed' events.</p> + <p> + The fault made it possible for the 'closed' event not to + be sent following a failed capabilities exchange.</p> + <p> + Own Id: OTP-9824</p> + </item> + <item> + <p> + Fix faulty diameterc -name/-prefix.</p> + <p> + A minor blunder when introducing the new dictionary + parser in diameter-1.0 broke these options.</p> + <p> + Own Id: OTP-9826</p> + </item> + </list> + </section> + +</section> + <section><title>Diameter 1.0</title> <section><title>Fixed Bugs and Malfunctions</title> @@ -395,8 +601,7 @@ Known issues or limitations:</p> Some agent-related functionality is not entirely complete. In particular, support for proxy agents, that advertise specific Diameter applications but otherwise relay messages in much the same -way as relay agents (for which a <seealso -marker="diameter_app#handle_request">handle_request/3</seealso> +way as relay agents (for which a handle_request callback can return a <c>relay</c> tuple), will be completed in an upcoming release. There may also be more explicit support for redirect agents, although @@ -428,8 +633,7 @@ could likely be expanded upon.</p> <item> <p> -The function <seealso -marker="diameter#service_info">diameter:service_info/2</seealso> +The function diameter:service_info/2 can be used to retrieve information about a started service (statistics, information about connected peers, etc) but this is not yet documented and both the input and output may change diff --git a/lib/diameter/doc/src/ref_man.xml b/lib/diameter/doc/src/ref_man.xml index 137ce79094..4b99fe716d 100644 --- a/lib/diameter/doc/src/ref_man.xml +++ b/lib/diameter/doc/src/ref_man.xml @@ -6,6 +6,7 @@ <header> <copyright> <year>2011</year> +<year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -40,7 +41,9 @@ applications on top of the Diameter protocol. </p> <xi:include href="diameter.xml"/> <xi:include href="diameter_compile.xml"/> <xi:include href="diameter_app.xml"/> +<xi:include href="diameter_codec.xml"/> <xi:include href="diameter_dict.xml"/> +<xi:include href="diameter_make.xml"/> <xi:include href="diameter_transport.xml"/> <xi:include href="diameter_tcp.xml"/> <xi:include href="diameter_sctp.xml"/> diff --git a/lib/diameter/doc/src/seealso.ent b/lib/diameter/doc/src/seealso.ent new file mode 100644 index 0000000000..4647c42f85 --- /dev/null +++ b/lib/diameter/doc/src/seealso.ent @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="iso-8859-1" ?> + +<!-- + +%CopyrightBegin% + +Copyright Ericsson AB 2012. All Rights Reserved. + +The contents of this file are subject to the Erlang Public License, +Version 1.1, (the "License"); you may not use this file except in +compliance with the License. You should have received a copy of the +Erlang Public License along with this software. If not, it can be +retrieved online at http://www.erlang.org/. + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +the License for the specific language governing rights and limitations +under the License. + +%CopyrightEnd% + +--> + +<!-- + +Entities for cross references: less to type, easier to read and +less error prone. + +Additional intra-document entities are generated by seehere.sed. +That each definition is on a single (hideously long) line is +significant. + +--> + +<!ENTITY the_rfc 'RFC 6733'> + +<!-- diameter --> + +<!ENTITY mod_add_transport '<seealso marker="diameter#add_transport-2">diameter:add_transport/2</seealso>'> +<!ENTITY mod_call '<seealso marker="diameter#call-4">diameter:call/4</seealso>'> +<!ENTITY mod_origin_state_id '<seealso marker="diameter#origin_state_id-0">diameter:origin_state_id/0</seealso>'> +<!ENTITY mod_remove_transport '<seealso marker="diameter#remove_transport-2">diameter:remove_transport/2</seealso>'> +<!ENTITY mod_service_info '<seealso marker="diameter#service_info-2">diameter:service_info/2</seealso>'> +<!ENTITY mod_services '<seealso marker="diameter#services-0">diameter:services/0</seealso>'> +<!ENTITY mod_start_service '<seealso marker="diameter#start_service-2">diameter:start_service/2</seealso>'> +<!ENTITY mod_stop_service '<seealso marker="diameter#stop_service-1">diameter:stop_service/1</seealso>'> +<!ENTITY mod_subscribe '<seealso marker="diameter#subscribe-1">diameter:subscribe/1</seealso>'> + +<!ENTITY mod_application_alias '<seealso marker="diameter#application_alias">diameter:application_alias()</seealso>'> +<!ENTITY mod_application_module '<seealso marker="diameter#application_module">diameter:application_module()</seealso>'> +<!ENTITY mod_application_opt '<seealso marker="diameter#application_opt">diameter:application_opt()</seealso>'> +<!ENTITY mod_call_opt '<seealso marker="diameter#call_opt">diameter:call_opt()</seealso>'> +<!ENTITY mod_capability '<seealso marker="diameter#capability">diameter:capability()</seealso>'> +<!ENTITY mod_evaluable '<seealso marker="diameter#evaluable">diameter:evaluable()</seealso>'> +<!ENTITY mod_peer_filter '<seealso marker="diameter#peer_filter">diameter:peer_filter()</seealso>'> +<!ENTITY mod_service_event '<seealso marker="diameter#service_event">diameter:service_event()</seealso>'> +<!ENTITY mod_service_name '<seealso marker="diameter#service_name">diameter:service_name()</seealso>'> +<!ENTITY mod_service_opt '<seealso marker="diameter#service_opt">diameter:service_opt()</seealso>'> +<!ENTITY mod_transport_opt '<seealso marker="diameter#transport_opt">diameter:transport_opt()</seealso>'> +<!ENTITY mod_transport_ref '<seealso marker="diameter#transport_ref">diameter:transport_ref()</seealso>'> + +<!ENTITY capabilities_cb '<seealso marker="#capabilities_cb">capabilities_cb</seealso>'> +<!ENTITY capx_timeout '<seealso marker="#capx_timeout">capx_timeout</seealso>'> +<!ENTITY disconnect_cb '<seealso marker="#disconnect_cb">disconnect_cb</seealso>'> +<!ENTITY transport_config '<seealso marker="#transport_config">transport_config</seealso>'> +<!ENTITY transport_module '<seealso marker="#transport_module">transport_module</seealso>'> +<!ENTITY reconnect_timer '<seealso marker="#reconnect_timer">reconnect_timer</seealso>'> +<!ENTITY watchdog_timer '<seealso marker="#watchdog_timer">watchdog_timer</seealso>'> + +<!-- diameter_app --> + +<!ENTITY app_handle_answer '<seealso marker="diameter_app#Mod:handle_answer-4">handle_answer/4</seealso>'> +<!ENTITY app_handle_request '<seealso marker="diameter_app#Mod:handle_request-3">handle_request/3</seealso>'> +<!ENTITY app_handle_error '<seealso marker="diameter_app#Mod:handle_error-4">handle_error/4</seealso>'> +<!ENTITY app_peer_down '<seealso marker="diameter_app#Mod:peer_down-3">peer_up/3</seealso>'> +<!ENTITY app_peer_up '<seealso marker="diameter_app#Mod:peer_up-3">peer_up/3</seealso>'> +<!ENTITY app_pick_peer '<seealso marker="diameter_app#Mod:pick_peer-4">pick_peer/4</seealso>'> +<!ENTITY app_prepare_retransmit '<seealso marker="diameter_app#Mod:prepare_retransmit-3">prepare_retransmit/3</seealso>'> +<!ENTITY app_prepare_request '<seealso marker="diameter_app#Mod:prepare_request-3">prepare_request/3</seealso>'> + +<!ENTITY app_capabilities '<seealso marker="diameter_app#capabilities">diameter_app:capabilities()</seealso>'> +<!ENTITY app_peer '<seealso marker="diameter_app#peer">diameter_app:peer()</seealso>'> +<!ENTITY app_peer_ref '<seealso marker="diameter_app#peer_ref">diameter_app:peer_ref()</seealso>'> +<!ENTITY app_state '<seealso marker="diameter_app#state">diameter_app:state()</seealso>'> + +<!-- diameter_codec --> + +<!ENTITY codec_encode '<seealso marker="diameter_codec#encode-2">diameter_codec:encode/2</seealso>'> +<!ENTITY codec_decode '<seealso marker="diameter_codec#decode-2">diameter_codec:decode/2</seealso>'> + +<!ENTITY codec_avp '<seealso marker="diameter_codec#avp">diameter_codec:avp()</seealso>'> +<!ENTITY codec_header '<seealso marker="diameter_codec#header">diameter_codec:header()</seealso>'> +<!ENTITY codec_dictionary '<seealso marker="diameter_codec#dictionary">diameter_codec:dictionary()</seealso>'> +<!ENTITY codec_message '<seealso marker="diameter_codec#message">diameter_codec:message()</seealso>'> +<!ENTITY codec_packet '<seealso marker="diameter_codec#packet">diameter_codec:packet()</seealso>'> + +<!-- diameter_dict --> + +<!ENTITY dict_data_types '<seealso marker="diameter_dict#DATA_TYPES">diameter_dict(4)</seealso>'> + +<!ENTITY dict_Address '<seealso marker="diameter_dict#DATA_TYPES">Address()</seealso>'> +<!ENTITY dict_DiameterIdentity '<seealso marker="diameter_dict#DATA_TYPES">DiameterIdentity()</seealso>'> +<!ENTITY dict_Grouped '<seealso marker="diameter_dict#DATA_TYPES">Grouped()</seealso>'> +<!ENTITY dict_OctetString '<seealso marker="diameter_dict#DATA_TYPES">OctetString()</seealso>'> +<!ENTITY dict_Time '<seealso marker="diameter_dict#DATA_TYPES">Time()</seealso>'> +<!ENTITY dict_UTF8String '<seealso marker="diameter_dict#DATA_TYPES">UTF8String()</seealso>'> +<!ENTITY dict_Unsigned32 '<seealso marker="diameter_dict#DATA_TYPES">Unsigned32()</seealso>'> + +<!ENTITY dict_name '<seealso marker="diameter_dict#name">@name</seealso>'> +<!ENTITY dict_prefix '<seealso marker="diameter_dict#prefix">@prefix</seealso>'> +<!ENTITY dict_inherits '<seealso marker="diameter_dict#inherits">@inherits</seealso>'> + +<!-- diameter_make --> + +<!ENTITY make_codec '<seealso marker="diameter_make#codec-2">diameter_make:codec/2</seealso>'> + +<!-- diameter_transport --> + +<!ENTITY transport_start + '<seealso marker="diameter_transport#Mod:start-3">start/3</seealso>'> + +<!-- reference pages --> + +<!ENTITY man_compile '<seealso marker="diameterc">diameterc(1)</seealso>'> +<!ENTITY man_main '<seealso marker="diameter">diameter(3)</seealso>'> +<!ENTITY man_app '<seealso marker="diameter_app">diameter_app(3)</seealso>'> +<!ENTITY man_codec '<seealso marker="diameter_codec">diameter_codec(3)</seealso>'> +<!ENTITY man_dict '<seealso marker="diameter_dict">diameter_dict(4)</seealso>'> +<!ENTITY man_make '<seealso marker="diameter_make">diameter_make(3)</seealso>'> +<!ENTITY man_transport '<seealso marker="diameter_transport">diameter_transport(3)</seealso>'> +<!ENTITY man_sctp '<seealso marker="diameter_sctp">diameter_sctp(3)</seealso>'> +<!ENTITY man_tcp '<seealso marker="diameter_tcp">diameter_tcp(3)</seealso>'> diff --git a/lib/diameter/doc/src/seehere.sed b/lib/diameter/doc/src/seehere.sed new file mode 100644 index 0000000000..c62a783d40 --- /dev/null +++ b/lib/diameter/doc/src/seehere.sed @@ -0,0 +1,35 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2012. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +# +# Map entities for inter-document references to ones for +# intra-document references like this: +# +# <!ENTITY aaa_xxx '<seealso marker="bbb#yyy">ccc:zzz</seealso>'> +# +# ===> +# +# <!ENTITY xxx '<seealso marker="#yyy">zzz</seealso>'> +# + +/<!ENTITY/!d +/#/!d +/"#/d +s@ [^_]*_@ @ +s@"[^#]*#@"#@ +s@>[^:]*:@>@ |