<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- diameter_transport(3)</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/diameter-0.9.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Diameter</strong><br><strong>Reference Manual</strong><br><small>Version 0.9</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li id="no" title="diameter " expanded="false">diameter<ul> <li><a href="diameter.html"> Top of manual page </a></li> <li title="add_transport-2"><a href="diameter.html#add_transport-2">add_transport/2</a></li> <li title="call-4"><a href="diameter.html#call-4">call/4</a></li> <li title="origin_state_id-0"><a href="diameter.html#origin_state_id-0">origin_state_id/0</a></li> <li title="remove_transport-2"><a href="diameter.html#remove_transport-2">remove_transport/2</a></li> <li title="service_info-2"><a href="diameter.html#service_info-2">service_info/2</a></li> <li title="services-0"><a href="diameter.html#services-0">services/0</a></li> <li title="session_id-1"><a href="diameter.html#session_id-1">session_id/1</a></li> <li title="start-0"><a href="diameter.html#start-0">start/0</a></li> <li title="start_service-2"><a href="diameter.html#start_service-2">start_service/2</a></li> <li title="stop-0"><a href="diameter.html#stop-0">stop/0</a></li> <li title="stop_service-1"><a href="diameter.html#stop_service-1">stop_service/1</a></li> <li title="subscribe-1"><a href="diameter.html#subscribe-1">subscribe/1</a></li> <li title="unsubscribe-1"><a href="diameter.html#unsubscribe-1">unsubscribe/1</a></li> </ul> </li> <li title="diameterc"><a href="diameterc.html">diameterc</a></li> <li id="no" title="diameter_app " expanded="false">diameter_app<ul> <li><a href="diameter_app.html"> Top of manual page </a></li> <li title="Mod:peer_up-3"><a href="diameter_app.html#Mod:peer_up-3">Mod:peer_up/3</a></li> <li title="Mod:peer_down-3"><a href="diameter_app.html#Mod:peer_down-3">Mod:peer_down/3</a></li> <li title="Mod:pick_peer-4"><a href="diameter_app.html#Mod:pick_peer-4">Mod:pick_peer/4</a></li> <li title="Mod:prepare_request-3"><a href="diameter_app.html#Mod:prepare_request-3">Mod:prepare_request/3</a></li> <li title="Mod:prepare_retransmit-3"><a href="diameter_app.html#Mod:prepare_retransmit-3">Mod:prepare_retransmit/3</a></li> <li title="Mod:handle_answer-4"><a href="diameter_app.html#Mod:handle_answer-4">Mod:handle_answer/4</a></li> <li title="Mod:handle_error-4"><a href="diameter_app.html#Mod:handle_error-4">Mod:handle_error/4</a></li> <li title="Mod:handle_request-3"><a href="diameter_app.html#Mod:handle_request-3">Mod:handle_request/3</a></li> </ul> </li> <li title="diameter_dict"><a href="diameter_dict.html">diameter_dict</a></li> <li id="loadscrollpos" title="diameter_transport " expanded="true">diameter_transport<ul> <li><a href="diameter_transport.html"> Top of manual page </a></li> <li title="Mod:start-3"><a href="diameter_transport.html#Mod:start-3">Mod:start/3</a></li> </ul> </li> <li id="no" title="diameter_tcp " expanded="false">diameter_tcp<ul> <li><a href="diameter_tcp.html"> Top of manual page </a></li> <li title="start-3"><a href="diameter_tcp.html#start-3">start/3</a></li> </ul> </li> <li id="no" title="diameter_sctp " expanded="false">diameter_sctp<ul> <li><a href="diameter_sctp.html"> Top of manual page </a></li> <li title="start-3"><a href="diameter_sctp.html#start-3">start/3</a></li> </ul> </li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>diameter_transport</h1></center> <h3>MODULE</h3> <div class="REFBODY">diameter_transport</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">Diameter transport interface.</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p> A module specified as a <span class="code">transport_module</span> to <span class="bold_code"><a href="diameter.html#add_transport">diameter:add_transport/2</a></span> 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> <a name="start"></a> </p></div> <h3>EXPORTS</h3> <p><a name="Mod:start-3"><span class="bold_code">Mod:start({Type, Ref}, Svc, Opts) -> {ok, Pid} | {ok, Pid, LAddrs} | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Type = connect | accept</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Ref = reference()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Svc = #diameter_service{}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Opts = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Pid = pid()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">LAddrs = [ip_address()]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p> Start a transport process. Called by diameter as a consequence of a call to <span class="bold_code"><a href="diameter.html#add_transport">diameter:add_transport/2</a></span> 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 (<span class="code">connect</span>) or listening (<span class="code">accept</span>) 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 <span class="bold_code"><a href="diameter.html#add_transport">diameter:add_transport/2</a></span> 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> <p> Transport processes for a given service are started sequentially.</p> <p> The start function should use the 'Host-IP-Address' list on the service, namely <span class="code">Svc#diameter_service.host_ip_address</span>, and/or <span class="code">Opts</span> to select an appropriate list of local IP addresses, and should return this list if different from the service addresses. The returned list is used to populate 'Host-IP-Address' AVPs in outgoing capabilities exchange messages, the service addresses being used otherwise.</p> <a name="MESSAGES"></a> </p></div> <h3><a name="id203089">MESSAGES</a></h3> <div class="REFBODY"> <p> All messages sent over the transport interface are of the form <span class="code">{diameter, term()}</span>.</p> <p> A transport process can expect the following messages from diameter.</p> <dl> <dt><strong><span class="code">{diameter, {send, Packet}}</span></strong></dt> <dd> <p> An outbound Diameter message. Packet can be either <span class="code">binary()</span> (the message to be sent) or a <span class="code">#diameter_packet{}</span> whose <span class="code">transport_data</span> field containes a value other than undefined.</p> </dd> <dt><strong><span class="code">{diameter, {close, Pid}}</span></strong></dt> <dd> <p> A request to close the transport connection. The transport process should terminate after closing the connection. Pid is the pid() of the parent process.</p> </dd> </dl> <p> A transport process should send the following messages to its parent.</p> <dl> <dt><strong><span class="code">{diameter, {self(), connected}}</span></strong></dt> <dd> <p> Inform the parent that the transport process with Type = accept has established a connection with the peer. Not sent if the transport process has Type = connect.</p> </dd> <dt><strong><span class="code">{diameter, {self(), connected, Remote}}</span></strong></dt> <dd> <p> Inform the parent that the transport process with Type = connect has established a connection with a peer. Not sent if the transport process has Type = accept. Remote is an arbitrary term that uniquely identifies the remote endpoint to which the transport has connected.</p> </dd> <dt><strong><span class="code">{diameter, {recv, Packet}}</span></strong></dt> <dd> <p> An inbound Diameter message. Packet can be either <span class="code">binary()</span> (the message to be sent) or <span class="code">#diameter_packet{}</span> whose <span class="code">packet</span> field contains a <span class="code">binary()</span>. Any value (other than undefined) set in the <span class="code">transport_data</span> 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 the <span class="code">transport_data</span> is used/interpreted is up to the transport module.</p> </dd> </dl> </div> <h3><a name="id203229">SEE ALSO</a></h3> <div class="REFBODY"> <p> <span class="bold_code"><a href="diameter_tcp.html">diameter_tcp(3)</a></span>, <span class="bold_code"><a href="diameter_sctp.html">diameter_sctp(3)</a></span></p> </div> </div> <div class="footer"> <hr> <p>Copyright © 2011-2011 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>