aboutsummaryrefslogblamecommitdiffstats
path: root/lib/diameter/doc/src/diameter_transport.xml
blob: 0507af63a8e1018d1eab271bf6098ed06e1a9301 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                        
                                      



                                        
  



           
                                  



























                                                                      
                                                            



             
                                                                      













                                                                              
                                         



                                                                  
                                
                                
                      
                  
                                                                                           




                          
                                                                       



                                                                         
                                                               


                                                                  
                                           

   
                                                                       
                                                     

   

                                                                      



                                                                      

                                       

   
                                                                    
                                                                  




                                                                    
 






                                                                           
























                                                                              



                                                                      




                                          


                                                                      
                                                  

       




                                                               
                                                        

                                                              
                                                                  

                                                                  

                                                                  

   
                                                                       











                                                                            










                                                      
                                                                        
                                       
                                                              




                                                         
                                                                     
                                         

                                                                      






                                                  



                                                           


                                                                      
                                                          


                     



                                             
                                             




                                                             










                                                                              
                         



          
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd" [
  <!ENTITY % also SYSTEM "seealso.ent" >
  <!ENTITY % here SYSTEM "seehere.ent" >
  %also;
  %here;
]>

<erlref>
<header>
<copyright>
<year>2011</year><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_transport(3)</title>
<prepared>Anders Svensson</prepared>
<responsible></responsible>
<docno></docno>
<approved></approved>
<checked></checked>
<date></date>
<rev></rev>
<file>diameter_transport.xml</file>
</header>

<module>diameter_transport</module>
<modulesummary>Diameter transport interface.</modulesummary>

<description>

<p>
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>

<!-- ===================================================================== -->

<funcs>

<func>
<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 = &mod_transport_ref;</v>
<v>Svc = #diameter_service{}</v>
<v>Config = term()</v>
<v>Pid = pid()</v>
<v>LAddrs = [<seealso marker="kernel:inet#type-ip_address">inet:ip_address()</seealso>]</v>
<v>Reason = term()</v>
</type>
<desc>
<p>
Start a transport process.
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>
<c>Type</c> indicates whether the transport process in question
is being started for a connecting (<c>connect</c>) or listening
(<c>accept</c>) transport.
In the latter case, transport processes are started as required to
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>
<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 start function should use the <c>Host-IP-Address</c> list and/or
<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>

<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>

<marker id="MESSAGES"/>
</desc>
</func>

</funcs>

<!-- ===================================================================== -->

<section>
<title>MESSAGES</title>

<p>
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>

<taglist>

<tag><c>{diameter, {send, Packet}}</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>
</item>

<tag><c>{diameter, {close, Pid}}</c></tag>
<item>
<p>
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>

<tag><c>{diameter, {tls, Ref, Type, Bool}}</c></tag>
<item>
<p>
Indication of whether or not capabilities exchange has selected
inband security using TLS.
<c>Ref</c> is a reference() that must be included in the
<c>{diameter, {tls, Ref}}</c> reply message to the transport's
parent process (see below).
<c>Type</c> is either <c>connect</c> or <c>accept</c> depending on
whether the process has been started for a connecting or listening
transport respectively.
<c>Bool</c> is a boolean() indicating whether or not the transport
connection should be upgraded to TLS.</p>

<p>
If TLS is requested (<c>Bool=true</c>) then a connecting process should
initiate a TLS handshake with the peer and an accepting process should
prepare to accept a handshake.
A successful handshake should be followed by a <c>{diameter, {tls, Ref}}</c>
message to the parent process.
A failed handshake should cause the process to exit.</p>

<p>
This message is only sent to a transport process over whose
<c>Inband-Security-Id</c> configuration has indicated support for
TLS.</p>
</item>

</taglist>

<p>
A transport process should send the following messages
to its parent.</p>

<taglist>

<tag><c>{diameter, {self(), connected}}</c></tag>
<item>
<p>
Inform the parent that the transport process with <c>Type=accept</c> has
established a connection with the peer.
Not sent if the transport process has <c>Type=connect</c>.</p>
</item>

<tag><c>{diameter, {self(), connected, Remote}}</c></tag>
<item>
<p>
Inform the parent that the transport process with <c>Type=connect</c>
has established a connection with a peer.
Not sent if the transport process has <c>Type=accept</c>.
<c>Remote</c> is an arbitrary term that uniquely identifies the remote
endpoint to which the transport has connected.</p>
</item>

<tag><c>{diameter, {recv, Packet}}</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>
</item>

<tag><c>{diameter, {tls, Ref}}</c></tag>
<item>
<p>
Acknowledgment of a successful TLS handshake.
<c>Ref</c> is the reference() received in the
<c>{diameter, {tls, Ref, Type, Bool}}</c> message in response
to which the reply is sent.
A transport must exit if a handshake is not successful.</p>
</item>

</taglist>

</section>

<!-- ===================================================================== -->
<!-- ===================================================================== -->

<section>
<title>SEE ALSO</title>

<p>
&man_tcp;, &man_sctp;</p>

</section>

</erlref>