2006-12-21 06:30:28 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Sofia-SIP package
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Nokia Corporation.
|
|
|
|
*
|
|
|
|
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2.1 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NTA_INTERNAL_H
|
|
|
|
/** Defined when <nta_internal.h> has been included. */
|
|
|
|
#define NTA_INTERNAL_H
|
|
|
|
|
Sync to current darcs tree:
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
2007-10-11 14:16:59 +00:00
|
|
|
/**@internal @file nta_internal.h
|
|
|
|
*
|
2006-12-21 06:30:28 +00:00
|
|
|
* @brief Internals of NTA objects.
|
|
|
|
*
|
|
|
|
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
|
|
|
*
|
|
|
|
* @date Created: Tue Jul 18 09:18:32 2000 ppessi
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Resolver context type */
|
|
|
|
#define SRES_CONTEXT_T nta_outgoing_t
|
|
|
|
|
|
|
|
/* We are customer of tport_t */
|
|
|
|
#define TP_AGENT_T nta_agent_t
|
|
|
|
#define TP_MAGIC_T sip_via_t
|
|
|
|
#define TP_CLIENT_T nta_outgoing_t
|
|
|
|
|
|
|
|
#include <sofia-sip/nta.h>
|
|
|
|
#include <sofia-sip/nta_tport.h>
|
|
|
|
#include <sofia-sip/tport.h>
|
|
|
|
|
|
|
|
#if HAVE_SOFIA_SRESOLV
|
|
|
|
#include <sofia-sip/sresolv.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sofia-sip/htable.h>
|
|
|
|
|
|
|
|
#if HAVE_SMIME
|
|
|
|
#include "smimec.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
SOFIA_BEGIN_DECLS
|
|
|
|
|
|
|
|
/** A sip_flag telling that this message is internally generated. */
|
|
|
|
#define NTA_INTERNAL_MSG (1<<15)
|
|
|
|
|
|
|
|
/** Resolving order */
|
|
|
|
enum nta_res_order_e
|
|
|
|
{
|
|
|
|
nta_res_ip6_ip4,
|
|
|
|
nta_res_ip4_ip6,
|
|
|
|
nta_res_ip6_only,
|
|
|
|
nta_res_ip4_only
|
|
|
|
};
|
|
|
|
|
|
|
|
HTABLE_DECLARE_WITH(leg_htable, lht, nta_leg_t, size_t, hash_value_t);
|
|
|
|
HTABLE_DECLARE_WITH(outgoing_htable, oht, nta_outgoing_t, size_t, hash_value_t);
|
|
|
|
HTABLE_DECLARE_WITH(incoming_htable, iht, nta_incoming_t, size_t, hash_value_t);
|
|
|
|
|
|
|
|
typedef struct outgoing_queue_t {
|
|
|
|
nta_outgoing_t **q_tail;
|
|
|
|
nta_outgoing_t *q_head;
|
|
|
|
size_t q_length;
|
|
|
|
unsigned q_timeout;
|
|
|
|
} outgoing_queue_t;
|
|
|
|
|
|
|
|
typedef struct incoming_queue_t {
|
|
|
|
nta_incoming_t **q_tail;
|
|
|
|
nta_incoming_t *q_head;
|
|
|
|
size_t q_length;
|
|
|
|
unsigned q_timeout;
|
|
|
|
} incoming_queue_t;
|
|
|
|
|
|
|
|
typedef struct nta_compressor nta_compressor_t;
|
|
|
|
|
|
|
|
struct nta_agent_s
|
|
|
|
{
|
|
|
|
su_home_t sa_home[1];
|
|
|
|
su_root_t *sa_root;
|
|
|
|
su_timer_t *sa_timer;
|
|
|
|
nta_agent_magic_t *sa_magic;
|
|
|
|
nta_message_f *sa_callback;
|
|
|
|
|
|
|
|
nta_update_magic_t *sa_update_magic;
|
|
|
|
nta_update_tport_f *sa_update_tport;
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
su_time_t sa_now; /**< Timestamp in microsecond resolution. */
|
2008-05-07 12:28:33 +00:00
|
|
|
uint32_t sa_next; /**< Timestamp for next agent_timer. */
|
|
|
|
uint32_t sa_millisec; /**< Timestamp in milliseconds. */
|
2006-12-21 06:30:28 +00:00
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
uint32_t sa_nw_updates; /* Shall we enable network detector? */
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
uint32_t sa_flags; /**< Message flags */
|
2007-04-15 02:03:41 +00:00
|
|
|
msg_mclass_t const *sa_mclass;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
sip_contact_t *sa_contact;
|
|
|
|
sip_via_t *sa_vias; /**< @Via headers for all transports */
|
|
|
|
sip_via_t *sa_public_vias; /**< @Vias for public transports */
|
|
|
|
sip_contact_t *sa_aliases;/**< List of aliases for agent */
|
|
|
|
|
|
|
|
uint64_t sa_branch; /**< Counter for generating branch parameter */
|
|
|
|
uint64_t sa_tags; /**< Counter for generating tag parameters */
|
|
|
|
|
|
|
|
char const *sa_2543_tag; /**< Fixed tag added to @To when responding */
|
|
|
|
|
|
|
|
#if HAVE_SOFIA_SRESOLV
|
|
|
|
sres_resolver_t *sa_resolver; /**< DNS resolver */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
tport_t *sa_tports;
|
|
|
|
|
|
|
|
/* Default outbound proxy */
|
|
|
|
url_t *sa_default_proxy;
|
|
|
|
|
|
|
|
#if HAVE_SMIME
|
|
|
|
sm_object_t *sa_smime;
|
|
|
|
#else
|
|
|
|
void *sa_smime;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/** Request error mask */
|
|
|
|
unsigned sa_bad_req_mask;
|
|
|
|
/** Response error mask */
|
|
|
|
unsigned sa_bad_resp_mask;
|
|
|
|
|
|
|
|
/** Maximum size of incoming messages */
|
|
|
|
size_t sa_maxsize;
|
|
|
|
|
2007-10-12 03:08:54 +00:00
|
|
|
/** Maximum size of proceeding queue */
|
|
|
|
size_t sa_max_proceeding;
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
/** Maximum size of outgoing UDP requests */
|
2007-10-11 21:14:34 +00:00
|
|
|
unsigned sa_udp_mtu;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
/** SIP T1 - initial interval of retransmissions (500 ms) */
|
|
|
|
unsigned sa_t1;
|
|
|
|
/** SIP T2 - maximum interval of retransmissions (4000 ms) */
|
|
|
|
unsigned sa_t2;
|
|
|
|
/** SIP T4 - clear message time (5000 ms) */
|
|
|
|
unsigned sa_t4;
|
|
|
|
|
|
|
|
/** SIP T1X64 - transaction lifetime (32 s) */
|
|
|
|
unsigned sa_t1x64;
|
|
|
|
|
|
|
|
/** Progress timer - interval between provisional responses sent */
|
|
|
|
unsigned sa_progress;
|
|
|
|
|
2007-08-06 19:24:10 +00:00
|
|
|
/** SIP timer C - interval between provisional responses receivedxs */
|
|
|
|
unsigned sa_timer_c;
|
|
|
|
|
2008-01-26 19:48:14 +00:00
|
|
|
/** Graylisting period */
|
|
|
|
unsigned sa_graylist;
|
2006-12-21 06:30:28 +00:00
|
|
|
/** Blacklisting period */
|
|
|
|
unsigned sa_blacklist;
|
|
|
|
|
2007-08-06 19:24:10 +00:00
|
|
|
/** NTA is used to test packet drop */
|
2006-12-21 06:30:28 +00:00
|
|
|
unsigned sa_drop_prob : 10;
|
|
|
|
/** NTA is acting as an User Agent server */
|
|
|
|
unsigned sa_is_a_uas : 1;
|
|
|
|
/** Process requests outside dialog statelessly */
|
|
|
|
unsigned sa_is_stateless : 1;
|
|
|
|
/** Let application provide @Via headers */
|
|
|
|
unsigned sa_user_via:1;
|
|
|
|
/** Respond with "100 Trying" if application has not responded. */
|
|
|
|
unsigned sa_extra_100:1;
|
|
|
|
/** The "100 Trying" provisional answers are passed to the application */
|
|
|
|
unsigned sa_pass_100:1;
|
|
|
|
/** If true, a "408 Request Timeout" message is generated when outgoing
|
|
|
|
request expires. */
|
|
|
|
unsigned sa_timeout_408:1;
|
|
|
|
/** If true, a "408 Request Timeout" responses are passed to client. */
|
|
|
|
unsigned sa_pass_408:1;
|
|
|
|
/** If true, a "482 Request Merged" response is sent to merged requests. */
|
|
|
|
unsigned sa_merge_482 : 1;
|
|
|
|
/** If true, send a CANCEL to an INVITE without an provisional response. */
|
|
|
|
unsigned sa_cancel_2543 : 1;
|
|
|
|
/** If true, reply with 487 response when a CANCEL is received. */
|
|
|
|
unsigned sa_cancel_487 : 1;
|
|
|
|
/** If true, use unique tags. */
|
|
|
|
unsigned sa_tag_3261 : 1;
|
|
|
|
/** If true, include 100rel in INVITE requests. */
|
|
|
|
unsigned sa_invite_100rel : 1;
|
|
|
|
/** If true, insert @Timestamp in requests. */
|
|
|
|
unsigned sa_timestamp : 1;
|
|
|
|
|
|
|
|
/** If true, transports support IPv4. */
|
|
|
|
unsigned sa_tport_ip4 : 1;
|
|
|
|
/** If true, transports support IPv6. */
|
|
|
|
unsigned sa_tport_ip6 : 1;
|
|
|
|
/** If true, transports support UDP. */
|
|
|
|
unsigned sa_tport_udp : 1;
|
|
|
|
/** If true, transports support TCP. */
|
|
|
|
unsigned sa_tport_tcp : 1;
|
|
|
|
/** If true, transports support SCTP. */
|
|
|
|
unsigned sa_tport_sctp : 1;
|
|
|
|
/** If true, transports support TLS. */
|
|
|
|
unsigned sa_tport_tls : 1;
|
|
|
|
|
|
|
|
/** If true, use NAPTR lookup */
|
|
|
|
unsigned sa_use_naptr : 1;
|
|
|
|
/** If true, use SRV lookup */
|
|
|
|
unsigned sa_use_srv : 1;
|
|
|
|
|
|
|
|
/** If true, transports use threadpool */
|
|
|
|
unsigned sa_tport_threadpool : 1;
|
|
|
|
|
|
|
|
/** If true, use rport at client */
|
|
|
|
unsigned sa_rport:1;
|
|
|
|
/** If true, use rport at server */
|
2008-05-25 21:22:35 +00:00
|
|
|
unsigned sa_server_rport:2;
|
2006-12-21 06:30:28 +00:00
|
|
|
/** If true, use rport with tcp, too */
|
|
|
|
unsigned sa_tcp_rport:1;
|
|
|
|
|
|
|
|
/** If true, automatically create compartments */
|
|
|
|
unsigned sa_auto_comp:1;
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
/** Set when executing timer */
|
|
|
|
unsigned sa_in_timer:1;
|
2007-08-06 19:24:10 +00:00
|
|
|
|
|
|
|
/** Set if application has set value for timer C */
|
|
|
|
unsigned sa_use_timer_c:1;
|
2007-04-15 02:03:41 +00:00
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
unsigned :0;
|
|
|
|
|
|
|
|
/** Messages memory preload. */
|
|
|
|
unsigned sa_preload;
|
|
|
|
|
|
|
|
/** Name of SigComp algorithm */
|
|
|
|
char const *sa_algorithm;
|
|
|
|
/** Options for SigComp. */
|
|
|
|
char const *sa_sigcomp_options;
|
|
|
|
char const* const *sa_sigcomp_option_list;
|
|
|
|
char const *sa_sigcomp_option_free;
|
|
|
|
|
|
|
|
nta_compressor_t *sa_compressor;
|
|
|
|
|
|
|
|
/** Resolving order (AAAA/A) */
|
|
|
|
enum nta_res_order_e sa_res_order;
|
|
|
|
|
|
|
|
/** @MaxForwards */
|
|
|
|
|
|
|
|
sip_max_forwards_t sa_max_forwards[1];
|
|
|
|
|
|
|
|
/* Statistics */
|
|
|
|
struct {
|
2007-10-11 19:58:13 +00:00
|
|
|
usize_t as_recv_msg;
|
|
|
|
usize_t as_recv_request;
|
|
|
|
usize_t as_recv_response;
|
|
|
|
usize_t as_bad_message;
|
|
|
|
usize_t as_bad_request;
|
|
|
|
usize_t as_bad_response;
|
|
|
|
usize_t as_drop_request;
|
|
|
|
usize_t as_drop_response;
|
|
|
|
usize_t as_client_tr;
|
|
|
|
usize_t as_server_tr;
|
|
|
|
usize_t as_dialog_tr;
|
|
|
|
usize_t as_acked_tr;
|
|
|
|
usize_t as_canceled_tr;
|
|
|
|
usize_t as_trless_request;
|
|
|
|
usize_t as_trless_to_tr;
|
|
|
|
usize_t as_trless_response;
|
|
|
|
usize_t as_trless_200;
|
|
|
|
usize_t as_merged_request;
|
|
|
|
usize_t as_sent_msg;
|
|
|
|
usize_t as_sent_request;
|
|
|
|
usize_t as_sent_response;
|
|
|
|
usize_t as_retry_request;
|
|
|
|
usize_t as_retry_response;
|
|
|
|
usize_t as_recv_retry;
|
|
|
|
usize_t as_tout_request;
|
|
|
|
usize_t as_tout_response;
|
2006-12-21 06:30:28 +00:00
|
|
|
} sa_stats[1];
|
|
|
|
|
|
|
|
/** Hash of dialogs. */
|
|
|
|
leg_htable_t sa_dialogs[1];
|
|
|
|
/** Default leg */
|
|
|
|
nta_leg_t *sa_default_leg;
|
|
|
|
/** Hash of legs without dialogs. */
|
|
|
|
leg_htable_t sa_defaults[1];
|
|
|
|
/** Hash table for outgoing transactions */
|
|
|
|
outgoing_htable_t sa_outgoing[1];
|
|
|
|
nta_outgoing_t *sa_default_outgoing;
|
|
|
|
/** Hash table for incoming transactions */
|
|
|
|
incoming_htable_t sa_incoming[1];
|
|
|
|
nta_incoming_t *sa_default_incoming;
|
|
|
|
|
|
|
|
/* Queues (states) for outgoing client transactions */
|
|
|
|
struct {
|
|
|
|
/** Queue for retrying client transactions */
|
|
|
|
nta_outgoing_t *re_list;
|
|
|
|
nta_outgoing_t **re_t1; /**< Special place for T1 timer */
|
|
|
|
size_t re_length; /**< Length of sa_out.re_list */
|
|
|
|
|
|
|
|
outgoing_queue_t delayed[1];
|
|
|
|
outgoing_queue_t resolving[1];
|
|
|
|
|
|
|
|
outgoing_queue_t trying[1]; /* Timer F/E */
|
|
|
|
outgoing_queue_t completed[1]; /* Timer K */
|
|
|
|
outgoing_queue_t terminated[1];
|
|
|
|
|
|
|
|
/* Special queues (states) for outgoing INVITE transactions */
|
|
|
|
outgoing_queue_t inv_calling[1]; /* Timer B/A */
|
2007-08-06 19:24:10 +00:00
|
|
|
outgoing_queue_t inv_proceeding[1]; /* Timer C */
|
2006-12-21 06:30:28 +00:00
|
|
|
outgoing_queue_t inv_completed[1]; /* Timer D */
|
|
|
|
|
|
|
|
/* Temporary queue for transactions waiting to be freed */
|
|
|
|
outgoing_queue_t *free;
|
|
|
|
} sa_out;
|
|
|
|
|
|
|
|
/* Queues (states) for incoming server transactions */
|
|
|
|
struct {
|
|
|
|
/** Queue for retransmitting response of server transactions */
|
|
|
|
nta_incoming_t *re_list;
|
|
|
|
nta_incoming_t **re_t1; /**< Special place for T1 timer */
|
|
|
|
size_t re_length;
|
|
|
|
|
|
|
|
incoming_queue_t proceeding[1]; /**< Request received */
|
|
|
|
incoming_queue_t preliminary[1]; /**< 100rel sent */
|
|
|
|
incoming_queue_t completed[1]; /**< Final answer sent (non-invite). */
|
|
|
|
incoming_queue_t inv_completed[1]; /**< Final answer sent (INVITE). */
|
|
|
|
incoming_queue_t inv_confirmed[1]; /**< Final answer sent, ACK recvd. */
|
|
|
|
incoming_queue_t terminated[1]; /**< Terminated, ready to free. */
|
|
|
|
incoming_queue_t final_failed[1];
|
|
|
|
} sa_in;
|
|
|
|
|
|
|
|
/* Special task for freeing memory */
|
|
|
|
su_clone_r sa_terminator;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nta_leg_s
|
|
|
|
{
|
|
|
|
su_home_t leg_home[1];
|
|
|
|
hash_value_t leg_hash;
|
|
|
|
unsigned leg_dialog : 1;
|
|
|
|
unsigned leg_stateless : 1; /**< Process requests statelessly */
|
|
|
|
#ifdef NTA_STRICT_ROUTING
|
|
|
|
unsigned leg_contact_set : 1;
|
|
|
|
#else
|
|
|
|
unsigned leg_loose_route : 1; /**< Topmost route in set is LR */
|
|
|
|
#endif
|
|
|
|
unsigned leg_local_is_to : 1; /**< Backwards-compatibility. */
|
2007-04-15 02:03:41 +00:00
|
|
|
unsigned leg_tagged : 1; /**< Tagged after creation.
|
|
|
|
*
|
|
|
|
* Request missing To tag matches it
|
|
|
|
* even after tagging.
|
|
|
|
*/
|
2006-12-21 06:30:28 +00:00
|
|
|
unsigned:0;
|
|
|
|
nta_request_f *leg_callback;
|
|
|
|
nta_leg_magic_t *leg_magic;
|
|
|
|
nta_agent_t *leg_agent;
|
|
|
|
/** Leg URL.
|
|
|
|
*
|
|
|
|
* This is the URL used to match incoming requests.
|
|
|
|
*/
|
|
|
|
url_t const *leg_url;
|
|
|
|
char const *leg_method; /**< Method for this dialog. */
|
|
|
|
|
|
|
|
uint32_t leg_seq; /**< Sequence number for next transaction */
|
|
|
|
uint32_t leg_rseq; /**< Remote sequence number */
|
|
|
|
sip_call_id_t *leg_id; /**< Call ID */
|
|
|
|
sip_from_t *leg_remote; /**< Remote address (@To/@From) */
|
|
|
|
sip_to_t *leg_local; /**< Local address (@From/@To) */
|
|
|
|
|
|
|
|
sip_route_t *leg_route; /**< @Route for outgoing requests. */
|
|
|
|
sip_contact_t *leg_target; /**< Remote destination (from @Contact). */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define leg_has_id(leg) ((leg)->leg_id != NULL)
|
|
|
|
|
|
|
|
struct nta_incoming_s
|
|
|
|
{
|
|
|
|
su_home_t *irq_home;
|
|
|
|
hash_value_t irq_hash;
|
|
|
|
nta_agent_t *irq_agent;
|
|
|
|
nta_ack_cancel_f *irq_callback;
|
|
|
|
nta_incoming_magic_t *irq_magic;
|
|
|
|
|
|
|
|
/* Timeout/state queue */
|
|
|
|
nta_incoming_t **irq_prev;
|
|
|
|
nta_incoming_t *irq_next;
|
|
|
|
incoming_queue_t *irq_queue;
|
|
|
|
|
|
|
|
/* Retry queue */
|
|
|
|
nta_incoming_t **irq_rprev;
|
|
|
|
nta_incoming_t *irq_rnext;
|
|
|
|
|
|
|
|
sip_method_t irq_method;
|
|
|
|
sip_request_t *irq_rq;
|
|
|
|
sip_from_t *irq_from;
|
|
|
|
sip_to_t *irq_to;
|
|
|
|
char const *irq_tag;
|
|
|
|
sip_cseq_t *irq_cseq;
|
|
|
|
sip_call_id_t *irq_call_id;
|
|
|
|
sip_via_t *irq_via;
|
|
|
|
sip_record_route_t *irq_record_route;
|
|
|
|
char const *irq_branch;
|
|
|
|
|
|
|
|
uint32_t irq_rseq;
|
|
|
|
|
|
|
|
sip_timestamp_t *irq_timestamp;
|
|
|
|
su_time_t irq_received;
|
|
|
|
|
2008-05-07 12:28:33 +00:00
|
|
|
uint32_t irq_timeout; /**< Timer H, I, J */
|
|
|
|
uint32_t irq_retry; /**< Timer G */
|
2006-12-21 06:30:28 +00:00
|
|
|
unsigned short irq_interval; /**< Next timer */
|
|
|
|
|
|
|
|
short irq_status;
|
|
|
|
|
|
|
|
unsigned irq_retries : 8;
|
|
|
|
unsigned irq_default : 1; /**< Default transaction */
|
|
|
|
unsigned irq_canceled : 1; /**< Transaction is canceled */
|
|
|
|
unsigned irq_completed : 1; /**< Transaction is completed */
|
|
|
|
unsigned irq_confirmed : 1; /**< Response has been acked */
|
|
|
|
unsigned irq_terminated :1; /**< Transaction is terminated */
|
|
|
|
unsigned irq_final_failed:1; /**< Sending final response failed */
|
|
|
|
unsigned irq_destroyed :1; /**< Transaction is destroyed */
|
|
|
|
unsigned irq_in_callback:1; /**< Callback is being invoked */
|
|
|
|
unsigned irq_reliable_tp:1; /**< Transport is reliable */
|
|
|
|
unsigned irq_sigcomp_zap:1; /**< Reset SigComp */
|
|
|
|
unsigned irq_must_100rel:1; /**< 100rel is required */
|
|
|
|
unsigned irq_tag_set:1; /**< Tag is not from request */
|
|
|
|
unsigned :0;
|
|
|
|
|
|
|
|
tp_name_t irq_tpn[1];
|
|
|
|
tport_t *irq_tport;
|
|
|
|
struct sigcomp_compartment *irq_cc;
|
|
|
|
msg_t *irq_request;
|
|
|
|
msg_t *irq_request2; /**< ACK/CANCEL */
|
|
|
|
msg_t *irq_response;
|
|
|
|
|
|
|
|
nta_reliable_t *irq_reliable; /**< List of reliable responses */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nta_reliable_s
|
|
|
|
{
|
|
|
|
nta_reliable_t *rel_next;
|
|
|
|
nta_incoming_t *rel_irq;
|
|
|
|
nta_prack_f *rel_callback;
|
|
|
|
nta_reliable_magic_t *rel_magic;
|
|
|
|
uint32_t rel_rseq;
|
|
|
|
unsigned short rel_status;
|
|
|
|
unsigned rel_pracked : 1;
|
|
|
|
unsigned rel_precious : 1;
|
|
|
|
msg_t *rel_response;
|
|
|
|
msg_t *rel_unsent;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct sipdns_resolver sipdns_resolver_t;
|
|
|
|
|
|
|
|
struct nta_outgoing_s
|
|
|
|
{
|
|
|
|
hash_value_t orq_hash; /**< Hash value */
|
|
|
|
nta_agent_t *orq_agent;
|
|
|
|
nta_response_f *orq_callback;
|
|
|
|
nta_outgoing_magic_t *orq_magic;
|
|
|
|
|
|
|
|
/* Timeout/state queue */
|
|
|
|
nta_outgoing_t **orq_prev;
|
|
|
|
nta_outgoing_t *orq_next;
|
|
|
|
outgoing_queue_t *orq_queue;
|
|
|
|
|
|
|
|
/* Retry queue */
|
|
|
|
nta_outgoing_t **orq_rprev;
|
|
|
|
nta_outgoing_t *orq_rnext;
|
|
|
|
|
|
|
|
sip_method_t orq_method;
|
|
|
|
char const *orq_method_name;
|
2007-04-15 02:03:41 +00:00
|
|
|
url_t const *orq_url; /**< Original RequestURI */
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
sip_from_t const *orq_from;
|
|
|
|
sip_to_t const *orq_to;
|
2007-04-15 02:03:41 +00:00
|
|
|
char const *orq_tag; /**< Tag from final response. */
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
sip_cseq_t const *orq_cseq;
|
|
|
|
sip_call_id_t const *orq_call_id;
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
msg_t *orq_request;
|
|
|
|
msg_t *orq_response;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
su_time_t orq_sent; /**< When request was sent? */
|
|
|
|
unsigned orq_delay; /**< RTT estimate */
|
|
|
|
|
2008-05-07 12:28:33 +00:00
|
|
|
uint32_t orq_retry; /**< Timer A, E */
|
|
|
|
uint32_t orq_timeout; /**< Timer B, D, F, K */
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
unsigned short orq_interval; /**< Next timer A/E */
|
|
|
|
|
|
|
|
unsigned short orq_status;
|
|
|
|
unsigned char orq_retries; /**< Number of tries this far */
|
|
|
|
unsigned orq_default : 1; /**< This is default transaction */
|
|
|
|
unsigned orq_inserted : 1;
|
|
|
|
unsigned orq_resolved : 1;
|
|
|
|
unsigned orq_prepared : 1; /**< outgoing_prepare() called */
|
|
|
|
unsigned orq_canceled : 1;
|
|
|
|
unsigned orq_terminated : 1;
|
|
|
|
unsigned orq_destroyed : 1;
|
|
|
|
unsigned orq_completed : 1;
|
|
|
|
unsigned orq_delayed : 1;
|
|
|
|
unsigned orq_stripped_uri : 1;
|
Update sofia-sip from darcs:
Mon May 14 12:43:07 EDT 2007 martti.mela@nokia.com
* su_base_port.c: fixed a double free in su_base_port_start_shared().
Fri May 25 13:56:23 EDT 2007 Pekka.Pessi@nokia.com
* soa: added SOATAG_ORDERED_USER(), SOATAG_REUSE_REJECTED().
Allow replacing existing m=lines.
Sun May 27 14:52:13 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.c: fixed bug #1726034
Mon May 28 04:57:08 EDT 2007 Pekka.Pessi@nokia.com
* test_nth.c: using non-blocking connect in test program, too.
Mon May 28 04:58:05 EDT 2007 Pekka.Pessi@nokia.com
* su.c: making all sockets non-blocking by default.
Mon May 28 04:59:28 EDT 2007 Pekka.Pessi@nokia.com
* m4/sac-su.m4: moved contents into sac-s2.m4
Mon May 28 05:32:26 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated.
Wed May 30 10:37:53 EDT 2007 Pekka.Pessi@nokia.com
* m4/sac-su2.m4: added configure option --disable-tag-cast.
Added SU_INLINE_TAG_CAST into sofia-sip/su_configure.h{,.in}.
Using SU_INLINE_TAG_CAST in
sofia-sip/sip_tag.h{,.in}
sofia-sip/http_tag.h{,.in}
sofia-sip/su_tag.h
sofia-sip/su_tag_io.h
sofia-sip/auth_module.h
sofia-sip/nth_tag.h
sofia-sip/nua_tag.h
Fri Jun 1 15:11:52 EDT 2007 Pekka.Pessi@nokia.com
* tport.c: fixed tport_set_params() with secondary transports
Fri Jun 1 15:13:23 EDT 2007 Pekka.Pessi@nokia.com
* tport_type_tcp.c: checking for end-of-stream even if su_getmsgsize() promised more data
Fri Jun 1 15:15:34 EDT 2007 Pekka.Pessi@nokia.com
* tport: added tport_is_clear_to_send(), allow use of tport_pending() without msg
The error callback from tport can now be registered even if there is no
request pending on transport (e.g., when keeping a transport connection open
for inbound messages).
Fri Jun 1 15:16:43 EDT 2007 Pekka.Pessi@nokia.com
* nta: not retrying after an transport error if application provided the transport
Fri Jun 1 15:17:23 EDT 2007 Pekka.Pessi@nokia.com
* sip: do not accept empty URIs (<>) in From, To, and other headers expecting name-addr format
Fri Jun 1 15:17:43 EDT 2007 Pekka.Pessi@nokia.com
* torture_url.c: added test for parsing empty URLs.
Fri Jun 1 15:19:27 EDT 2007 Pekka.Pessi@nokia.com
* nua/test_proxy.[hc]: use registered connections for outbound with TCP.
Added test_proxy_close_tports() used testing recovering from TCP failures.
Fri Jun 1 15:20:33 EDT 2007 Pekka.Pessi@nokia.com
* test_nua.c: added --print-tags and --tags-a, --tags=b and --tags=c options
Added more functions for handling events
Fri Jun 1 15:22:08 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: fixed some tests depending on delivery of responses in correct order
Reordering might happen if some messages are sent over TCP, other over UDP.
Fri Jun 1 15:27:55 EDT 2007 Pekka.Pessi@nokia.com
* nua_register.c: re-registering in case the TCP connection towards proxy is closed
In test_nua, Mr. B is now using TCP with the test proxy.
Fri Jun 1 15:35:39 EDT 2007 Pekka.Pessi@nokia.com
* nua/test_refer.c: fixed SIP payload checks
Fri Jun 1 15:36:08 EDT 2007 Pekka.Pessi@nokia.com
* nta_internal.h: added orq_user_tport field
Tue Jun 5 06:16:43 EDT 2007 Pekka.Pessi@nokia.com
* hide_email.sh: now fixing links, too.
Fri Jun 15 05:34:29 EDT 2007 Pekka.Pessi@nokia.com
* nua: fixed documentation entries for API functions left out from doxygen
Thanks for Jerry Ricahrds for pointing this out.
Wed May 23 10:26:26 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* Correct documentation for parameter type of NUTAG_WITH_SAVED
Mon Jun 18 12:34:58 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* Make nua_saved_event_request() and hence NUTAG_WITH_SAVED resilient to a NULL event content
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5413 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-06-20 10:41:15 +00:00
|
|
|
unsigned orq_user_tport : 1; /**< Application provided tport - don't retry */
|
2006-12-21 06:30:28 +00:00
|
|
|
unsigned orq_try_tcp_instead : 1;
|
|
|
|
unsigned orq_try_udp_instead : 1;
|
|
|
|
unsigned orq_reliable : 1; /**< Transport is reliable */
|
|
|
|
unsigned orq_ack_error : 1; /**< ACK is sent by NTA */
|
|
|
|
/* Attributes */
|
|
|
|
unsigned orq_user_via : 1;
|
|
|
|
unsigned orq_stateless : 1;
|
|
|
|
unsigned orq_pass_100 : 1;
|
|
|
|
unsigned orq_sigcomp_new:1; /**< Create compartment if needed */
|
|
|
|
unsigned orq_sigcomp_zap:1; /**< Reset SigComp after completing */
|
|
|
|
unsigned orq_must_100rel : 1;
|
2007-04-15 02:03:41 +00:00
|
|
|
unsigned orq_timestamp : 1; /**< Insert @Timestamp header. */
|
2007-08-06 19:24:10 +00:00
|
|
|
unsigned orq_100rel:1; /**< Support 100rel */
|
2006-12-21 06:30:28 +00:00
|
|
|
unsigned : 0; /* pad */
|
|
|
|
|
|
|
|
#if HAVE_SOFIA_SRESOLV
|
|
|
|
sipdns_resolver_t *orq_resolver;
|
|
|
|
#endif
|
|
|
|
enum nta_res_order_e orq_res_order; /**< AAAA/A first? */
|
|
|
|
|
|
|
|
url_t *orq_route; /**< Route URL */
|
|
|
|
tp_name_t orq_tpn[1]; /**< Where to send request */
|
|
|
|
char const *orq_scheme; /**< Transport URL type */
|
|
|
|
|
|
|
|
tport_t *orq_tport;
|
|
|
|
struct sigcomp_compartment *orq_cc;
|
|
|
|
tagi_t *orq_tags; /**< Tport tag items */
|
|
|
|
int orq_pending; /**< Request is pending in tport */
|
|
|
|
|
|
|
|
char const *orq_branch; /**< Transaction branch */
|
|
|
|
char const *orq_via_branch; /**< @Via branch */
|
2007-02-07 21:59:38 +00:00
|
|
|
|
2007-10-11 19:58:13 +00:00
|
|
|
int *orq_status2b; /**< Delayed response */
|
|
|
|
|
2007-02-17 06:25:21 +00:00
|
|
|
nta_outgoing_t *orq_cancel; /**< CANCEL transaction */
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
uint32_t orq_rseq; /**< Latest incoming rseq */
|
2006-12-21 06:30:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Virtual function table for plugging in SigComp */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int ncv_size;
|
|
|
|
char const *ncv_name;
|
|
|
|
|
|
|
|
nta_compressor_t *(*ncv_init_agent)(nta_agent_t *sa,
|
|
|
|
char const * const *options);
|
|
|
|
|
|
|
|
void (*ncv_deinit_agent)(nta_agent_t *sa, nta_compressor_t *);
|
|
|
|
|
|
|
|
struct sigcomp_compartment *(*ncv_compartment)(nta_agent_t *sa,
|
|
|
|
tport_t *tport,
|
|
|
|
nta_compressor_t *msc,
|
|
|
|
tp_name_t const *tpn,
|
|
|
|
char const * const *options,
|
|
|
|
int new_if_needed);
|
|
|
|
|
|
|
|
int (*ncv_accept_compressed)(nta_agent_t *sa,
|
|
|
|
nta_compressor_t *msc,
|
|
|
|
tport_compressor_t *sc,
|
|
|
|
msg_t *msg,
|
|
|
|
struct sigcomp_compartment *cc);
|
|
|
|
|
|
|
|
int (*ncv_close_compressor)(nta_agent_t *sa,
|
|
|
|
struct sigcomp_compartment *cc);
|
|
|
|
int (*ncv_zap_compressor)(nta_agent_t *sa,
|
|
|
|
struct sigcomp_compartment *cc);
|
|
|
|
|
|
|
|
struct sigcomp_compartment *(*ncv_compartment_ref)
|
|
|
|
(struct sigcomp_compartment *);
|
|
|
|
|
|
|
|
void (*ncv_compartment_unref)(struct sigcomp_compartment *);
|
|
|
|
|
|
|
|
} nta_compressor_vtable_t;
|
|
|
|
|
|
|
|
extern nta_compressor_vtable_t *nta_compressor_vtable;
|
|
|
|
|
|
|
|
SOFIAPUBFUN nta_compressor_t *nta_agent_init_sigcomp(nta_agent_t *sa);
|
|
|
|
SOFIAPUBFUN void nta_agent_deinit_sigcomp(nta_agent_t *sa);
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
/* Debug log settings */
|
|
|
|
|
|
|
|
#define SU_LOG nta_log
|
|
|
|
|
|
|
|
#ifdef SU_DEBUG_H
|
|
|
|
#error <su_debug.h> included directly.
|
|
|
|
#endif
|
|
|
|
#include <sofia-sip/su_debug.h>
|
|
|
|
SOFIAPUBVAR su_log_t nta_log[];
|
|
|
|
|
|
|
|
SOFIA_END_DECLS
|
|
|
|
|
|
|
|
#endif /* NTA_INTERNAL_H */
|