update to latest darcs sofia

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3888 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-01-02 15:11:55 +00:00
parent af598aa069
commit ad36f2a9f3
22 changed files with 355 additions and 125 deletions

View File

@ -5,17 +5,30 @@ Pekka Pessi <pekka.pessi -at nokia -dot com>
Martti Mela <martti.mela -at nokia -dot com>
Kai Vehmanen <kai.vehmanen -at nokia -dot com>
Contributors (in alphabetical order)
------------------------------------
Contributors (in alphabetical order, surname first)
---------------------------------------------------
Chan, Tat
Haataja, Mikko
Jacobs, Remeres
Jalava, Teemu
Chan, Tat <first.surname@nokia.com>
Ciarkowski, Andrzej <wp-voigtkampff -at users -dot sourceforge -dot net>
Haataja, Mikko <first.surname@nokia.com>
Jacobs, Remeres <first.surname@nokia.com>
Jalava, Teemu <first.surname@nokia.com>
Jerris, Michael <mike -at jerris -dot com>
Legostayev Denis <legostayev -at neic -dot nsk -dot su>
Prado, Dimitri E. <dprado -at e3c -dot com -dot br>
Puustinen, Ismo
Rinne-Rahkola, Pasi
Saari, Mika
Selin, Jari
Urpalainen, Jari
Puolakka, Petteri <first.surname@nokia.com>
Puustinen, Ismo <first.surname@nokia.com>
Rinne-Rahkola, Pasi <first.surname@nokia.com>
Saari, Mika <first.surname@nokia.com>
Selin, Jari <first.surname@nokia.com>
Underwood, Steve <steveu -at coppice -dot org>
Urpalainen, Jari <first.surname@nokia.com>
Whittaker, Colin <colinw -at occamnetworks -dot com>
Zabaluev, Mikhail <first.surname@nokia.com>
Note: for details on who did what, see the version control
system change history, and release notes for past releases at
http://sofia-sip.sourceforge.net/relnotes/

View File

@ -55,6 +55,7 @@ Contributors to this release
- **template**: First Surname (patch to nua/soa/msg)
- Petteri Puolakka (patch to stun)
- Mikhail Zabluev (patch to su-glib mainloop integration)
See the AUTHORS file in the distribution package.
@ -94,3 +95,8 @@ Bugs fixed in this release
Roman Filonenko.
- Bug in zero-padding STUN messages with a message integrity
attribute. Patch by Petteri Puolakka.
- Fixed a severe problem with timer accuracy, when sofia-sip timers
where used under glib's mainloop.
- Improved glib mainloop integration to avoid warnings about already
active mainloop context, and potentially other issue. Patch by
Mikhail Zabaluev. Closes sf.net item #1606786.

View File

@ -0,0 +1,2 @@
#! /bin/sh
./configure $@ --with-pic --with-glib=no

View File

@ -19,12 +19,12 @@ INCLUDES = -I$(S_BASE)/su -I$(B_BASE)/su $(GLIB_CFLAGS)
noinst_LTLIBRARIES = libsu-glib.la
check_PROGRAMS = su_source_test
check_PROGRAMS = su_source_test torture_su_glib_timer
# ----------------------------------------------------------------------
# Tests
TESTS = su_source_test
TESTS = su_source_test torture_su_glib_timer
# ----------------------------------------------------------------------
# Rules for building the targets

View File

