mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-04 18:27:36 +00:00
5e81b98eba
Mon Sep 17 14:50:04 EDT 2007 Pekka.Pessi@nokia.com * sofia-sip/sip_util.h: updated documentation Mon Sep 17 14:50:18 EDT 2007 Pekka.Pessi@nokia.com * sofia-sip/tport_tag.h: updated documentation Mon Sep 17 14:50:28 EDT 2007 Pekka.Pessi@nokia.com * soa_tag.c: updated documentation Wed Sep 19 12:50:01 EDT 2007 Pekka.Pessi@nokia.com * msg: updated documentation Wed Sep 19 13:29:50 EDT 2007 Pekka.Pessi@nokia.com * url: updated documentation Wed Sep 19 13:32:14 EDT 2007 Pekka.Pessi@nokia.com * nth: updated documentation Wed Sep 19 13:32:27 EDT 2007 Pekka.Pessi@nokia.com * nea: updated documentation Wed Sep 19 13:33:36 EDT 2007 Pekka.Pessi@nokia.com * http: updated documentation Wed Sep 19 13:36:58 EDT 2007 Pekka.Pessi@nokia.com * bnf: updated documentation Wed Sep 19 13:38:58 EDT 2007 Pekka.Pessi@nokia.com * nua: updated nua_stack_init_handle() prototype Wed Sep 19 18:45:56 EDT 2007 Pekka.Pessi@nokia.com * sip: added sip_name_addr_xtra(), sip_name_addr_dup() Wed Sep 19 19:00:19 EDT 2007 Pekka.Pessi@nokia.com * sip_basic.c: cleaned old crud Thu Sep 20 13:34:04 EDT 2007 Pekka.Pessi@nokia.com * iptsec: updated documentation Thu Sep 20 13:36:22 EDT 2007 Pekka.Pessi@nokia.com * tport: updated documentation Thu Sep 20 13:36:56 EDT 2007 Pekka.Pessi@nokia.com * su: updated documentation Removed internal files from doxygen-generated documentation. Thu Sep 20 13:38:29 EDT 2007 Pekka.Pessi@nokia.com * soa: fixed documentation Thu Sep 20 13:39:56 EDT 2007 Pekka.Pessi@nokia.com * sdp: updated documentation Thu Sep 20 13:40:16 EDT 2007 Pekka.Pessi@nokia.com * ipt: updated documentation Thu Sep 20 14:24:20 EDT 2007 Pekka.Pessi@nokia.com * nta: updated documentation Thu Sep 20 14:41:04 EDT 2007 Pekka.Pessi@nokia.com * nua: updated documentation Updated tag documentation. Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c. Removed internal datatypes and files from the generated documents. Wed Sep 19 13:34:20 EDT 2007 Pekka.Pessi@nokia.com * docs: updated the generation of documentation. Updated links to header files. Thu Sep 20 08:45:32 EDT 2007 Pekka.Pessi@nokia.com * sip/Makefile.am: added tags to <sofia-sip/sip_extra.h> Added check for extra tags in torture_sip.c. Thu Sep 20 14:45:22 EDT 2007 Pekka.Pessi@nokia.com * stun: updated documentation Wed Jul 4 18:55:20 EDT 2007 Pekka.Pessi@nokia.com * torture_heap.c: added tests for ##sort() and su_smoothsort() Wed Jul 4 18:56:59 EDT 2007 Pekka.Pessi@nokia.com * Makefile.am: added smoothsort.c Fri Jul 13 12:38:44 EDT 2007 Pekka.Pessi@nokia.com * sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item Mon Jul 23 11:14:22 EDT 2007 Pekka.Pessi@nokia.com * sofia-sip/heap.h: fixed bug in heap##remove() If left kid was in heap but right was not, left kid was ignored. Wed Jul 4 18:51:08 EDT 2007 Pekka.Pessi@nokia.com * smoothsort.c: added Wed Jul 4 18:51:34 EDT 2007 Pekka.Pessi@nokia.com * heap.h: using su_smoothsort() Fri Jul 6 10:20:27 EDT 2007 Pekka.Pessi@nokia.com * smoothsort.c: added Wed Sep 19 17:40:30 EDT 2007 Pekka.Pessi@nokia.com * msg_parser.awk: generate two parser tables, default and extended Wed Sep 19 18:39:45 EDT 2007 Pekka.Pessi@nokia.com * msg_parser.awk: just generate list of extra headers Allocate extended parser dynamically. Wed Sep 19 18:59:59 EDT 2007 Pekka.Pessi@nokia.com * sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity Added functions sip_update_default_mclass() and sip_extend_mclass() for handling the extended parser. Note that Reply-To and Alert-Info are only available with the extended parser. Wed Sep 19 19:05:44 EDT 2007 Pekka.Pessi@nokia.com * RELEASE: updated Thu Sep 20 13:38:59 EDT 2007 Pekka.Pessi@nokia.com * sip: updated documentation Thu Sep 20 14:17:28 EDT 2007 Pekka.Pessi@nokia.com * docs/conformance.docs: updated Mon Oct 1 10:11:14 EDT 2007 Pekka.Pessi@nokia.com * tport_tag.c: re-enabled tptag_trusted Thu Oct 4 09:21:07 EDT 2007 Pekka.Pessi@nokia.com * su_osx_runloop.c: moved virtual function table after struct definition Preparing for su_port_vtable_t refactoring. Thu Oct 4 10:22:03 EDT 2007 Pekka.Pessi@nokia.com * su_source.c: refactored initialization/deinitialization Fri Oct 5 04:58:18 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_extra.c: fixed prototypes with isize_t Fri Oct 5 04:58:45 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_nta_api.c: removed warnings about signedness Fri Oct 5 04:59:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_nua_params.c: removed warnings about constness Fri Oct 5 07:20:26 EDT 2007 Pekka Pessi <first.lastname@nokia.com> * su_port.h, su_root.c: cleaned argument checking The su_root_*() and su_port_*() functions now check their arguments once and do not assert() with NULL arguments. The sur_task->sut_port should always be valid while su_root_t is alive. Fri Oct 5 07:22:09 EDT 2007 Pekka Pessi <first.lastname@nokia.com> * su: added su_root_obtain(), su_root_release() and su_root_has_thread() When root is created with su_root_create() or cloned with su_clone_start(), the resulting root is obtained by the calling or created thread, respectively. The root can be released with su_root_release() and another thread can obtain it. The function su_root_has_thread() can be used to check if a thread has obtained or released the root. Implementation upgraded the su_port_own_thread() method as su_port_thread(). Fri Oct 5 07:28:10 EDT 2007 Pekka Pessi <first.lastname@nokia.com> * su_port.h: removed su_port_threadsafe() and su_port_yield() methods su_port_wait_events() replaces su_port_yield(). Fri Oct 5 13:26:04 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * msg_parser.awk: not extending header structure unless needed. Removed gawk-ish /* comments */. Fri Oct 5 14:32:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * run_test_su: removed GNUisms Fri Oct 5 14:32:47 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: removed implicit check target test_urlmap Fri Oct 5 14:22:32 EDT 2007 Pekka Pessi <first.lastname@nokia.com> * torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available Casting timespec tv_sec to unsigned long. Fri Oct * nua_s added handling nua_prack() Thanks to Fabio Margarido for the patch. Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com * test_nua: added test for sf.net bug #1803686 Mon Oct 8 08:15:23 EDT 2007 Pekka.Pessi@nokia.com * RELEASE: updated. Mon Oct 8 09:30:36 EDT 2007 Pekka.Pessi@nokia.com * nua_stack: added handling nua_prack() Thanks to Fabio Margarido for the patch. Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com * test_nua: added test for sf.net bug #1803686 Mon Oct 8 10:26:31 EDT 2007 Pekka.Pessi@nokia.com * nua: added test for nua_prack() (sf.net bug #1804248) Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too. Mon Oct 8 10:32:04 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com> * su_source.c: don t leak the wait arrays Mon Oct 8 10:37:11 EDT 2007 Pekka.Pessi@nokia.com * RELEASE: updated Wed Oct 10 11:55:21 EDT 2007 Pekka.Pessi@nokia.com * sip_parser.c: silenced warning about extra const in sip_extend_mclass() Wed Oct 10 11:57:08 EDT 2007 Pekka.Pessi@nokia.com * nta_tag.c: updated tag documentation Wed Oct 10 13:16:40 EDT 2007 Pekka.Pessi@nokia.com * nua: fix logging crash if outbound used with application contact Silenced warnings. Wed Oct 10 13:30:45 EDT 2007 Pekka.Pessi@nokia.com * msg_parser.awk: removed extra "const" Wed Oct 10 13:31:45 EDT 2007 Pekka.Pessi@nokia.com * Makefile.am's: fixed distclean of documentation git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
197 lines
9.0 KiB
Plaintext
197 lines
9.0 KiB
Plaintext
/**@MODULEPAGE "tport" - Transport Module
|
|
|
|
@section tport_meta Module Information
|
|
|
|
The @b tport module contains a generic transport interface used by SIP,
|
|
RTSP, and HTTP protocols. It is an abstraction layer between a protocol
|
|
stack and a transport protocol implementation. The interface is implemented
|
|
via transport objects. The tag parameters for transport objects are defined
|
|
in <sofia-sip/tport_tag.h>.
|
|
|
|
@CONTACT Pekka.Pessi@nokia.com
|
|
|
|
@STATUS @SofiaSIP Core library
|
|
|
|
@LICENSE LGPL
|
|
|
|
@section tp_primary Master, Primary and Secondary Transport Objects
|
|
|
|
A transport object can be used in three roles. Master transport object
|
|
represents all available transport. It is used to store stack and root
|
|
interface as well as common data such as SigComp state handler. The primary
|
|
transport objects represent available transports. The secondary transports
|
|
represent actual transport connections.
|
|
|
|
A protocol stack first creates a @e master @e transport object and binds a
|
|
number of primary transport objects (each representing a transport protocol
|
|
such as UDP, TCP, TLS/TCP, SCTP, etc). The binding process creates a new
|
|
primary transport object for each transport supported. If the protocol stack
|
|
is used as a server, the binding process also creates the necessary server
|
|
sockets and binds them to the specified server ports.
|
|
|
|
Secondary transport objects are created for each transport-level
|
|
connection. The @b tport module takes care of automatically creating them
|
|
and discarding them when they are no more used. The secondary transport
|
|
objects are required to transmit messages when a connection-oriented
|
|
transport protocol is used.
|
|
|
|
A secondary transport object can be created for two reasons. A server may
|
|
accept a new connection from a client, or a client may connect to a
|
|
server. When the connection belonging to a secondary transport has been
|
|
established, the protocol stack can send or receive messages through it.
|
|
|
|
@section tp_init Initializing Transports
|
|
|
|
When the primary transport object is created with tport_tcreate(), the
|
|
protocol stack must pass a #tport_stack_class_t structure containing
|
|
function pointers to the new transport object. These function pointers
|
|
are used to
|
|
|
|
-# create new message objects used to store received messages
|
|
-# pass received messages to the protocol stack, and
|
|
-# report transport errors to the protocol stack.
|
|
|
|
The transport protocols are bound to the primary transport objects with
|
|
the method tport_tbind(). The protocol stack gives the desired server
|
|
transport name (transport name is a structure containing a text-formatted
|
|
socket address along with transport name) along with the list of
|
|
transport protocols supported by the stack. The function tport_tbind()
|
|
can be called multiple times, if, for example, the server port(s) used by
|
|
transport protocol differ (for example, default TCP port for SIP is 5060,
|
|
and default TLS port is 5061).
|
|
|
|
@subsection tp_connect Connection-Oriented and Connection-Less Transports
|
|
|
|
A secondary transport objects is created for each transport-level
|
|
connection. The tport module takes care of automatically creating them,
|
|
and discarding them when they are no more used. The secondary transport
|
|
objects are required to transmit messages when a connection-oriented
|
|
transport protocol is used.
|
|
|
|
A secondary transport can be created for two reasons. A server may accept
|
|
a new connection from a client, or a client may connect to a server. When
|
|
the connection belonging to a secondary transport has been established,
|
|
the protocol stack can send or receive messages through it.
|
|
|
|
@par Connection-Oriented and Connection-Less Transports
|
|
|
|
A transport can be connection-oriented (TCP, SCTP) or connectionless
|
|
(UDP). A connection-oriented transport needs a connection to be
|
|
established before messages can be sent. It can also send messages only
|
|
to a single destination. For a connectionless transport, a destination
|
|
address must always be given.
|
|
|
|
A connectionless transport can be used to send messages to several
|
|
distinct destinations. The destination address must be given to the
|
|
kernel whenever a message is sent using connectionless transport.
|
|
|
|
Note that UDP can be used in connection-oriented manner (client does not
|
|
use sendto(), but connect() and then send()), if tport_set_params() is
|
|
called with TPTAG_CONNECT(1) argument.
|
|
|
|
@subsection tp_stream Stream and Datagram Transports
|
|
|
|
A connection-oriented transport can also be stream-based (TCP, SCTP) or
|
|
packet-based (UDP, SCTP). A stream-based transport protocol takes care of
|
|
ordering the data within a stream, a data chunk sent earlier is always
|
|
delivered before chunks sent after it. A packet-based transport delivers
|
|
data chunks independent of each other and does not maintain the relative
|
|
order, for instance, if a data chunk is lost by the network and then
|
|
retransmitted, application can receive it later than a data chunk that
|
|
was sent after lost one but did not need any retransmissions.
|
|
|
|
@subsection tp_magic Transport Magic
|
|
|
|
Transport magic is a cookie, a piece of data specified by stack that can
|
|
be associated with a transport (e.g., a Via header). The protocol stack
|
|
can change the type of transport magic by defining the macro
|
|
#TP_MAGIC_T before including <sofia-sip/tport.h>.
|
|
|
|
@section tp_op Transport Operations
|
|
|
|
@subsection tp_send Sending Messages
|
|
|
|
A message can be sent by the tport_tsend() method. The method can be
|
|
called either from the primary or from the secondary transport. If a
|
|
secondary transport is needed to send the message, it is created and
|
|
connected automatically.
|
|
|
|
The transport gets the data to be sent from the message object with
|
|
msg_iovec() call. The transport tries to send all the data using one
|
|
su_vsend() call. If the call would fail, for instance, because the send
|
|
buffer is too short, the transport object would create a reference to the
|
|
message and queue it in its own queue.
|
|
|
|
@subsection tp_recv Receiving Messages
|
|
|
|
When a primary connectionless transport object or a secondary transport
|
|
object receives new data, it allocates a new message object. The message
|
|
object is created using the factory function tpac_alloc() provided by the
|
|
protocl stack. The incoming data is passed to the message object, data is
|
|
parsed and when a message is complete, it is passed to the application
|
|
using the tpac_recv() function provided when the transport was created.
|
|
|
|
@subsection tp_refcnt Reference Counting
|
|
|
|
In order to destroy unused connections, each secondary transport object
|
|
needs to know if there is a reference to it from the stack. A protocol
|
|
stack creates a reference to a transport when it receives an incoming
|
|
request and needs to send the response using the same transport, or when
|
|
it expects a reply from the server coming on the connection used to send
|
|
the request.
|
|
|
|
@note While the reference counting has been implemented in the tport
|
|
module, the transport objects are not destroyed by timers by default as
|
|
all the protocol stacks do @b not properly handle the reference counting.
|
|
Timers are activated when the tag TPTAG_IDLE() is used.
|
|
|
|
@subsection tp_pend Pending Requests
|
|
|
|
The protocol stack can mark requests as @e pending using tport_pend()
|
|
function. The tport_pend() function associates a request message with a
|
|
callback and a handle to a client object. When a transport error occurs,
|
|
it is reported to the client object using the associated callback
|
|
function.
|
|
|
|
When the stack receives a response to the request it has marked as
|
|
pending, it calls tport_release(). The request can be still considered
|
|
pending, if the response was a preliminary one. In this case, the @a
|
|
still_pending argument is true. The function tport_release() is also
|
|
called without response message, if the stack is no more interested in
|
|
the response, for instance, after a timeout.
|
|
|
|
@subsection tp_queue Send Queue
|
|
|
|
Each stream-based transport also supports send queue. The queue can be
|
|
used either to queue messages during congestion, or to maintain the
|
|
relative ordering of responses. Usually, queue is used implicitly for the
|
|
first purpose, e.g., if a transport is busy sending a message it queues
|
|
further messages when tport_tsend() is called.
|
|
|
|
Explicit queueing is needed when the protocol (like HTTP/1.1) requires
|
|
that the relative order of responses is maintained. When the protocol
|
|
stack receives a request, it queues an empty response message to the
|
|
transport with tport_tqueue(). Such an empty response is marked as
|
|
incomplete, not ready to send. When application responds to the request
|
|
via tport_tqsend(), the transport object marks the message ready to send
|
|
and, if there are no other queued responses before it, sends it.
|
|
|
|
@section tp_debug Logging and Dumping Messages
|
|
|
|
Seeing message contents and network events is extremely useful when
|
|
debugging protocols. There are environment variables that are used to
|
|
activate message logging within @b tport module.
|
|
<dl compact>
|
|
<dt>@b #TPORT_LOG
|
|
<dd>if set, tport module prints out the message contents
|
|
after parsing
|
|
<dt>@b #TPORT_DUMP
|
|
<dd>contains dump file name - incoming data is written
|
|
dump file @e before parsing
|
|
<dt>@b #TPORT_DEBUG
|
|
<dd>integer in range -1..9 controlling amount of
|
|
debugging printout from @b tport module. See also #tport_log.
|
|
</dl>
|
|
*/
|
|
|