mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-05 10:34:54 +00:00
da29143b60
Mon Nov 19 22:05:07 EST 2007 Pekka Pessi <first.lastname@nokia.com> * test_htable2.c: define struct before using it in prototypes Fri Jan 11 09:12:01 EST 2008 Bernhard Suttner <suttner at comdasys.com> * Using # in SOATAG_HOLD to set media as inactive instead of sendonly Fri Jan 11 09:15:18 EST 2008 Pekka.Pessi@nokia.com * soa_tag.c: documented SOATAG_HOLD() inactive mode Fri Jan 11 09:28:46 EST 2008 Pekka.Pessi@nokia.com * su_addrinfo.c: if su_getaddrinfo() service is NULL, try both with "0" and NULL Fri Jan 11 09:30:23 EST 2008 Pekka.Pessi@nokia.com * Makefile.am: added tests to DIST_SUBDIRS Fri Jan 11 12:11:12 EST 2008 Pekka.Pessi@nokia.com * nta.c: NetModule hack re-prioritizing SRV records Original hack by Stefan Leuenberger <Stefan.Leuenberger@netmodule.com>. The hack reprioritizes the SRV records used with transaction in case a server refuses connection or it does not answer. Fri Jan 11 12:12:23 EST 2008 Pekka.Pessi@nokia.com * sres.c, sres_cache.c: NetModule hack for re-prioritizing SRV records Original hack by Stefan Leuenberger <Stefan.Leuenberger@netmodule.com>. The hack reprioritizes the SRV records used with transaction in case a server refuses connection or it does not answer. New functions sres_cache_set_srv_priority() and sres_set_cached_srv_priority(). Fri Jan 11 12:15:19 EST 2008 Pekka.Pessi@nokia.com * Makefile.am: fixed dist target Fri Jan 11 12:19:33 EST 2008 Pekka.Pessi@nokia.com * tport_internal.h: grammar in doc Mon Jan 14 06:59:17 EST 2008 Pekka.Pessi@nokia.com * su.h: IPv6 fix for Vista SDK Patch by Michael Jerris Wed Jan 16 13:20:47 EST 2008 Pekka.Pessi@nokia.com * nua: fix sf.net bug #1867753 (avoid duplicating initial route set) Thu Jan 17 07:48:10 EST 2008 Pekka.Pessi@nokia.com * sres.c, sres_cache.c: documented sres_set_cached_srv_priority(), sres_cache_set_srv_priority() Thu Jan 17 07:51:32 EST 2008 Pekka.Pessi@nokia.com * sofia-sip/su_wait.h, su_port.h, su_root.c: documented new functions and types for 1.12.8 Thu Jan 17 07:52:03 EST 2008 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: marked new features for release 1.12.8 Thu Jan 17 07:52:33 EST 2008 Pekka.Pessi@nokia.com * su_alloc.c: marked new features for release 1.12.8. Thu Jan 17 07:53:01 EST 2008 Pekka.Pessi@nokia.com * AUTHORS: updated Thu Jan 17 07:53:21 EST 2008 Pekka.Pessi@nokia.com * RELEASE: added new features and bug fixes since 1.12.7 Thu Jan 17 07:55:18 EST 2008 Pekka.Pessi@nokia.com * libsofia-sip-ua/docs/Doxyfile.aliases: added @NEW_1_12_8 and @VERSION_1_12_8 Thu Jan 17 09:48:48 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * autogen.sh: use automake 1.9 unless otherwise specified Thu Jan 17 11:40:46 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * soa_static.c: cleaned inactive hold, added tests Thu Jan 17 11:41:54 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: added hide_emails.sh to dist Thu Jan 17 11:42:35 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * nua_stack.c: removed noisy debug message from nua_client_request_sendmsg() Fri Jan 18 11:06:10 EST 2008 Pekka.Pessi@nokia.com * nua: Added NUA_ERROR_AT() macro Made internally generated 900 (and 904) response phrases unique as suggested by Jerry Richards. Mon Jan 21 10:39:50 EST 2008 Stefan Knoblich * TLS debug cleanup Mon Jan 21 12:05:38 EST 2008 Pekka.Pessi@nokia.com * tport: build fixes from Freeswitch Mon Jan 21 12:14:25 EST 2008 Pekka.Pessi@nokia.com * su_global_log.c: disable warning on SU_DEBUG[] (Doxygen-only variable) Patch from Michael Jerris. Mon Jan 21 12:15:19 EST 2008 Pekka.Pessi@nokia.com * sres.c: default log level to the same as SU_DEBUG define Patch by Michael Jerris Mon Jan 21 12:16:39 EST 2008 Pekka.Pessi@nokia.com * stun.c: default log level to the same as SU_DEBUG define Patch by Michael Jerris Mon Jan 21 12:45:04 EST 2008 Stefan Knoblich * TLS debug cleanup, 2/2. Silence openssl messages, part 2 of 2. Changed to TPORT_DEBUG=1 (thanks MikeJ). This one converts all ERR_print_errors() calls Mon Jan 21 13:00:49 EST 2008 Pekka.Pessi@nokia.com * nua: removed asserts() on hairy dialog/request handling cases Mon Jan 21 14:06:35 EST 2008 Pekka.Pessi@nokia.com * soa.c: using session state in soa_set_activity() The media mode bits are set using (local) session description instead of remote offer/answer when O/A has been completed. Mon Jan 21 14:08:08 EST 2008 Pekka.Pessi@nokia.com * soa_static.c: soa_sdp_mode_set() now includes wanted media state in offer The wanted media state is based on original user SDP and SOATAG_HOLD() content. Removed soa_sdp_mode_set_is_needed(), using dry-run parameter instead. Mon Jan 21 14:09:11 EST 2008 Pekka.Pessi@nokia.com * nua_subnotref.c: fixed REFER re-try case REFER trashed its dialog when it got retried if there was no other dialog usages. Mon Jan 21 14:20:31 EST 2008 Pekka.Pessi@nokia.com * nua_stack.c: return specific error phrases from nua_client_init_request() As suggested by Jerry Richards. Tue Jan 22 11:15:04 EST 2008 Pekka.Pessi@nokia.com * sip_util.c: updated sip_response_terminates_dialog() as per RFC 5057. Changes handling of 423 in case of SUBSCRIBE. Tue Jan 22 11:34:01 EST 2008 Pekka.Pessi@nokia.com * conformance.docs: added RFC 5057 (sipping-dialogusage) Tue Jan 22 11:34:16 EST 2008 Pekka.Pessi@nokia.com * test_auth_digest.c: testing empty realm Tue Jan 22 11:35:44 EST 2008 Pekka.Pessi@nokia.com * test_soa.c: testing hold with inactive, offered mode and setting remote activity flags while in hold Tue Jan 22 12:27:41 EST 2008 Pekka.Pessi@nokia.com * nta.c: fixed memory corruption in case sending ACK failed Thanks for Fabio Margarido for reporting this problem. Tue Jan 22 12:49:02 EST 2008 Pekka.Pessi@nokia.com * nua/test_refer.c: run test_challenge_refer() only if we use proxy Test case is now more deterministic, too. Tue Jan 22 12:51:59 EST 2008 Pekka.Pessi@nokia.com * docs/Makefile.am, docs/conformance.docs: fixed links to RFC 5057. Tue Jan 22 13:57:38 EST 2008 Pekka.Pessi@nokia.com * sres: added ttl parameter to sres_set_cached_srv_priority() and sres_cache_set_srv_priority(). Tue Jan 22 13:59:44 EST 2008 Pekka.Pessi@nokia.com * nta.c: added NTATAG_GRAYLIST(). Use NTATAG_GRAYLIST() as ttl value for sres_set_cached_srv_priority(). Tue Jan 22 14:04:29 EST 2008 Pekka.Pessi@nokia.com * RELEASE: updated. Tue Jan 22 14:04:29 EST 2008 Pekka.Pessi@nokia.com * RELEASE: updated. Wed Jan 23 06:56:11 EST 2008 Pekka.Pessi@nokia.com * sip_extra.c, sip_parser.c: updated documentation Wed Jan 23 09:47:50 EST 2008 Pekka.Pessi@nokia.com * test_nta.c: fixed receiving with sink socket Wed Jan 23 10:07:30 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * soa_static.c: fixed signedness error Wed Jan 23 10:11:14 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * win32 project files: fixed slash direction Wed Jan 23 10:13:00 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * torture_su.c: set blocking on Wed Jan 23 10:13:36 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * test_tport.c: using blocking sockets in test_incomplete() Wed Jan 23 11:01:11 EST 2008 Pekka.Pessi@nokia.com * nta.c: now using RFC3261-compliant dialog-matching Wed Jan 23 11:05:23 EST 2008 Pekka.Pessi@nokia.com * nta.c: ignore tags in nta_leg_by_dialog() if they are empty strings Wed Jan 23 11:05:58 EST 2008 Pekka.Pessi@nokia.com * nta.c: asserting in proper place when handling queue tail Wed Jan 23 12:11:09 EST 2008 Pekka.Pessi@nokia.com * torture_sip.c: added tests for accessing other extra headers beside P-Asserted-Identity/P-Preferred-Identity Wed Jan 23 13:08:55 EST 2008 Pekka.Pessi@nokia.com * nua: terminate dialog when redirected and re-establish it with new request Wed Jan 23 13:18:16 EST 2008 Pekka.Pessi@nokia.com * test_100rel.c: added test for redirect after 100rel response. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7328 d0543943-73ff-0310-b7d9-9358b9ac24b2
614 lines
20 KiB
C
614 lines
20 KiB
C
/*
|
|
* 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
|
|
|
|
/**@internal @file nta_internal.h
|
|
*
|
|
* @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;
|
|
|
|
su_duration_t sa_next; /**< Timestamp for next agent_timer. */
|
|
su_time_t sa_now; /**< Timestamp in microsecond resolution. */
|
|
uint32_t sa_millisec; /**< Timestamp in milliseconds resolution. */
|
|
|
|
uint32_t sa_nw_updates; /* Shall we enable network detector? */
|
|
|
|
uint32_t sa_flags; /**< Message flags */
|
|
msg_mclass_t const *sa_mclass;
|
|
|
|
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;
|
|
|
|
/** Maximum size of proceeding queue */
|
|
size_t sa_max_proceeding;
|
|
|
|
/** Maximum size of outgoing UDP requests */
|
|
unsigned sa_udp_mtu;
|
|
|
|
/** 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;
|
|
|
|
/** SIP timer C - interval between provisional responses receivedxs */
|
|
unsigned sa_timer_c;
|
|
|
|
/** Graylisting period */
|
|
unsigned sa_graylist;
|
|
/** Blacklisting period */
|
|
unsigned sa_blacklist;
|
|
|
|
/** NTA is used to test packet drop */
|
|
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 */
|
|
unsigned sa_server_rport:1;
|
|
/** If true, use rport with tcp, too */
|
|
unsigned sa_tcp_rport:1;
|
|
|
|
/** If true, automatically create compartments */
|
|
unsigned sa_auto_comp:1;
|
|
|
|
/** Set when executing timer */
|
|
unsigned sa_in_timer:1;
|
|
|
|
/** Set if application has set value for timer C */
|
|
unsigned sa_use_timer_c:1;
|
|
|
|
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 {
|
|
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;
|
|
} 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 */
|
|
outgoing_queue_t inv_proceeding[1]; /* Timer C */
|
|
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. */
|
|
unsigned leg_tagged : 1; /**< Tagged after creation.
|
|
*
|
|
* Request missing To tag matches it
|
|
* even after tagging.
|
|
*/
|
|
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;
|
|
|
|
su_duration_t irq_timeout; /**< Timer H, I, J */
|
|
su_duration_t irq_retry; /**< Timer G */
|
|
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;
|
|
url_t const *orq_url; /**< Original RequestURI */
|
|
|
|
sip_from_t const *orq_from;
|
|
sip_to_t const *orq_to;
|
|
char const *orq_tag; /**< Tag from final response. */
|
|
|
|
sip_cseq_t const *orq_cseq;
|
|
sip_call_id_t const *orq_call_id;
|
|
|
|
msg_t *orq_request;
|
|
msg_t *orq_response;
|
|
|
|
su_time_t orq_sent; /**< When request was sent? */
|
|
unsigned orq_delay; /**< RTT estimate */
|
|
|
|
su_duration_t orq_retry; /**< Timer A, E */
|
|
su_duration_t orq_timeout; /**< Timer B, D, F, K */
|
|
|
|
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;
|
|
unsigned orq_user_tport : 1; /**< Application provided tport - don't retry */
|
|
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;
|
|
unsigned orq_timestamp : 1; /**< Insert @Timestamp header. */
|
|
unsigned orq_100rel:1; /**< Support 100rel */
|
|
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 */
|
|
|
|
int *orq_status2b; /**< Delayed response */
|
|
|
|
nta_outgoing_t *orq_cancel; /**< CANCEL transaction */
|
|
|
|
uint32_t orq_rseq; /**< Latest incoming rseq */
|
|
};
|
|
|
|
/* 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 */
|