@ -319,34 +319,28 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
enter;
if (self->sup_head)
if (self->sup_head) {
*return_tout = 0;
return TRUE;
*return_tout = -1;
}
if (self->sup_timers) {
su_time_t now;
GTimeVal gtimeval;
su_duration_t tout;
tout = SU_DURATION_MAX;
g_source_get_current_time(gs, &gtimeval);
now.tv_sec = gtimeval.tv_sec + 2208988800UL;
now.tv_usec = gtimeval.tv_usec;
tout = su_timer_next_expires(self->sup_timers, now);
if (tout == 0)
return TRUE;
*return_tout = (tout < 0 || tout > (su_duration_t)G_MAXINT)?
-1 : (gint)tout;
if ((gint)tout < 0 || tout > (su_duration_t)G_MAXINT)
tout = -1;
*return_tout = (gint)tout;
return (tout == 0);
}
return FALSE;
}
@ -995,30 +989,30 @@ su_duration_t su_source_step(su_port_t *self, su_duration_t tout)
gmc = g_source_get_context(self->sup_source);
if (gmc && g_main_context_acquire(gmc)) {
GPollFD *fds = NULL;
gint fds_size = 0;
gint fds_wait;
gint priority = G_MAXINT;
if (g_main_context_prepare(gmc, &priority)) {
g_main_context_dispatch(gmc);
} else {
gint timeout = tout > G_MAXINT ? G_MAXINT : tout;
gint i, n = 0;
GPollFD *fds = NULL;
gint src_tout = -1;
priority = G_MAXINT;
g_main_context_prepare(gmc, &priority);
n = g_main_context_query(gmc, priority, &timeout, fds, n);
if (n > 0) {
fds = g_alloca(n * (sizeof *fds));
n = g_main_context_query(gmc, priority, &timeout, fds, n);
}
if (tout < timeout)
timeout = tout;
i = su_wait((su_wait_t *)fds, n, timeout);
if (g_main_context_check(gmc, priority, fds, n))
g_main_context_dispatch(gmc);
fds_wait = g_main_context_query(gmc, priority, &src_tout, NULL, 0);
while (fds_wait > fds_size) {
fds = g_alloca(fds_wait * sizeof(fds[0]));
fds_size = fds_wait;
fds_wait = g_main_context_query(gmc, priority, &src_tout, fds, fds_size);
}
if (src_tout >= 0 && tout > (su_duration_t)src_tout)
tout = src_tout;
su_wait((su_wait_t *)fds, fds_wait, tout);
g_main_context_check(gmc, priority, fds, fds_wait);
g_main_context_dispatch(gmc);
g_main_context_release(gmc);
}

View File

@ -90,7 +90,7 @@ doxygen: built-sources
for d in $(DIST_SUBDIRS); do \
test -r $$d/Doxyfile \
&& pushd $$d > /dev/null \
&& echo running ${DOXYGEN} in second time in $$d \
&& echo running ${DOXYGEN} second time in $$d \
&& ${DOXYGEN} 2>&1 \
| egrep -v -i -e 'Warning: Unsupported (xml/)?html tag' \
; popd > /dev/null ; \

View File

@ -3074,13 +3074,6 @@ int nta_msg_request_complete(msg_t *msg,
if (!sip->sip_max_forwards)
sip_add_dup(msg, sip, (sip_header_t *)leg->leg_agent->sa_max_forwards);
if (!sip->sip_call_id) {
if (leg->leg_id)
sip->sip_call_id = sip_call_id_dup(home, leg->leg_id);
else
sip->sip_call_id = sip_call_id_create(home, NULL);
}
if (!sip->sip_from)
sip->sip_from = sip_from_dup(home, leg->leg_local);
else if (leg->leg_local && leg->leg_local->a_tag &&
@ -3113,7 +3106,10 @@ int nta_msg_request_complete(msg_t *msg,
method = sip->sip_request->rq_method;
method_name = sip->sip_request->rq_method_name;
if (method == sip_method_ack || method == sip_method_cancel)
if (!leg->leg_id && !sip->sip_call_id && sip->sip_cseq)
seq = sip->sip_cseq->cs_seq;
else if (method == sip_method_ack || method == sip_method_cancel)
/* Dangerous - we may do PRACK/UPDATE meanwhile */
seq = sip->sip_cseq ? sip->sip_cseq->cs_seq : leg->leg_seq;
else if (leg->leg_seq)
seq = ++leg->leg_seq;
@ -3122,6 +3118,13 @@ int nta_msg_request_complete(msg_t *msg,
else
seq = leg->leg_seq = (sip_now() >> 1) & 0x7ffffff;
if (!sip->sip_call_id) {
if (leg->leg_id)
sip->sip_call_id = sip_call_id_dup(home, leg->leg_id);
else
sip->sip_call_id = sip_call_id_create(home, NULL);
}
if ((!sip->sip_cseq ||
seq != sip->sip_cseq->cs_seq ||
method != sip->sip_cseq->cs_method ||
@ -9718,6 +9721,9 @@ int outgoing_recv_reliable(nta_outgoing_t *orq,
* @param magic
* @param to_tag
* @param rseq
*
* @bug Fix the memory leak - either one of the requests is left unreleased
* for ever.
*/
nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
nta_response_f *callback,
@ -9757,8 +9763,8 @@ nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
tagged->orq_to = to;
tagged->orq_tport = tport_ref(orq->orq_tport);
tagged->orq_request = (msg_t *)msg_ref_create(orq->orq_request);
tagged->orq_response = NULL;
tagged->orq_request = msg_ref_create(orq->orq_request);
tagged->orq_response = msg_ref_create(orq->orq_response);
tagged->orq_cancel = NULL;
tagged->orq_pending = tport_pend(orq->orq_tport,

View File

@ -138,7 +138,7 @@ void sl_from_log(su_log_t *log, int level,
a->a_params = NULL;
if (!a->a_display) a->a_display = "";
return sl_header_log(log, level, fmt, (sip_header_t *)a);
sl_header_log(log, level, fmt, (sip_header_t *)a);
}
/**Log a @To header.

View File

@ -17,7 +17,7 @@ INCLUDES = -I$(srcdir)/../bnf -I../bnf \
noinst_LTLIBRARIES = libsip.la
check_PROGRAMS = torture_sip \
test_sip_msg validator date_test
test_sip_msg validator test_date
# ----------------------------------------------------------------------
# Rules for building the targets
@ -59,7 +59,7 @@ LDADD = libsip.la \
torture_sip_LDFLAGS = -static
test_sip_msg_LDFLAGS = -static
date_test_LDFLAGS = -static
test_date_LDFLAGS = -static
# ----------------------------------------------------------------------
# Install and distribution rules
@ -93,9 +93,9 @@ EXTRA_DIST = Doxyfile sip.docs sip_parser.docs sip.doxyaliases \
# ----------------------------------------------------------------------
# Tests
#TESTS = torture_sip run_test_sip_msg run_date_test
#TESTS = torture_sip run_test_sip_msg run_test_date
#dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
#dist_noinst_SCRIPTS = run_test_sip_msg run_test_date
# ----------------------------------------------------------------------
# Sofia specific rules

View File

@ -1,2 +0,0 @@
#!/bin/sh
./date_test "Sun, 18 Mar 2001 23:01:00 GMT"

View File

@ -24,7 +24,7 @@
/**@internal
*
* @CFILE date_test.c
* @CFILE test_date.c
*
* Tester for SIP date parser
*
@ -45,7 +45,7 @@
void usage(void)
{
fprintf(stderr,
"usage: date_test [SIP-date] "
"usage: test_date [SIP-date] "
"[YYYYy][DDd][HHh][MMm][SS[s]]\n");
exit(1);
}
@ -65,7 +65,7 @@ int main(int ac, char *av[])
if ((s = av[1])) {
if (msg_date_d(&s, &t) < 0) {
fprintf(stderr, "date_test: %s is not valid time\n", s);
fprintf(stderr, "test_date: %s is not valid time\n", s);
exit(1);
}
@ -82,7 +82,7 @@ int main(int ac, char *av[])
case '\0': --s; /* FALLTHROUGH */
case 's': delta += t2; break;
default:
fprintf(stderr, "date_test: %s is not valid time offset\n" , av[2]);
fprintf(stderr, "test_date: %s is not valid time offset\n" , av[2]);
usage();
break;
}
@ -100,12 +100,12 @@ int main(int ac, char *av[])
s = buf, t2 = 0;
if (msg_date_d(&s, &t2) < 0) {
fprintf(stderr, "date_test: decoding %s failed\n", buf);
fprintf(stderr, "test_date: decoding %s failed\n", buf);
retval = 1;
break;
}
else if (t2 != t) {
fprintf(stderr, "date_test: %lu != %lu\n", t, t2);
fprintf(stderr, "test_date: %lu != %lu\n", t, t2);
retval = 1;
break;
}

View File

@ -1,7 +1,12 @@
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS) $(SOFIA_COVERAGE)
# Use with --enable-ndebug
if NDEBUG
AM_CFLAGS += -DNDEBUG
endif
built-sources: $(BUILT_SOURCES)

View File

@ -58,6 +58,10 @@
#include <sofia-sip/su_tag_inline.h>
#include <sofia-sip/su_tagarg.h>
#ifndef HAVE_STRTOULL
unsigned longlong strtoull(const char *, char **, int);
#endif
/**@defgroup su_tag Tag Item Lists
*
* Object-oriented tag routines for Sofia utility library.

View File

@ -165,17 +165,16 @@ int su_time_print(char *s, int n, su_time_t const *tv)
/** Time difference in milliseconds.
*
* Calculates the duration from t2 to t1 in milliseconds.
* Calculates the duration from t2 to t1 in milliseconds.
*
* @param t1 after time
* @param t2 before time
*
* @return
* The duration in milliseconds between the two times. If the difference
* is bigger than @c SU_DURATION_MAX, the function su_duration() returns
* @c SU_DURATION_MAX instead. If the difference is smaller than @c
* -SU_DURATION_MAX, the function su_duration() returns @c
* -SU_DURATION_MAX.
* @return The duration in milliseconds between the two times.
* If the difference is bigger than #SU_DURATION_MAX, return #SU_DURATION_MAX
* instead.
* If the difference is smaller than -#SU_DURATION_MAX, return
* -#SU_DURATION_MAX.
*/
su_duration_t su_duration(su_time_t const t1, su_time_t const t2)
{

View File

@ -7,7 +7,10 @@ INPUT = tport.docs sofia-sip .
TAGFILES += \
../docs/su.doxytags=../su \
../docs/msg.doxytags=../msg
../docs/msg.doxytags=../msg \
../docs/nth.doxytags=../nth \
../docs/nta.doxytags=../nta \
../docs/nua.doxytags=../nua \
GENERATE_TAGFILE = ../docs/tport.doxytags

View File

@ -51,28 +51,46 @@ TPORT_DLL extern tagi_t tport_tags[];
TPORT_DLL extern tag_typedef_t tptag_any;
TPORT_DLL extern tag_typedef_t tptag_ident;
/** Ident transport connection (true by default). */
/**Identify a transport interface.
*
* Use with tport_tbind(), tport_tsend(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nta_outgoing_tcreate(), nta_outgoing_mcreate(),
* nth_engine_create(), nth_client_tcreate(), or initial nth_site_create().
*/
#define TPTAG_IDENT(x) tptag_ident, tag_str_v((x))
TPORT_DLL extern tag_typedef_t tptag_ident_ref;
#define TPTAG_IDENT_REF(x) tptag_ident_ref, tag_str_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_reuse;
/** Allow reusing transport connection (true by default). */
/** Allow reusing transport connection (true by default).
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(),
* tport_tsend(), nua_create(), nta_agent_create(), nta_agent_add_tport(),
* nta_outgoing_tcreate(), nta_outgoing_mcreate(), nth_engine_create(),
* nth_client_tcreate(), or initial nth_site_create().
*/
#define TPTAG_REUSE(x) tptag_reuse, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_reuse_ref;
#define TPTAG_REUSE_REF(x) tptag_reuse_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_fresh;
/** Create new connection (but allow reusing new one). */
/** Create new connection (but allow other messages to reuse the new one).
*
* Use with tport_tsend(), nta_outgoing_tcreate(), nta_outgoing_mcreate(),
* or nth_client_tcreate().
*/
#define TPTAG_FRESH(x) tptag_fresh, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_fresh_ref;
#define TPTAG_FRESH_REF(x) tptag_fresh_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_server;
/** Bind server sockets (true by default, disable with TPTAG_SERVER(0)). */
/** Bind server sockets (true by default, disable with TPTAG_SERVER(0)).
*
* Use with tport_tbind().
*/
#define TPTAG_SERVER(x) tptag_server, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_server_ref;
@ -93,58 +111,99 @@ typedef enum tport_via {
} tport_pri_type_t;
TPORT_DLL extern tag_typedef_t tptag_public;
/** Use a transport reaching to public Internet. */
/** Use a transport reaching to public Internet.
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
#define TPTAG_PUBLIC(x) tptag_public, tag_int_v((x))
TPORT_DLL extern tag_typedef_t tptag_public_ref;
#define TPTAG_PUBLIC_REF(x) tptag_public_ref, tag_int_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_mtu;
/** Specify MTU. */
/** Specify MTU.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(),
* tport_tsend(), nua_create(), nta_agent_create(), nta_agent_add_tport(),
* nta_outgoing_tcreate(), nta_outgoing_mcreate(), nth_engine_create(),
* nth_client_tcreate(), or initial nth_site_create().
*/
#define TPTAG_MTU(x) tptag_mtu, tag_usize_v((x))
TPORT_DLL extern tag_typedef_t tptag_mtu_ref;
#define TPTAG_MTU_REF(x) tptag_mtu_ref, tag_usize_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_connect;
/** Specify that tport must always use connections. */
/** Specify that tport must always use connections (even with UDP).
*
* @note Unimplemented (?).
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_CONNECT(x) tptag_connect, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_connect_ref;
#define TPTAG_CONNECT_REF(x) tptag_connect_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_queuesize;
/** Specify the number of messages that can be queued per connection. */
/** Specify the number of messages that can be queued per connection.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_QUEUESIZE(x) tptag_queuesize, tag_uint_v((x))
TPORT_DLL extern tag_typedef_t tptag_queuesize_ref;
#define TPTAG_QUEUESIZE_REF(x) tptag_queuesize_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_sdwn_error;
/** If true, half close of a connection by remote is considered as an error. */
/** If true, half close of a connection by remote is considered as an error.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_SDWN_ERROR(x) tptag_sdwn_error, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_sdwn_error_ref;
#define TPTAG_SDWN_ERROR_REF(x) tptag_sdwn_error_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_sdwn_after;
/** Half-close (shutdown(c, 1) after sending the message. */
/** Half-close (shutdown(c, 1)) after sending the message.
*
* Use with tport_tsend(), nta_outgoing_tcreate(), nta_outgoing_mcreate(),
* or nth_client_tcreate().
*/
#define TPTAG_SDWN_AFTER(x) tptag_sdwn_after, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_sdwn_after_ref;
#define TPTAG_SDWN_AFTER_REF(x) tptag_sdwn_after_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_close_after;
/** Close of a connection after sending the message. */
/** Close of a connection after sending the message.
*
* Use with tport_tsend(), nta_outgoing_tcreate(), nta_outgoing_mcreate(),
* or nth_client_tcreate().
*/
#define TPTAG_CLOSE_AFTER(x) tptag_close_after, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_close_after_ref;
#define TPTAG_CLOSE_AFTER_REF(x) tptag_close_after_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_idle;
/** How long transports may be idle (value in milliseconds).
/** How long transports may be idle (value in milliseconds).
*
* If 0, zap immediately,
* if UINT_MAX, leave them there (default value for now).
*
* @par Use With
* tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_IDLE(x) tptag_idle, tag_uint_v((x))
@ -156,6 +215,10 @@ TPORT_DLL extern tag_typedef_t tptag_timeout;
*
* If UINT_MAX, leave the incomplete messages there for ever.
* Default value for now is UINT_MAX.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_TIMEOUT(x) tptag_timeout, tag_uint_v((x))
@ -163,11 +226,15 @@ TPORT_DLL extern tag_typedef_t tptag_timeout_ref;
#define TPTAG_TIMEOUT_REF(x) tptag_timeout_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_sigcomp_lifetime;
/**Default SigComp lifetime.
/**Default SigComp lifetime in seconds.
*
* If UINT_MAX, keep SigComp compartments around for ever.
* If value is UINT_MAX, keep SigComp compartments around for ever.
*
* @note Experimental.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_SIGCOMP_LIFETIME(x) tptag_sigcomp_lifetime, tag_uint_v((x))
@ -176,7 +243,10 @@ TPORT_DLL extern tag_typedef_t tptag_sigcomp_lifetime_ref;
tptag_sigcomp_lifetime_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_compartment;
/** Pointer to SigComp compartment. */
/** Pointer to SigComp compartment.
*
* @note Not used.
*/
#define TPTAG_COMPARTMENT(x) tptag_compartment, tag_ptr_v((x))
TPORT_DLL extern tag_typedef_t tptag_compartment_ref;
@ -185,6 +255,9 @@ TPORT_DLL extern tag_typedef_t tptag_compartment_ref;
TPORT_DLL extern tag_typedef_t tptag_certificate;
/** Path to the public key certificate directory.
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
#define TPTAG_CERTIFICATE(x) tptag_certificate, tag_str_v((x))
@ -193,43 +266,80 @@ TPORT_DLL extern tag_typedef_t tptag_certificate_ref;
TPORT_DLL extern tag_typedef_t tptag_tls_version;
/** Sets the TLS version (version 0 implies SSL2/SSL3).
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
#define TPTAG_TLS_VERSION(x) tptag_tls_version, tag_uint_v((x))
TPORT_DLL extern tag_typedef_t tptag_tls_version_ref;
#define TPTAG_TLS_VERSION_REF(x) tptag_tls_version_ref, tag_uint_vr(&(x))
#if 0
TPORT_DLL extern tag_typedef_t tptag_trusted;
/** Mark transport as trusted. */
/** Mark transport as trusted.
*
* @note Not implemented.
*/
#define TPTAG_TRUSTED(x) tptag_trusted, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_trusted_ref;
#define TPTAG_TRUSTED_REF(x) tptag_trusted_ref, tag_bool_vr(&(x))
#endif
TPORT_DLL extern tag_typedef_t tptag_debug_drop;
/** Sets the drop propability for (0..1000) incoming/outgoing packets. */
/** Sets the drop propability for (0..1000) incoming/outgoing packets.
*
* This is a parameter suitable for debugging only.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_DEBUG_DROP(x) tptag_debug_drop, tag_uint_v((x))
TPORT_DLL extern tag_typedef_t tptag_debug_drop_ref;
#define TPTAG_DEBUG_DROP_REF(x) tptag_debug_drop_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_udp_rmem;
/** Sets the maximum receive buffer in bytes for primary UDP socket. */
/** Sets the maximum receive buffer in bytes for primary UDP socket.
*
* This is a parameter suitable for tuning.
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
#define TPTAG_UDP_RMEM(x) tptag_udp_rmem, tag_uint_v((x))
TPORT_DLL extern tag_typedef_t tptag_udp_rmem_ref;
#define TPTAG_UDP_RMEM_REF(x) tptag_udp_rmem_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_udp_wmem;
/** Sets the maximum send buffer in bytes for primary UDP socket. */
/** Sets the maximum send buffer in bytes for primary UDP socket.
*
* This is a parameter suitable for tuning.
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
#define TPTAG_UDP_WMEM(x) tptag_udp_wmem, tag_uint_v((x))
TPORT_DLL extern tag_typedef_t tptag_udp_wmem_ref;
#define TPTAG_UDP_WMEM_REF(x) tptag_udp_wmem_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_thrpsize;
/** Determines the number of threads in the pool receiving, uncompressing,
/**Determines the number of threads in the pool.
*
* The thread pools can have multiple threads receiving, uncompressing,
* parsing, compressing, and sending messages.
*
* This is a parameter suitable for tuning.
*
* @note Thread pools are currently broken.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_THRPSIZE(x) tptag_thrpsize, tag_uint_v((x))
@ -237,7 +347,13 @@ TPORT_DLL extern tag_typedef_t tptag_thrpsize_ref;
#define TPTAG_THRPSIZE_REF(x) tptag_thrpsize_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_thrprqsize;
/** Length of per-thread receive queue (as messages)
/** Length of per-thread receive queue (as messages).
*
* This is a parameter suitable for tuning.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_THRPRQSIZE(x) tptag_thrprqsize, tag_uint_v((x))
@ -245,26 +361,66 @@ TPORT_DLL extern tag_typedef_t tptag_thrprqsize_ref;
#define TPTAG_THRPRQSIZE_REF(x) tptag_thrprqsize_ref, tag_uint_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_http_connect;
/** Specify that tport can use HTTP connect method. */
/** Specify that tport can use HTTP connect method.
*
* Use with tport_tbind(), nua_create(), nta_agent_create(),
* nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
*/
#define TPTAG_HTTP_CONNECT(x) tptag_http_connect, tag_str_v((x))
TPORT_DLL extern tag_typedef_t tptag_http_connect_ref;
#define TPTAG_HTTP_CONNECT_REF(x) tptag_http_connect_ref, tag_str_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_stun_server;
/** Enable STUN server. */
/** Enable STUN server.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_STUN_SERVER(x) tptag_stun_server, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_stun_server_ref;
#define TPTAG_STUN_SERVER_REF(x) tptag_stun_server_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_tos;
/** Sets the IP TOS for the socket. */
/** Sets the IP TOS for the socket.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
* nta_agent_create(), nta_agent_add_tport(), nth_engine_create(), or
* initial nth_site_create().
*/
#define TPTAG_TOS(x) tptag_tos, tag_int_v((x))
TPORT_DLL extern tag_typedef_t tptag_tos_ref;
#define TPTAG_TOS_REF(x) tptag_tos_ref, tag_int_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_log;
/** If set, print out parsed or sent messages at transport layer.
*
* Use with tport_tcreate(), nua_create(), nta_agent_create(),
* nth_engine_create(), or initial nth_site_create().
*
* @sa #TPORT_DUMP, TPTAG_DUMP()
*/
#define TPTAG_LOG(x) tptag_log, tag_bool_v((x))
TPORT_DLL extern tag_typedef_t tptag_log_ref;
#define TPTAG_LOG_REF(x) tptag_log_ref, tag_bool_vr(&(x))
TPORT_DLL extern tag_typedef_t tptag_dump;
/** Filename for dumping unparsed messages from transport.
*
* Use with tport_tcreate(), nta_agent_create(), nua_create(),
* nth_engine_create(), or initial nth_site_create().
*
* @sa #TPORT_DUMP, TPTAG_LOG().
*/
#define TPTAG_DUMP(x) tptag_dump, tag_str_v((x))
TPORT_DLL extern tag_typedef_t tptag_dump_ref;
#define TPTAG_DUMP_REF(x) tptag_dump_ref, tag_str_vr(&(x))
SOFIA_END_DECLS
#endif /* !defined TPORT_TAG_H */

View File

@ -286,7 +286,7 @@ static inline int tport_is_bound(tport_t const *self)
}
/** Test if transport connection has been established. @NEW_1_12_5 */
inline int tport_is_connected(tport_t const *self)
int tport_is_connected(tport_t const *self)
{
return self->tp_is_connected;
}
@ -308,7 +308,7 @@ void tport_set_tos(su_socket_t socket, su_addrinfo_t *ai, int tos)
{
if (tos >= 0 &&
ai->ai_family == AF_INET &&
setsockopt(socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) {
setsockopt(socket, IPPROTO_IP, IP_TOS, (const void*)&tos, sizeof(tos)) < 0) {
SU_DEBUG_3(("tport: setsockopt(IP_TOS): %s\n",
su_strerror(su_errno())));
}
@ -427,7 +427,12 @@ msg_t *tport_destroy_alloc(tp_stack_t *stack, int flags,
/** Name for "any" transport. @internal */
static char const tpn_any[] = "*";
/** Create the master transport. */
/** Create the master transport.
*
* @TAGS
* TPTAG_LOG(), TPTAG_DUMP(), tags used with tport_set_params(), especially
* TPTAG_QUEUESIZE().
*/
tport_t *tport_tcreate(tp_stack_t *stack,
tp_stack_class_t const *tpac,
su_root_t *root,
@ -1128,6 +1133,12 @@ int tport_get_params(tport_t const *self,
*
* @param self pointer to a transport object
* @param tag,value,... list of tags
*
* @TAGS
* TPTAG_MTU(), TPTAG_QUEUESIZE(), TPTAG_IDLE(), TPTAG_TIMEOUT(),
* TPTAG_DEBUG_DROP(), TPTAG_THRPSIZE(), TPTAG_THRPRQSIZE(),
* TPTAG_SIGCOMP_LIFETIME(), TPTAG_CONNECT(), TPTAG_SDWN_ERROR(),
* TPTAG_REUSE(), TPTAG_STUN_SERVER(), and TPTAG_TOS().
*/
int tport_set_params(tport_t *self,
tag_type_t tag, tag_value_t value, ...)
@ -1138,8 +1149,6 @@ int tport_set_params(tport_t *self,
int connect, sdwn_error, reusable, stun_server;
struct sigcomp_compartment *cc = NONE;
if (self == NULL)
return su_seterrno(EINVAL);
@ -1164,7 +1173,6 @@ int tport_set_params(tport_t *self,
TPTAG_CONNECT_REF(connect),
TPTAG_SDWN_ERROR_REF(sdwn_error),
TPTAG_REUSE_REF(reusable),
TPTAG_COMPARTMENT_REF(cc),
TPTAG_STUN_SERVER_REF(stun_server),
TPTAG_TOS_REF(tpp->tpp_tos),
TAG_END());
@ -1324,6 +1332,11 @@ int tport_bind_set(tport_master_t *mr,
* @param tpn desired transport address
* @param transports list of protocol names supported by stack
* @param tag,value,... tagged argument list
*
* @TAGS
* TPTAG_SERVER(), TPTAG_PUBLIC(), TPTAG_IDENT(), TPTAG_HTTP_CONNECT(),
* TPTAG_CERTIFICATE(), TPTAG_TLS_VERSION(), and tags used with
* tport_set_params(), especially TPTAG_QUEUESIZE().
*/
int tport_tbind(tport_t *self,
tp_name_t const *tpn,
@ -2940,6 +2953,7 @@ int tport_recv_error_report(tport_t *self)
*
* @TAGS
* TPTAG_MTU(), TPTAG_REUSE(), TPTAG_CLOSE_AFTER(), TPTAG_SDWN_AFTER(),
* TPTAG_FRESH(), TPTAG_COMPARTMENT().
*/
tport_t *tport_tsend(tport_t *self,
msg_t *msg,
@ -4526,5 +4540,3 @@ char *tport_hostport(char buf[], isize_t bufsize,
return buf;
}
/* ---------------------------------------------------------------------- */

View File

@ -90,14 +90,24 @@ su_log_t tport_log[] = {
/** Initialize logging. */
void tport_open_log(tport_master_t *mr, tagi_t *tags)
{
char const *log;
mr->mr_log =
getenv("MSG_STREAM_LOG") != NULL ||
getenv("TPORT_LOG") != NULL
? MSG_DO_EXTRACT_COPY : 0;
if ((log = getenv("TPORT_DUMP")) || (log = getenv("MSG_DUMP"))) {
char const *log = NULL;
int log_msg = 0;
tl_gets(tags, TPTAG_LOG_REF(log_msg), TAG_END());
if (getenv("MSG_STREAM_LOG") != NULL || getenv("TPORT_LOG") != NULL)
log_msg = 1;
mr->mr_log = log_msg ? MSG_DO_EXTRACT_COPY : 0;
tl_gets(tags, TPTAG_DUMP_REF(log), TAG_END());
if (getenv("MSG_DUMP"))
log = getenv("MSG_DUMP");
if (getenv("TPORT_DUMP"))
log = getenv("TPORT_DUMP");
if (log) {
time_t now;
if (strcmp(log, "-"))

View File

@ -78,3 +78,6 @@ tag_typedef_t tptag_thrprqsize = UINTTAG_TYPEDEF(thrprqsize);
tag_typedef_t tptag_http_connect = STRTAG_TYPEDEF(http_connect);
tag_typedef_t tptag_stun_server = BOOLTAG_TYPEDEF(stun_server);
tag_typedef_t tptag_tos = INTTAG_TYPEDEF(tos);
tag_typedef_t tptag_log = INTTAG_TYPEDEF(log);
tag_typedef_t tptag_dump = STRTAG_TYPEDEF(dump);

View File

@ -54,7 +54,7 @@
#elif HAVE_FUNCTION
#define __func__ __FUNCTION__
#else
char const __func__[] = "tport_type_tcp";
static char const __func__[] = "tport_type_tcp";
#endif
/* ---------------------------------------------------------------------- */

View File

@ -58,6 +58,13 @@ int tport_udp_init_client(tport_primary_t *pri,
tagi_t const *tags,
char const **return_culprit);
#if HAVE_FUNC
#elif HAVE_FUNCTION
#define __func__ __FUNCTION__
#else
static char const __func__[] = "tport_type_udp";
#endif
tport_vtable_t const tport_udp_client_vtable =
{
"udp", tport_type_client,
@ -215,7 +222,7 @@ static void tport_check_trunc(tport_t *tp, su_addrinfo_t *ai)
int tport_recv_dgram(tport_t *self)
{
msg_t *msg;
ssize_t n, veclen;
ssize_t n, veclen, N;
su_addrinfo_t *ai;
su_sockaddr_t *from;
socklen_t fromlen;
@ -232,8 +239,21 @@ int tport_recv_dgram(tport_t *self)
assert(self->tp_msg == NULL);
veclen = tport_recv_iovec(self, &self->tp_msg, iovec, 65536, 1);
if (veclen < 0)
#if nomore
/* We used to resize the buffer, but it fragments the memory */
N = 65535;
#else
N = (ssize_t)su_getmsgsize(self->tp_socket);
if (N == -1) {
int err = su_errno();
SU_DEBUG_1(("%s(%p): su_getmsgsize(): %s (%d)\n", __func__, self,
su_strerror(err), err));
return -1;
}
#endif
veclen = tport_recv_iovec(self, &self->tp_msg, iovec, N, 1);
if (veclen == -1)
return -1;
msg = self->tp_msg;

View File

@ -133,7 +133,7 @@ AC_ARG_ENABLE(coverage,
if test X$enable_coverage != Xno ; then
case "${CC-cc}" in
*gcc*)
SOFIA_CFLAGS="$SOFIA_CFLAGS -fprofile-arcs -ftest-coverage"
AC_SUBST([SOFIA_COVERAGE], ["-fprofile-arcs -ftest-coverage"])
;;
*) AC_MSG_ERROR([--enable-coverage requires gcc])
esac
@ -344,7 +344,6 @@ AC_ARG_ENABLE(ndebug,
[ --enable-ndebug compile with NDEBUG (disabled)],
, enable_ndebug=no)
AM_CONDITIONAL(NDEBUG, test x$enable_ndebug = yes)
SOFIA_CFLAGS="$SOFIA_CFLAGS -DNDEBUG"
])
dnl ======================================================================