Temporarily reverting sofia-sip library back to prior to the changes merged on 2/7/2007 due to ongoing unresolved issues in the new code. Will re-commit these changes once we receive fixes from the sofia-sip tree for these outstanding issues. Make sure recommended.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4308 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-02-17 06:25:21 +00:00
parent 08debcfcb4
commit 7b4e100b31
235 changed files with 14740 additions and 40227 deletions

View File

@ -1 +1 @@
Thu Feb 15 00:08:41 EST 2007
Sat Feb 17 01:18:56 EST 2007

View File

@ -10,8 +10,6 @@ Contributors (in alphabetical order, surname first)
Chan, Tat <first.surname@nokia.com>
Ciarkowski, Andrzej <wp-voigtkampff -at users -dot sourceforge -dot net>
Denis-Courmont, Remi <first.surname@nokia.com>
Filonenko Roman <shkoder -at ua -dot fm>
Haataja, Mikko <first.surname@nokia.com>
Jacobs, Remeres <first.surname@nokia.com>
Jalava, Teemu <first.surname@nokia.com>
@ -28,7 +26,9 @@ 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

@ -221,31 +221,3 @@ other special, indirect and consequential damages, even if author has
been advised of the possibility of such damages.
----------------------------------------------------------------------------
libsofia-sip-ua/su/poll.c
The package also contains files from GNU C Library by Free Software
Foundation.
These files are distributed with the following copyright notice:
Copyright (C) 1994,1996,1997,1998,1999,2001,2002
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
----------------------------------------------------------------------------

View File

@ -27,10 +27,6 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST += m4/sac-general.m4 m4/sac-su.m4 \
m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4
EXTRA_DIST += docs/build_system.txt \
docs/devel_platform_notes.txt \
docs/release_management.txt
dist_man_MANS = man/man1/sip-date.1 man/man1/sip-options.1 \
man/man1/localinfo.1 man/man1/addrinfo.1 \
man/man1/stunc.1 man/man1/sip-dig.1
@ -48,7 +44,7 @@ endif
CLEANFILES = $(dist_man_MANS)
coverage built-sources clean-built-sources valcheck doxygen:
coverage built-sources clean-built-sources doxygen:
for i in libsofia-sip-ua $(GLIB_SUBDIRS) ; do $(MAKE) $(AM_MAKEFLAGS) -C $$i $@ ; done
.PHONY: coverage built-sources clean-built-sources doxygen manpages

View File

@ -91,7 +91,6 @@ distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = -I m4
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -138,12 +137,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -187,7 +182,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -251,9 +245,7 @@ DIST_SUBDIRS = libsofia-sip-ua libsofia-sip-ua-glib utils packages win32
@HAVE_GLIB_TRUE@GLIB_SUBDIRS = libsofia-sip-ua-glib
EXTRA_DIST = AUTHORS COPYING COPYRIGHTS ChangeLog.ext-trees README \
README.developers RELEASE TODO m4/sac-general.m4 m4/sac-su.m4 \
m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4 \
docs/build_system.txt docs/devel_platform_notes.txt \
docs/release_management.txt
m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4
dist_man_MANS = man/man1/sip-date.1 man/man1/sip-options.1 \
man/man1/localinfo.1 man/man1/addrinfo.1 \
man/man1/stunc.1 man/man1/sip-dig.1
@ -504,7 +496,7 @@ distclean-tags:
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/docs $(distdir)/libsofia-sip-ua/docs $(distdir)/libsofia-sip-ua/features/sofia-sip $(distdir)/libsofia-sip-ua/su/sofia-sip $(distdir)/m4 $(distdir)/man/man1 $(distdir)/packages $(distdir)/utils $(distdir)/win32
$(mkdir_p) $(distdir)/libsofia-sip-ua/docs $(distdir)/libsofia-sip-ua/features/sofia-sip $(distdir)/libsofia-sip-ua/su/sofia-sip $(distdir)/m4 $(distdir)/man/man1 $(distdir)/packages $(distdir)/utils $(distdir)/win32
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -757,7 +749,7 @@ manpages: built-sources
@HAVE_DOXYGEN_TRUE@ @rm -f man/man1/_*.1
@HAVE_DOXYGEN_FALSE@ -touch $(dist_man_MANS)
coverage built-sources clean-built-sources valcheck doxygen:
coverage built-sources clean-built-sources doxygen:
for i in libsofia-sip-ua $(GLIB_SUBDIRS) ; do $(MAKE) $(AM_MAKEFLAGS) -C $$i $@ ; done
.PHONY: coverage built-sources clean-built-sources doxygen manpages

View File

@ -46,6 +46,7 @@ The Sofia-SIP su submodule also provides some small utilities:
- localinfo (libsofia-sip-ua/su), prints information about
local network interfaces
References
----------

View File

@ -6,8 +6,7 @@ Changes since last release
--------------------------
<changes since last written in freshmeat.net "Changes:" style;
and in less than 10 lines, written in 3rd person English, with
complete sentences />
and in less than 10 lines />
Bugs in blaa and foo have been fixed. The stack now supports
use of foobar...
@ -25,36 +24,54 @@ API/ABI changes and versioning
libsofia-sip-ua:
- **template**: Added foobar() function (sofia-sip/foobar.h).
- Added sip_is_allowed() function and k_bitmap field to the
sip_allow_t structure
- Added SIP header Refer-Sub and related functions
- Added <sofia-sip/sip_extra.h> include file
- Added auc_info() function (sofia-sip/auth_client.h)
- This release is ABI/API compatible with applications linked against
any 1.12.x release. However, applications built against this release won't
work against an older library. The ABI has been tested with the nua module
unit test (test_nua) built against original 1.12.0 release.
libsofia-sip-ua-glib:
- No ABI/API changes, compatible with 1.12.0. Note, libsofia-sip-ua-glib
interface is not considered stable and may change in a future 1.12.x
release.
- The 'nua-glib' module has been removed from the library and moved
to a separate package 'sofia-nua-glib'. The remaining library (su-glib)
is now considered stable and will be API/ABI compatible with later
releases in the 1.12.x series.
- ABI has been modified and applications built against 1.12.4 and earlier
releases need to be rebuilt.
Contributors to this release
----------------------------
<list of people who contributed to _this_ release
- update as people's patches are added, or when you commit stuff
- current development team members (see AUTHORS) may be omitted,
or listed at the end of the contribur list (depending on the scope
of the work done since the last release)
- current development team members (see AUTHORS) may be omitted
- name of the contributor should be enough (email addresses in AUTHORS),
plus a _brief_ description of what was contributed
plus a brief description of what was contributed
- roughly sorted by number of patches accepted
/>
- **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.
Notes on new features
---------------------
RFC 4488 defines the Refer-Sub header. Its datatypes, related functions and
methods declared in <sofia-sip/sip_extra.h> include file. The Refer-Sub
header structure can be accessed from sip_t structure with sip_refer_sub()
method, e.g.,
if (sip_refer_sub(sip) &&
strcasecmp("false", sip_refer_sub(sip)->rs_value) == 0) {
/* Do not create implicit subscription */
}
<information about major new features
- new/changed/removed functionality
- links to further documentation
@ -71,3 +88,15 @@ Bugs fixed in this release
/>
- **template**: #9499652 sf.net bug item title
- Fixed crash when nua_bye() was called while a NOTIFY client transaction
was in progress. Problem reported by Anthony Minnessale.
- Not using close() with sockets in sres.c. Problem reported by
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

@ -6,8 +6,7 @@ Changes since last release
--------------------------
<changes since last written in freshmeat.net "Changes:" style;
and in less than 10 lines, written in 3rd person English, with
complete sentences />
and in less than 10 lines />
Bugs in blaa and foo have been fixed. The stack now supports
use of foobar...
@ -40,11 +39,9 @@ Contributors to this release
<list of people who contributed to _this_ release
- update as people's patches are added, or when you commit stuff
- current development team members (see AUTHORS) may be omitted,
or listed at the end of the contribur list (depending on the scope
of the work done since the last release)
- current development team members (see AUTHORS) may be omitted
- name of the contributor should be enough (email addresses in AUTHORS),
plus a _brief_ description of what was contributed
plus a brief description of what was contributed
- roughly sorted by number of patches accepted
/>

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,5 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to the random number source name. */
#undef DEV_URANDOM
@ -17,13 +9,6 @@
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
@ -208,9 +193,6 @@
/* Define to 1 if you have the `poll' function. */
#undef HAVE_POLL
/* Define to 1 if you use poll in su_port. */
#undef HAVE_POLL_PORT
/* Define to 1 if you have /proc/net/if_inet6 control file */
#undef HAVE_PROC_NET_IF_INET6
@ -239,9 +221,6 @@
/* Define to 1 if you have the <sigcomp.h> header file. */
#undef HAVE_SIGCOMP_H
/* Define to 1 if you have the `signal' function. */
#undef HAVE_SIGNAL
/* Define to 1 if you have SIGPIPE */
#undef HAVE_SIGPIPE
@ -254,9 +233,6 @@
/* Define to 1 if you have the `socketpair' function. */
#undef HAVE_SOCKETPAIR
/* Define to 1 if we use NTH library */
#undef HAVE_SOFIA_NTH
/* Define to 1 if we use NTLM library */
#undef HAVE_SOFIA_NTLM
@ -302,9 +278,6 @@
/* Define to 1 if your CC supports C99 struct initialization */
#undef HAVE_STRUCT_KEYWORDS
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
/* Define to 1 if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
@ -389,14 +362,6 @@
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

5662
libs/sofia-sip/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -11,14 +11,14 @@ dnl information on the package
dnl ---------------------------
dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
AC_INIT([sofia-sip], [1.12.5work])
AC_INIT([sofia-sip], [1.12.4work])
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
dnl Includedir specific to this sofia version
AC_SUBST(include_sofiadir, '${includedir}/sofia-sip-1.12')
AC_SUBST(LIBVER_SOFIA_SIP_UA_CUR, [4])
AC_SUBST(LIBVER_SOFIA_SIP_UA_CUR, [3])
AC_SUBST(LIBVER_SOFIA_SIP_UA_REV, [0])
AC_SUBST(LIBVER_SOFIA_SIP_UA_AGE, [4])
AC_SUBST(LIBVER_SOFIA_SIP_UA_AGE, [3])
AC_SUBST(LIBVER_SOFIA_SIP_UA_SOVER, [0]) # CUR-AGE
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_CUR, [3])
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_REV, [0])
@ -83,15 +83,6 @@ elif test x${HAVE_OPENSSL} != x1 ; then
else
AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
fi
AM_CONDITIONAL([HAVE_STUN], [test "x$enable_stun" = xyes])
AC_ARG_ENABLE(nth,
[ --disable-nth disable nth and http modules (enabled)],
, enable_nth=yes)
AM_CONDITIONAL([HAVE_NTH], [test "x$enable_nth" = xyes])
if test x$enable_nth = xyes ; then
AC_DEFINE([HAVE_SOFIA_NTH], 1, [Define to 1 if we use NTH library])
fi
dnl Disable NTLM support by default
AC_ARG_ENABLE(ntlm,
@ -113,6 +104,10 @@ AC_HEADER_STDC
### checks for declarations
### -----------------------
AC_CHECK_DECL([SIGPIPE], [
AC_DEFINE([HAVE_SIGPIPE], 1, [Define to 1 if you have SIGPIPE])],,[
#include <signal.h>
])
### checks for types
### ----------------

View File

@ -38,11 +38,6 @@ Makefile target notes
separately in ``DIST_SOURCES`` variable (otherwise ``make dist``
will fail)
Makefile fragments
------------------
Some common makefile rules are in 'rules' subdirectory.
Maintainer mode
---------------
@ -59,16 +54,13 @@ option '--enable-maintainer-mode'.
Running tests
=============
Sofia-SIP has quite complete suite of test cases. It is prudent to run
them while making changes and before committing them to revision control
system. However, running certain tests takes quite a long time to
execture. Therefore, they are run only if the environment variable
Sofia-SIP has quite complete suite of test cases. It is prudent to
run them while making changes and before committing them to revision
control system. However, running certain tests takes quite a long
time. Therefore, they are run only if the environment variable
EXPENSIVE_CHECKS has been set. EXPENSIVE_CHECKS is also set by the build
system if configure option '--enable-expensive-checks' has been used.
On hosts with i386 architecture, it is possible to run tests under
valgrind. Use the make target 'valcheck' for that purpose.
Code-tree layout
================

View File

@ -11,30 +11,14 @@ up-to-date autotools. Autoconf should be at least 2.57 and automake should
be at least 1.7. You can avoid running autoreconf explicitly if you use
./configure option --enable-maintainer-mode.
Notes to distributors
----------------------
Build options such as "--disable-stun" (HAVE_SOFIA_STUN) and
"--disable-nth" (HAVE_SOFIA_NTH) modify the public library API/ABI,
by omitting certain interfaces from the resulting library and installed
header files.
Options such as '--disable-size-compat' modify the library
ABI by changing the types used in public library function
signatures.
Generic POSIX (GNU/Linux, BSD, ...)
-----------------------------------
Sofia-SIP should compile out-of-the-box on generic POSIX
machines. Use the standard GNU autotool 'configure+make'
procedure to build the software. See top-level README file
procedure to build the software. See top-level INSTALL
for more information.
The configure script accepts various options. See "./configure --help"
for the full list.
Mac OS X
--------

View File

@ -61,8 +61,7 @@ Making the release tarball
sh> cvs tag rel-sofia-sip-x_y_z
- take a fresh checkout of the release using the release tag
sh> darcs get http://sofia-sip.org/repos/sofia-sip --tag=rel-sofia-sip-1_yy_z
- create the release tarball with "make distcheck" (make sure depcomp et
al libtool scripts are correctly created)
- create the release tarball with "make distcheck"
- calculate md5 and sha1 hashes using md5sum and sha1sum utilities,
and copy the values to the release-notes (see below)

View File

@ -31,6 +31,16 @@ EXTRA_DIST = docs/Doxyfile.aliases \
docs/Doxyfile.conf \
docs/Doxyfile.version
built-sources: built-sources-recursive
clean-built-sources: clean-built-sources-recursive
built-sources-recursive clean-built-sources-recursive:
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $@ in $$subdir"; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
done;
doxygen: built-sources
@cd ${srcdir} ;\
mkdir -p docs docs/html &&\
@ -43,6 +53,4 @@ doxygen: built-sources
done
cd ${srcdir}/docs/html && ../../${top_srcdir}/libsofia-sip-ua/docs/hide_emails.sh
include $(top_srcdir)/rules/recursive.am
.PHONY: built-sources built-sources-am doxygen

View File

@ -22,9 +22,6 @@
# Licensed under LGPL. See file COPYING.
#
# Recursive Makefile targets
# --------------------------
SOURCES = $(libsofia_sip_ua_glib_la_SOURCES)
srcdir = @srcdir@
@ -51,9 +48,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@HAVE_GLIB_TRUE@am__append_1 = libsofia-sip-ua-glib.la
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/rules/recursive.am ChangeLog
subdir = libsofia-sip-ua-glib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
$(top_srcdir)/m4/sac-openssl.m4 $(top_srcdir)/m4/sac-su.m4 \
@ -104,7 +100,6 @@ DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -151,12 +146,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -200,7 +191,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -271,19 +261,10 @@ EXTRA_DIST = docs/Doxyfile.aliases \
docs/Doxyfile.conf \
docs/Doxyfile.version
@ENABLE_COVERAGE_TRUE@COVERAGE_RECURSIVE = coverage-recursive
SOFIA_RECURSIVE = \
valcheck-recursive \
$(COVERAGE_RECURSIVE)
SOFIA_DIST_RECURSIVE = \
built-sources-recursive \
clean-built-sources-recursive
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/recursive.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -479,7 +460,7 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../rules $(distdir)/docs
$(mkdir_p) $(distdir)/docs
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -621,6 +602,16 @@ uninstall-info: uninstall-info-recursive
uninstall-info-am uninstall-libLTLIBRARIES
built-sources: built-sources-recursive
clean-built-sources: clean-built-sources-recursive
built-sources-recursive clean-built-sources-recursive:
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $@ in $$subdir"; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
done;
doxygen: built-sources
@cd ${srcdir} ;\
mkdir -p docs docs/html &&\
@ -632,44 +623,6 @@ doxygen: built-sources
&& popd > /dev/null ; \
done
cd ${srcdir}/docs/html && ../../${top_srcdir}/libsofia-sip-ua/docs/hide_emails.sh
@ENABLE_COVERAGE_TRUE@coverage: $(COVERAGE_RECURSIVE)
all-recursive: built-sources-recursive
built-sources: built-sources-recursive
clean-built-sources: clean-built-sources-recursive
valcheck: valcheck-recursive
$(SOFIA_RECURSIVE):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
|| eval $$failcom; \
done; \
test -z "$$fail"
$(SOFIA_DIST_RECURSIVE):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
target=`echo $@ | sed s/-recursive//`; \
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
|| eval $$failcom; \
done; \
test -z "$$fail"
.PHONY: built-sources built-sources-am doxygen
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -58,4 +58,4 @@ AUTOMAKE_OPTIONS = foreign
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../../libsofia-sip-ua/sofia.am

View File

@ -25,36 +25,11 @@
# ----------------------------------------------------------------------
# Headers
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libsu_glib_la_SOURCES) su_source_test.c torture_su_glib_timer.c
SOURCES = $(libsu_glib_la_SOURCES) su_source_test.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@ -79,18 +54,14 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = su_source_test$(EXEEXT) \
torture_su_glib_timer$(EXEEXT)
check_PROGRAMS = su_source_test$(EXEEXT)
@HAVE_GLIB_TRUE@am__append_1 = \
@HAVE_GLIB_TRUE@ sofia-sip/su_source.h \
@HAVE_GLIB_TRUE@ sofia-sip/su_glib.h
DIST_COMMON = $(am__nobase_include_sofia_HEADERS_DIST) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_2 = -DNDEBUG
$(srcdir)/../../libsofia-sip-ua/sofia.am $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
subdir = libsofia-sip-ua-glib/su-glib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -113,11 +84,6 @@ su_source_test_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
su_source_test_DEPENDENCIES = libsu-glib.la \
../../libsofia-sip-ua/libsofia-sip-ua.la $(am__DEPENDENCIES_1)
torture_su_glib_timer_SOURCES = torture_su_glib_timer.c
torture_su_glib_timer_OBJECTS = torture_su_glib_timer.$(OBJEXT)
torture_su_glib_timer_LDADD = $(LDADD)
torture_su_glib_timer_DEPENDENCIES = libsu-glib.la \
../../libsofia-sip-ua/libsofia-sip-ua.la $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@ -129,10 +95,8 @@ LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libsu_glib_la_SOURCES) su_source_test.c \
torture_su_glib_timer.c
DIST_SOURCES = $(libsu_glib_la_SOURCES) su_source_test.c \
torture_su_glib_timer.c
SOURCES = $(libsu_glib_la_SOURCES) su_source_test.c
DIST_SOURCES = $(libsu_glib_la_SOURCES) su_source_test.c
am__nobase_include_sofia_HEADERS_DIST = sofia-sip/su_source.h \
sofia-sip/su_glib.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@ -148,7 +112,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -195,12 +158,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -244,7 +203,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -309,7 +267,7 @@ noinst_LTLIBRARIES = libsu-glib.la
# ----------------------------------------------------------------------
# Tests
TESTS = su_source_test torture_su_glib_timer
TESTS = su_source_test
# ----------------------------------------------------------------------
# Rules for building the targets
@ -330,8 +288,7 @@ EXTRA_DIST = Doxyfile su_glib.docs
# ----------------------------------------------------------------------
# Automake options
AUTOMAKE_OPTIONS = foreign
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_2)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -357,13 +314,11 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../libsofia-sip-ua/sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -413,9 +368,6 @@ clean-checkPROGRAMS:
su_source_test$(EXEEXT): $(su_source_test_OBJECTS) $(su_source_test_DEPENDENCIES)
@rm -f su_source_test$(EXEEXT)
$(LINK) $(su_source_test_LDFLAGS) $(su_source_test_OBJECTS) $(su_source_test_LDADD) $(LIBS)
torture_su_glib_timer$(EXEEXT): $(torture_su_glib_timer_OBJECTS) $(torture_su_glib_timer_DEPENDENCIES)
@rm -f torture_su_glib_timer$(EXEEXT)
$(LINK) $(torture_su_glib_timer_LDFLAGS) $(torture_su_glib_timer_OBJECTS) $(torture_su_glib_timer_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -425,7 +377,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/su_source.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/su_source_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/torture_su_glib_timer.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@ -599,7 +550,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/../../libsofia-sip-ua $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -747,92 +698,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -43,7 +43,6 @@ SOFIA_BEGIN_DECLS
SOFIAPUBFUN su_root_t *su_glib_root_create(su_root_magic_t *) __attribute__((__malloc__));
SOFIAPUBFUN GSource *su_glib_root_gsource(su_root_t *);
SOFIAPUBFUN void su_glib_prefer_gsource(void);
SOFIA_END_DECLS

View File

@ -25,11 +25,7 @@
/**
* @file su_source.c
* @brief Wrapper for glib GSource.
*
* Refs:
* - http://sofia-sip.sourceforge.net/refdocs/su/group__su__wait.html
* - http://developer.gnome.org/doc/API/glib/glib-the-main-event-loop.html
*
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com>.
*
* @date Created: Thu Mar 4 15:15:15 2004 ppessi
@ -40,6 +36,12 @@
#include "config.h"
#endif
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <glib.h>
#define SU_PORT_IMPLEMENTATION 1
@ -55,26 +57,16 @@
#include "su_port.h"
#include "sofia-sip/su_alloc.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#if 1
#define PORT_LOCK_DEBUG(x) ((void)0)
#else
#define PORT_LOCK_DEBUG(x) printf x
#endif
static su_port_t *su_source_port_create(void) __attribute__((__malloc__));
static su_port_t *su_source_create(void) __attribute__((__malloc__));
static gboolean su_source_prepare(GSource *gs, gint *return_tout);
static gboolean su_source_check(GSource *gs);
static gboolean su_source_dispatch(GSource *gs,
GSourceFunc callback,
gpointer user_data);
GSourceFunc callback,
gpointer user_data);
static void su_source_finalize(GSource *source);
static int su_source_getmsgs(su_port_t *self);
static
GSourceFuncs su_source_funcs[1] = {{
su_source_prepare,
@ -114,22 +106,21 @@ static void su_source_break(su_port_t *self);
static su_duration_t su_source_step(su_port_t *self, su_duration_t tout);
static int su_source_own_thread(su_port_t const *port);
static int su_source_add_prepoll(su_port_t *port,
su_root_t *root,
su_prepoll_f *,
su_prepoll_magic_t *);
su_root_t *root,
su_prepoll_f *,
su_prepoll_magic_t *);
static int su_source_remove_prepoll(su_port_t *port,
su_root_t *root);
static su_timer_t **su_source_timers(su_port_t *port);
static int su_source_multishot(su_port_t *self, int multishot);
static int su_source_threadsafe(su_port_t *port);
static char const *su_source_name(su_port_t const *self);
static
su_port_vtable_t const su_source_port_vtable[1] =
static
su_port_vtable_t const su_source_vtable[1] =
{{
/* su_vtable_size: */ sizeof su_source_port_vtable,
/* su_vtable_size: */ sizeof su_source_vtable,
su_source_lock,
su_source_unlock,
su_source_incref,
su_source_decref,
@ -147,23 +138,11 @@ su_port_vtable_t const su_source_port_vtable[1] =
su_source_own_thread,
su_source_add_prepoll,
su_source_remove_prepoll,
su_base_port_timers,
su_source_timers,
su_source_multishot,
su_base_port_threadsafe,
/*su_source_yield*/ NULL,
/*su_source_wait_events*/ NULL,
su_base_port_getmsgs,
su_base_port_getmsgs_from,
su_source_name,
su_base_port_start_shared,
su_base_port_wait,
NULL,
}};
su_source_threadsafe
static char const *su_source_name(su_port_t const *self)
{
return "GSource";
}
}};
/**
* Port is a per-thread reactor.
@ -171,14 +150,20 @@ static char const *su_source_name(su_port_t const *self)
* Multiple root objects executed by single thread share a su_port_t object.
*/
struct su_source_s {
su_base_port_t sup_base[1];
su_home_t sup_home[1];
su_port_vtable_t const *sup_vtable;
GThread *sup_tid;
GStaticMutex sup_mutex[1];
GStaticRWLock sup_ref[1];
GSource *sup_source; /**< Backpointer to source */
GMainLoop *sup_main_loop; /**< Reference to mainloop while running */
GSource *sup_source;
GMainLoop *sup_main_loop;
/* Message list - this is protected by lock */
su_msg_t *sup_head;
su_msg_t **sup_tail;
/* Waits */
unsigned sup_registers; /** Counter incremented by
su_port_register() or
@ -192,6 +177,9 @@ struct su_source_s {
su_wakeup_f *sup_wait_cbs;
su_wakeup_arg_t**sup_wait_args;
su_root_t **sup_wait_roots;
/* Timer list */
su_timer_t *sup_timers;
};
typedef struct _SuSource
@ -206,6 +194,10 @@ typedef struct _SuSource
#define SU_SOURCE_INCREF(p, f) (g_source_ref(p->sup_source))
#define SU_SOURCE_DECREF(p, f) (g_source_unref(p->sup_source))
#define SU_SOURCE_INITLOCK(p) (g_static_mutex_init((p)->sup_mutex))
#define SU_SOURCE_LOCK(p, f) (g_static_mutex_lock((p)->sup_mutex))
#define SU_SOURCE_UNLOCK(p, f) (g_static_mutex_unlock((p)->sup_mutex))
#else
/* Debugging versions */
@ -213,6 +205,15 @@ typedef struct _SuSource
#define SU_SOURCE_DECREF(p, f) do { printf("decref(%p) by %s\n", (p), f), \
g_source_unref(p->sup_source); } while(0)
#define SU_SOURCE_INITLOCK(p) \
(g_static_mutex_init((p)->sup_mutex), printf("init_lock(%p)\n", p))
#define SU_SOURCE_LOCK(p, f) \
(printf("%ld at %s locking(%p)...", g_thread_self(), f, p), g_static_mutex_lock((p)->sup_mutex), printf(" ...%ld at %s locked(%p)...", g_thread_self(), f, p))
#define SU_SOURCE_UNLOCK(p, f) \
(g_static_mutex_unlock((p)->sup_mutex), printf(" ...%ld at %s unlocked(%p)\n", g_thread_self(), f, p))
#endif
#if HAVE_FUNC
@ -228,7 +229,7 @@ typedef struct _SuSource
/** Create a root that uses GSource as reactor */
su_root_t *su_glib_root_create(su_root_magic_t *magic)
{
return su_root_create_with_port(magic, su_source_port_create());
return su_root_create_with_port(magic, su_source_create());
}
/** Deprecated */
@ -237,15 +238,6 @@ su_root_t *su_root_source_create(su_root_magic_t *magic)
return su_glib_root_create(magic);
}
/**
* Returns a GSource object for the root
*
* Note that you need to unref the GSource with g_source_unref()
* before destroying the root object.
*
* @return NULL on error (for instance if root was not created with
* su_glib_root_create())
*/
GSource *su_glib_root_gsource(su_root_t *root)
{
g_assert(root);
@ -254,20 +246,41 @@ GSource *su_glib_root_gsource(su_root_t *root)
/*=============== Private function definitions ===============*/
/** Initialize source port */
int su_source_port_init(su_port_t *self,
GSource *gs,
su_port_vtable_t const *vtable)
/**@internal
*
* Allocates and initializes a reactor and message port object.
*
* @return
* If successful a pointer to the new message port is returned, otherwise
* NULL is returned.
*/
su_port_t *su_source_create(void)
{
if (su_base_port_init(self, vtable) < 0)
return -1;
SuSource *ss;
self->sup_source = gs;
self->sup_tid = g_thread_self();
SU_DEBUG_9(("su_source_create() called\n"));
g_static_mutex_init(self->sup_mutex);
return 0;
ss = (SuSource *)g_source_new(su_source_funcs, (sizeof *ss));
if (ss) {
su_port_t *self = ss->ss_port;
self->sup_vtable = su_source_vtable;
self->sup_source = ss->ss_source;
SU_SOURCE_INITLOCK(self);
self->sup_tail = &self->sup_head;
self->sup_tid = g_thread_self();
SU_DEBUG_9(("su_source_with_main_context() returns %p\n", self));
return self;
} else {
su_perror("su_source_with_main_context(): su_home_clone");
SU_DEBUG_9(("su_source_with_main_context() fails\n"));
return NULL;
}
}
/** @internal Destroy a port. */
@ -281,70 +294,23 @@ void su_source_finalize(GSource *gs)
SU_DEBUG_9(("su_source_finalize() called\n"));
g_static_mutex_free(self->sup_mutex);
if (self->sup_waits)
free(self->sup_waits), self->sup_waits = NULL;
if (self->sup_wait_cbs)
free(self->sup_wait_cbs), self->sup_wait_cbs = NULL;
if (self->sup_wait_args)
free(self->sup_wait_args), self->sup_wait_args = NULL;
if (self->sup_wait_roots)
free(self->sup_wait_roots), self->sup_wait_roots = NULL;
if (self->sup_indices)
free(self->sup_indices), self->sup_indices = NULL;
su_base_port_deinit(self);
su_home_deinit(self->sup_base->sup_home);
su_home_deinit(self->sup_home);
}
void su_source_port_lock(su_port_t *self, char const *who)
{
PORT_LOCK_DEBUG(("%p at %s locking(%p)...",
(void *)g_thread_self(), who, self));
g_static_mutex_lock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
(void *)g_thread_self(), who, self));
}
void su_source_port_unlock(su_port_t *self, char const *who)
{
g_static_mutex_unlock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
(void *)g_thread_self(), who, self));
}
/** @internal Send a message to the port. */
int su_source_send(su_port_t *self, su_msg_r rmsg)
{
int wakeup = su_base_port_send(self, rmsg);
GMainContext *gmc;
if (wakeup < 0)
return -1;
if (wakeup == 0)
return 0;
gmc = g_source_get_context(self->sup_source);
if (gmc)
g_main_context_wakeup(gmc);
return 0;
}
/** @internal
* Checks if the calling thread owns the port object.
*
* @param self pointer to a port object
*
* @retval true (nonzero) if the calling thread owns the port,
* @retval false (zero) otherwise.
*/
int su_source_own_thread(su_port_t const *self)
{
return self == NULL || SU_SOURCE_OWN_THREAD(self);
}
/* -- Registering and unregistering ------------------------------------- */
/* Seconds from 1.1.1900 to 1.1.1970 */
#define NTP_EPOCH 2208988800UL
/** Prepare to wait - calculate time to next timer */
static
gboolean su_source_prepare(GSource *gs, gint *return_tout)
{
@ -353,12 +319,12 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
enter;
if (self->sup_base->sup_head) {
if (self->sup_head) {
*return_tout = 0;
return TRUE;
}
if (self->sup_base->sup_timers) {
if (self->sup_timers) {
su_time_t now;
GTimeVal gtimeval;
su_duration_t tout;
@ -367,7 +333,7 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
now.tv_sec = gtimeval.tv_sec + 2208988800UL;
now.tv_usec = gtimeval.tv_usec;
tout = su_timer_next_expires(self->sup_base->sup_timers, now);
tout = su_timer_next_expires(self->sup_timers, now);
*return_tout = (tout < 0 || tout > (su_duration_t)G_MAXINT)?
-1 : (gint)tout;
@ -410,10 +376,10 @@ gboolean su_source_dispatch(GSource *gs,
enter;
if (self->sup_base->sup_head)
su_base_port_getmsgs(self);
if (self->sup_head)
su_source_getmsgs(self);
if (self->sup_base->sup_timers) {
if (self->sup_timers) {
su_time_t now;
GTimeVal gtimeval;
su_duration_t tout;
@ -426,7 +392,7 @@ gboolean su_source_dispatch(GSource *gs,
now.tv_sec = gtimeval.tv_sec + 2208988800UL;
now.tv_usec = gtimeval.tv_usec;
timers = su_timer_expire(&self->sup_base->sup_timers, &tout, now);
timers = su_timer_expire(&self->sup_timers, &tout, now);
}
#if SU_HAVE_POLL
@ -458,20 +424,12 @@ gboolean su_source_dispatch(GSource *gs,
static void su_source_lock(su_port_t *self, char const *who)
{
PORT_LOCK_DEBUG(("%p at %s locking(%p)...",
(void *)g_thread_self(), who, self));
g_static_mutex_lock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
(void *)g_thread_self(), who, self));
SU_SOURCE_LOCK(self, who);
}
static void su_source_unlock(su_port_t *self, char const *who)
{
g_static_mutex_unlock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
(void *)g_thread_self(), who, self));
SU_SOURCE_UNLOCK(self, who);
}
static void su_source_incref(su_port_t *self, char const *who)
@ -490,6 +448,81 @@ GSource *su_source_gsource(su_port_t *self)
return self->sup_source;
}
/** @internal Send a message to the port. */
int su_source_send(su_port_t *self, su_msg_r rmsg)
{
enter;
if (self) {
su_msg_t *msg;
GMainContext *gmc;
SU_SOURCE_LOCK(self, "su_source_send");
msg = rmsg[0]; rmsg[0] = NULL;
*self->sup_tail = msg;
self->sup_tail = &msg->sum_next;
SU_SOURCE_UNLOCK(self, "su_source_send");
gmc = g_source_get_context(self->sup_source);
if (gmc)
g_main_context_wakeup(gmc);
return 0;
}
else {
su_msg_destroy(rmsg);
return -1;
}
}
/** @internal
* Execute the messages in the incoming queue until the queue is empty..
*
* @param self - pointer to a port object
*
* @retval 0 if there was a signal to handle,
* @retval -1 otherwise.
*/
static
int su_source_getmsgs(su_port_t *self)
{
enter;
if (self && self->sup_head) {
su_root_t *root;
su_msg_f f;
SU_SOURCE_INCREF(self, "su_source_getmsgs");
SU_SOURCE_LOCK(self, "su_source_getmsgs");
while (self->sup_head) {
su_msg_t *msg = self->sup_head;
self->sup_head = msg->sum_next;
if (!self->sup_head) {
assert(self->sup_tail == &msg->sum_next);
self->sup_tail = &self->sup_head;
}
root = msg->sum_to->sut_root;
f = msg->sum_func;
SU_SOURCE_UNLOCK(self, "su_source_getmsgs");
if (f)
f(su_root_magic(root), &msg, msg->sum_data);
su_msg_delivery_report(&msg);
SU_SOURCE_LOCK(self, "su_source_getmsgs");
}
SU_SOURCE_UNLOCK(self, "su_source_getmsgs");
SU_SOURCE_DECREF(self, "su_source_getmsgs");
return 0;
}
else
return -1;
}
/** @internal
*
* Register a @c su_wait_t object. The wait object, a callback function and
@ -881,6 +914,13 @@ int su_source_multishot(su_port_t *self, int multishot)
return (errno = EINVAL), -1;
}
/** @internal Enable threadsafe operation. */
static
int su_source_threadsafe(su_port_t *port)
{
return su_home_threadsafe(port->sup_home);
}
/** @internal Main loop.
*
@ -979,19 +1019,18 @@ su_duration_t su_source_step(su_port_t *self, su_duration_t tout)
return 0;
}
static int su_source_add_prepoll(su_port_t *port,
su_root_t *root,
su_prepoll_f *prepoll,
su_prepoll_magic_t *magic)
{
/* We could call prepoll in su_source_prepare()?? */
return -1;
}
static int su_source_remove_prepoll(su_port_t *port,
su_root_t *root)
/** @internal
* Checks if the calling thread owns the port object.
*
* @param self pointer to a port object
*
* @retval true (nonzero) if the calling thread owns the port,
* @retval false (zero) otherwise.
*/
int su_source_own_thread(su_port_t const *self)
{
return -1;
return self == NULL || SU_SOURCE_OWN_THREAD(self);
}
#if 0
@ -1022,44 +1061,52 @@ void su_source_dump(su_port_t const *self, FILE *f)
#endif
/**@internal
*
* Allocates and initializes a reactor and message port object.
*
* @return
* If successful a pointer to the new message port is returned, otherwise
* NULL is returned.
/* =========================================================================
* Pre-poll() callback
*/
static su_port_t *su_source_port_create(void)
int su_source_add_prepoll(su_port_t *port,
su_root_t *root,
su_prepoll_f *callback,
su_prepoll_magic_t *magic)
{
SuSource *ss;
su_port_t *self = NULL;
#if 0
if (port->sup_prepoll)
return -1;
SU_DEBUG_9(("su_source_port_create() called\n"));
port->sup_prepoll = callback;
port->sup_pp_magic = magic;
port->sup_pp_root = root;
ss = (SuSource *)g_source_new(su_source_funcs, (sizeof *ss));
if (ss) {
self = ss->ss_port;
if (su_source_port_init(self, ss->ss_source, su_source_port_vtable) < 0)
g_source_unref(ss->ss_source), self = NULL;
} else {
su_perror("su_source_port_create(): g_source_new");
}
SU_DEBUG_1(("su_source_port_create() returns %p\n", (void *)self));
return self;
return 0;
#else
return -1;
#endif
}
/* No su_source_port_start */
/** Use su_source implementation when su_root_create() is called.
*
* @NEW_1_12_5
*/
void su_glib_prefer_gsource(void)
int su_source_remove_prepoll(su_port_t *port,
su_root_t *root)
{
su_port_prefer(su_source_port_create, NULL);
#if 0
if (port->sup_pp_root != root)
return -1;
port->sup_prepoll = NULL;
port->sup_pp_magic = NULL;
port->sup_pp_root = NULL;
return 0;
#else
return -1;
#endif
}
/* =========================================================================
* Timers
*/
static
su_timer_t **su_source_timers(su_port_t *self)
{
return &self->sup_timers;
}

View File

@ -1,269 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005,2006 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
*
*/
/**
* @brief Test program for su-glib timers
*
* Based on torture_su_timer.c of libsofia-sip-ua.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <first.surname@nokia.com>
*
* @internal
*
* @date Created: Fri Oct 19 08:53:55 2001 pessi
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <assert.h>
struct tester;
#define SU_ROOT_MAGIC_T struct tester
#define SU_INTERNAL_P su_root_t *
#define SU_TIMER_ARG_T struct timing
#include "sofia-sip/su.h"
#include "sofia-sip/su_wait.h"
#include "sofia-sip/su_log.h"
#include <sofia-sip/su_glib.h>
struct timing
{
int t_run;
int t_times;
su_time_t t_prev;
};
struct tester
{
su_root_t *root;
su_timer_t *t, *t1;
unsigned times;
void *sentinel;
};
void
print_stamp(struct tester *x, su_timer_t *t, struct timing *ti)
{
su_time_t now = su_now(), prev = ti->t_prev;
ti->t_prev = now;
printf("timer interval %f\n", 1000 * su_time_diff(now, prev));
if (!ti->t_run)
su_timer_set(t, print_stamp, ti);
if (++ti->t_times >= 10)
su_timer_reset(t);
}
void
print_X(struct tester *x, su_timer_t *t1, struct timing *ti)
{
su_timer_set(t1, print_X, ti);
putchar('X'); fflush(stdout);
}
su_msg_r intr_msg = SU_MSG_R_INIT;
static RETSIGTYPE intr_handler(int signum)
{
su_msg_send(intr_msg);
}
static void test_break(struct tester *tester, su_msg_r msg, su_msg_arg_t *arg)
{
su_root_break(tester->root);
}
void
end_test(struct tester *tester, su_timer_t *t, struct timing *ti)
{
printf("ending test\n");
su_timer_destroy(t);
su_timer_reset(tester->t);
su_timer_reset(tester->t1);
su_root_break(tester->root);
}
void
increment(struct tester *tester, su_timer_t *t, struct timing *ti)
{
tester->times++;
if ((void *)ti == (void*)tester->sentinel)
su_root_break(tester->root);
}
void
usage(char const *name)
{
fprintf(stderr, "usage: %s [-1r] [-Nnum] [interval]\n", name);
exit(1);
}
/*
* test su_timer functionality:
*
* Create a timer, executing print_stamp() in every 20 ms
*/
int main(int argc, char *argv[])
{
su_root_t *root;
su_timer_t *t, *t1, *t_end;
su_timer_t **timers;
su_duration_t interval = 60;
char *argv0 = argv[0];
char *s;
int use_t1 = 0;
su_time_t now, started;
intptr_t i, N = 500;
GSource *source;
struct timing timing[1] = {{ 0 }};
struct tester tester[1] = {{ 0 }};
while (argv[1] && argv[1][0] == '-') {
char *o = argv[1] + 1;
while (*o) {
if (*o == '1')
o++, use_t1 = 1;
else if (*o == 'r')
o++, timing->t_run = 1;
else if (*o == 'N') {
if (o[1])
N = strtoul(o + 1, &o, 0);
else if (argv[2])
N = strtoul(argv++[2], &o, 0);
break;
}
else
break;
}
if (*o)
usage(argv0);
argv++;
}
if (argv[1]) {
interval = strtoul(argv[1], &s, 10);
if (interval == 0 || s == argv[1])
usage(argv0);
}
su_init(); atexit(su_deinit);
tester->root = root = su_glib_root_create(tester);
source = su_root_gsource(tester->root);
g_source_attach(source, NULL /*g_main_context_default ()*/);
su_msg_create(intr_msg,
su_root_task(root),
su_root_task(root),
test_break, 0);
signal(SIGINT, intr_handler);
#if HAVE_SIGPIPE
signal(SIGPIPE, intr_handler);
signal(SIGQUIT, intr_handler);
signal(SIGHUP, intr_handler);
#endif
t = su_timer_create(su_root_task(root), interval);
t1 = su_timer_create(su_root_task(root), 1);
t_end = su_timer_create(su_root_task(root), 20 * interval);
if (t == NULL || t1 == NULL || t_end == NULL)
su_perror("su_timer_create"), exit(1);
tester->t = t, tester->t1 = t1;
timing->t_prev = su_now();
if (timing->t_run)
su_timer_run(t, print_stamp, timing);
else
su_timer_set(t, print_stamp, timing);
if (use_t1)
su_timer_set(t1, print_X, NULL);
su_timer_set(t_end, end_test, NULL);
su_root_run(root);
su_msg_destroy(intr_msg);
su_timer_destroy(t);
su_timer_destroy(t1);
if (timing->t_times != 10) {
fprintf(stderr, "%s: t expired %d times (expecting 10)\n",
argv0, timing->t_times);
return 1;
}
/* Insert timers in order */
timers = calloc(N, sizeof *timers);
if (!timers) { perror("calloc"); exit(1); }
now = started = su_now();
for (i = 0; i < N; i++) {
t = su_timer_create(su_root_task(root), 1000);
if (!t) { perror("su_timer_create"); exit(1); }
if (++now.tv_usec == 0) ++now.tv_sec;
su_timer_set_at(t, increment, (void *)i, now);
timers[i] = t;
}
tester->sentinel = (void*)(i - 1);
su_root_run(root);
printf("Processing %u timers took %f millisec (%f expected)\n",
(unsigned)i, su_time_diff(su_now(), started) * 1000, (double)i / 1000);
for (i = 0; i < N; i++) {
su_timer_destroy(timers[i]);
}
su_root_destroy(root);
su_deinit();
return 0;
}

View File

@ -1,11 +1,3 @@
2007-02-09 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v4 frozen (4:0:4) for the 1.12.5 release
2006-10-12 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v3 frozen (3:0:3) for the 1.12.3 release
2006-09-26 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v2 frozen (2:0:2) for the 1.12.2 release

View File

@ -9,25 +9,12 @@
AUTOMAKE_OPTIONS = foreign
# select whicn optional sofia-sip modules have been enabled
# in the build
OPT_LIBADD =
OPT_SUBDIRS_STUN =
OPT_SUBDIRS_NTH =
if HAVE_STUN
OPT_LIBADD += stun/libstun.la
OPT_SUBDIRS_STUN += stun
endif
if HAVE_NTH
OPT_LIBADD += nth/libnth.la http/libhttp.la
OPT_SUBDIRS_NTH += nth http
endif
# note: order does matter in the subdir list
SUBDIRS = su features bnf sresolv sdp url msg sip $(OPT_SUBDIRS_STUN) ipt soa \
tport nta nea iptsec $(OPT_SUBDIRS_NTH) nua
SUBDIRS = su features bnf sresolv sdp url msg sip stun ipt soa \
tport http nta nea iptsec nth nua
DIST_SUBDIRS = $(SUBDIRS) docs
EXTRA_DIST = sofia.am
DOXYGEN = doxygen
lib_LTLIBRARIES = libsofia-sip-ua.la
@ -40,22 +27,37 @@ libsofia_sip_ua_la_LIBADD = bnf/libbnf.la \
msg/libmsg.la \
nea/libnea.la \
nta/libnta.la \
nth/libnth.la \
nua/libnua.la \
http/libhttp.la \
sdp/libsdp.la \
sip/libsip.la \
soa/libsoa.la \
sresolv/libsresolv.la \
su/libsu.la \
stun/libstun.la \
tport/libtport.la \
url/liburl.la \
$(OPT_LIBADD)
url/liburl.la
# set the libtool version info version:revision:age for libsofia-sip-ua
# - soname to 'libsofia-sip-ua.so.(CUR-AGE)'
libsofia_sip_ua_la_LDFLAGS = \
-version-info $(LIBVER_SOFIA_SIP_UA_CUR):$(LIBVER_SOFIA_SIP_UA_REV):$(LIBVER_SOFIA_SIP_UA_AGE)
include $(top_srcdir)/rules/recursive.am
if ENABLE_COVERAGE
COVERAGE_RECURSIVE = coverage-recursive
coverage: $(COVERAGE_RECURSIVE)
endif
all-recursive: built-sources-recursive
built-sources: built-sources-recursive
clean-built-sources: clean-built-sources-recursive
built-sources-recursive clean-built-sources-recursive $(COVERAGE_RECURSIVE):
target=`echo $@ | sed s/-recursive//`; \
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
echo "Making $@ in $$subdir"; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
done;
doxygen: built-sources
@echo Generating empty doxytags

View File

@ -23,9 +23,6 @@
#
# ref: http://www.gnu.org/software/automake/manual/automake.html
# Recursive Makefile targets
# --------------------------
SOURCES = $(libsofia_sip_ua_la_SOURCES)
srcdir = @srcdir@
@ -51,13 +48,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@HAVE_STUN_TRUE@am__append_1 = stun/libstun.la
@HAVE_STUN_TRUE@am__append_2 = stun
@HAVE_NTH_TRUE@am__append_3 = nth/libnth.la http/libhttp.la
@HAVE_NTH_TRUE@am__append_4 = nth http
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/rules/recursive.am ChangeLog
subdir = libsofia-sip-ua
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
$(top_srcdir)/m4/sac-openssl.m4 $(top_srcdir)/m4/sac-su.m4 \
@ -78,15 +70,12 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
@HAVE_STUN_TRUE@am__DEPENDENCIES_1 = stun/libstun.la
@HAVE_NTH_TRUE@am__DEPENDENCIES_2 = nth/libnth.la http/libhttp.la
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
libsofia_sip_ua_la_DEPENDENCIES = bnf/libbnf.la \
features/libfeatures.la ipt/libipt.la iptsec/libiptsec.la \
msg/libmsg.la nea/libnea.la nta/libnta.la nua/libnua.la \
sdp/libsdp.la sip/libsip.la soa/libsoa.la \
sresolv/libsresolv.la su/libsu.la tport/libtport.la \
url/liburl.la $(am__DEPENDENCIES_3)
msg/libmsg.la nea/libnea.la nta/libnta.la nth/libnth.la \
nua/libnua.la http/libhttp.la sdp/libsdp.la sip/libsip.la \
soa/libsoa.la sresolv/libsresolv.la su/libsu.la \
stun/libstun.la tport/libtport.la url/liburl.la
am_libsofia_sip_ua_la_OBJECTS =
libsofia_sip_ua_la_OBJECTS = $(am_libsofia_sip_ua_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
@ -110,7 +99,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -157,12 +145,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -206,7 +190,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -263,17 +246,12 @@ target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
# select whicn optional sofia-sip modules have been enabled
# in the build
OPT_LIBADD = $(am__append_1) $(am__append_3)
OPT_SUBDIRS_STUN = $(am__append_2)
OPT_SUBDIRS_NTH = $(am__append_4)
# note: order does matter in the subdir list
SUBDIRS = su features bnf sresolv sdp url msg sip $(OPT_SUBDIRS_STUN) ipt soa \
tport nta nea iptsec $(OPT_SUBDIRS_NTH) nua
SUBDIRS = su features bnf sresolv sdp url msg sip stun ipt soa \
tport http nta nea iptsec nth nua
DIST_SUBDIRS = $(SUBDIRS) docs
EXTRA_DIST = sofia.am
lib_LTLIBRARIES = libsofia-sip-ua.la
libsofia_sip_ua_la_SOURCES =
libsofia_sip_ua_la_LIBADD = bnf/libbnf.la \
@ -283,16 +261,17 @@ libsofia_sip_ua_la_LIBADD = bnf/libbnf.la \
msg/libmsg.la \
nea/libnea.la \
nta/libnta.la \
nth/libnth.la \
nua/libnua.la \
http/libhttp.la \
sdp/libsdp.la \
sip/libsip.la \
soa/libsoa.la \
sresolv/libsresolv.la \
su/libsu.la \
stun/libstun.la \
tport/libtport.la \
url/liburl.la \
$(OPT_LIBADD)
url/liburl.la
# set the libtool version info version:revision:age for libsofia-sip-ua
# - soname to 'libsofia-sip-ua.so.(CUR-AGE)'
@ -300,18 +279,10 @@ libsofia_sip_ua_la_LDFLAGS = \
-version-info $(LIBVER_SOFIA_SIP_UA_CUR):$(LIBVER_SOFIA_SIP_UA_REV):$(LIBVER_SOFIA_SIP_UA_AGE)
@ENABLE_COVERAGE_TRUE@COVERAGE_RECURSIVE = coverage-recursive
SOFIA_RECURSIVE = \
valcheck-recursive \
$(COVERAGE_RECURSIVE)
SOFIA_DIST_RECURSIVE = \
built-sources-recursive \
clean-built-sources-recursive
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/recursive.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -507,7 +478,6 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../rules
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -653,39 +623,13 @@ uninstall-info: uninstall-info-recursive
all-recursive: built-sources-recursive
built-sources: built-sources-recursive
clean-built-sources: clean-built-sources-recursive
valcheck: valcheck-recursive
$(SOFIA_RECURSIVE):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
|| eval $$failcom; \
done; \
test -z "$$fail"
$(SOFIA_DIST_RECURSIVE):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
built-sources-recursive clean-built-sources-recursive $(COVERAGE_RECURSIVE):
target=`echo $@ | sed s/-recursive//`; \
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
echo "Making $@ in $$subdir"; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target) \
|| eval $$failcom; \
done; \
test -z "$$fail"
done;
doxygen: built-sources
@echo Generating empty doxytags
@ -718,7 +662,7 @@ doxygen: built-sources
for d in $(DIST_SUBDIRS); do \
test -r $$d/Doxyfile \
&& pushd $$d > /dev/null \
&& echo running ${DOXYGEN} second time in $$d \
&& echo running ${DOXYGEN} in second time in $$d \
&& ${DOXYGEN} 2>&1 \
| egrep -v -i -e 'Warning: Unsupported (xml/)?html tag' \
; popd > /dev/null ; \

View File

@ -43,5 +43,4 @@ TESTS = torture_bnf
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libbnf_la_SOURCES) torture_bnf.c
@ -79,12 +54,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = torture_bnf$(EXEEXT)
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
$(top_srcdir)/rules/valcheck.am ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/bnf
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -131,7 +102,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -178,12 +148,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -227,7 +193,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -303,8 +268,7 @@ EXTRA_DIST = Doxyfile bnf.docs
# ----------------------------------------------------------------------
# Tests
TESTS = torture_bnf
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -330,13 +294,11 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -568,7 +530,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -716,92 +678,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -825,9 +825,9 @@ static size_t convert_ip_address(char const *s,
{
size_t len;
int canonize = 0;
char buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
#if SU_HAVE_IN6
char buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
len = span_ip6_reference(s);
if (len) {

View File

@ -45,5 +45,4 @@ ALIASES = \
"VERSION_1_12_4=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.4.txt\">1.12.4</a>" \
"VERSION_1_12_5=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>" \
"NEW_1_12_5=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>" \
"EXP_1_12_5=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>, available if --enable-experimental configuration option is given" \

View File

@ -47,4 +47,4 @@ CLEANFILES = Doxyfile.rfc
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am

View File

@ -14,33 +14,8 @@
@SET_MAKE@
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@ -64,13 +39,9 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(srcdir)/Doxyfile.version.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/sofia-footer.html.in \
$(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am \
ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(srcdir)/../sofia.am $(srcdir)/Doxyfile.version.in \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/sofia-footer.html.in ChangeLog
subdir = libsofia-sip-ua/docs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -88,7 +59,6 @@ DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -135,12 +105,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -184,7 +150,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -270,8 +235,7 @@ EXTRA_DIST = Doxyfile Doxyfile.aliases Doxyfile.conf \
BUILT_SOURCES = Doxyfile.rfc
CLEANFILES = Doxyfile.rfc
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -297,13 +261,11 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -354,7 +316,7 @@ CTAGS:
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/pictures
$(mkdir_p) $(distdir)/.. $(distdir)/pictures
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -505,92 +467,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -31,5 +31,4 @@ EXTRA_DIST = Doxyfile features.docs
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libfeatures_la_SOURCES)
@ -78,12 +53,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
$(top_srcdir)/rules/valcheck.am ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/features
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -126,7 +97,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -173,12 +143,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -222,7 +188,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -293,8 +258,7 @@ libfeatures_la_SOURCES = features.c
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = Doxyfile features.docs
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -320,13 +284,11 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -474,7 +436,7 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -619,92 +581,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -64,7 +64,7 @@ EXTRA_DIST = Doxyfile http.docs \
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am
TAG_DLL_FLAGS = DLLREF=1

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libhttp_la_SOURCES) test_http.c
@ -79,12 +54,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = test_http$(EXEEXT)
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
$(top_srcdir)/rules/valcheck.am ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/http
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -135,7 +106,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -182,12 +152,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -231,7 +197,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -330,8 +295,7 @@ EXTRA_DIST = Doxyfile http.docs \
http_parser_table.c.in \
http_tag.c.in
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -357,8 +321,6 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
# ----------------------------------------------------------------------
# Sofia specific rules
@ -370,7 +332,7 @@ all: $(BUILT_SOURCES)
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -610,7 +572,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -761,92 +723,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
sofia-sip/http_tag.h: sofia-sip/http_tag.h.in $(MSG_PARSER_AWK)
sofia-sip/http_protos.h: sofia-sip/http_protos.h.in $(MSG_PARSER_AWK)
http_tag.c: http_tag.c.in $(MSG_PARSER_AWK)

View File

@ -61,9 +61,9 @@ char const http_version_1_0[] = "HTTP/1.0";
/** HTTP version 0.9 is an empty string. */
char const http_version_0_9[] = "";
msg_mclass_t const *http_default_mclass(void)
msg_mclass_t *http_default_mclass(void)
{
extern msg_mclass_t const http_mclass[];
extern msg_mclass_t http_mclass[];
return http_mclass;
}

View File

@ -95,7 +95,7 @@ SOFIAPUBVAR char const http_version_1_1[];
*/
/** HTTP parser description. */
SOFIAPUBFUN msg_mclass_t const *http_default_mclass(void);
SOFIAPUBFUN msg_mclass_t *http_default_mclass(void);
/** Complete a HTTP request. */
SOFIAPUBFUN int http_request_complete(msg_t *msg);

View File

@ -76,7 +76,7 @@ static int http_tag_test(void);
static int test_query_parser(void);
static msg_t *read_message(char const string[]);
msg_mclass_t const *test_mclass = NULL;
msg_mclass_t *test_mclass = NULL;
void usage(void)
{

View File

@ -51,5 +51,4 @@ EXTRA_DIST += Doxyfile ipt.docs
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libipt_la_SOURCES) torture_base64.c
@ -79,12 +54,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = torture_base64$(EXEEXT)
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
$(top_srcdir)/rules/valcheck.am ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/ipt
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -132,7 +103,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -179,12 +149,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -228,7 +194,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -310,8 +275,7 @@ LDADD = libipt.la \
../su/libsu.la
torture_base64_LDFLAGS = -static
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -337,13 +301,11 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -577,7 +539,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -725,92 +687,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -57,9 +57,6 @@ SOFIAPUBFUN isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz)
/** Calculate size of n bytes encoded in base64 */
#define BASE64_SIZE(n) ((((n) + 2) / 3) * 4)
/** Calculate size of n bytes encoded in base64 sans trailing =. @NEW_1_12_5 */
#define BASE64_MINSIZE(n) ((n * 4 + 2) / 3)
SOFIA_END_DECLS
#endif /* !BASE_64 */

View File

@ -35,18 +35,29 @@ nobase_include_sofia_HEADERS = \
sofia-sip/auth_common.h \
sofia-sip/auth_client.h sofia-sip/auth_digest.h \
sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
sofia-sip/auth_client_plugin.h
sofia-sip/auth_client_plugin.h \
$(NTLM_HEADER)
libiptsec_la_SOURCES = iptsec_debug.h \
auth_client.c auth_common.c auth_digest.c \
auth_module.c auth_tag.c auth_tag_ref.c \
auth_plugin.c auth_plugin_delayed.c \
auth_module_sip.c \
auth_module_http.c auth_module_sip.c \
$(NTLM_SOURCE) \
iptsec_debug.c
NTLM_HEADER = sofia-sip/auth_ntlm.h
if HAVE_NTLM
NTLM_SOURCE = auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
endif
EXTRA_libiptsec_la_SOURCES = \
auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libiptsec.la \
../http/libhttp.la \
../nta/libnta.la \
../sip/libsip.la \
../msg/libmsg.la \
@ -57,31 +68,13 @@ LDADD = libiptsec.la \
test_auth_digest_LDFLAGS = -static
if HAVE_NTLM
nobase_include_sofia_HEADERS += $(NTLM_HEADER)
libiptsec_la_SOURCES += $(NTLM_SOURCE)
endif
if HAVE_NTH
libiptsec_la_SOURCES += $(HTTP_SOURCE)
LDADD += ../http/libhttp.la
endif
HTTP_SOURCE = auth_module_http.c
NTLM_HEADER = sofia-sip/auth_ntlm.h
NTLM_SOURCE = auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
EXTRA_libiptsec_la_SOURCES = \
$(NTLM_HEADER) $(NTLM_SOURCE) $(HTTP_SOURCE)
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = Doxyfile iptsec.docs testpasswd $(BUILT_SOURCES)
EXTRA_DIST = Doxyfile iptsec.docs testpasswd \
auth_module_sip.c auth_module_http.c $(BUILT_SOURCES)
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libiptsec_la_SOURCES) $(EXTRA_libiptsec_la_SOURCES) test_auth_digest.c
@ -79,17 +54,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = test_auth_digest$(EXEEXT)
@HAVE_NTLM_TRUE@am__append_1 = $(NTLM_HEADER)
@HAVE_NTLM_TRUE@am__append_2 = $(NTLM_SOURCE)
@HAVE_NTH_TRUE@am__append_3 = $(HTTP_SOURCE)
@HAVE_NTH_TRUE@am__append_4 = ../http/libhttp.la
DIST_COMMON = $(am__nobase_include_sofia_HEADERS_DIST) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am \
ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_5 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/iptsec
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -107,25 +73,22 @@ libiptsec_la_LIBADD =
am__libiptsec_la_SOURCES_DIST = iptsec_debug.h auth_client.c \
auth_common.c auth_digest.c auth_module.c auth_tag.c \
auth_tag_ref.c auth_plugin.c auth_plugin_delayed.c \
auth_module_sip.c iptsec_debug.c auth_ntlm.c \
auth_client_ntlm.c auth_plugin_ntlm.c auth_module_http.c
am__objects_1 = auth_ntlm.lo auth_client_ntlm.lo auth_plugin_ntlm.lo
@HAVE_NTLM_TRUE@am__objects_2 = $(am__objects_1)
am__objects_3 = auth_module_http.lo
@HAVE_NTH_TRUE@am__objects_4 = $(am__objects_3)
auth_module_http.c auth_module_sip.c auth_ntlm.c \
auth_client_ntlm.c auth_plugin_ntlm.c iptsec_debug.c
@HAVE_NTLM_TRUE@am__objects_1 = auth_ntlm.lo auth_client_ntlm.lo \
@HAVE_NTLM_TRUE@ auth_plugin_ntlm.lo
am_libiptsec_la_OBJECTS = auth_client.lo auth_common.lo auth_digest.lo \
auth_module.lo auth_tag.lo auth_tag_ref.lo auth_plugin.lo \
auth_plugin_delayed.lo auth_module_sip.lo iptsec_debug.lo \
$(am__objects_2) $(am__objects_4)
auth_plugin_delayed.lo auth_module_http.lo auth_module_sip.lo \
$(am__objects_1) iptsec_debug.lo
libiptsec_la_OBJECTS = $(am_libiptsec_la_OBJECTS)
test_auth_digest_SOURCES = test_auth_digest.c
test_auth_digest_OBJECTS = test_auth_digest.$(OBJEXT)
test_auth_digest_LDADD = $(LDADD)
@HAVE_NTH_TRUE@am__DEPENDENCIES_1 = ../http/libhttp.la
test_auth_digest_DEPENDENCIES = libiptsec.la ../nta/libnta.la \
../sip/libsip.la ../msg/libmsg.la ../url/liburl.la \
../bnf/libbnf.la ../ipt/libipt.la ../su/libsu.la \
$(am__DEPENDENCIES_1)
test_auth_digest_DEPENDENCIES = libiptsec.la ../http/libhttp.la \
../nta/libnta.la ../sip/libsip.la ../msg/libmsg.la \
../url/liburl.la ../bnf/libbnf.la ../ipt/libipt.la \
../su/libsu.la
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@ -141,10 +104,6 @@ SOURCES = $(libiptsec_la_SOURCES) $(EXTRA_libiptsec_la_SOURCES) \
test_auth_digest.c
DIST_SOURCES = $(am__libiptsec_la_SOURCES_DIST) \
$(EXTRA_libiptsec_la_SOURCES) test_auth_digest.c
am__nobase_include_sofia_HEADERS_DIST = sofia-sip/auth_common.h \
sofia-sip/auth_client.h sofia-sip/auth_digest.h \
sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
sofia-sip/auth_client_plugin.h sofia-sip/auth_ntlm.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -158,7 +117,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -205,12 +163,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -254,7 +208,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -327,31 +280,45 @@ TESTS = test_auth_digest
# ----------------------------------------------------------------------
# Rules for building the targets
BUILT_SOURCES = auth_tag_ref.c
nobase_include_sofia_HEADERS = sofia-sip/auth_common.h \
sofia-sip/auth_client.h sofia-sip/auth_digest.h \
sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
sofia-sip/auth_client_plugin.h $(am__append_1)
libiptsec_la_SOURCES = iptsec_debug.h auth_client.c auth_common.c \
auth_digest.c auth_module.c auth_tag.c auth_tag_ref.c \
auth_plugin.c auth_plugin_delayed.c auth_module_sip.c \
iptsec_debug.c $(am__append_2) $(am__append_3)
COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libiptsec.la ../nta/libnta.la ../sip/libsip.la \
../msg/libmsg.la ../url/liburl.la ../bnf/libbnf.la \
../ipt/libipt.la ../su/libsu.la $(am__append_4)
test_auth_digest_LDFLAGS = -static
HTTP_SOURCE = auth_module_http.c
NTLM_HEADER = sofia-sip/auth_ntlm.h
NTLM_SOURCE = auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
EXTRA_libiptsec_la_SOURCES = \
$(NTLM_HEADER) $(NTLM_SOURCE) $(HTTP_SOURCE)
nobase_include_sofia_HEADERS = \
sofia-sip/auth_common.h \
sofia-sip/auth_client.h sofia-sip/auth_digest.h \
sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
sofia-sip/auth_client_plugin.h \
$(NTLM_HEADER)
libiptsec_la_SOURCES = iptsec_debug.h \
auth_client.c auth_common.c auth_digest.c \
auth_module.c auth_tag.c auth_tag_ref.c \
auth_plugin.c auth_plugin_delayed.c \
auth_module_http.c auth_module_sip.c \
$(NTLM_SOURCE) \
iptsec_debug.c
NTLM_HEADER = sofia-sip/auth_ntlm.h
@HAVE_NTLM_TRUE@NTLM_SOURCE = auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
EXTRA_libiptsec_la_SOURCES = \
auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libiptsec.la \
../http/libhttp.la \
../nta/libnta.la \
../sip/libsip.la \
../msg/libmsg.la \
../url/liburl.la \
../bnf/libbnf.la \
../ipt/libipt.la \
../su/libsu.la
test_auth_digest_LDFLAGS = -static
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = Doxyfile iptsec.docs testpasswd $(BUILT_SOURCES)
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_5)
EXTRA_DIST = Doxyfile iptsec.docs testpasswd \
auth_module_sip.c auth_module_http.c $(BUILT_SOURCES)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -377,14 +344,12 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -629,7 +594,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -780,92 +745,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -210,8 +210,6 @@ int ca_challenge(auth_client_t *ca,
* @retval number of challenges to updated
* @retval 0 when there was no challenge to update
* @retval -1 upon an error
*
* @NEW_1_12_5
*/
int auc_info(auth_client_t **auc_list,
msg_auth_info_t const *ai,
@ -497,8 +495,6 @@ int ca_clear_credentials(auth_client_t *ca,
*
* @retval 1 when authorization can proceed
* @retval 0 when there is not enough credentials
*
* @NEW_1_12_5
*/
int auc_has_authorization(auth_client_t **auc_list)
{
@ -770,13 +766,22 @@ static int auc_digest_challenge(auth_client_t *ca, msg_auth_t const *ch)
if (ac->ac_qop && (cda->cda_cnonce == NULL || ac->ac_stale)) {
su_guid_t guid[1];
char *cnonce;
size_t b64len = BASE64_MINSIZE(sizeof(guid)) + 1;
char *e;
if (cda->cda_cnonce != NULL)
/* Free the old one if we are updating after stale=true */
su_free(home, (void *)cda->cda_cnonce);
su_guid_generate(guid);
cda->cda_cnonce = cnonce = su_alloc(home, b64len);
base64_e(cnonce, b64len, guid, sizeof(guid));
cda->cda_cnonce = cnonce = su_alloc(home, BASE64_SIZE(sizeof(guid)) + 1);
base64_e(cnonce, BASE64_SIZE(sizeof(guid)) + 1, guid, sizeof(guid));
/* somewhere else in the code the '=' chars are stripped in the header
we need to strip it now before the digest is created or we're in trouble
cos they won't match.....
*/
e = cnonce + strlen(cnonce) - 1;
while(*e == '=') {
*e-- = '\0';
}
cda->cda_ncount = 0;
}

View File

@ -76,7 +76,6 @@ static char const __func__[] = "auth_mod";
char const auth_internal_server_error[] = "Internal server error";
static void auth_call_scheme_destructor(void *);
static void auth_md5_hmac_key(auth_mod_t *am);
HTABLE_PROTOS_WITH(auth_htable, aht, auth_passwd_t, usize_t, unsigned);
@ -95,7 +94,7 @@ auth_mod_t *auth_mod_alloc(auth_scheme_t *scheme,
if ((am = su_home_new(scheme->asch_size))) {
am->am_scheme = scheme;
su_home_destructor(am->am_home, auth_call_scheme_destructor);
am->am_refcount = 1;
}
return am;
@ -247,14 +246,10 @@ int auth_init_default(auth_mod_t *am,
/** Destroy (a reference to) an authentication module. */
void auth_mod_destroy(auth_mod_t *am)
{
su_home_unref(am->am_home);
}
/** Call scheme-specific destructor function. */
static void auth_call_scheme_destructor(void *arg)
{
auth_mod_t *am = arg;
am->am_scheme->asch_destroy(am);
if (am && am->am_refcount != 0 && --am->am_refcount == 0) {
am->am_scheme->asch_destroy(am);
su_home_zap(am->am_home);
}
}
/** Do-nothing destroy function.
@ -269,13 +264,18 @@ void auth_destroy_default(auth_mod_t *am)
/** Create a new reference to authentication module. */
auth_mod_t *auth_mod_ref(auth_mod_t *am)
{
return (auth_mod_t *)su_home_ref(am->am_home);
if (!am || am->am_refcount == 0)
return NULL;
am->am_refcount++;
return am;
}
/** Destroy a reference to an authentication module. */
void auth_mod_unref(auth_mod_t *am)
{
su_home_unref(am->am_home);
auth_mod_destroy(am);
}
/** Get authenticatin module name. @NEW_1_12_4. */
@ -608,7 +608,7 @@ struct nonce {
uint8_t digest[6];
};
#define AUTH_DIGEST_NONCE_LEN (BASE64_MINSIZE(sizeof (struct nonce)) + 1)
#define AUTH_DIGEST_NONCE_LEN (BASE64_SIZE(sizeof (struct nonce)) + 1)
/** Authenticate a request with @b Digest authentication scheme.
*
@ -950,8 +950,7 @@ int auth_readdb_if_needed(auth_mod_t *am)
#include <sys/file.h>
#endif
/* This is just a magic value */
#define auth_apw_local ((void *)(intptr_t)auth_readdb_internal)
#define auth_apw_local auth_readdb_internal
/** Read authentication database */
static

View File

@ -126,7 +126,7 @@ static int delayed_auth_init(auth_mod_t *am,
struct auth_splugin_t
{
void const *asp_cookie;
void const *asp_tag;
auth_splugin_t *asp_next;
auth_splugin_t **asp_prev;
auth_mod_t *asp_am;
@ -136,8 +136,6 @@ struct auth_splugin_t
int asp_canceled;
};
/* This is unique identifier */
#define delayed_asp_cookie ((void const *)(intptr_t)delayed_auth_cancel)
static void delayed_auth_method_recv(su_root_magic_t *rm,
su_msg_r msg,
@ -164,7 +162,7 @@ static void delayed_auth_method(auth_mod_t *am,
asp = su_msg_data(mamc); assert(asp);
asp->asp_cookie = delayed_asp_cookie;
asp->asp_tag = delayed_auth_cancel;
asp->asp_am = am;
asp->asp_as = as;
asp->asp_header = auth;
@ -218,7 +216,7 @@ static void delayed_auth_cancel(auth_mod_t *am, auth_status_t *as)
(void)ap; /* xyzzy */
if (as->as_plugin && as->as_plugin->asp_cookie == delayed_asp_cookie)
if (as->as_plugin && as->as_plugin->asp_tag == delayed_auth_cancel)
as->as_plugin->asp_canceled = 1;
as->as_status = 500, as->as_phrase = "Authentication canceled";

View File

@ -105,7 +105,7 @@ struct auth_scheme
typedef struct
{
unsigned apw_index; /**< Key to hash table */
void const *apw_type; /**< Magic identifier */
void const *apw_type; /**< Magic pointer */
char const *apw_user; /**< Username */
char const *apw_realm; /**< Realm */
@ -124,7 +124,7 @@ struct stat;
struct auth_mod_t
{
su_home_t am_home[1];
unsigned _am_refcount; /**< Not used */
unsigned am_refcount; /**< Number of references to this module */
/* User database / cache */
char const *am_db; /**< User database file name */

View File

@ -769,6 +769,8 @@ int test_digest_client()
{
char const *nonce1, *nextnonce, *nonce2;
reinit_as(as); auth_mod_destroy(am); aucs = NULL;
TEST_1(am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM("ims3.so.noklab.net"),

View File

@ -77,7 +77,7 @@ TESTS = test_msg
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am
MSG_PARSER_AWK = $(srcdir)/msg_parser.awk

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
@ -82,12 +57,8 @@ host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = msg_name_hash$(EXEEXT) test_msg$(EXEEXT)
DIST_COMMON = $(dist_pkgdata_SCRIPTS) $(nobase_include_sofia_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am \
ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
$(srcdir)/../sofia.am $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/msg
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -155,7 +126,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -202,12 +172,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -251,7 +217,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -362,8 +327,7 @@ EXTRA_DIST = Doxyfile msg.docs \
# ----------------------------------------------------------------------
# Tests
TESTS = test_msg
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -389,8 +353,6 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
# ----------------------------------------------------------------------
# Sofia specific rules
@ -401,7 +363,7 @@ all: $(BUILT_SOURCES)
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -677,7 +639,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -831,92 +793,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
test_protos.h: test_protos.h.in $(MSG_PARSER_AWK)
test_table.c: test_table.c.in $(MSG_PARSER_AWK)

View File

@ -54,13 +54,11 @@ BEGIN {
split("", NAMES);
split("", Comments);
split("", COMMENTS);
split("", experimental);
# indexed by the C name of the header
split("", Since); # Non-NUL if extra
split("", Extra); # Offset in extra headers
without_experimental = 0;
template="";
template1="";
template2="";
@ -157,24 +155,11 @@ function protos (name, comment, hash, since)
Extra[name] = extra++;
}
expr = (without_experimental > 0 && do_hash);
if (expr) {
printf "%s is experimental\n", Comment;
}
experimental[N] = expr;
if (PR) {
if (expr) {
print "#if SU_HAVE_EXPERIMENTAL" > PR;
}
replace(template, hash, name, NAME, comment, Comment, COMMENT, since);
replace(template1, hash, name, NAME, comment, Comment, COMMENT, since);
replace(template2, hash, name, NAME, comment, Comment, COMMENT, since);
replace(template3, hash, name, NAME, comment, Comment, COMMENT, since);
if (expr) {
print "#endif /* SU_HAVE_EXPERIMENTAL */" > PR;
}
}
}
@ -225,19 +210,8 @@ function process_footer (text)
for (i = 1; i <= n; i++) {
l = lines[i];
if (match(tolower(l), /#(xxxxxx(x_xxxxxxx)?|hash)#/)) {
expr = 0;
for (j = 1; j <= N; j++) {
l = lines[i];
if (expr != experimental[j]) {
expr = experimental[j];
if (expr) {
print "#if SU_HAVE_EXPERIMENTAL" > PR;
}
else {
print "#endif /* SU_HAVE_EXPERIMENTAL */" > PR;
}
}
gsub(/#hash#/, hashes[j], l);
gsub(/#xxxxxxx_xxxxxxx#/, comments[j], l);
gsub(/#Xxxxxxx_Xxxxxxx#/, Comments[j], l);
@ -246,10 +220,6 @@ function process_footer (text)
gsub(/#XXXXXX#/, NAMES[j], l);
print l > PR;
}
if (expr) {
print "#endif /* SU_HAVE_EXPERIMENTAL */" > PR;
}
} else {
print l > PR;
}
@ -363,11 +333,10 @@ function templates ()
}
/^#### EXTRA HEADER LIST STARTS HERE ####$/ { HLIST=1; templates(); }
HLIST && /^#### EXPERIMENTAL HEADER LIST STARTS HERE ####$/ {
without_experimental=total; }
HLIST && /^[a-z]/ { protos($1, $0, 0, $2); headers[total++] = $1; }
/^#### EXTRA HEADER LIST ENDS HERE ####$/ { HLIST=0; }
/^ *\/\* === Headers start here \*\// { in_header_list=1; templates(); }
/^ *\/\* === Headers end here \*\// { in_header_list=0; }
@ -397,13 +366,10 @@ in_header_list && /^ (sip|rtsp|http|msg|mp)_[a-z_0-9]+_t/ {
END {
if (failed) { exit };
if (without_experimental == 0)
without_experimental = total;
if (!NO_LAST) {
protos("unknown", "/**< Unknown headers */", -3);
protos("error", "/**< Erroneous headers */", -4);
protos("separator", "/**< Separator line between headers and body */", -5);
protos("separator", "/**< Separator line between headers and payload */", -5);
protos("payload", "/**< Message payload */", -6);
if (multipart)
protos("multipart", "/**< Multipart payload */", -7);
@ -460,16 +426,7 @@ END {
if (extra > 0) {
printf("struct %s {\n", extra_struct) > PT;
printf(" %s base;\n", module_struct) > PT;
if (total - without_experimental < extra) {
printf(" msg_header_t *extra[%u];\n",
extra - (total - without_experimental)) > PT;
}
if (total - without_experimental > 0) {
print "#if SU_HAVE_EXPERIMENTAL" > PT;
printf(" msg_header_t *experimental[%u];\n",
total - without_experimental) > PT;
print "#endif" > PT;
}
printf(" msg_header_t *extra[%u];\n", extra) > PT;
printf("};\n\n") > PT;
module_struct = "struct " extra_struct;
}
@ -508,13 +465,7 @@ END {
else {
printf(" NULL, \n") > PT;
}
printf(" %d, \n", MC_HASH_SIZE) > PT;
printf ("#if SU_HAVE_EXPERIMENTAL\n" \
" %d,\n" \
"#else\n" \
" %d,\n" \
"#endif\n", \
total, without_experimental) > PT;
printf(" %d, %d, \n", MC_HASH_SIZE, total) > PT;
printf(" {\n") > PT;
for (i = 0; i < total; i++) {
@ -533,7 +484,6 @@ END {
}
header_hash[j] = n;
experimental2[j] = (i >= without_experimental);
}
for (i = 0; i < MC_HASH_SIZE; i++) {
@ -542,23 +492,14 @@ END {
n = header_hash[i];
flags = header_flags[n]; if (flags) flags = ",\n " flags;
if (experimental2[i]) {
print "#if SU_HAVE_EXPERIMENTAL" > PT;
}
if (Since[n]) {
printf(" { %s_%s_class,\n" \
" offsetof(struct %s, extra[%u])%s }%s\n",
printf(" { %s_%s_class, offsetof(struct %s, extra[%u])%s }%s\n",
tprefix, n, extra_struct, Extra[n], flags, c) > PT;
}
else {
printf(" { %s_%s_class, offsetof(%s_t, %s_%s)%s }%s\n",
tprefix, n, module, prefix, n, flags, c) > PT;
}
if (experimental2[i]) {
printf("#else\n { NULL, 0 }%s\n#endif\n", c) > PT;
}
}
else {
printf(" { NULL, 0 }%s\n", c) > PT;

View File

@ -56,8 +56,7 @@ SOFIA_BEGIN_DECLS
* 1) Header class definitions.
*/
/* Do not use keywords until you fix msg_kind_foo_critical thing! */ \
#if HAVE_STRUCT_KEYWORDS && 0
#if HAVE_STRUCT_KEYWORDS
/** Define a header class */
#define MSG_HEADER_CLASS(pr, c, l, s, params, kind, dup, upd) \
{{ \
@ -75,7 +74,6 @@ SOFIA_BEGIN_DECLS
hc_kind: msg_kind_##kind, \
}}
#else
/** Define a header class */
#define MSG_HEADER_CLASS(pr, c, l, s, params, kind, dup, upd) \
{{ \
pr##c##_hash, \

View File

@ -59,5 +59,4 @@ EXTRA_DIST = Doxyfile nea.docs $(BUILT_SOURCES)
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libnea_la_SOURCES)
@ -78,12 +53,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
$(top_srcdir)/rules/valcheck.am ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/nea
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -127,7 +98,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -174,12 +144,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -223,7 +189,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -321,8 +286,7 @@ LDADD = libnea.la \
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = Doxyfile nea.docs $(BUILT_SOURCES)
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -348,14 +312,12 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -581,7 +543,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -731,92 +693,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -496,14 +496,14 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
nes->nes_eventity_uri &&
(nes->nes_leg || leg == NULL) &&
nes->nes_timer) {
SU_DEBUG_5(("nea_server_create(%p): success\n", (void *)nes));
SU_DEBUG_5(("nea_server_create(%p): success\n", nes));
su_timer_set(nes->nes_timer, nes_event_timer, nes);
nes->nes_callback = callback;
nes->nes_context = context;
}
else {
SU_DEBUG_5(("nea_server_create(%p): failed\n", (void *)nes));
SU_DEBUG_5(("nea_server_create(%p): failed\n", nes));
nea_server_destroy(nes), nes = NULL;
}
}
@ -551,11 +551,11 @@ int nea_server_shutdown(nea_server_t *nes,
return 500;
if (nes->nes_in_callback) {
SU_DEBUG_5(("nea_server_shutdown(%p) while in callback\n", (void *)nes));
SU_DEBUG_5(("nea_server_shutdown(%p) while in callback\n", nes));
return 100;
}
SU_DEBUG_5(("nea_server_shutdown(%p)\n", (void *)nes));
SU_DEBUG_5(("nea_server_shutdown(%p)\n", nes));
in_callback = nes->nes_in_callback; nes->nes_in_callback = 1;
@ -585,12 +585,12 @@ void nea_server_destroy(nea_server_t *nes)
return;
if (nes->nes_in_callback) {
SU_DEBUG_5(("nea_server_destroy(%p) while in callback\n", (void *)nes));
SU_DEBUG_5(("nea_server_destroy(%p) while in callback\n", nes));
nes->nes_pending_destroy = 1;
return;
}
SU_DEBUG_5(("nea_server_destroy(%p)\n", (void *)nes));
SU_DEBUG_5(("nea_server_destroy(%p)\n", nes));
nta_leg_destroy(nes->nes_leg), nes->nes_leg = NULL;
@ -837,8 +837,8 @@ int nea_view_update(nea_server_t *nes,
if (evq->evq_content_type)
nea_view_queue(nes, evv, evq);
SU_DEBUG_7(("nea_server_update(%p): %s (%s)\n", (void *)nes,
ev->ev_event->o_type, evv->evv_content_type->c_type));
SU_DEBUG_7(("nea_server_update(%p): %s (%s)\n",
nes, ev->ev_event->o_type, evv->evv_content_type->c_type));
return 1;
}
@ -1019,8 +1019,7 @@ int nea_server_notify(nea_server_t *nes, nea_event_t *ev)
nea_sub_t *s;
int notified = 0, throttled = nes->nes_throttled;
SU_DEBUG_7(("nea_server_notify(%p): %s\n", (void *)nes,
ev ? ev->ev_event->o_type: ""));
SU_DEBUG_7(("nea_server_notify(%p): %s\n", nes, ev ? ev->ev_event->o_type: ""));
++nes->nes_in_list;

View File

@ -73,7 +73,7 @@ EXTRA_DIST = Doxyfile nta.docs sl_utils.docs \
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am
# Generate list of nta tags
TAG_DLL_FLAGS = LIST=nta_tag_list

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
@ -82,12 +57,8 @@ target_triplet = @target@
check_PROGRAMS = test_nta_api$(EXEEXT) test_nta$(EXEEXT) \
portbind$(EXEEXT)
DIST_COMMON = $(dist_noinst_SCRIPTS) $(nobase_include_sofia_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am \
ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
$(srcdir)/../sofia.am $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/nta
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -157,7 +128,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -204,12 +174,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -253,7 +219,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = $(SHELL)
@ -360,8 +325,7 @@ EXTRA_DIST = Doxyfile nta.docs sl_utils.docs \
agent.pem cafile.pem \
invite.msc $(BUILT_SOURCES)
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -387,8 +351,6 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
# ----------------------------------------------------------------------
# Sofia specific rules
@ -400,7 +362,7 @@ all: $(BUILT_SOURCES)
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -646,7 +608,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -796,92 +758,6 @@ clean-built-sources:
../sresolv/libsresolv.la ../stun/libstun.la ../su/libsu.la \
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -225,7 +225,7 @@ static inline int incoming_cancel(nta_incoming_t *irq, msg_t *msg, sip_t *sip,
static inline int incoming_merge(nta_incoming_t *irq, msg_t *msg, sip_t *sip,
tport_t *tport);
static inline int incoming_timestamp(nta_incoming_t *, msg_t *, sip_t *);
static inline su_duration_t incoming_timer(nta_agent_t *, su_duration_t);
static inline int incoming_timer(nta_agent_t *, su_duration_t);
static nta_reliable_t *reliable_mreply(nta_incoming_t *,
nta_prack_f *, nta_reliable_magic_t *,
@ -259,7 +259,7 @@ static nta_outgoing_t *outgoing_find(nta_agent_t const *sa,
sip_via_t const *v);
static int outgoing_recv(nta_outgoing_t *orq, int status, msg_t *, sip_t *);
static void outgoing_default_recv(nta_outgoing_t *, int, msg_t *, sip_t *);
static inline su_duration_t outgoing_timer(nta_agent_t *, su_duration_t);
static inline int outgoing_timer(nta_agent_t *, su_duration_t);
static int outgoing_recv_reliable(nta_outgoing_t *orq, msg_t *msg, sip_t *sip);
/* Internal message passing */
@ -369,10 +369,8 @@ nta_agent_t *nta_agent_create(su_root_t *root,
agent->sa_flags = MSG_DO_CANONIC;
agent->sa_maxsize = 2 * 1024 * 1024; /* 2 MB */
agent->sa_bad_req_mask =
(unsigned) ~(sip_mask_response | sip_mask_proxy);
agent->sa_bad_resp_mask =
(unsigned) ~(sip_mask_request | sip_mask_proxy);
agent->sa_bad_req_mask = (unsigned)(~(sip_mask_response | sip_mask_proxy));
agent->sa_bad_resp_mask = (unsigned)(~(sip_mask_request | sip_mask_proxy));
agent->sa_t1 = NTA_SIP_T1;
agent->sa_t2 = NTA_SIP_T2;
agent->sa_t4 = NTA_SIP_T4;
@ -669,108 +667,53 @@ static int agent_tag_init(nta_agent_t *self)
static
int agent_timer_init(nta_agent_t *agent)
{
agent->sa_timer = su_timer_create(su_root_task(agent->sa_root),
NTA_SIP_T1 / 8);
#if 0
return su_timer_set(agent->sa_timer,
return su_timer_set(agent->sa_timer =
su_timer_create(su_root_task(agent->sa_root),
NTA_SIP_T1 / 8),
agent_timer,
agent);
#endif
return -(agent->sa_timer == NULL);
}
#define NEXT_TIMEOUT(next, p, f, now) \
(p && p->f - (next) < 0 ? (p->f - (now) > 0 ? p->f : (now)) : (next))
/**
* Agent timer routine.
*/
static
void agent_timer(su_root_magic_t *rm, su_timer_t *timer, nta_agent_t *agent)
{
su_time_t stamp = su_now();
su_duration_t now = su_time_ms(stamp), next;
su_duration_t now = su_time_ms(agent->sa_now = su_now());
int again;
now += now == 0;
agent->sa_now = stamp;
agent->sa_millisec = now;
agent->sa_next = 0;
agent->sa_in_timer = 1;
next = now + SU_DURATION_MAX;
next = outgoing_timer(agent, next);
next = incoming_timer(agent, next);
again = outgoing_timer(agent, now);
again = incoming_timer(agent, now) || again;
agent->sa_millisec = 0;
agent->sa_in_timer = 0;
if (agent->sa_next)
next = NEXT_TIMEOUT(next, agent, sa_next, now);
if (next == now + SU_DURATION_MAX) {
/* Do not set timer */
SU_DEBUG_9(("nta: timer not set\n"));
assert(!agent->sa_out.completed->q_head);
assert(!agent->sa_out.trying->q_head);
assert(!agent->sa_out.inv_calling->q_head);
assert(!agent->sa_out.re_list);
assert(!agent->sa_in.inv_confirmed->q_head);
assert(!agent->sa_in.preliminary->q_head);
assert(!agent->sa_in.completed->q_head);
assert(!agent->sa_in.inv_completed->q_head);
assert(!agent->sa_in.re_list);
return;
}
if (next == now) if (++next == 0) ++next;
SU_DEBUG_9(("nta: timer %s to %ld ms\n", "set next", (long)(next - now)));
agent->sa_next = next;
su_timer_set_at(timer, agent_timer, agent, su_time_add(stamp, next - now));
if (again)
su_timer_set_at(timer, agent_timer, agent, su_time_add(su_now(), 1));
else
su_timer_set(timer, agent_timer, agent);
}
/** Calculate nonzero value for timeout.
*
* Sets or adjusts agent timer when needed.
*
* @retval 0 if offset is 0
* @retval timeout (millisecond counter) otherwise
*/
static
su_duration_t set_timeout(nta_agent_t *agent, su_duration_t offset)
/** Calculate nonzero value for timer */
static inline
su_duration_t set_timeout(nta_agent_t const *agent, su_duration_t offset)
{
su_time_t now;
su_duration_t next, ms;
su_duration_t now;
if (offset == 0)
return 0;
if (agent->sa_millisec) /* Avoid expensive call to su_timer_ms() */
now = agent->sa_now, ms = agent->sa_millisec;
#if 0
if (agent->sa_millisec)
now = agent->sa_millisec;
else
now = su_now(), ms = (su_duration_t)su_time_ms(now);
next = ms + offset; if (next == 0) next = 1;
#endif
now = (su_duration_t)su_time_ms(su_now());
if (agent->sa_in_timer)
return next;
now += offset;
if (agent->sa_next == 0 || agent->sa_next - next - 5L > 0) {
/* Set timer */
if (agent->sa_next)
SU_DEBUG_9(("nta: timer %s to %ld ms\n", "shortened", (long)offset));
else
SU_DEBUG_9(("nta: timer %s to %ld ms\n", "set", (long)offset));
su_timer_set_at(agent->sa_timer, agent_timer, agent,
su_time_add(now, offset));
agent->sa_next = next;
}
return next;
return now ? now : 1;
}
@ -890,7 +833,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
unsigned threadpool = agent->sa_tport_threadpool;
char const *sigcomp = agent->sa_sigcomp_options;
char const *algorithm = NONE;
msg_mclass_t const *mclass = NONE;
msg_mclass_t *mclass = NONE;
sip_contact_t const *aliases = NONE;
url_string_t const *proxy = NONE;
tport_t *tport;
@ -1532,7 +1475,7 @@ int nta_agent_add_tport(nta_agent_t *self,
(nta_compressor_vtable == NULL ||
strcasecmp(tpn->tpn_comp, nta_compressor_vtable->ncv_name) != 0)) {
SU_DEBUG_1(("nta(%p): comp=%s not supported for " URL_PRINT_FORMAT "\n",
(void *)self, tpn->tpn_comp, URL_PRINT_ARGS(url)));
self, tpn->tpn_comp, URL_PRINT_ARGS(url)));
}
}
@ -2017,8 +1960,7 @@ static void agent_update_tport(nta_agent_t *self, tport_t *tport)
}
else {
/* XXX - we should do something else? */
SU_DEBUG_3(("%s(%p): %s\n", "nta", (void *)self,
"transport address updated"));
SU_DEBUG_3(("nta(%p): transport address updated\n", self));
}
}
@ -3479,7 +3421,7 @@ nta_leg_t *nta_leg_tcreate(nta_agent_t *agent,
leg_insert(agent, leg);
SU_DEBUG_9(("nta_leg_create(%p)\n", (void *)leg));
SU_DEBUG_9(("nta_leg_create(%p)\n", leg));
return leg;
@ -3529,7 +3471,7 @@ void leg_insert(nta_agent_t *sa, nta_leg_t *leg)
*/
void nta_leg_destroy(nta_leg_t *leg)
{
SU_DEBUG_9(("nta_leg_destroy(%p)\n", (void *)leg));
SU_DEBUG_9(("nta_leg_destroy(%p)\n", leg));
if (leg) {
leg_htable_t *leg_hash;
@ -3624,7 +3566,6 @@ char const *nta_leg_tag(nta_leg_t *leg, char const *tag)
if (tag) {
if (sip_to_tag(leg->leg_home, leg->leg_local, tag) < 0)
return NULL;
leg->leg_tagged = 1;
return leg->leg_local->a_tag;
}
@ -3633,8 +3574,6 @@ char const *nta_leg_tag(nta_leg_t *leg, char const *tag)
if (!tag || sip_to_add_param(leg->leg_home, leg->leg_local, tag) < 0)
return NULL;
leg->leg_tagged = 1;
return leg->leg_local->a_tag;
}
@ -3818,7 +3757,7 @@ void leg_recv(nta_leg_t *leg, msg_t *msg, sip_t *sip, tport_t *tport)
if (!(irq = incoming_create(agent, msg, sip, tport, tag))) {
SU_DEBUG_3(("nta: leg_recv(%p): cannot create transaction for %s\n",
(void *)leg, method_name));
leg, method_name));
nta_msg_treply(agent, msg,
SIP_500_INTERNAL_SERVER_ERROR,
NTATAG_TPORT(tport),
@ -3844,12 +3783,12 @@ void leg_recv(nta_leg_t *leg, msg_t *msg, sip_t *sip, tport_t *tport)
if (status < 100 || status > 699) {
SU_DEBUG_3(("nta_leg(%p): invalid status %03d from callback\n",
(void *)leg, status));
leg, status));
status = 500;
}
else if (method == sip_method_invite && status >= 200 && status < 300) {
SU_DEBUG_3(("nta_leg(%p): invalid INVITE status %03d from callback\n",
(void *)leg, status));
leg, status));
status = 500;
}
@ -3983,14 +3922,6 @@ nta_leg_t *leg_find(nta_agent_t const *sa,
/* Do not match if the incoming To has tag, but the local does not */
if (!local_tag && to_tag)
continue;
/*
* Do not match if incoming To has no tag and we have local tag
* and the tag has been there from the beginning.
*/
if (local_tag && !to_tag && !leg->leg_tagged)
continue;
/* Do not match if incoming From has no tag but remote has a tag */
if (remote_tag && !from_tag)
continue;
@ -4222,7 +4153,7 @@ static inline void incoming_queue(incoming_queue_t *queue, nta_incoming_t *);
static inline void incoming_remove(nta_incoming_t *irq);
static inline void incoming_set_timer(nta_incoming_t *, unsigned interval);
static inline void incoming_reset_timer(nta_incoming_t *);
static inline size_t incoming_mass_destroy(nta_agent_t *, incoming_queue_t *);
static inline size_t incoming_mass_destroy(nta_agent_t *sa, incoming_queue_t *q);
static int incoming_set_params(nta_incoming_t *irq, tagi_t const *tags);
static inline
@ -4505,7 +4436,7 @@ int incoming_callback(nta_leg_t *leg, nta_incoming_t *irq, sip_t *sip)
if (leg->leg_rseq > sip->sip_cseq->cs_seq) {
SU_DEBUG_3(("nta_leg(%p): out-of-order %s (%u < %u)\n",
(void *)leg, method_name, seq, leg->leg_rseq));
leg, method_name, seq, leg->leg_rseq));
return 500;
}
@ -4600,7 +4531,10 @@ void incoming_queue(incoming_queue_t *queue,
assert(*queue->q_tail == NULL);
irq->irq_timeout = set_timeout(irq->irq_agent, queue->q_timeout);
if (queue->q_timeout)
irq->irq_timeout = set_timeout(irq->irq_agent, queue->q_timeout);
else
irq->irq_timeout = 0;
irq->irq_queue = queue;
irq->irq_prev = queue->q_tail;
@ -4692,7 +4626,7 @@ void incoming_reset_timer(nta_incoming_t *irq)
static
void incoming_free(nta_incoming_t *irq)
{
SU_DEBUG_9(("nta: incoming_free(%p)\n", (void *)irq));
SU_DEBUG_9(("nta: incoming_free(%p)\n", irq));
incoming_cut_off(irq);
incoming_reclaim(irq);
@ -4772,8 +4706,7 @@ void incoming_reclaim_queued(su_root_magic_t *rm,
incoming_queue_t *q = u->a_incoming_queue;
nta_incoming_t *irq, *irq_next;
SU_DEBUG_9(("incoming_reclaim_all(%p, %p, %p)\n",
(void *)rm, (void *)msg, (void *)u));
SU_DEBUG_9(("incoming_reclaim_all(%p, %p, %p)\n", rm, msg, u));
for (irq = q->q_head; irq; irq = irq_next) {
irq_next = irq->irq_next;
@ -4983,16 +4916,15 @@ static inline
nta_incoming_t *incoming_find(nta_agent_t const *agent,
sip_t const *sip,
sip_via_t const *v,
nta_incoming_t **return_merge,
nta_incoming_t **return_ack)
nta_incoming_t **merge,
nta_incoming_t **ack)
{
sip_cseq_t const *cseq = sip->sip_cseq;
sip_call_id_t const *i = sip->sip_call_id;
sip_to_t const *to = sip->sip_to;
sip_from_t const *from = sip->sip_from;
sip_request_t *rq = sip->sip_request;
int is_uas_ack = return_ack &&
agent->sa_is_a_uas && rq->rq_method == sip_method_ack;
int is_uas_ack = ack && agent->sa_is_a_uas && rq->rq_method == sip_method_ack;
incoming_htable_t const *iht = agent->sa_incoming;
hash_value_t hash = NTA_HASH(i, cseq->cs_seq);
@ -5009,30 +4941,6 @@ nta_incoming_t *incoming_find(nta_agent_t const *agent,
continue;
if (str0casecmp(irq->irq_from->a_tag, from->a_tag))
continue;
if (str0casecmp(irq->irq_via->v_branch, v->v_branch) != 0 ||
strcasecmp(irq->irq_via->v_host, v->v_host) != 0) {
if (!agent->sa_is_a_uas)
continue;
if (is_uas_ack &&
irq->irq_method == sip_method_invite &&
200 <= irq->irq_status && irq->irq_status < 300 &&
addr_match(irq->irq_to, to))
*return_ack = irq;
/* RFC3261 - section 8.2.2.2 Merged Requests */
else if (return_merge && agent->sa_merge_482 &&
irq->irq_cseq->cs_method == cseq->cs_method &&
(irq->irq_cseq->cs_method != sip_method_unknown ||
strcmp(irq->irq_cseq->cs_method_name,
cseq->cs_method_name) == 0)) {
*return_merge = irq;
continue;
}
else
continue;
}
if (is_uas_ack) {
if (!addr_match(irq->irq_to, to))
continue;
@ -5045,6 +4953,16 @@ nta_incoming_t *incoming_find(nta_agent_t const *agent,
else if (str0casecmp(irq->irq_to->a_tag, to->a_tag))
continue;
if (str0casecmp(irq->irq_via->v_branch, v->v_branch) != 0) {
if (!agent->sa_is_a_uas)
continue;
if (is_uas_ack && irq->irq_status >= 200 && irq->irq_status < 300)
*ack = irq;
/* RFC3261 - section 8.2.2.2 Merged Requests */
else if (merge && !to->a_tag && agent->sa_merge_482)
*merge = irq;
continue;
}
if (!is_uas_ack && url_cmp(irq->irq_rq->rq_url, rq->rq_url))
continue;
@ -5056,24 +4974,18 @@ nta_incoming_t *incoming_find(nta_agent_t const *agent,
if (irq->irq_method == rq->rq_method)
break; /* found */
if (!return_ack)
continue;
if (irq->irq_method == sip_method_invite) {
if (rq->rq_method == sip_method_cancel)
*return_ack = irq;
else if (rq->rq_method == sip_method_ack)
*return_ack = irq;
}
else if (rq->rq_method == sip_method_cancel && !irq->irq_terminated)
*return_ack = irq;
if (ack && rq->rq_method == sip_method_cancel)
*ack = irq;
else if (ack && rq->rq_method == sip_method_ack &&
irq->irq_method == sip_method_invite)
*ack = irq;
}
if (irq)
return irq;
/* Check PRACKed requests */
if (return_ack && rq->rq_method == sip_method_prack && sip->sip_rack) {
if (ack && rq->rq_method == sip_method_prack && sip->sip_rack) {
sip_rack_t const *rack = sip->sip_rack;
hash = NTA_HASH(i, rack->ra_cseq);
@ -5093,7 +5005,7 @@ nta_incoming_t *incoming_find(nta_agent_t const *agent,
continue;
if (!irq->irq_from->a_tag != !from->a_tag)
continue;
*return_ack = irq;
*ack = irq;
return NULL;
}
@ -5185,18 +5097,10 @@ int incoming_cancel(nta_incoming_t *irq, msg_t *msg, sip_t *sip,
nta_agent_t *agent = irq->irq_agent;
/* Respond to the CANCEL */
nta_msg_treply(agent, msg_ref_create(msg), SIP_200_OK,
NTATAG_TPORT(tport),
TAG_END());
if (200 <= irq->irq_status && irq->irq_status < 300) {
nta_msg_treply(agent, msg_ref_create(msg), SIP_481_NO_TRANSACTION,
NTATAG_TPORT(tport),
TAG_END());
}
else
nta_msg_treply(agent, msg_ref_create(msg), SIP_200_OK,
NTATAG_TPORT(tport),
TAG_END());
/* We have already sent final response */
if (irq->irq_completed || irq->irq_method != sip_method_invite) {
msg_destroy(msg);
return 0;
@ -5372,34 +5276,6 @@ int incoming_set_compartment(nta_incoming_t *irq, tport_t *tport, msg_t *msg,
return 0;
}
/** Add essential headers to the response message */
static int nta_incoming_response_headers(nta_incoming_t *irq,
msg_t *msg,
sip_t *sip)
{
int clone = 0;
su_home_t *home = msg_home(msg);
if (!sip->sip_from)
clone = 1, sip->sip_from = sip_from_copy(home, irq->irq_from);
if (!sip->sip_to)
clone = 1, sip->sip_to = sip_to_copy(home, irq->irq_to);
if (!sip->sip_call_id)
clone = 1, sip->sip_call_id = sip_call_id_copy(home, irq->irq_call_id);
if (!sip->sip_cseq)
clone = 1, sip->sip_cseq = sip_cseq_copy(home, irq->irq_cseq);
if (!sip->sip_via)
clone = 1, sip->sip_via = sip_via_copy(home, irq->irq_via);
if (clone)
msg_set_parent(msg, (msg_t *)irq->irq_home);
if (!sip->sip_from || !sip->sip_to || !sip->sip_call_id || !sip->sip_cseq || !sip->sip_via)
return -1;
return 0;
}
/** Complete a response message.
*
* @param irq server transaction object
@ -5421,6 +5297,7 @@ int nta_incoming_complete_response(nta_incoming_t *irq,
{
su_home_t *home = msg_home(msg);
sip_t *sip = sip_object(msg);
int clone = 0;
int retval;
ta_list ta;
@ -5430,7 +5307,7 @@ int nta_incoming_complete_response(nta_incoming_t *irq,
if (status != 0 && (status < 100 || status > 699))
return su_seterrno(EINVAL), -1;
if (status != 0 && !sip->sip_status)
if (!sip->sip_status)
sip->sip_status = sip_status_create(home, status, phrase, NULL);
ta_start(ta, tag, value);
@ -5443,54 +5320,42 @@ int nta_incoming_complete_response(nta_incoming_t *irq,
if (irq->irq_default)
return sip_complete_message(msg);
if (!sip->sip_from)
clone = 1, sip->sip_from = sip_from_copy(home, irq->irq_from);
if (status > 100 && !irq->irq_tag) {
if (sip->sip_to)
nta_incoming_tag(irq, sip->sip_to->a_tag);
else
nta_incoming_tag(irq, NULL);
}
if (nta_incoming_response_headers(irq, msg, sip) < 0)
return -1;
if (!sip->sip_to)
clone = 1, sip->sip_to = sip_to_copy(home, irq->irq_to);
if (sip->sip_status && sip->sip_status->st_status > 100 &&
irq->irq_tag && sip->sip_to && !sip->sip_to->a_tag)
if (sip_to_tag(home, sip->sip_to, irq->irq_tag) < 0)
return -1;
sip_to_tag(home, sip->sip_to, irq->irq_tag);
if (!sip->sip_call_id)
clone = 1, sip->sip_call_id = sip_call_id_copy(home, irq->irq_call_id);
if (!sip->sip_cseq)
clone = 1, sip->sip_cseq = sip_cseq_copy(home, irq->irq_cseq);
if (!sip->sip_via)
clone = 1, sip->sip_via = sip_via_copy(home, irq->irq_via);
if (status < 300 &&
!sip->sip_record_route && irq->irq_record_route)
sip_add_dup(msg, sip, (sip_header_t *)irq->irq_record_route);
if (status < 300 && !sip->sip_record_route && irq->irq_record_route)
if (sip_add_dup(msg, sip, (sip_header_t *)irq->irq_record_route) < 0)
return -1;
if (clone)
msg_set_parent(msg, (msg_t *)irq->irq_home);
if (retval < 0 || !sip->sip_from || !sip->sip_to || !sip->sip_call_id
|| !sip->sip_cseq || !sip->sip_via
|| (status < 300 && irq->irq_record_route && !sip->sip_record_route &&
sip->sip_cseq && sip->sip_cseq->cs_method != sip_method_register))
return -1;
return sip_complete_message(msg);
}
/** Create a response message for request.
*
* @NEW_1_12_5.
*/
msg_t *nta_incoming_create_response(nta_incoming_t *irq,
int status, char const *phrase)
{
msg_t *msg = NULL;
sip_t *sip;
if (irq) {
msg = nta_msg_create(irq->irq_agent, 0);
sip = sip_object(msg);
if (status != 0)
sip->sip_status = sip_status_create(msg_home(msg), status, phrase, NULL);
if (nta_incoming_response_headers(irq, msg, sip) < 0)
msg_destroy(msg), msg = NULL;
}
return msg;
}
/**Reply to an incoming transaction request.
*
* This function creates a response message to an incoming request and sends
@ -5879,9 +5744,8 @@ enum {
/** @internal Timer routine for the incoming request. */
static inline
su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
int incoming_timer(nta_agent_t *sa, su_duration_t now)
{
su_duration_t now = sa->sa_millisec;
nta_incoming_t *irq, *irq_next;
size_t retransmitted = 0, timeout = 0, terminated = 0, destroyed = 0;
size_t unconfirmed =
@ -5898,9 +5762,8 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
/* Handle retry queue */
while ((irq = sa->sa_in.re_list)) {
if (irq->irq_retry - now > 0)
break;
if (retransmitted >= timer_max_retransmit)
if ((irq->irq_retry && irq->irq_retry - now > 0) ||
retransmitted >= timer_max_retransmit)
break;
if (irq->irq_method == sip_method_invite && irq->irq_status >= 200) {
@ -5938,8 +5801,7 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
retransmitted++;
incoming_retransmit_reply(irq, irq->irq_tport);
}
}
else {
} else {
/* Timer N1 */
SU_DEBUG_5(("nta: timer N1 fired, sending %u %s\n", SIP_100_TRYING));
incoming_reset_timer(irq);
@ -5947,8 +5809,6 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
}
}
next = NEXT_TIMEOUT(next, irq, irq_retry, now);
while ((irq = sa->sa_in.final_failed->q_head)) {
incoming_remove(irq);
irq->irq_final_failed = 0;
@ -5981,9 +5841,8 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
assert(irq->irq_status < 200);
assert(irq->irq_timeout);
if (irq->irq_timeout - now > 0)
break;
if (timeout >= timer_max_timeout)
if (irq->irq_timeout - now > 0
|| timeout >= timer_max_timeout)
break;
timeout++;
@ -5996,8 +5855,6 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
reliable_timeout(irq, 1);
}
next = NEXT_TIMEOUT(next, irq, irq_timeout, now);
while ((irq = sa->sa_in.inv_completed->q_head)) {
assert(irq->irq_status >= 200);
assert(irq->irq_timeout);
@ -6026,14 +5883,13 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
}
}
next = NEXT_TIMEOUT(next, irq, irq_timeout, now);
while ((irq = sa->sa_in.inv_confirmed->q_head)) {
assert(irq->irq_timeout);
assert(irq->irq_status >= 200);
assert(irq->irq_method == sip_method_invite);
if (irq->irq_timeout - now > 0 || terminated >= timer_max_terminate)
if (irq->irq_timeout - now > 0 ||
terminated >= timer_max_terminate)
break;
/* Timer I */
@ -6049,14 +5905,13 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
incoming_free_queue(rq, irq);
}
next = NEXT_TIMEOUT(next, irq, irq_timeout, now);
while ((irq = sa->sa_in.completed->q_head)) {
assert(irq->irq_status >= 200);
assert(irq->irq_timeout);
assert(irq->irq_method != sip_method_invite);
if (irq->irq_timeout - now > 0 || terminated >= timer_max_terminate)
if (irq->irq_timeout - now > 0 ||
terminated >= timer_max_terminate)
break;
/* Timer J */
@ -6073,8 +5928,6 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
incoming_free_queue(rq, irq);
}
next = NEXT_TIMEOUT(next, irq, irq_timeout, now);
for (irq = sa->sa_in.terminated->q_head; irq; irq = irq_next) {
irq_next = irq->irq_next;
if (irq->irq_destroyed)
@ -6094,7 +5947,10 @@ su_duration_t incoming_timer(nta_agent_t *sa, su_duration_t next)
terminated, unterminated,
destroyed, total));
return next;
return
retransmitted >= timer_max_retransmit
|| timeout >= timer_max_timeout
|| terminated >= timer_max_terminate;
}
/** Mass destroy server transactions */
@ -6162,11 +6018,11 @@ static inline void outgoing_remove(nta_outgoing_t *orq);
static inline void outgoing_set_timer(nta_outgoing_t *orq, unsigned interval);
static inline void outgoing_reset_timer(nta_outgoing_t *orq);
static size_t outgoing_timer_dk(outgoing_queue_t *q,
char const *timer,
su_duration_t now);
char const *timer,
su_duration_t now);
static size_t outgoing_timer_bf(outgoing_queue_t *q,
char const *timer,
su_duration_t now);
char const *timer,
su_duration_t now);
static void outgoing_ack(nta_outgoing_t *orq, msg_t *msg, sip_t *sip);
static msg_t *outgoing_ackmsg(nta_outgoing_t *, sip_method_t, char const *,
@ -6525,8 +6381,7 @@ void nta_outgoing_destroy(nta_outgoing_t *orq)
return;
if (orq->orq_destroyed) {
SU_DEBUG_1(("%s(%p): %s\n", "nta_outgoing_destroy", (void *)orq,
"already destroyed"));
SU_DEBUG_1(("nta_outgoing_destroy(%p): already destroyed\n", orq));
return;
}
@ -7391,7 +7246,7 @@ void outgoing_queue(outgoing_queue_t *queue,
assert(*queue->q_tail == NULL);
orq->orq_timeout = set_timeout(orq->orq_agent, queue->q_timeout);
orq->orq_queue = queue;
orq->orq_prev = queue->q_tail;
*queue->q_tail = orq;
@ -7450,7 +7305,6 @@ void outgoing_set_timer(nta_outgoing_t *orq, unsigned interval)
orq->orq_retry = set_timeout(orq->orq_agent, orq->orq_interval = interval);
/* Shortcut into queue at SIP T1 */
rq = orq->orq_agent->sa_out.re_t1;
if (!(*rq) || (*rq)->orq_retry - orq->orq_retry > 0)
@ -7489,7 +7343,7 @@ void outgoing_reset_timer(nta_outgoing_t *orq)
static
void outgoing_free(nta_outgoing_t *orq)
{
SU_DEBUG_9(("nta: outgoing_free(%p)\n", (void *)orq));
SU_DEBUG_9(("nta: outgoing_free(%p)\n", orq));
outgoing_cut_off(orq);
outgoing_reclaim(orq);
}
@ -7556,8 +7410,7 @@ void outgoing_reclaim_queued(su_root_magic_t *rm,
outgoing_queue_t *q = u->a_outgoing_queue;
nta_outgoing_t *orq, *orq_next;
SU_DEBUG_9(("outgoing_reclaim_all(%p, %p, %p)\n",
(void *)rm, (void *)msg, (void *)u));
SU_DEBUG_9(("outgoing_reclaim_all(%p, %p, %p)\n", rm, msg, u));
for (orq = q->q_head; orq; orq = orq_next) {
orq_next = orq->orq_next;
@ -7581,14 +7434,6 @@ void outgoing_destroy(nta_outgoing_t *orq)
if (orq->orq_terminated || orq->orq_default) {
outgoing_free(orq);
}
/* We have to handle 200 OK statelessly =>
kill transaction immediately */
else if (orq->orq_method == sip_method_invite && !orq->orq_completed
/* (unless we have to wait to send CANCEL) */
&& !orq->orq_cancel) {
orq->orq_destroyed = 1;
outgoing_terminate(orq);
}
else {
orq->orq_destroyed = 1;
orq->orq_callback = outgoing_default_cb;
@ -7596,29 +7441,24 @@ void outgoing_destroy(nta_outgoing_t *orq)
}
}
/** @internal Outgoing transaction timer routine.
*
*/
static inline
su_duration_t outgoing_timer(nta_agent_t *sa, su_duration_t next)
/** @internal Outgoing transaction timer routine. */
static
int outgoing_timer(nta_agent_t *sa, su_duration_t now)
{
su_duration_t now = sa->sa_millisec;
nta_outgoing_t *orq;
outgoing_queue_t rq[1];
size_t retransmitted = 0, terminated = 0, timeout = 0, destroyed;
size_t total = sa->sa_outgoing->oht_used;
size_t trying = sa->sa_out.re_length;
size_t pending = sa->sa_out.trying->q_length +
sa->sa_out.inv_calling->q_length;
size_t pending = sa->sa_out.trying->q_length + sa->sa_out.inv_calling->q_length;
size_t completed = sa->sa_out.completed->q_length +
sa->sa_out.inv_completed->q_length;
outgoing_queue_init(sa->sa_out.free = rq, 0);
while ((orq = sa->sa_out.re_list)) {
if (orq->orq_retry - now > 0)
break;
if (retransmitted >= timer_max_retransmit)
if ((orq->orq_retry && orq->orq_retry - now > 0)
|| retransmitted >= timer_max_retransmit)
break;
if (orq->orq_reliable) {
@ -7654,22 +7494,14 @@ su_duration_t outgoing_timer(nta_agent_t *sa, su_duration_t next)
su_root_yield(sa->sa_root); /* Handle received packets */
}
next = NEXT_TIMEOUT(next, orq, orq_retry, now);
terminated
= outgoing_timer_dk(sa->sa_out.inv_completed, "D", now)
+ outgoing_timer_dk(sa->sa_out.completed, "K", now);
next = NEXT_TIMEOUT(next, sa->sa_out.inv_completed->q_head, orq_timeout, now);
next = NEXT_TIMEOUT(next, sa->sa_out.completed->q_head, orq_timeout, now);
timeout
= outgoing_timer_bf(sa->sa_out.inv_calling, "B", now)
+ outgoing_timer_bf(sa->sa_out.trying, "F", now);
next = NEXT_TIMEOUT(next, sa->sa_out.inv_calling->q_head, orq_timeout, now);
next = NEXT_TIMEOUT(next, sa->sa_out.trying->q_head, orq_timeout, now);
destroyed = outgoing_mass_destroy(sa, rq);
sa->sa_out.free = NULL;
@ -7686,7 +7518,10 @@ su_duration_t outgoing_timer(nta_agent_t *sa, su_duration_t next)
destroyed, total));
}
return next;
return
retransmitted >= timer_max_retransmit ||
terminated >= timer_max_terminate ||
timeout >= timer_max_timeout;
}
/** @internal Retransmit the outgoing request. */
@ -7723,12 +7558,16 @@ size_t outgoing_timer_bf(outgoing_queue_t *q,
char const *timer,
su_duration_t now)
{
nta_outgoing_t *orq;
size_t timeout = 0;
while ((orq = q->q_head)) {
if (orq->orq_timeout - now > 0 || timeout >= timer_max_timeout)
break;
for (;;) {
nta_outgoing_t *orq = q->q_head;
if (!orq
|| !orq->orq_timeout
|| orq->orq_timeout - now > 0
|| timeout >= timer_max_timeout)
return timeout;
timeout++;
@ -7740,8 +7579,6 @@ size_t outgoing_timer_bf(outgoing_queue_t *q,
assert(q->q_head != orq || orq->orq_timeout - now > 0);
}
return timeout;
}
/** @internal Signal transaction timeout to the application. */
@ -7750,8 +7587,7 @@ void outgoing_timeout(nta_outgoing_t *orq, su_duration_t now)
nta_outgoing_t *cancel;
if (outgoing_other_destinations(orq)) {
SU_DEBUG_5(("%s(%p): %s\n", "nta", (void *)orq,
"try next after timeout"));
SU_DEBUG_5(("nta(%p): try next after timeout\n", orq));
outgoing_try_another(orq);
return;
}
@ -7798,12 +7634,16 @@ size_t outgoing_timer_dk(outgoing_queue_t *q,
char const *timer,
su_duration_t now)
{
nta_outgoing_t *orq;
size_t terminated = 0;
while ((orq = q->q_head)) {
if (orq->orq_timeout - now > 0 || terminated >= timer_max_terminate)
break;
for (;;) {
nta_outgoing_t *orq = q->q_head;
if (!orq
|| !orq->orq_timeout
|| orq->orq_timeout - now > 0
|| terminated >= timer_max_terminate)
return terminated;
terminated++;
@ -7812,8 +7652,6 @@ size_t outgoing_timer_dk(outgoing_queue_t *q,
outgoing_terminate(orq);
}
return terminated;
}
/** Terminate a client transaction. */
@ -7997,16 +7835,6 @@ int outgoing_recv(nta_outgoing_t *orq,
outgoing_send(cancel, 0);
else
outgoing_reply(cancel, SIP_481_NO_TRANSACTION, 0);
if (status < 300 && orq->orq_destroyed &&
orq->orq_method == sip_method_invite) {
outgoing_terminate(orq); /* We can now kill transaction */
if (status == 100) {
msg_destroy(msg);
return 0;
}
return -1;
}
}
if (orq->orq_pending) {
@ -8339,8 +8167,7 @@ int outgoing_reply(nta_outgoing_t *orq, int status, char const *phrase,
if (orq->orq_method == sip_method_ack) {
if (status != delayed)
SU_DEBUG_3(("nta(%p): responding %u %s to ACK!\n",
(void *)orq, status, phrase));
SU_DEBUG_3(("nta(%p): responding %u %s to ACK!\n", orq, status, phrase));
orq->orq_status = status;
if (orq->orq_queue == NULL)
outgoing_complete(orq); /* Timer D/K */
@ -8620,8 +8447,8 @@ outgoing_resolve(nta_outgoing_t *orq)
/* Nothing found */
if (!sr->sr_tports[0]) {
SU_DEBUG_3(("nta(%p): transport %s is not supported%s%s\n", (void *)orq,
tpname, ident ? " by interface " : "", ident ? ident : ""));
SU_DEBUG_3(("nta(%p): transport %s is not supported%s%s\n", orq, tpname,
ident ? " by interface " : "", ident ? ident : ""));
outgoing_resolving_error(orq, SIPDNS_503_ERROR);
return;
}
@ -9235,10 +9062,10 @@ void outgoing_answer_aaaa(sres_context_t *orq, sres_query_t *q,
inet_ntop(AF_INET6, &aaaa->aaaa_addr, addr, sizeof(addr));
if (j == 0)
SU_DEBUG_5(("nta(%p): %s IN AAAA %s\n", (void *)orq,
SU_DEBUG_5(("nta(%p): %s IN AAAA %s\n", orq,
aaaa->aaaa_record->r_name, addr));
else
SU_DEBUG_5(("nta(%p): AAAA %s\n", (void *)orq, addr));
SU_DEBUG_5(("nta(%p): AAAA %s\n", orq, addr));
assert(j < found);
results[j++] = su_strdup(home, addr);
@ -9320,7 +9147,7 @@ void outgoing_answer_a(sres_context_t *orq, sres_query_t *q,
if (j == 0)
SU_DEBUG_5(("nta: %s IN A %s\n", a->a_record->r_name, addr));
else
SU_DEBUG_5(("nta(%p): A %s\n", (void *)orq, addr));
SU_DEBUG_5(("nta(%p): A %s\n", orq, addr));
assert(j < found);
results[j++] = su_strdup(home, addr);
@ -9344,7 +9171,7 @@ outgoing_query_results(nta_outgoing_t *orq,
sq->sq_type != sr->sr_a_aaaa2) {
sq->sq_type = sr->sr_a_aaaa2;
SU_DEBUG_7(("nta(%p): %s %s record still unresolved\n", (void *)orq,
SU_DEBUG_7(("nta(%p): %s %s record still unresolved\n", orq,
sq->sq_domain, sq->sq_type == sres_type_a ? "A" : "AAAA"));
/*
@ -9665,9 +9492,8 @@ int reliable_recv(nta_incoming_t *irq, msg_t *msg, sip_t *sip, tport_t *tp)
status = rel->rel_callback(rel->rel_magic, rel, pr_irq, sip); rel = NULL;
irq->irq_in_callback = pr_irq->irq_in_callback = 0;
if (pr_irq->irq_completed) { /* Already sent final response */
if (pr_irq->irq_terminated && pr_irq->irq_destroyed)
incoming_free(pr_irq);
if (pr_irq->irq_destroyed && pr_irq->irq_terminated) {
incoming_free(pr_irq);
}
else if (status != 0) {
if (status < 200 || status > 299) {
@ -9805,7 +9631,7 @@ void nta_reliable_destroy(nta_reliable_t *rel)
return;
if (rel->rel_callback == nta_reliable_destroyed)
SU_DEBUG_1(("%s(%p): %s\n", __func__, (void *)rel, "already destroyed"));
SU_DEBUG_1(("%s(%p): already destroyed\n", __func__, rel));
rel->rel_callback = nta_reliable_destroyed;
@ -9832,7 +9658,7 @@ int nta_reliable_destroyed(nta_reliable_magic_t *rmagic,
if (!*prev) {
assert(*prev);
SU_DEBUG_1(("%s(%p): %s\n", __func__, (void *)rel, "not linked"));
SU_DEBUG_1(("%s(%p): not linked\n", __func__, rel));
return 200;
}
@ -9913,8 +9739,7 @@ nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
if (orq == NULL || to_tag == NULL)
return NULL;
if (orq->orq_to->a_tag) {
SU_DEBUG_1(("%s: transaction %p already in dialog\n", __func__,
(void *)orq));
SU_DEBUG_1(("%s: transaction %p already in dialog\n", __func__, orq));
return NULL;
}
@ -9930,9 +9755,6 @@ nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
tagged->orq_prev = NULL, tagged->orq_next = NULL, tagged->orq_queue = NULL;
tagged->orq_rprev = NULL, tagged->orq_rnext = NULL;
#if HAVE_SOFIA_SRESOLV
tagged->orq_resolver = NULL;
#endif
if (tagged->orq_cc)
nta_compartment_ref(tagged->orq_cc);
@ -10325,12 +10147,8 @@ int nta_tport_keepalive(nta_outgoing_t *orq)
assert(orq); (void)tp;
#if HAVE_SOFIA_STUN
return tport_keepalive(orq->orq_tport, msg_addrinfo(orq->orq_request),
TAG_END());
#else
return -1;
#endif
}
/** Close all transports. @since Experimental in @VERSION_1_12_2. */
@ -10350,7 +10168,7 @@ int nta_agent_close_tports(nta_agent_t *agent)
orq->orq_pending = 0;
tport_unref(orq->orq_tport), orq->orq_tport = NULL;
}
}
for (i = iht->iht_size; i-- > 0;)

View File

@ -343,8 +343,8 @@ int nta_check_accept(nta_incoming_t *irq,
/**Check @SessionExpires header.
*
* If the proposed session-expiration time is smaller than @MinSE or our
* minimal session expiration time, respond with 422 containing shortest
* acceptable session expiration time in @MinSE header.
* minimal session expiration time, respond with 422 containing our minimal
* session expiration time in @MinSE header.
*
* @param irq incoming transaction object (may be NULL).
* @param sip contents of the SIP message
@ -359,28 +359,26 @@ int nta_check_session_expires(nta_incoming_t *irq,
sip_time_t my_min_se,
tag_type_t tag, tag_value_t value, ...)
{
unsigned long min_se = my_min_se;
if (sip->sip_min_se && min_se < sip->sip_min_se->min_delta)
min_se = sip->sip_min_se->min_delta;
if (sip->sip_session_expires->x_delta >= min_se)
return 0;
if (irq) {
if ((sip->sip_min_se &&
sip->sip_session_expires->x_delta < sip->sip_min_se->min_delta)
|| sip->sip_session_expires->x_delta < my_min_se) {
ta_list ta;
sip_min_se_t min_se0[1];
ta_start(ta, tag, value);
sip_min_se_t min_se[1];
sip_min_se_init(min_se0)->min_delta = min_se;
sip_min_se_init(min_se)->min_delta = my_min_se;
nta_incoming_treply(irq,
SIP_422_SESSION_TIMER_TOO_SMALL,
SIPTAG_MIN_SE(min_se0),
ta_tags(ta));
ta_end(ta);
if (irq) {
ta_start(ta, tag, value);
nta_incoming_treply(irq,
SIP_422_SESSION_TIMER_TOO_SMALL,
SIPTAG_MIN_SE(min_se),
ta_tags(ta));
ta_end(ta);
}
return 422;
}
return 422;
return 0;
}

View File

@ -98,17 +98,16 @@ struct nta_agent_s
nta_agent_magic_t *sa_magic;
nta_message_f *sa_callback;
uint32_t sa_nw_updates; /* Shall we enable network detector? */
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. */
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;
msg_mclass_t *sa_mclass;
sip_contact_t *sa_contact;
sip_via_t *sa_vias; /**< @Via headers for all transports */
@ -224,9 +223,6 @@ struct nta_agent_s
/** If true, automatically create compartments */
unsigned sa_auto_comp:1;
/** Set when executing timer */
unsigned sa_in_timer:1;
unsigned :0;
/** Messages memory preload. */
@ -346,11 +342,6 @@ struct nta_leg_s
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;
@ -472,17 +463,12 @@ struct nta_outgoing_s
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;
char const *orq_tag; /**< Tag from final response. */
su_time_t orq_sent; /**< When request was sent? */
unsigned orq_delay; /**< RTT estimate */
@ -515,9 +501,11 @@ struct nta_outgoing_s
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_timestamp : 1; /**< insert @Timestamp header. */
unsigned : 0; /* pad */
uint32_t orq_rseq; /**< Latest incoming rseq */
#if HAVE_SOFIA_SRESOLV
sipdns_resolver_t *orq_resolver;
#endif
@ -534,10 +522,12 @@ struct nta_outgoing_s
char const *orq_branch; /**< Transaction branch */
char const *orq_via_branch; /**< @Via branch */
url_t const *orq_url; /**< Original RequestURI */
msg_t *orq_request;
msg_t *orq_response;
nta_outgoing_t *orq_cancel; /**< CANCEL transaction */
uint32_t orq_rseq; /**< Latest incoming rseq */
};
/* Virtual function table for plugging in SigComp */

View File

@ -110,38 +110,38 @@ tag_typedef_t ntatag_rseq = UINTTAG_TYPEDEF(rseq);
/* Status */
tag_typedef_t ntatag_s_irq_hash = USIZETAG_TYPEDEF(s_irq_hash);
tag_typedef_t ntatag_s_orq_hash = USIZETAG_TYPEDEF(s_orq_hash);
tag_typedef_t ntatag_s_leg_hash = USIZETAG_TYPEDEF(s_leg_hash);
tag_typedef_t ntatag_s_irq_hash_used = USIZETAG_TYPEDEF(s_irq_hash_used);
tag_typedef_t ntatag_s_orq_hash_used = USIZETAG_TYPEDEF(s_orq_hash_used);
tag_typedef_t ntatag_s_leg_hash_used = USIZETAG_TYPEDEF(s_leg_hash_used);
tag_typedef_t ntatag_s_recv_msg = USIZETAG_TYPEDEF(s_recv_msg);
tag_typedef_t ntatag_s_recv_request = USIZETAG_TYPEDEF(s_recv_request);
tag_typedef_t ntatag_s_recv_response = USIZETAG_TYPEDEF(s_recv_response);
tag_typedef_t ntatag_s_bad_message = USIZETAG_TYPEDEF(s_bad_message);
tag_typedef_t ntatag_s_bad_request = USIZETAG_TYPEDEF(s_bad_request);
tag_typedef_t ntatag_s_bad_response = USIZETAG_TYPEDEF(s_bad_response);
tag_typedef_t ntatag_s_drop_request = USIZETAG_TYPEDEF(s_drop_request);
tag_typedef_t ntatag_s_drop_response = USIZETAG_TYPEDEF(s_drop_response);
tag_typedef_t ntatag_s_client_tr = USIZETAG_TYPEDEF(s_client_tr);
tag_typedef_t ntatag_s_server_tr = USIZETAG_TYPEDEF(s_server_tr);
tag_typedef_t ntatag_s_dialog_tr = USIZETAG_TYPEDEF(s_dialog_tr);
tag_typedef_t ntatag_s_acked_tr = USIZETAG_TYPEDEF(s_acked_tr);
tag_typedef_t ntatag_s_canceled_tr = USIZETAG_TYPEDEF(s_canceled_tr);
tag_typedef_t ntatag_s_trless_request = USIZETAG_TYPEDEF(s_trless_request);
tag_typedef_t ntatag_s_trless_to_tr = USIZETAG_TYPEDEF(s_trless_to_tr);
tag_typedef_t ntatag_s_trless_response = USIZETAG_TYPEDEF(s_trless_response);
tag_typedef_t ntatag_s_trless_200 = USIZETAG_TYPEDEF(s_trless_200);
tag_typedef_t ntatag_s_merged_request = USIZETAG_TYPEDEF(s_merged_request);
tag_typedef_t ntatag_s_sent_msg = USIZETAG_TYPEDEF(s_sent_msg);
tag_typedef_t ntatag_s_sent_request = USIZETAG_TYPEDEF(s_sent_request);
tag_typedef_t ntatag_s_sent_response = USIZETAG_TYPEDEF(s_sent_response);
tag_typedef_t ntatag_s_retry_request = USIZETAG_TYPEDEF(s_retry_request);
tag_typedef_t ntatag_s_retry_response = USIZETAG_TYPEDEF(s_retry_response);
tag_typedef_t ntatag_s_recv_retry = USIZETAG_TYPEDEF(s_recv_retry);
tag_typedef_t ntatag_s_tout_request = USIZETAG_TYPEDEF(s_tout_request);
tag_typedef_t ntatag_s_tout_response = USIZETAG_TYPEDEF(s_tout_response);
tag_typedef_t ntatag_s_irq_hash = UINTTAG_TYPEDEF(s_irq_hash);
tag_typedef_t ntatag_s_orq_hash = UINTTAG_TYPEDEF(s_orq_hash);
tag_typedef_t ntatag_s_leg_hash = UINTTAG_TYPEDEF(s_leg_hash);
tag_typedef_t ntatag_s_irq_hash_used = UINTTAG_TYPEDEF(s_irq_hash_used);
tag_typedef_t ntatag_s_orq_hash_used = UINTTAG_TYPEDEF(s_orq_hash_used);
tag_typedef_t ntatag_s_leg_hash_used = UINTTAG_TYPEDEF(s_leg_hash_used);
tag_typedef_t ntatag_s_recv_msg = UINTTAG_TYPEDEF(s_recv_msg);
tag_typedef_t ntatag_s_recv_request = UINTTAG_TYPEDEF(s_recv_request);
tag_typedef_t ntatag_s_recv_response = UINTTAG_TYPEDEF(s_recv_response);
tag_typedef_t ntatag_s_bad_message = UINTTAG_TYPEDEF(s_bad_message);
tag_typedef_t ntatag_s_bad_request = UINTTAG_TYPEDEF(s_bad_request);
tag_typedef_t ntatag_s_bad_response = UINTTAG_TYPEDEF(s_bad_response);
tag_typedef_t ntatag_s_drop_request = UINTTAG_TYPEDEF(s_drop_request);
tag_typedef_t ntatag_s_drop_response = UINTTAG_TYPEDEF(s_drop_response);
tag_typedef_t ntatag_s_client_tr = UINTTAG_TYPEDEF(s_client_tr);
tag_typedef_t ntatag_s_server_tr = UINTTAG_TYPEDEF(s_server_tr);
tag_typedef_t ntatag_s_dialog_tr = UINTTAG_TYPEDEF(s_dialog_tr);
tag_typedef_t ntatag_s_acked_tr = UINTTAG_TYPEDEF(s_acked_tr);
tag_typedef_t ntatag_s_canceled_tr = UINTTAG_TYPEDEF(s_canceled_tr);
tag_typedef_t ntatag_s_trless_request = UINTTAG_TYPEDEF(s_trless_request);
tag_typedef_t ntatag_s_trless_to_tr = UINTTAG_TYPEDEF(s_trless_to_tr);
tag_typedef_t ntatag_s_trless_response = UINTTAG_TYPEDEF(s_trless_response);
tag_typedef_t ntatag_s_trless_200 = UINTTAG_TYPEDEF(s_trless_200);
tag_typedef_t ntatag_s_merged_request = UINTTAG_TYPEDEF(s_merged_request);
tag_typedef_t ntatag_s_sent_msg = UINTTAG_TYPEDEF(s_sent_msg);
tag_typedef_t ntatag_s_sent_request = UINTTAG_TYPEDEF(s_sent_request);
tag_typedef_t ntatag_s_sent_response = UINTTAG_TYPEDEF(s_sent_response);
tag_typedef_t ntatag_s_retry_request = UINTTAG_TYPEDEF(s_retry_request);
tag_typedef_t ntatag_s_retry_response = UINTTAG_TYPEDEF(s_retry_response);
tag_typedef_t ntatag_s_recv_retry = UINTTAG_TYPEDEF(s_recv_retry);
tag_typedef_t ntatag_s_tout_request = UINTTAG_TYPEDEF(s_tout_request);
tag_typedef_t ntatag_s_tout_response = UINTTAG_TYPEDEF(s_tout_response);
/* Internal */
tag_typedef_t ntatag_delay_sending = BOOLTAG_TYPEDEF(delay_sending);

View File

@ -299,9 +299,6 @@ int nta_incoming_complete_response(nta_incoming_t *irq,
char const *phrase,
tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN
msg_t *nta_incoming_create_response(nta_incoming_t *irq, int status, char const *phrase);
SOFIAPUBFUN
int nta_incoming_treply(nta_incoming_t *ireq,
int status, char const *phrase,

View File

@ -59,10 +59,10 @@ NTA_DLL extern tag_typedef_t ntatag_any;
NTA_DLL extern tag_typedef_t ntatag_mclass;
/** Message class used by NTA. @HI */
#define NTATAG_MCLASS(x) ntatag_mclass, tag_cptr_v((x))
#define NTATAG_MCLASS(x) ntatag_mclass, tag_ptr_v((x))
NTA_DLL extern tag_typedef_t ntatag_mclass_ref;
#define NTATAG_MCLASS_REF(x) ntatag_mclass_ref, tag_cptr_vr(&(x), (x))
#define NTATAG_MCLASS_REF(x) ntatag_mclass_ref, tag_ptr_vr(&(x), (x))
NTA_DLL extern tag_typedef_t ntatag_bad_req_mask;
/** Mask for bad request messages.
@ -464,223 +464,223 @@ NTA_DLL extern tag_typedef_t ntatag_rseq_ref;
/* Tags for statistics. */
NTA_DLL extern tag_typedef_t ntatag_s_irq_hash;
#define NTATAG_S_IRQ_HASH(x) ntatag_s_irq_hash, tag_usize_v(x)
#define NTATAG_S_IRQ_HASH(x) ntatag_s_irq_hash, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_irq_hash_ref;
#define NTATAG_S_IRQ_HASH_REF(x) ntatag_s_irq_hash_ref, tag_usize_vr(&(x))
#define NTATAG_S_IRQ_HASH_REF(x) ntatag_s_irq_hash_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_orq_hash;
#define NTATAG_S_ORQ_HASH(x) ntatag_s_orq_hash, tag_usize_v(x)
#define NTATAG_S_ORQ_HASH(x) ntatag_s_orq_hash, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_orq_hash_ref;
#define NTATAG_S_ORQ_HASH_REF(x) ntatag_s_orq_hash_ref, tag_usize_vr(&(x))
#define NTATAG_S_ORQ_HASH_REF(x) ntatag_s_orq_hash_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_leg_hash;
#define NTATAG_S_LEG_HASH(x) ntatag_s_leg_hash, tag_usize_v(x)
#define NTATAG_S_LEG_HASH(x) ntatag_s_leg_hash, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_leg_hash_ref;
#define NTATAG_S_LEG_HASH_REF(x) ntatag_s_leg_hash_ref, tag_usize_vr(&(x))
#define NTATAG_S_LEG_HASH_REF(x) ntatag_s_leg_hash_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_irq_hash_used;
#define NTATAG_S_IRQ_HASH_USED(x) ntatag_s_irq_hash_used, tag_usize_v(x)
#define NTATAG_S_IRQ_HASH_USED(x) ntatag_s_irq_hash_used, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_irq_hash_used_ref;
#define NTATAG_S_IRQ_HASH_USED_REF(x) \
ntatag_s_irq_hash_used_ref, tag_usize_vr(&(x))
ntatag_s_irq_hash_used_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_orq_hash_used;
#define NTATAG_S_ORQ_HASH_USED(x) ntatag_s_orq_hash_used, tag_usize_v(x)
#define NTATAG_S_ORQ_HASH_USED(x) ntatag_s_orq_hash_used, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_orq_hash_used_ref;
#define NTATAG_S_ORQ_HASH_USED_REF(x) \
ntatag_s_orq_hash_used_ref, tag_usize_vr(&(x))
ntatag_s_orq_hash_used_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_leg_hash_used;
#define NTATAG_S_LEG_HASH_USED(x) ntatag_s_leg_hash_used, tag_usize_v(x)
#define NTATAG_S_LEG_HASH_USED(x) ntatag_s_leg_hash_used, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_leg_hash_used_ref;
#define NTATAG_S_LEG_HASH_USED_REF(x) \
ntatag_s_leg_hash_used_ref, tag_usize_vr(&(x))
ntatag_s_leg_hash_used_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_recv_msg;
#define NTATAG_S_RECV_MSG(x) ntatag_s_recv_msg, tag_usize_v(x)
#define NTATAG_S_RECV_MSG(x) ntatag_s_recv_msg, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_recv_msg_ref;
#define NTATAG_S_RECV_MSG_REF(x) ntatag_s_recv_msg_ref, tag_usize_vr(&(x))
#define NTATAG_S_RECV_MSG_REF(x) ntatag_s_recv_msg_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_recv_request;
#define NTATAG_S_RECV_REQUEST(x) ntatag_s_recv_request, tag_usize_v(x)
#define NTATAG_S_RECV_REQUEST(x) ntatag_s_recv_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_recv_request_ref;
#define NTATAG_S_RECV_REQUEST_REF(x)\
ntatag_s_recv_request_ref, tag_usize_vr(&(x))
ntatag_s_recv_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_recv_response;
#define NTATAG_S_RECV_RESPONSE(x) ntatag_s_recv_response, tag_usize_v(x)
#define NTATAG_S_RECV_RESPONSE(x) ntatag_s_recv_response, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_recv_response_ref;
#define NTATAG_S_RECV_RESPONSE_REF(x)\
ntatag_s_recv_response_ref, tag_usize_vr(&(x))
ntatag_s_recv_response_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_bad_message;
#define NTATAG_S_BAD_MESSAGE(x) ntatag_s_bad_message, tag_usize_v(x)
#define NTATAG_S_BAD_MESSAGE(x) ntatag_s_bad_message, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_bad_message_ref;
#define NTATAG_S_BAD_MESSAGE_REF(x)\
ntatag_s_bad_message_ref, tag_usize_vr(&(x))
ntatag_s_bad_message_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_bad_request;
#define NTATAG_S_BAD_REQUEST(x) ntatag_s_bad_request, tag_usize_v(x)
#define NTATAG_S_BAD_REQUEST(x) ntatag_s_bad_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_bad_request_ref;
#define NTATAG_S_BAD_REQUEST_REF(x)\
ntatag_s_bad_request_ref, tag_usize_vr(&(x))
ntatag_s_bad_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_bad_response;
#define NTATAG_S_BAD_RESPONSE(x) ntatag_s_bad_response, tag_usize_v(x)
#define NTATAG_S_BAD_RESPONSE(x) ntatag_s_bad_response, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_bad_response_ref;
#define NTATAG_S_BAD_RESPONSE_REF(x)\
ntatag_s_bad_response_ref, tag_usize_vr(&(x))
ntatag_s_bad_response_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_drop_request;
#define NTATAG_S_DROP_REQUEST(x) ntatag_s_drop_request, tag_usize_v(x)
#define NTATAG_S_DROP_REQUEST(x) ntatag_s_drop_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_drop_request_ref;
#define NTATAG_S_DROP_REQUEST_REF(x)\
ntatag_s_drop_request_ref, tag_usize_vr(&(x))
ntatag_s_drop_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_drop_response;
#define NTATAG_S_DROP_RESPONSE(x) ntatag_s_drop_response, tag_usize_v(x)
#define NTATAG_S_DROP_RESPONSE(x) ntatag_s_drop_response, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_drop_response_ref;
#define NTATAG_S_DROP_RESPONSE_REF(x)\
ntatag_s_drop_response_ref, tag_usize_vr(&(x))
ntatag_s_drop_response_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_client_tr;
#define NTATAG_S_CLIENT_TR(x) ntatag_s_client_tr, tag_usize_v(x)
#define NTATAG_S_CLIENT_TR(x) ntatag_s_client_tr, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_client_tr_ref;
#define NTATAG_S_CLIENT_TR_REF(x)\
ntatag_s_client_tr_ref, tag_usize_vr(&(x))
ntatag_s_client_tr_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_server_tr;
#define NTATAG_S_SERVER_TR(x) ntatag_s_server_tr, tag_usize_v(x)
#define NTATAG_S_SERVER_TR(x) ntatag_s_server_tr, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_server_tr_ref;
#define NTATAG_S_SERVER_TR_REF(x)\
ntatag_s_server_tr_ref, tag_usize_vr(&(x))
ntatag_s_server_tr_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_dialog_tr;
#define NTATAG_S_DIALOG_TR(x) ntatag_s_dialog_tr, tag_usize_v(x)
#define NTATAG_S_DIALOG_TR(x) ntatag_s_dialog_tr, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_dialog_tr_ref;
#define NTATAG_S_DIALOG_TR_REF(x)\
ntatag_s_dialog_tr_ref, tag_usize_vr(&(x))
ntatag_s_dialog_tr_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_acked_tr;
#define NTATAG_S_ACKED_TR(x) ntatag_s_acked_tr, tag_usize_v(x)
#define NTATAG_S_ACKED_TR(x) ntatag_s_acked_tr, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_acked_tr_ref;
#define NTATAG_S_ACKED_TR_REF(x) ntatag_s_acked_tr_ref, tag_usize_vr(&(x))
#define NTATAG_S_ACKED_TR_REF(x) ntatag_s_acked_tr_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_canceled_tr;
#define NTATAG_S_CANCELED_TR(x) ntatag_s_canceled_tr, tag_usize_v(x)
#define NTATAG_S_CANCELED_TR(x) ntatag_s_canceled_tr, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_canceled_tr_ref;
#define NTATAG_S_CANCELED_TR_REF(x) \
ntatag_s_canceled_tr_ref, tag_usize_vr(&(x))
ntatag_s_canceled_tr_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_trless_request;
#define NTATAG_S_TRLESS_REQUEST(x) ntatag_s_trless_request, tag_usize_v(x)
#define NTATAG_S_TRLESS_REQUEST(x) ntatag_s_trless_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_trless_request_ref;
#define NTATAG_S_TRLESS_REQUEST_REF(x)\
ntatag_s_trless_request_ref, tag_usize_vr(&(x))
ntatag_s_trless_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_trless_to_tr;
#define NTATAG_S_TRLESS_TO_TR(x) ntatag_s_trless_to_tr, tag_usize_v(x)
#define NTATAG_S_TRLESS_TO_TR(x) ntatag_s_trless_to_tr, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_trless_to_tr_ref;
#define NTATAG_S_TRLESS_TO_TR_REF(x)\
ntatag_s_trless_to_tr_ref, tag_usize_vr(&(x))
ntatag_s_trless_to_tr_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_trless_response;
#define NTATAG_S_TRLESS_RESPONSE(x) ntatag_s_trless_response, tag_usize_v(x)
#define NTATAG_S_TRLESS_RESPONSE(x) ntatag_s_trless_response, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_trless_response_ref;
#define NTATAG_S_TRLESS_RESPONSE_REF(x)\
ntatag_s_trless_response_ref, tag_usize_vr(&(x))
ntatag_s_trless_response_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_trless_200;
#define NTATAG_S_TRLESS_200(x) ntatag_s_trless_200, tag_usize_v(x)
#define NTATAG_S_TRLESS_200(x) ntatag_s_trless_200, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_trless_200_ref;
#define NTATAG_S_TRLESS_200_REF(x)\
ntatag_s_trless_200_ref, tag_usize_vr(&(x))
ntatag_s_trless_200_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_merged_request;
#define NTATAG_S_MERGED_REQUEST(x) ntatag_s_merged_request, tag_usize_v(x)
#define NTATAG_S_MERGED_REQUEST(x) ntatag_s_merged_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_merged_request_ref;
#define NTATAG_S_MERGED_REQUEST_REF(x)\
ntatag_s_merged_request_ref, tag_usize_vr(&(x))
ntatag_s_merged_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_sent_msg;
#define NTATAG_S_SENT_MSG(x) ntatag_s_sent_msg, tag_usize_v(x)
#define NTATAG_S_SENT_MSG(x) ntatag_s_sent_msg, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_sent_msg_ref;
#define NTATAG_S_SENT_MSG_REF(x)\
ntatag_s_sent_msg_ref, tag_usize_vr(&(x))
ntatag_s_sent_msg_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_sent_request;
#define NTATAG_S_SENT_REQUEST(x) ntatag_s_sent_request, tag_usize_v(x)
#define NTATAG_S_SENT_REQUEST(x) ntatag_s_sent_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_sent_request_ref;
#define NTATAG_S_SENT_REQUEST_REF(x)\
ntatag_s_sent_request_ref, tag_usize_vr(&(x))
ntatag_s_sent_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_sent_response;
#define NTATAG_S_SENT_RESPONSE(x) ntatag_s_sent_response, tag_usize_v(x)
#define NTATAG_S_SENT_RESPONSE(x) ntatag_s_sent_response, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_sent_response_ref;
#define NTATAG_S_SENT_RESPONSE_REF(x)\
ntatag_s_sent_response_ref, tag_usize_vr(&(x))
ntatag_s_sent_response_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_retry_request;
#define NTATAG_S_RETRY_REQUEST(x) ntatag_s_retry_request, tag_usize_v(x)
#define NTATAG_S_RETRY_REQUEST(x) ntatag_s_retry_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_retry_request_ref;
#define NTATAG_S_RETRY_REQUEST_REF(x)\
ntatag_s_retry_request_ref, tag_usize_vr(&(x))
ntatag_s_retry_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_retry_response;
#define NTATAG_S_RETRY_RESPONSE(x) ntatag_s_retry_response, tag_usize_v(x)
#define NTATAG_S_RETRY_RESPONSE(x) ntatag_s_retry_response, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_retry_response_ref;
#define NTATAG_S_RETRY_RESPONSE_REF(x)\
ntatag_s_retry_response_ref, tag_usize_vr(&(x))
ntatag_s_retry_response_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_recv_retry;
#define NTATAG_S_RECV_RETRY(x) ntatag_s_recv_retry, tag_usize_v(x)
#define NTATAG_S_RECV_RETRY(x) ntatag_s_recv_retry, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_recv_retry_ref;
#define NTATAG_S_RECV_RETRY_REF(x)\
ntatag_s_recv_retry_ref, tag_usize_vr(&(x))
ntatag_s_recv_retry_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_tout_request;
#define NTATAG_S_TOUT_REQUEST(x) ntatag_s_tout_request, tag_usize_v(x)
#define NTATAG_S_TOUT_REQUEST(x) ntatag_s_tout_request, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_tout_request_ref;
#define NTATAG_S_TOUT_REQUEST_REF(x)\
ntatag_s_tout_request_ref, tag_usize_vr(&(x))
ntatag_s_tout_request_ref, tag_uint_vr(&(x))
NTA_DLL extern tag_typedef_t ntatag_s_tout_response;
#define NTATAG_S_TOUT_RESPONSE(x) ntatag_s_tout_response, tag_usize_v(x)
#define NTATAG_S_TOUT_RESPONSE(x) ntatag_s_tout_response, tag_uint_v(x)
NTA_DLL extern tag_typedef_t ntatag_s_tout_response_ref;
#define NTATAG_S_TOUT_RESPONSE_REF(x)\
ntatag_s_tout_response_ref, tag_usize_vr(&(x))
ntatag_s_tout_response_ref, tag_uint_vr(&(x))
SOFIA_END_DECLS

View File

@ -654,7 +654,7 @@ int readfile(FILE *f, void **contents)
*contents = buffer;
return (int)len;
return len;
}
#if HAVE_DIRENT_H

View File

@ -559,18 +559,18 @@ int api_test_stats(agent_t *ag)
nta_agent_t *nta;
usize_t irq_hash = -1, orq_hash = -1, leg_hash = -1;
usize_t recv_msg = -1, sent_msg = -1;
usize_t recv_request = -1, recv_response = -1;
usize_t bad_message = -1, bad_request = -1, bad_response = -1;
usize_t drop_request = -1, drop_response = -1;
usize_t client_tr = -1, server_tr = -1, dialog_tr = -1;
usize_t acked_tr = -1, canceled_tr = -1;
usize_t trless_request = -1, trless_to_tr = -1, trless_response = -1;
usize_t trless_200 = -1, merged_request = -1;
usize_t sent_request = -1, sent_response = -1;
usize_t retry_request = -1, retry_response = -1, recv_retry = -1;
usize_t tout_request = -1, tout_response = -1;
uint32_t irq_hash = -1, orq_hash = -1, leg_hash = -1;
uint32_t recv_msg = -1, sent_msg = -1;
uint32_t recv_request = -1, recv_response = -1;
uint32_t bad_message = -1, bad_request = -1, bad_response = -1;
uint32_t drop_request = -1, drop_response = -1;
uint32_t client_tr = -1, server_tr = -1, dialog_tr = -1;
uint32_t acked_tr = -1, canceled_tr = -1;
uint32_t trless_request = -1, trless_to_tr = -1, trless_response = -1;
uint32_t trless_200 = -1, merged_request = -1;
uint32_t sent_request = -1, sent_response = -1;
uint32_t retry_request = -1, retry_response = -1, recv_retry = -1;
uint32_t tout_request = -1, tout_response = -1;
TEST_1(nta = nta_agent_create(ag->ag_root, (url_string_t *)"sip:*:*",
NULL, NULL, TAG_END()));
@ -1301,10 +1301,10 @@ int main(int argc, char *argv[])
}
if (o_attach) {
char *response, line[10];
char line[10];
printf("nua_test: pid %lu\n", (unsigned long)getpid());
printf("<Press RETURN to continue>\n");
response = fgets(line, sizeof line, stdin);
fgets(line, sizeof line, stdin);
}
#if HAVE_ALARM
else if (o_alarm) {

View File

@ -63,4 +63,4 @@ EXTRA_DIST = Doxyfile nth.docs $(BUILT_SOURCES) \
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libnth_la_SOURCES) http-client.c http-server.c test_nth.c
@ -80,12 +55,8 @@ host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = test_nth$(EXEEXT) http-client$(EXEEXT) \
http-server$(EXEEXT)
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
$(top_srcdir)/rules/valcheck.am ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/nth
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -154,7 +125,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -201,12 +171,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -250,7 +216,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -349,8 +314,7 @@ test_nth_LDFLAGS = -static
EXTRA_DIST = Doxyfile nth.docs $(BUILT_SOURCES) \
agent.pem cafile.pem
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -376,14 +340,12 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -626,7 +588,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -777,92 +739,6 @@ clean-built-sources:
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# ----------------------------------------------------------------------
# Sofia specific rules
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -38,10 +38,7 @@
#include <string.h>
#include <stdio.h>
#include <assert.h>
#if HAVE_SIGNAL
#include <signal.h>
#endif
typedef struct context_s context_t;
#define NTH_SITE_MAGIC_T context_t
@ -80,10 +77,7 @@ static int request(context_t *context,
http_t const *http,
char const *path);
su_msg_r server_intr_msg = SU_MSG_R_INIT;
#if HAVE_SIGNAL
static RETSIGTYPE server_intr_handler(int signum);
#endif
static void server_break(context_t *c, su_msg_r msg, su_msg_arg_t *arg);
static msg_payload_t *read_payload(su_home_t *home, char const *fname);
@ -146,12 +140,12 @@ int main(int argc, char *argv[])
su_root_task(context->c_root),
server_break, 0);
#if HAVE_SIGNAL
signal(SIGINT, server_intr_handler);
#if HAVE_SIGQUIT
#ifndef _WIN32
signal(SIGPIPE, server_intr_handler);
signal(SIGQUIT, server_intr_handler);
signal(SIGHUP, server_intr_handler);
#endif
#endif
if (context->c_root) {

View File

@ -1094,7 +1094,7 @@ int hc_reply(nth_client_t * hc, int status, char const *phrase)
assert(status >= 400);
SU_DEBUG_5(("nth: hc_reply(%p, %u, %s)\n", (void *)hc, status, phrase));
SU_DEBUG_5(("nth: hc_reply(%p, %u, %s)\n", hc, status, phrase));
if (hc->hc_pending) {
tport_release(hc->hc_tport, hc->hc_pending, hc->hc_request, NULL, hc,

View File

@ -704,7 +704,7 @@ server_t *server_create(url_t const *url,
tag_type_t tag, tag_value_t value, ...)
{
server_t *srv;
msg_mclass_t const *mclass = NULL;
msg_mclass_t *mclass = NULL;
tp_name_t tpn[1] = {{ NULL }};
su_root_t *root = NULL;
http_server_t const *server = NULL;

View File

@ -96,6 +96,6 @@ EXTRA_DIST = Doxyfile nua.docs $(BUILT_SOURCES)
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
include ../sofia.am
TAG_DLL_FLAGS = LIST=nua_tag_list

View File

@ -24,33 +24,8 @@
# ----------------------------------------------------------------------
# Header paths
# common Makefile targets for libsofia-sip-ua(-glib) modules
# ----------------------------------------------------------
#
# run tests with valgrind
#
# Copyright (C) 2007 Nokia Corporation.
# 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 file contains free software from Makefile.in by the Free Software
# Foundation:
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
SOURCES = $(libnua_la_SOURCES) $(test_nua_SOURCES)
@ -79,12 +54,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = test_nua$(EXEEXT)
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
$(top_srcdir)/rules/valcheck.am ChangeLog
# Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/nua
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@ -149,7 +120,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@ -196,12 +166,8 @@ HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
HAVE_NTH_FALSE = @HAVE_NTH_FALSE@
HAVE_NTH_TRUE = @HAVE_NTH_TRUE@
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
HAVE_STUN_FALSE = @HAVE_STUN_FALSE@
HAVE_STUN_TRUE = @HAVE_STUN_TRUE@
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
INSTALL_DATA = @INSTALL_DATA@
@ -245,7 +211,6 @@ REPLACE_LIBADD = @REPLACE_LIBADD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOFIA_CFLAGS = @SOFIA_CFLAGS@
SOFIA_COVERAGE = @SOFIA_COVERAGE@
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
STRIP = @STRIP@
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
@ -376,8 +341,7 @@ test_nua_SOURCES = test_nua.c test_nua.h test_ops.c \
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = Doxyfile nua.docs $(BUILT_SOURCES)
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files
@ -403,8 +367,6 @@ INTERNAL_INCLUDES = \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su
VALGRIND = valgrind
VALGRINDFLAGS = --tool=memcheck
# ----------------------------------------------------------------------
# Sofia specific rules
@ -414,7 +376,7 @@ all: $(BUILT_SOURCES)
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -681,7 +643,7 @@ check-TESTS: $(TESTS)
else :; fi
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../rules $(distdir)/sofia-sip
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@ -832,92 +794,6 @@ clean-built-sources:
../sresolv/libsresolv.la ../stun/libstun.la ../su/libsu.la \
../tport/libtport.la ../url/liburl.la:
$(MAKE) -C $(@D) $(@F)
valcheck: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) valcheck-am
valcheck-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
# Run tests with valgrind in
valcheck-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if case $$tst in \
run*) VALGRIND="$(VALGRIND) $(VALGRINDFLAGS)" \
$(TESTS_ENVIRONMENT) $${dir}$$tst ;; \
*) $(TESTS_ENVIRONMENT) $(VALGRIND) $(VALGRINDFLAGS) \
$${dir}$$tst ;; \
esac ; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -67,7 +67,7 @@ char const nua_version[] = VERSION;
*
* The NUA_DEBUG environment variable is used to determine the debug logging
* level for @nua module. The default level is 3.
*
*
* @sa <sofia-sip/su_debug.h>, nua_log, SOFIA_DEBUG
*/
extern char const NUA_DEBUG[];
@ -76,8 +76,8 @@ extern char const NUA_DEBUG[];
#define SU_DEBUG 3
#endif
/**Debug log for @nua module.
*
/**Debug log for @nua module.
*
* The nua_log is the log object used by @nua module. The level of
* #nua_log is set using #NUA_DEBUG environment variable.
*/
@ -104,17 +104,16 @@ su_log_t nua_log[] = { SU_LOG_INIT("nua", "NUA_DEBUG", SU_DEBUG) };
* NUTAG_UICC() \n
* NUTAG_CERTIFICATE_DIR() \n
* and all tags listed in nua_set_params(), \n
* and all relevant NTATAG_* are passed to NTA \n
* and all tport tags listed in <sofia-sip/tport_tag.h>
* and all relevant NTATAG_* are passed to NTA.
*
* @note
* From the @VERSION_1_12_2 all the nua_set_params() tags are processed.
* From the @VERSION_1_12_2 all the nua_set_params() tags are processed.
* Previously all nutags except NUTAG_SOA_NAME() and NUTAG_MEDIA_ENABLE()
* were ignored.
*
* @note
* Both the NUTAG_URL() and NUTAG_SIPS_URL() are used to pass arguments to
* nta_agent_add_tport().
* nta_agent_add_tport().
*
* @par Events:
* none
@ -188,9 +187,9 @@ void nua_shutdown(nua_t *nua)
/** Destroy the @nua stack.
*
* Before calling nua_destroy() the application
* Before calling nua_destroy() the application
* should call nua_shutdown and wait for successful #nua_r_shutdown event.
* Shuts down and destroys the @nua stack. Ongoing calls, registrations,
* Shuts down and destroys the @nua stack. Ongoing calls, registrations,
* and subscriptions are left as they are.
*
* @param nua Pointer to @nua stack object
@ -212,8 +211,7 @@ void nua_destroy(nua_t *nua)
if (nua) {
if (!nua->nua_shutdown_final) {
SU_DEBUG_0(("nua_destroy(%p): FATAL: nua_shutdown not completed\n",
(void *)nua));
SU_DEBUG_0(("nua_destroy(%p): FATAL: nua_shutdown not completed\n", nua));
assert(nua->nua_shutdown);
return;
}
@ -244,7 +242,7 @@ nua_magic_t *nua_magic(nua_t *nua)
/** Obtain default operation handle of the @nua stack object.
*
* A default operation can be used for operations where the
* A default operation can be used for operations where the
* ultimate result is not important or can be discarded.
*
* @param nua Pointer to @nua stack object
@ -264,7 +262,7 @@ nua_handle_t *nua_default(nua_t *nua)
return nua ? nua->nua_handles : NULL;
}
/** Create an operation handle
/** Create an operation handle
*
* Allocates a new operation handle and associated storage.
*
@ -277,7 +275,7 @@ nua_handle_t *nua_default(nua_t *nua)
*
* @par Related tags:
* Duplicates the provided tags for use with every operation. Note that
* NUTAG_URL() is converted to SIPTAG_TO() if there is no SIPTAG_TO().
* NUTAG_URL() is converted to SIPTAG_TO() if there is no SIPTAG_TO().
* And also vice versa, request-URI is taken from SIPTAG_TO() if there
* is no NUTAG_URL(). Note that certain SIP headers cannot be saved with
* the handle. They include @ContentLength, @CSeq, @RSeq, @RAck, and
@ -304,7 +302,7 @@ nua_handle_t *nua_handle(nua_t *nua, nua_hmagic_t *hmagic,
ta_start(ta, tag, value);
nh = nh_create_handle(nua, hmagic, ta_args(ta));
if (nh)
nh->nh_ref_by_user = 1;
@ -314,7 +312,7 @@ nua_handle_t *nua_handle(nua_t *nua, nua_hmagic_t *hmagic,
return nh;
}
/** Bind a callback context to an operation handle.
/** Bind a callback context to an operation handle.
*
* @param nh Pointer to operation handle
* @param hmagic Pointer to callback context
@ -336,7 +334,7 @@ void nua_handle_bind(nua_handle_t *nh, nua_hmagic_t *hmagic)
nh->nh_magic = hmagic;
}
/** Fetch a callback context from an operation handle.
/** Fetch a callback context from an operation handle.
*
* @param nh Pointer to operation handle
*
@ -358,7 +356,7 @@ nua_hmagic_t *nua_handle_magic(nua_handle_t *nh)
if (NH_IS_VALID(nh))
magic = nh->nh_magic;
return magic;
}
@ -371,8 +369,8 @@ nua_hmagic_t *nua_handle_magic(nua_handle_t *nh)
*
* @param nh Pointer to operation handle
*
* @retval 0 no invite in operation or operation handle is invalid
* @retval 1 operation has invite
* @retval 0 no invite in operation or operation handle is invalid
* @retval 1 operation has invite
*
* @par Related tags:
* none
@ -385,15 +383,15 @@ int nua_handle_has_invite(nua_handle_t const *nh)
return nh ? nh->nh_has_invite : 0;
}
/**Check if operation handle has active event subscriptions.
/**Check if operation handle has active event subscriptions.
*
* Active subscription can be established either by nua_subscribe() or
* nua_refer() calls.
*
* @param nh Pointer to operation handle
*
* @retval 0 no event subscriptions in operation or
* operation handle is invalid
* @retval 0 no event subscriptions in operation or
* operation handle is invalid
* @retval !=0 operation has event subscriptions
*
* @par Related tags:
@ -418,7 +416,7 @@ int nua_handle_has_events(nua_handle_t const *nh)
*
* @param nh Pointer to operation handle
*
* @retval 0 no active registration in operation or
* @retval 0 no active registration in operation or
* operation handle is invalid
* @retval 1 operation has registration
*
@ -435,12 +433,12 @@ int nua_handle_has_registrations(nua_handle_t const *nh)
return nh && nh->nh_ds->ds_has_register;
}
/** Check if operation handle has been used with outgoing SUBSCRIBE of REFER request.
/** Check if operation handle has been used with outgoing SUBSCRIBE of REFER request.
*
* @param nh Pointer to operation handle
*
* @retval 0 no active subscription in operation or
* operation handle is invalid
* @retval 0 no active subscription in operation or
* operation handle is invalid
* @retval 1 operation has subscription.
*
* @par Related tags:
@ -472,7 +470,7 @@ int nua_handle_has_register(nua_handle_t const *nh)
return nh ? nh->nh_has_register : 0;
}
/** Check if operation handle has an active call
/** Check if operation handle has an active call
*
* @param nh Pointer to operation handle
*
@ -490,17 +488,17 @@ int nua_handle_has_active_call(nua_handle_t const *nh)
return nh ? nh->nh_active_call : 0;
}
/** Check if operation handle has a call on hold
/** Check if operation handle has a call on hold
*
* Please note that this status is not affected by remote end putting
* this end on hold. Remote end can put each media separately on hold
* and status is reflected on SOATAG_ACTIVE_AUDIO(), SOATAG_ACTIVE_VIDEO()
* Please note that this status is not affected by remote end putting
* this end on hold. Remote end can put each media separately on hold
* and status is reflected on SOATAG_ACTIVE_AUDIO(), SOATAG_ACTIVE_VIDEO()
* and SOATAG_ACTIVE_CHAT() tag values in #nua_i_state event.
*
* @param nh Pointer to operation handle
*
* @retval 0 if no call on hold in operation or operation handle is invalid
* @retval 1 if operation has call on hold, for example nua_invite() or
* @retval 0 if no call on hold in operation or operation handle is invalid
* @retval 1 if operation has call on hold, for example nua_invite() or
* nua_update() has been called with SOATAG_HOLD() with non-NULL
* argument.
*
@ -517,14 +515,14 @@ int nua_handle_has_call_on_hold(nua_handle_t const *nh)
/** Get the remote address (From/To header) of operation handle
*
* Remote address is used as To header in outgoing operations and
* Remote address is used as To header in outgoing operations and
* derived from From: header in incoming operations.
*
* @param nh Pointer to operation handle
*
* @retval NULL no remote address for operation or operation handle invalid
* @retval !=NULL pointer to remote address for operation
*
*
* @par Related tags:
* none
*
@ -538,14 +536,14 @@ sip_to_t const *nua_handle_remote(nua_handle_t const *nh)
/** Get the local address (From/To header) of operation handle
*
* Local address is used as From header in outgoing operations and
* Local address is used as From header in outgoing operations and
* derived from To: header in incoming operations.
*
* @param nh Pointer to operation handle
*
* @retval NULL no local address for operation or operation handle invalid
* @retval !=NULL pointer to local address for operation
*
*
* @par Related tags:
* none
*
@ -592,7 +590,7 @@ void nua_get_params(nua_t *nua, tag_type_t tag, tag_value_t value, ...)
ta_end(ta); \
} \
else { \
SU_DEBUG_1(("nua: " #event " with invalid handle %p\n", (void *)nh)); \
SU_DEBUG_1(("nua: " #event " with invalid handle %p\n", nh)); \
}
/* Documented with nua_stack_set_params() */
@ -660,18 +658,18 @@ void nua_method(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
NUA_SIGNAL(nh, nua_r_method, tag, value);
}
/** Send a chat message.
/** Send a chat message.
*
* A chat channel can be established during call setup using "message" media.
* An active chat channel is indicated using #nua_i_state event containing
* SOATAG_ACTIVE_CHAT() tag. Chat messages can be sent using this channel with
* nua_chat() function. Currently this is implemented using SIP MESSAGE
* A chat channel can be established during call setup using "message" media.
* An active chat channel is indicated using #nua_i_state event containing
* SOATAG_ACTIVE_CHAT() tag. Chat messages can be sent using this channel with
* nua_chat() function. Currently this is implemented using SIP MESSAGE
* requests but in future MSRP (message session protocol) will replace it.
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
* @return
* @return
* nothing
*
* @par Related Tags:
@ -709,18 +707,18 @@ void nua_notify(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
/* nua_r_notify is documented with process_response_to_notify() */
/** Create an event server.
/** Create an event server.
*
* This function create an event server taking care of sending NOTIFY
* requests and responding to further SUBSCRIBE requests. The event
* server can accept multiple subscriptions from several sources and
* takes care for distributing the notifications. Unlike other functions
* This function create an event server taking care of sending NOTIFY
* requests and responding to further SUBSCRIBE requests. The event
* server can accept multiple subscriptions from several sources and
* takes care for distributing the notifications. Unlike other functions
* this call only accepts the SIP tags listed below.
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
* @return
* @return
* nothing
*
* @par Related Tags:
@ -738,7 +736,7 @@ void nua_notifier(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
NUA_SIGNAL(nh, nua_r_notifier, tag, value);
}
/** Terminate an event server.
/** Terminate an event server.
*
* Terminate an event server with matching event and content type. The event
* server was created earlier with nua_notifier() function.
@ -746,7 +744,7 @@ void nua_notifier(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
* @return
* @return
* nothing
*
* @par Related Tags:
@ -811,7 +809,7 @@ void nua_update(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
* @return
* @return
* nothing
*
* @par Related Tags:
@ -829,7 +827,7 @@ void nua_authenticate(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
*
* After creating a local presence server by nua_notifier(), an incoming
* SUBSCRIBE request causes #nua_i_subscription event. Each subscriber is
* identified with NEATAG_SUB() tag in the #nua_i_subscription event.
* identified with NEATAG_SUB() tag in the #nua_i_subscription event.
* Application can either authorize the subscriber with
* NUTAG_SUBSTATE(#nua_substate_active) or terminate the subscription with
* NUTAG_SUBSTATE(#nua_substate_terminated).
@ -837,7 +835,7 @@ void nua_authenticate(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
* @return
* @return
* nothing
*
* @par Related Tags:
@ -877,11 +875,11 @@ void nua_respond(nua_handle_t *nh,
ta_end(ta);
}
else {
SU_DEBUG_1(("nua: respond with invalid handle %p\n", (void *)nh));
SU_DEBUG_1(("nua: respond with invalid handle %p\n", nh));
}
}
/** Destroy a handle
/** Destroy a handle
*
* Terminate the protocol state associated with an operation handle. The
* stack discards resources and terminates the ongoing dialog usage,
@ -895,7 +893,7 @@ void nua_respond(nua_handle_t *nh,
*
* @param nh Pointer to operation handle
*
* @return
* @return
* nothing
*
* @par Related Tags:
@ -956,14 +954,11 @@ void nua_signal(nua_t *nua, nua_handle_t *nh, msg_t *msg, int always,
e->e_status = status;
e->e_phrase = phrase;
SU_DEBUG_7(("nua(%p): signal %s\n", (void *)nh,
nua_event_name(event) + 4));
if (su_msg_send(sumsg) != 0 && event != nua_r_destroy)
if (su_msg_send(sumsg) != 0)
nua_handle_unref(nh);
}
}
else {
/* XXX - we should return error code to application but we just abort() */
/* XXX - we should return error code to application */
assert(ENOMEM == 0);
}
@ -986,16 +981,8 @@ void nua_event(nua_t *root_magic, su_msg_r sumsg, event_t *e)
}
if (!nh || !nh->nh_valid) { /* Handle has been destroyed */
if (nua_log->log_level >= 7) {
char const *name = nua_event_name(e->e_event) + 4;
SU_DEBUG_7(("nua(%p): event %s dropped\n", (void *)nh, name));
}
if (nh && !NH_IS_DEFAULT(nh) && nua_handle_unref(nh)) {
#if HAVE_NUA_HANDLE_DEBUG
SU_DEBUG_0(("nua(%p): freed by application\n", (void *)nh));
#else
SU_DEBUG_9(("nua(%p): freed by application\n", (void *)nh));
#endif
SU_DEBUG_9(("nua(%p): freed by application\n", nh));
}
if (e->e_msg)
msg_destroy(e->e_msg), e->e_msg = NULL;
@ -1024,11 +1011,7 @@ void nua_event(nua_t *root_magic, su_msg_r sumsg, event_t *e)
e->e_tags);
if (nh && !NH_IS_DEFAULT(nh) && nua_handle_unref(nh)) {
#if HAVE_NUA_HANDLE_DEBUG
SU_DEBUG_0(("nua(%p): freed by application\n", (void *)nh));
#else
SU_DEBUG_9(("nua(%p): freed by application\n", (void *)nh));
#endif
SU_DEBUG_9(("nua(%p): freed by application\n", nh));
}
if (!su_msg_is_non_null(nua->nua_current))
@ -1083,7 +1066,7 @@ void nua_destroy_event(nua_saved_event_t saved[1])
msg_destroy(e->e_msg), e->e_msg = NULL;
if (nh && !NH_IS_DEFAULT(nh) && nua_handle_unref(nh)) {
SU_DEBUG_9(("nua(%p): freed by application\n", (void *)nh));
SU_DEBUG_9(("nua(%p): freed by application\n", nh));
}
su_msg_destroy(saved);
@ -1110,36 +1093,21 @@ static int nua_stack_handle_make_replaces_call(void *arg)
/**Generate a @Replaces header for handle.
*
* A @Replaces header contains the @CallID value, @From and @To tags
* corresponding to SIP dialog associated with handle @a nh. Note that the
* @Replaces matches with dialog of the remote peer,
* nua_handle_by_replaces() does not return same handle (unless you swap
* rp_from_tag and rp_to_tag in @Replaces header).
*
* A @Replaces header is used in attended transfer, among other things.
*
* @param nh pointer to operation handle
* @param home memory home used to allocate the header
* @param early_only if true, include "early-only" parameter in @Replaces, too
*
* @return A newly created @Replaces header.
*
* @since New in @VERSION_1_12_4.
*
* @sa nua_handle_by_replaces(), @Replaces, @RFC3891, @RFC3515, nua_refer(),
* #nua_i_refer(), @ReferTo, nta_leg_make_replaces(),
* sip_headers_as_url_query()
* @sa nua_handle_by_replaces(), @Replaces, @RFC3891, nua_refer(),
* #nua_i_refer, @ReferTo, nta_leg_make_replaces()
*/
sip_replaces_t *nua_handle_make_replaces(nua_handle_t *nh,
sip_replaces_t *nua_handle_make_replaces(nua_handle_t *nh,
su_home_t *home,
int early_only)
{
if (nh && nh->nh_valid && nh->nh_nua) {
struct nua_stack_handle_make_replaces_args a = { NULL, nh, home, early_only };
if (su_task_execute(nh->nh_nua->nua_server,
nua_stack_handle_make_replaces_call, (void *)&a,
if (su_task_execute(nh->nh_nua->nua_server,
nua_stack_handle_make_replaces_call, (void *)&a,
NULL) == 0) {
return a.retval;
}
@ -1166,9 +1134,9 @@ static int nua_stack_handle_by_replaces_call(void *arg)
*
* @since New in @VERSION_1_12_4.
*
* @note
* @note
* You should release the reference with nua_handle_unref() when you are
* done with the handle.
* done with handle.
*
* @sa nua_handle_make_replaces(), @Replaces, @RFC3891, nua_refer(),
* #nua_i_refer, @ReferTo, nta_leg_by_replaces()
@ -1178,8 +1146,8 @@ nua_handle_t *nua_handle_by_replaces(nua_t *nua, sip_replaces_t const *r)
if (nua) {
struct nua_stack_handle_by_replaces_args a = { NULL, nua, r };
if (su_task_execute(nua->nua_server,
nua_stack_handle_by_replaces_call, (void *)&a,
if (su_task_execute(nua->nua_server,
nua_stack_handle_by_replaces_call, (void *)&a,
NULL) == 0) {
nua_handle_t *nh = a.retval;

View File

@ -1124,7 +1124,7 @@ follows:
<td>terminating</td>
<td>Process answer</td>
<td>
If there was a failure in SDP negotiation or other failure with media,
If there was an failure in SDP negotiation or other failure with media,
the stack will automatically terminate the call. The BYE follows
immediatelhy after the ACK.
</td></tr>
@ -1262,7 +1262,7 @@ does not include the extensions like @b 100rel or @b UPDATE.
| +---------------| | : | :
| | +------------+ : | :
| | | : | :
| | nua_respond/18X (2a) : | :
| | nua_respond/18X (2) : | :
| | | : | :
| | V V | :
| | +------------+ | :
@ -2219,7 +2219,7 @@ NUTAG_AUTOANSWER(0) on B side, NUTAG_AUTOACK(0) on A side.
* @param nh operation handle associated with the notifier
* @param hmagic operation magic associated with the notifier
* @param sip response to MESSAGE request or NULL upon an error
* (error code and message are in status and phrase parameters)
* (error code and message are in status an phrase parameters)
* @param tags empty
*
* @sa nua_chat(), #nua_r_message

View File

@ -110,14 +110,13 @@ nua_handle_t *nh_create_handle(nua_t *nua,
assert(nua->nua_home);
if ((nh = su_home_clone(nua->nua_home, sizeof(*nh)))) {
nh->nh_valid = nua_valid_handle_cookie;
nh->nh_valid = nua_handle;
nh->nh_nua = nua;
nh->nh_magic = hmagic;
nh->nh_prefs = nua->nua_dhandle->nh_prefs;
if (nua_handle_save_tags(nh, tags) < 0) {
SU_DEBUG_5(("nua(%p): creating handle %p failed\n",
(void *)nua, (void *)nh));
SU_DEBUG_5(("nua(%p): creating handle %p failed\n", nua, nh));
su_home_unref(nh->nh_home), nh = NULL;
}
@ -137,7 +136,7 @@ nua_handle_t *nh_create_handle(nua_t *nua,
}
else {
_handle_lifetime = 2;
SU_DEBUG_0(("nh_handle_create(%p)\n", (void *)nh));
SU_DEBUG_0(("nh_handle_create(%p)\n", nh));
su_home_destructor(nh->nh_home, nh_destructor);
}
}
@ -160,11 +159,9 @@ extern char const _NUA_HANDLE_DEBUG[];
static void nh_destructor(void *arg)
{
nua_handle_t *nh = arg;
SU_DEBUG_0(("nh_destructor(%p)\n", (void *)nh));
}
#undef nua_handle_ref
#undef nua_handle_unref
SU_DEBUG_0(("nh_destructor(%p)\n", nh));
}
/** Make a new reference to handle.
*
@ -183,6 +180,7 @@ nua_handle_t *nua_handle_ref(nua_handle_t *nh)
return (nua_handle_t *)su_home_ref(nh->nh_home);
}
/** Destroy reference to handle.
*
* The handles use reference counting for memory management. In addition to
@ -303,34 +301,3 @@ char const *nua_callstate_name(enum nua_callstate state)
default: return "UNKNOWN";
}
}
/** Return name of subscription state. @NEW_1_12_5. */
char const *nua_substate_name(enum nua_substate substate)
{
switch (substate) {
case nua_substate_embryonic:
/*FALLTHROUGH*/
case nua_substate_pending:
return "pending";
case nua_substate_terminated:
return "terminated";
case nua_substate_active:
/*FALLTHROUGH*/
default:
return "active";
}
}
/** Convert string to enum nua_substate. @NEW_1_12_5. */
enum nua_substate nua_substate_make(char const *sip_substate)
{
if (sip_substate == NULL)
return nua_substate_active;
else if (strcasecmp(sip_substate, "terminated") == 0)
return nua_substate_terminated;
else if (strcasecmp(sip_substate, "pending") == 0)
return nua_substate_pending;
else /* if (strcasecmp(sip_substate, "active") == 0) */
return nua_substate_active;
}

View File

@ -269,7 +269,7 @@ nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own,
du = *prev_du;
if (du) { /* Already exists */
SU_DEBUG_5(("nua(%p): adding already existing %s usage%s%s\n",
(void *)own, nua_dialog_usage_name(du),
own, nua_dialog_usage_name(du),
event ? " with event " : "", event ? event->o_type : ""));
if (prev_du != &ds->ds_usage) {
@ -297,7 +297,7 @@ nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own,
}
SU_DEBUG_5(("nua(%p): adding %s usage%s%s\n",
(void *)own, nua_dialog_usage_name(du),
own, nua_dialog_usage_name(du),
o ? " with event " : "", o ? o->o_type :""));
su_home_ref(own);
@ -345,24 +345,6 @@ void nua_dialog_usage_remove_at(nua_owner_t *own,
nua_client_request_t *cr, *cr_next;
nua_server_request_t *sr, *sr_next;
*at = du->du_next;
o = du->du_event;
SU_DEBUG_5(("nua(%p): removing %s usage%s%s\n",
(void *)own, nua_dialog_usage_name(du),
o ? " with event " : "", o ? o->o_type :""));
du->du_class->usage_remove(own, ds, du);
/* Destroy saved client request */
if (nua_client_is_bound(du->du_cr)) {
nua_client_bind(cr = du->du_cr, NULL);
if (!nua_client_is_queued(cr) &&
!nua_client_is_reporting(cr))
nua_client_request_destroy(cr);
}
/* Clean references from queued client requests */
for (cr = ds->ds_cr; cr; cr = cr_next) {
cr_next = cr->cr_next;
if (cr->cr_usage == du)
@ -375,20 +357,29 @@ void nua_dialog_usage_remove_at(nua_owner_t *own,
nua_server_request_destroy(sr);
}
*at = du->du_next;
o = du->du_event;
SU_DEBUG_5(("nua(%p): removing %s usage%s%s\n",
own, nua_dialog_usage_name(du),
o ? " with event " : "", o ? o->o_type :""));
du->du_class->usage_remove(own, ds, du);
msg_destroy(du->du_msg), du->du_msg = NULL;
su_home_unref(own);
su_free(own, du);
}
/* Zap dialog if there are no more usages */
if (ds->ds_terminated)
;
else if (ds->ds_usage == NULL) {
nua_dialog_remove(own, ds, NULL);
/* Zap dialog if there is no more usages */
if (ds->ds_usage == NULL) {
nta_leg_destroy(ds->ds_leg), ds->ds_leg = NULL;
su_free(own, (void *)ds->ds_remote_tag), ds->ds_remote_tag = NULL;
ds->ds_route = 0;
ds->ds_has_events = 0;
ds->ds_terminated = 0;
return;
}
else {
else if (!ds->ds_terminated) {
nua_dialog_log_usage(own, ds);
}
}
@ -421,7 +412,7 @@ void nua_dialog_log_usage(nua_owner_t *own, nua_dialog_state_t *ds)
}
}
SU_DEBUG_3(("nua(%p): handle with %s%s%s\n", (void *)own,
SU_DEBUG_3(("nua(%p): handle with %s%s%s\n", own,
ds->ds_has_session ? "session and " : "",
ds->ds_has_events ? "events " : "",
buffer));
@ -439,11 +430,12 @@ void nua_dialog_deinit(nua_owner_t *own,
/** @internal Dialog has been terminated. Remove all usages. */
void nua_dialog_remove_usages(nua_owner_t *own,
struct nua_dialog_state *ds,
int status,
char const *phrase)
void nua_dialog_terminated(nua_owner_t *own,
struct nua_dialog_state *ds,
int status,
char const *phrase)
{
ds->ds_terminated = 1;
while (ds->ds_usage) {
@ -457,8 +449,6 @@ void nua_dialog_remove_usages(nua_owner_t *own,
#endif
nua_dialog_usage_remove_at(own, ds, &ds->ds_usage);
}
nua_dialog_remove(own, ds, NULL);
}
/**@internal
@ -534,8 +524,7 @@ void nua_dialog_usage_refresh_range(nua_dialog_usage_t *du,
/**@internal Do not refresh. */
void nua_dialog_usage_reset_refresh(nua_dialog_usage_t *du)
{
if (du)
du->du_refresh = 0;
du->du_refresh = 0;
}
/** @internal Refresh usage or shutdown usage if @a now is 0. */
@ -548,45 +537,18 @@ void nua_dialog_usage_refresh(nua_owner_t *owner,
du->du_refresh = 0;
if (now > 0) {
assert(du->du_class->usage_refresh);
du->du_class->usage_refresh(owner, ds, du, now);
if (du->du_class->usage_refresh) {
du->du_class->usage_refresh(owner, ds, du, now);
return;
}
}
else {
du->du_shutdown = 1;
assert(du->du_class->usage_shutdown);
du->du_class->usage_shutdown(owner, ds, du);
}
}
}
/** Terminate all dialog usages gracefully. */
int nua_dialog_shutdown(nua_owner_t *owner, nua_dialog_state_t *ds)
{
nua_dialog_usage_t *du;
ds->ds_terminated = 1;
do {
for (du = ds->ds_usage; du; du = du->du_next) {
if (!du->du_shutdown) {
nua_dialog_usage_shutdown(owner, ds, du);
break;
if (du->du_class->usage_shutdown) {
du->du_class->usage_shutdown(owner, ds, du);
return;
}
}
} while (du);
return 1;
}
/** (Gracefully) terminate usage */
void nua_dialog_usage_shutdown(nua_owner_t *owner,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
if (du) {
du->du_refresh = 0;
du->du_shutdown = 1;
assert(du->du_class->usage_shutdown);
du->du_class->usage_shutdown(owner, ds, du);
}
}

View File

@ -48,74 +48,36 @@ typedef NUA_OWNER_T nua_owner_t;
#include <sofia-sip/nta.h>
#endif
typedef su_msg_r nua_saved_signal_t;
typedef struct nua_server_request nua_server_request_t;
typedef struct nua_client_request nua_client_request_t;
typedef struct {
sip_method_t sm_method;
char const *sm_method_name;
/** Respond to an incoming request. */
typedef int nua_server_respond_f(nua_server_request_t *, tagi_t const *);
int sm_event;
struct {
unsigned create_dialog:1, in_dialog:1, target_refresh:1, add_contact:1;
unsigned :0;
} sm_flags;
/** Initialize server-side request. */
int (*sm_init)(nua_server_request_t *sr);
/** Preprocess server-side request (after handle has been created). */
int (*sm_preprocess)(nua_server_request_t *sr);
/** Update server-side request parameters */
int (*sm_params)(nua_server_request_t *sr, tagi_t const *tags);
/** Respond to server-side request. */
int (*sm_respond)(nua_server_request_t *sr, tagi_t const *tags);
/** Report server-side request to application. */
int (*sm_report)(nua_server_request_t *sr, tagi_t const *tags);
} nua_server_methods_t;
/** Restart an outgoing request. */
typedef void nua_creq_restart_f(nua_owner_t *, tagi_t *tags);
/** Server side transaction */
struct nua_server_request {
struct nua_server_request *sr_next, **sr_prev;
nua_server_methods_t const *sr_methods;
nua_owner_t *sr_owner; /**< Backpointer to handle */
nua_dialog_usage_t *sr_usage; /**< Backpointer to usage */
nta_incoming_t *sr_irq; /**< Server transaction object */
/** When the application responds to an request with
* nua_respond(), the sr_respond() is called
*/
nua_server_respond_f *sr_respond;
struct {
msg_t *msg; /**< Request message */
sip_t const *sip; /**< Headers in request message */
} sr_request;
struct {
msg_t *msg; /**< Response message */
sip_t *sip; /**< Headers in response message */
} sr_response;
nta_incoming_t *sr_irq; /**< Server transaction object */
msg_t *sr_msg; /**< Request message */
sip_method_t sr_method; /**< Request method */
int sr_application; /**< Status by application */
int sr_status; /**< Status code */
char const *sr_phrase; /**< Status phrase */
unsigned sr_event:1; /**< Reported to application */
unsigned sr_auto:1; /**< Autoresponse - no event has been sent */
unsigned sr_initial:1; /**< Handle was created by this request */
unsigned sr_add_contact:1; /**< Add Contact header to the response */
unsigned sr_terminating:1; /**< Terminate usage after final response */
unsigned sr_gracefully:1; /**< Terminate usage gracefully */
unsigned sr_neutral:1; /**< No effect on session or other usage */
/* Flags used with offer-answer */
unsigned sr_offer_recv:1; /**< We have received an offer */
@ -123,12 +85,13 @@ struct nua_server_request {
unsigned sr_offer_sent:1; /**< We have offered SDP */
unsigned sr_answer_recv:1; /**< We have received SDP answer */
unsigned :0;
char const *sr_sdp; /**< SDP received from client */
size_t sr_sdp_len; /**< ... and its length */
};
#define SR_INIT(sr) \
((void)memset((sr), 0, sizeof (sr)[0]), \
(void)(SR_STATUS1((sr), SIP_100_TRYING)), \
sr)
#define SR_STATUS(sr, status, phrase) \
((sr)->sr_phrase = (phrase), (sr)->sr_status = (status))
@ -141,180 +104,37 @@ int sr_status(nua_server_request_t *sr, int status, char const *phrase)
return (void)(sr->sr_phrase = phrase), (sr->sr_status = status);
}
/** Methods for client request */
typedef struct {
sip_method_t crm_method;
char const *crm_method_name;
size_t crm_extra; /**< Size of private data */
struct {
unsigned create_dialog:1, in_dialog:1, target_refresh:1;
unsigned:0;
} crm_flags;
/** Generate a request message.
*
* @retval 1 when request message has been created
* @retval 0 when request message should be created in normal fashion
* @retval -1 upon an error
*/
int (*crm_template)(nua_client_request_t *cr,
msg_t **return_msg,
tagi_t const *tags);
/**@a crm_init is called when a client request is sent first time.
*
* @retval 1 when request has been responded
* @retval 0 when request should be sent in normal fashion
* @retval -1 upon an error
*/
int (*crm_init)(nua_client_request_t *, msg_t *msg, sip_t *sip,
tagi_t const *tags);
/** @a crm_send is called each time when a client request is sent.
*
* @retval 1 when request has been responded
* @retval 0 when request has been sent
* @retval -1 upon an error (request message has not been destroyed)
* @retval -2 upon an error (request message has been destroyed)
*/
int (*crm_send)(nua_client_request_t *,
msg_t *msg, sip_t *sip,
tagi_t const *tags);
/** @a crm_check_restart is called each time when a response is received.
*
* It is used to restart reqquest after responses with method-specific
* status code or method-specific way of restarting the request.
*
* @retval 1 when request has been restarted
* @retval 0 when response should be processed normally
*/
int (*crm_check_restart)(nua_client_request_t *,
int status, char const *phrase,
sip_t const *sip);
/** @a crm_recv is called each time a final response is received.
*
* A final response is in range 200 .. 699 (or internal response) and it
* cannot be restarted.
*
* crm_recv() should call nua_base_client_response() or
* nua_base_client_tresponse(). The return values below are documented with
* nua_base_client_response(), too.
*
* @retval 0 if response was preliminary
* @retval 1 if response was final
* @retval 2 if response destroyed the handle, too.
*/
int (*crm_recv)(nua_client_request_t *,
int status, char const *phrase,
sip_t const *sip);
/** @a crm_preliminary is called each time a preliminary response is received.
*
* A preliminary response is in range 101 .. 199.
*
* crm_preliminary() should call nua_base_client_response() or
* nua_base_client_tresponse().
*
* @retval 0 if response was preliminary
* @retval 1 if response was final
* @retval 2 if response destroyed the handle, too.
*/
int (*crm_preliminary)(nua_client_request_t *,
int status, char const *phrase,
sip_t const *sip);
/** @a crm_report is called each time a response is received and it is
* reported to the application.
*
* The status and phrase may be different from the status and phrase
* received from the network, e.g., when the request is restarted.
*
* @return The return value should be 0. It is currently ignored.
*/
int (*crm_report)(nua_client_request_t *,
int status, char const *phrase,
sip_t const *sip,
nta_outgoing_t *orq,
tagi_t const *tags);
/** @a crm_deinit is called when a client-side request is destroyed.
*
* @return The return value should be 0. It is currently ignored.
*/
int (*crm_deinit)(nua_client_request_t *);
} nua_client_methods_t;
/* Client-side request. Documented by nua_client_create() */
struct nua_client_request
{
nua_client_request_t *cr_next, **cr_prev; /**< Linked list of requests */
nua_owner_t *cr_owner;
nua_dialog_usage_t *cr_usage;
nua_saved_signal_t cr_signal;
tagi_t const *cr_tags;
nua_client_methods_t const *cr_methods;
msg_t *cr_msg;
sip_t *cr_sip;
nta_outgoing_t *cr_orq;
nua_client_request_t *cr_next; /**< Linked list of requests */
/*nua_event_t*/ int cr_event; /**< Request event */
sip_method_t cr_method;
char const *cr_method_name;
url_t *cr_target;
uint32_t cr_seq;
unsigned short cr_status; /**< Latest status */
nua_creq_restart_f *cr_restart;
nta_outgoing_t *cr_orq;
msg_t *cr_msg;
nua_dialog_usage_t *cr_usage;
unsigned short cr_retry_count; /**< Retry count for this request */
/* Flags used with offer-answer */
unsigned short cr_answer_recv; /**< Recv answer in response
* with this status.
*/
unsigned cr_offer_sent:1; /**< Sent offer in this request */
unsigned cr_offer_sent:1; /**< Sent offer in this request */
unsigned cr_offer_recv:1; /**< Recv offer in a response */
unsigned cr_answer_sent:1; /**< Sent answer in (PR)ACK */
unsigned cr_offer_recv:1; /**< Recv offer in a response */
unsigned cr_answer_sent:1; /**< Sent answer in (PR)ACK */
/* Flags with usage */
unsigned cr_neutral:1; /**< No effect on session or other usage */
/* Lifelong flags? */
unsigned cr_auto:1; /**< Request was generated by stack */
unsigned cr_has_contact:1; /**< Request has user Contact */
unsigned cr_contactize:1; /**< Request needs Contact */
/* Current state */
unsigned cr_challenged:1; /**< Request was challenged, pending auth */
unsigned cr_restarting:1; /**< Request is being restarted */
unsigned cr_reporting:1; /**< Reporting in progress */
unsigned cr_terminating:1; /**< Request terminates the usage */
signed int cr_terminated:2; /**< Response terminated usage (1) or
whole dialog (-1) */
unsigned cr_graceful:1; /**< Graceful termination required */
unsigned cr_has_contact:1; /**< Request has application contact */
};
struct nua_dialog_state
{
nua_client_request_t ds_cr[1];
nua_server_request_t *ds_sr;
/** Dialog usages. */
nua_dialog_usage_t *ds_usage;
/** Client requests */
nua_client_request_t *ds_cr;
/** Server requests */
nua_server_request_t *ds_sr;
/* Dialog and subscription state */
unsigned ds_route:1; /**< We have route */
unsigned ds_terminated:1; /**< Being terminated */
@ -323,8 +143,7 @@ struct nua_dialog_state
unsigned ds_has_register:1; /**< We have registration */
unsigned ds_has_publish:1; /**< We have publish */
unsigned ds_got_session:1; /**< We have (or have had) session */
unsigned ds_got_referrals:1; /**< We have (or have had) referrals */
unsigned ds_has_referrals:1; /**< We have (or have had) referrals */
unsigned :0;
@ -377,8 +196,8 @@ typedef struct {
struct nua_dialog_usage {
nua_dialog_usage_t *du_next;
nua_usage_class const *du_class;
nua_client_request_t *du_cr; /**< Client request bound with usage */
unsigned du_terminating:1; /**< Now trying to terminate usage */
unsigned du_ready:1; /**< Established usage */
unsigned du_shutdown:1; /**< Shutdown in progress */
unsigned:0;
@ -393,6 +212,7 @@ struct nua_dialog_usage {
sip_event_t const *du_event; /**< Event of usage */
msg_t *du_msg; /**< Template message */
};
void nua_dialog_uac_route(nua_owner_t *, nua_dialog_state_t *ds,
@ -423,12 +243,10 @@ void nua_dialog_usage_remove(nua_owner_t *,
void nua_dialog_deinit(nua_owner_t *own,
nua_dialog_state_t *ds);
int nua_dialog_shutdown(nua_owner_t *owner, nua_dialog_state_t *ds);
void nua_dialog_remove_usages(nua_owner_t *,
struct nua_dialog_state *ds,
int status,
char const *phrase);
void nua_dialog_terminated(nua_owner_t *,
struct nua_dialog_state *ds,
int status,
char const *phrase);
void nua_dialog_usage_set_expires(nua_dialog_usage_t *du, unsigned delta);
@ -444,10 +262,6 @@ void nua_dialog_usage_refresh(nua_owner_t *owner,
nua_dialog_usage_t *du,
sip_time_t now);
void nua_dialog_usage_shutdown(nua_owner_t *owner,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du);
static inline
int nua_dialog_is_established(nua_dialog_state_t const *ds)
{
@ -473,171 +287,18 @@ nua_dialog_usage_t *nua_dialog_usage_public(void const *p)
/* ---------------------------------------------------------------------- */
int nua_client_create(nua_owner_t *owner,
int event,
nua_client_methods_t const *methods,
tagi_t const *tags);
int nua_client_tcreate(nua_owner_t *nh,
int event,
nua_client_methods_t const *methods,
tag_type_t tag, tag_value_t value, ...);
static inline
void *nua_private_client_request(nua_client_request_t const *cr)
{
return (void *)(cr + 1);
}
void nua_client_request_destroy(nua_client_request_t *);
int nua_client_request_queue(nua_client_request_t *cr);
static inline int nua_client_is_queued(nua_client_request_t const *cr)
{
return cr && cr->cr_prev;
}
nua_client_request_t *nua_client_request_remove(nua_client_request_t *cr);
int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du);
static inline int nua_client_is_bound(nua_client_request_t const *cr)
{
return cr && cr->cr_usage && cr->cr_usage->du_cr == cr;
}
static inline int nua_client_is_reporting(nua_client_request_t const *cr)
{
return cr && cr->cr_reporting;
}
/** Mark client request as a terminating one */
static inline void nua_client_terminating(nua_client_request_t *cr)
{
cr->cr_terminating = 1;
}
int nua_client_init_request(nua_client_request_t *cr);
int nua_client_resend_request(nua_client_request_t *cr,
int terminating,
tagi_t const *tags);
int nua_base_client_request(nua_client_request_t *cr,
msg_t *msg,
sip_t *sip,
tagi_t const *tags);
int nua_base_client_trequest(nua_client_request_t *cr,
msg_t *msg,
sip_t *sip,
tag_type_t tag, tag_value_t value, ...);
extern nta_response_f nua_client_orq_response;
int nua_client_return(nua_client_request_t *cr,
int status,
char const *phrase,
msg_t *to_be_destroyed);
int nua_client_response(nua_client_request_t *cr,
int status,
char const *phrase,
sip_t const *sip);
int nua_client_check_restart(nua_client_request_t *cr,
int status,
char const *phrase,
sip_t const *sip);
int nua_base_client_check_restart(nua_client_request_t *cr,
int status,
char const *phrase,
sip_t const *sip);
int nua_client_restart(nua_client_request_t *cr,
int status, char const *phrase);
int nua_base_client_response(nua_client_request_t *cr,
int status, char const *phrase,
sip_t const *sip,
tagi_t const *tags);
int nua_base_client_tresponse(nua_client_request_t *cr,
int status, char const *phrase,
sip_t const *sip,
tag_type_t tag, tag_value_t value, ...);
int nua_client_set_target(nua_client_request_t *cr, url_t const *target);
int nua_client_report(nua_client_request_t *cr,
int status, char const *phrase,
sip_t const *sip,
nta_outgoing_t *orq,
tagi_t const *tags);
nua_client_request_t *nua_client_request_pending(nua_client_request_t const *);
int nua_client_init_requests(nua_client_request_t *cr,
void const *cr0,
int invite);
/* ---------------------------------------------------------------------- */
extern nua_server_methods_t const
nua_extension_server_methods,
nua_invite_server_methods, /**< INVITE */
nua_bye_server_methods, /**< BYE */
nua_options_server_methods, /**< OPTIONS */
nua_register_server_methods, /**< REGISTER */
nua_info_server_methods, /**< INFO */
nua_prack_server_methods, /**< PRACK */
nua_update_server_methods, /**< UPDATE */
nua_message_server_methods, /**< MESSAGE */
nua_subscribe_server_methods, /**< SUBSCRIBE */
nua_notify_server_methods, /**< NOTIFY */
nua_refer_server_methods, /**< REFER */
nua_publish_server_methods; /**< PUBLISH */
/** Return true if we have not sent final response to request */
static inline
int nua_server_request_is_pending(nua_server_request_t const *sr)
{
return sr && sr->sr_response.msg;
}
void nua_server_request_destroy(nua_server_request_t *sr);
int nua_base_server_init(nua_server_request_t *sr);
int nua_server_respond(nua_server_request_t *sr,
int status, char const *phrase,
tag_type_t tag, tag_value_t value, ...);
#define nua_base_server_init NULL
msg_t *nua_server_response(nua_server_request_t *sr,
int status, char const *phrase,
tag_type_t tag, tag_value_t value, ...);
int nua_base_server_preprocess(nua_server_request_t *sr);
int nua_default_respond(nua_server_request_t *sr,
tagi_t const *tags);
#define nua_base_server_preprocess NULL
int nua_server_params(nua_server_request_t *sr, tagi_t const *tags);
int nua_base_server_params(nua_server_request_t *sr, tagi_t const *tags);
#define nua_base_server_params NULL
int nua_server_trespond(nua_server_request_t *sr,
tag_type_t tag, tag_value_t value, ...);
int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags);
int nua_base_server_trespond(nua_server_request_t *sr,
tag_type_t tag, tag_value_t value, ...);
int nua_base_server_respond(nua_server_request_t *sr,
tagi_t const *tags);
int nua_server_report(nua_server_request_t *sr);
int nua_base_server_treport(nua_server_request_t *sr,
tag_type_t tag, tag_value_t value, ...);
int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags);
/* ---------------------------------------------------------------------- */
#endif /* NUA_DIALOG_H */

View File

@ -45,6 +45,9 @@
#include <sofia-sip/sip_status.h>
#include <sofia-sip/su_tagarg.h>
#define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#define NEA_SMAGIC_T struct nua_handle_s
#define NEA_EMAGIC_T struct nua_handle_s
@ -118,13 +121,13 @@ nua_stack_notifier(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *ta
status = 900, phrase = "Error when notifying watchers";
else
nua_stack_tevent(nua, nh, NULL, e, status = SIP_200_OK,
SIPTAG_EVENT(event),
SIPTAG_CONTENT_TYPE(ct),
TAG_END());
nua_stack_event(nua, nh, NULL, e, status = SIP_200_OK,
SIPTAG_EVENT(event),
SIPTAG_CONTENT_TYPE(ct),
TAG_END());
if (status != 200)
nua_stack_event(nua, nh, NULL, e, status, phrase, NULL);
nua_stack_event(nua, nh, NULL, e, status, phrase, TAG_END());
su_home_deinit(home);
}
@ -220,7 +223,7 @@ void authorize_watcher(nea_server_t *nes,
what = "active";
}
SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n", (void *)nh, what));
SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n", nh, what));
nea_sub_auth(sn->sn_subscriber, substate,
TAG_IF(substate == nua_substate_pending,
NEATAG_FAKE(1)),
@ -232,13 +235,13 @@ void authorize_watcher(nea_server_t *nes,
substate = nua_substate_terminated;
nea_server_flush(nes, NULL);
SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n",
(void *)nh, "watcher is removed"));
nh, "watcher is removed"));
}
nua_stack_tevent(nua, nh, msg, nua_i_subscription, status, phrase,
NUTAG_SUBSTATE(substate),
NEATAG_SUB(sn->sn_subscriber),
TAG_END());
nua_stack_event(nua, nh, msg, nua_i_subscription, status, phrase,
NUTAG_SUBSTATE(substate),
NEATAG_SUB(sn->sn_subscriber),
TAG_END());
}
/* ---------------------------------------------------------------------- */
@ -259,11 +262,12 @@ void nua_stack_authorize(nua_t *nua,
if (sub && state > 0) {
nea_sub_auth(sub, state, TAG_NEXT(tags));
nua_stack_event(nua, nh, NULL, e, SIP_200_OK, NULL);
nua_stack_event(nua, nh, NULL, e, SIP_200_OK, TAG_END());
}
else {
nua_stack_event(nua, nh, NULL, e, NUA_INTERNAL_ERROR, NULL);
nua_stack_event(nua, nh, NULL, e, NUA_INTERNAL_ERROR, TAG_END());
}
return;
}
/** @internal Shutdown notifier object */
@ -343,5 +347,5 @@ void nua_stack_terminate(nua_t *nua,
NEATAG_REASON("noresource"),
TAG_NEXT(tags));
nua_stack_event(nua, nh, NULL, e, SIP_200_OK, NULL);
nua_stack_event(nua, nh, NULL, e, SIP_200_OK, TAG_END());
}

View File

@ -43,8 +43,17 @@
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
#define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#include "nua_stack.h"
static int process_response_to_method(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip);
static void restart_method(nua_handle_t *nh, tagi_t *tags);
static int respond_to_method(nua_server_request_t *sr, tagi_t const *tags);
/** Send an extension request.
*
* Send an entension request message.
@ -69,25 +78,32 @@
* @since New in @VERSION_1_12_4.
*/
static nua_client_methods_t const nua_method_client_methods = {
SIP_METHOD_UNKNOWN,
0,
{
/* create_dialog */ 0,
/* in_dialog */ 0,
/* target_refresh */ 0
},
/* nua_method_client_template */ NULL,
/* nua_method_client_init */ NULL,
/* nua_method_client_request */ NULL,
/* nua_method_client_check_restart */ NULL,
/* nua_method_client_response */ NULL
};
int
nua_stack_method(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags)
{
return nua_client_create(nh, e, &nua_method_client_methods, tags);
nua_client_request_t *cr = nh->nh_ds->ds_cr;
msg_t *msg;
if (cr->cr_orq)
return UA_EVENT2(e, 900, "Request already in progress");
nua_stack_init_handle(nua, nh, TAG_NEXT(tags));
msg = nua_creq_msg(nua, nh, cr, cr->cr_retry_count,
SIP_METHOD_UNKNOWN,
TAG_NEXT(tags));
if (msg)
cr->cr_orq = nta_outgoing_mcreate(nua->nua_nta,
process_response_to_method, nh, NULL,
msg,
SIPTAG_END(),
TAG_NEXT(tags));
if (!cr->cr_orq) {
msg_destroy(msg);
return UA_EVENT1(e, NUA_INTERNAL_ERROR);
}
return cr->cr_event = e;
}
/** @NUA_EVENT nua_r_method
@ -111,6 +127,20 @@ nua_stack_method(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags
* @END_NUA_EVENT
*/
static int process_response_to_method(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip)
{
if (nua_creq_check_restart(nh, nh->nh_ds->ds_cr, orq, sip, restart_method))
return 0;
return nua_stack_process_response(nh, nh->nh_ds->ds_cr, orq, sip, TAG_END());
}
void restart_method(nua_handle_t *nh, tagi_t *tags)
{
nua_creq_restart(nh, nh->nh_ds->ds_cr, process_response_to_method, tags);
}
/** @NUA_EVENT nua_i_method
*
* @brief Incoming extension request.
@ -135,19 +165,40 @@ nua_stack_method(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags
* @END_NUA_EVENT
*/
nua_server_methods_t const nua_extension_server_methods =
{
SIP_METHOD_UNKNOWN,
nua_i_method, /* Event */
{
0, /* Do not create dialog */
0, /* Can be an initial request */
1, /* Perhaps a target refresh request? */
1, /* Add a contact? */
},
nua_base_server_init,
nua_base_server_preprocess,
nua_base_server_params,
nua_base_server_respond,
nua_base_server_report,
};
int nua_stack_process_method(nua_t *nua,
nua_handle_t *nh,
nta_incoming_t *irq,
sip_t const *sip)
{
nua_server_request_t *sr, sr0[1];
sr = SR_INIT(sr0);
sr = nua_server_request(nua, nh, irq, sip, sr, sizeof *sr,
respond_to_method, 0);
return nua_stack_server_event(nua, sr, nua_i_method, TAG_END());
}
static
int respond_to_method(nua_server_request_t *sr, tagi_t const *tags)
{
nua_handle_t *nh = sr->sr_owner;
nua_t *nua = nh->nh_nua;
msg_t *msg;
msg = nua_server_response(sr, sr->sr_status, sr->sr_phrase, TAG_NEXT(tags));
if (msg) {
nta_incoming_mreply(sr->sr_irq, msg);
}
else {
SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
nta_incoming_treply(sr->sr_irq, sr->sr_status, sr->sr_phrase, TAG_END());
nua_stack_event(nua, nh, NULL,
nua_i_error, 900, "Response to Extension Method Fails",
TAG_END());
}
return sr->sr_status >= 200 ? sr->sr_status : 0;
}

View File

@ -43,6 +43,9 @@
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
#define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#include "nua_stack.h"
/* ======================================================================== */
@ -69,41 +72,48 @@
* @sa #nua_i_message, @RFC3428
*/
static int nua_message_client_init(nua_client_request_t *cr,
msg_t *, sip_t *,
tagi_t const *tags);
static nua_client_methods_t const nua_message_client_methods = {
SIP_METHOD_MESSAGE,
0,
{
/* create_dialog */ 0,
/* in_dialog */ 0,
/* target refresh */ 0
},
/* nua_message_client_template */ NULL,
nua_message_client_init,
/*nua_message_client_request*/ NULL,
/* nua_message_client_check_restart */ NULL,
/*nua_message_client_response*/ NULL
};
static int process_response_to_message(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip);
int
nua_stack_message(nua_t *nua,
nua_handle_t *nh,
nua_event_t e,
tagi_t const *tags)
nua_stack_message(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags)
{
return nua_client_create(nh, e, &nua_message_client_methods, tags);
nua_client_request_t *cr = nh->nh_ds->ds_cr;
msg_t *msg;
sip_t *sip;
if (nh_is_special(nh)) {
return UA_EVENT2(e, 900, "Invalid handle for MESSAGE");
}
else if (cr->cr_orq) {
return UA_EVENT2(e, 900, "Request already in progress");
}
nua_stack_init_handle(nua, nh, TAG_NEXT(tags));
msg = nua_creq_msg(nua, nh, cr, cr->cr_retry_count,
SIP_METHOD_MESSAGE,
NUTAG_ADD_CONTACT(NH_PGET(nh, win_messenger_enable)),
TAG_NEXT(tags));
sip = sip_object(msg);
if (sip)
cr->cr_orq = nta_outgoing_mcreate(nua->nua_nta,
process_response_to_message, nh, NULL,
msg,
SIPTAG_END(), TAG_NEXT(tags));
if (!cr->cr_orq) {
msg_destroy(msg);
return UA_EVENT1(e, NUA_INTERNAL_ERROR);
}
return cr->cr_event = e;
}
static int nua_message_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
void restart_message(nua_handle_t *nh, tagi_t *tags)
{
if (NH_PGET(cr->cr_owner, win_messenger_enable))
cr->cr_contactize = 1;
return 0;
nua_creq_restart(nh, nh->nh_ds->ds_cr, process_response_to_message, tags);
}
/** @NUA_EVENT nua_r_message
@ -127,6 +137,15 @@ static int nua_message_client_init(nua_client_request_t *cr,
* @END_NUA_EVENT
*/
static int process_response_to_message(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip)
{
if (nua_creq_check_restart(nh, nh->nh_ds->ds_cr, orq, sip, restart_message))
return 0;
return nua_stack_process_response(nh, nh->nh_ds->ds_cr, orq, sip, TAG_END());
}
/** @NUA_EVENT nua_i_message
*
* @brief Incoming @b MESSAGE request.
@ -149,39 +168,32 @@ static int nua_message_client_init(nua_client_request_t *cr,
* @END_NUA_EVENT
*/
int nua_message_server_init(nua_server_request_t *sr);
int nua_message_server_params(nua_server_request_t *, tagi_t const *);
nua_server_methods_t const nua_message_server_methods =
{
SIP_METHOD_MESSAGE,
nua_i_message, /* Event */
{
0, /* Do not create dialog */
0, /* Can be initial request */
0, /* Perhaps a target refresh request? */
0, /* Do not add contact by default */
},
nua_message_server_init,
nua_base_server_preprocess,
nua_message_server_params,
nua_base_server_respond,
nua_base_server_report,
};
int nua_message_server_init(nua_server_request_t *sr)
int nua_stack_process_message(nua_t *nua,
nua_handle_t *nh,
nta_incoming_t *irq,
sip_t const *sip)
{
if (!NH_PGET(sr->sr_owner, message_enable))
return SR_STATUS1(sr, SIP_403_FORBIDDEN);
msg_t *msg;
return 0;
}
int nua_message_server_params(nua_server_request_t *sr,
tagi_t const *tags)
{
if (NH_PGET(sr->sr_owner, win_messenger_enable))
sr->sr_add_contact = 1;
return 0;
if (nh
? !NH_PGET(nh, message_enable)
: !DNH_PGET(nua->nua_dhandle, message_enable))
return 403;
if (nh == NULL)
if (!(nh = nua_stack_incoming_handle(nua, irq, sip, 0)))
return 500; /* respond with 500 Internal Server Error */
msg = nta_incoming_getrequest(irq);
nua_stack_event(nh->nh_nua, nh, msg, nua_i_message, SIP_200_OK, TAG_END());
#if 0 /* XXX */
if (nh->nh_nua->nua_messageRespond) {
nh->nh_irq = irq;
return 0;
}
#endif
return 200;
}

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,9 @@
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
#define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#include "nua_stack.h"
/**@fn void nua_options(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
@ -66,6 +69,46 @@
* @sa #nua_i_options, @RFC3261 section 10
*/
static int process_response_to_options(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip);
int
nua_stack_options(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags)
{
nua_client_request_t *cr = nh->nh_ds->ds_cr;
msg_t *msg;
if (nh_is_special(nh)) {
return UA_EVENT2(e, 900, "Invalid handle for OPTIONS");
}
else if (cr->cr_orq) {
return UA_EVENT2(e, 900, "Request already in progress");
}
nua_stack_init_handle(nua, nh, TAG_NEXT(tags));
msg = nua_creq_msg(nua, nh, cr, cr->cr_retry_count,
SIP_METHOD_OPTIONS,
TAG_NEXT(tags));
cr->cr_orq = nta_outgoing_mcreate(nua->nua_nta,
process_response_to_options, nh, NULL,
msg,
SIPTAG_END(), TAG_NEXT(tags));
if (!cr->cr_orq) {
msg_destroy(msg);
return UA_EVENT1(e, NUA_INTERNAL_ERROR);
}
return cr->cr_event = e;
}
void restart_options(nua_handle_t *nh, tagi_t *tags)
{
nua_creq_restart(nh, nh->nh_ds->ds_cr, process_response_to_options, tags);
}
/** @NUA_EVENT nua_r_options
*
* Answer to outgoing OPTIONS.
@ -87,25 +130,11 @@
* @END_NUA_EVENT
*/
static nua_client_methods_t const nua_options_client_methods = {
SIP_METHOD_OPTIONS,
0,
{
/* create_dialog */ 0,
/* in_dialog */ 0,
/* target refresh */ 0
},
/*nua_options_client_template*/ NULL,
/*nua_options_client_init*/ NULL,
/*nua_options_client_request*/ NULL,
/* nua_options_client_check_restart */ NULL,
/*nua_options_client_response*/ NULL
};
int nua_stack_options(nua_t *nua,
nua_handle_t *nh,
nua_event_t e,
tagi_t const *tags)
{
return nua_client_create(nh, e, &nua_options_client_methods, tags);
static int process_response_to_options(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip)
{
if (nua_creq_check_restart(nh, nh->nh_ds->ds_cr, orq, sip, restart_options))
return 0;
return nua_stack_process_response(nh, nh->nh_ds->ds_cr, orq, sip, TAG_END());
}

View File

@ -762,6 +762,12 @@ static int nhp_set_tags(su_home_t *home,
else if (tag == nutag_enablemessenger) {
NHP_SET(nhp, win_messenger_enable, value != 0);
}
#if 0
/* NUTAG_AUTORESPOND(autorespond) */
else if (tag == nutag_autorespond) {
NHP_SET(nhp, autorespond, value);
}
#endif
/* NUTAG_CALLEE_CAPS(callee_caps) */
else if (tag == nutag_callee_caps) {
NHP_SET(nhp, callee_caps, value != 0);
@ -876,8 +882,7 @@ static int nhp_set_tags(su_home_t *home,
sip_allow_class,
&appl_method,
(msg_list_t const *)nhp->nhp_appl_method,
/* already set by tags? */
NHP_ISSET(nhp, appl_method),
NHP_ISSET(nhp, allow), /* already set by tags */
0, /* dup it, don't make */
1, /* merge with old value */
t->t_value);
@ -1166,10 +1171,10 @@ int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags)
nh->nh_tags =
tl_filtered_tlist(nh->nh_home, tagfilter,
TAG_IF(p_from != SIP_NONE, SIPTAG_FROM(p_from)),
TAG_IF(p_from != SIP_NONE, TAG_FILTER(nua_handle_tags_filter)),
TAG_IF(p_to != SIP_NONE, SIPTAG_TO(p_to)),
TAG_IF(p_to != SIP_NONE, TAG_FILTER(nua_handle_tags_filter)),
SIPTAG_FROM(p_from),
TAG_FILTER(nua_handle_tags_filter),
SIPTAG_TO(p_to),
TAG_FILTER(nua_handle_tags_filter),
TAG_NEXT(tags));
nh->nh_ptags =
@ -1361,8 +1366,7 @@ int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags)
* application contact associated with the operation handle
* when responding to nua_get_hparams()
* @param sip NULL
* @param tags
* NUTAG_APPL_METHOD() \n
* @param tags
* NUTAG_AUTOACK() \n
* NUTAG_AUTOALERT() \n
* NUTAG_AUTOANSWER() \n
@ -1555,7 +1559,6 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
TIF_STR(SIPTAG_SUPPORTED_STR, supported),
TIF(SIPTAG_ALLOW, allow),
TIF_STR(SIPTAG_ALLOW_STR, allow),
TIF_STR(NUTAG_APPL_METHOD, appl_method),
TIF(SIPTAG_ALLOW_EVENTS, allow_events),
TIF_STR(SIPTAG_ALLOW_EVENTS_STR, allow_events),
TIF_SIP(SIPTAG_USER_AGENT, user_agent),
@ -1604,7 +1607,7 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
TAG_NEXT(media_params));
nua_stack_event(nua, nh, NULL, nua_r_get_params, SIP_200_OK, lst);
nua_stack_event(nua, nh, NULL, nua_r_get_params, SIP_200_OK, TAG_NEXT(lst));
su_home_deinit(tmphome);

View File

@ -45,6 +45,9 @@
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
#define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#include "nua_stack.h"
/* ====================================================================== */
@ -52,7 +55,6 @@
struct publish_usage {
sip_etag_t *pu_etag;
int pu_published;
};
static char const *nua_publish_usage_name(nua_dialog_usage_t const *du);
@ -114,6 +116,14 @@ void nua_publish_usage_remove(nua_handle_t *nh,
/* ======================================================================== */
/* PUBLISH */
static int nua_stack_publish2(nua_t *nua, nua_handle_t *nh, nua_event_t e,
int refresh, tagi_t const *tags);
static int process_response_to_publish(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip);
/**@fn \
* void nua_publish(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
*
@ -227,217 +237,213 @@ void nua_unpublish(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
* @END_NUA_EVENT
*/
static int nua_publish_client_template(nua_client_request_t *cr,
msg_t **return_msg,
tagi_t const *tags);
static int nua_publish_client_init(nua_client_request_t *cr,
msg_t *, sip_t *,
tagi_t const *tags);
static int nua_publish_client_request(nua_client_request_t *cr,
msg_t *, sip_t *,
tagi_t const *tags);
static int nua_publish_client_response(nua_client_request_t *cr,
int status, char const *phrase,
sip_t const *sip);
static nua_client_methods_t const nua_publish_client_methods = {
SIP_METHOD_PUBLISH,
0,
{
/* create_dialog */ 0,
/* in_dialog */ 0,
/* target refresh */ 0
},
nua_publish_client_template,
nua_publish_client_init,
nua_publish_client_request,
/* nua_publish_client_check_restart */ NULL,
nua_publish_client_response,
/* nua_publish_client_preliminary */ NULL
};
/**@internal Send PUBLISH. */
int nua_stack_publish(nua_t *nua,
nua_handle_t *nh,
nua_event_t e,
tagi_t const *tags)
int nua_stack_publish(nua_t *nua, nua_handle_t *nh, nua_event_t e,
tagi_t const *tags)
{
return nua_client_create(nh, e, &nua_publish_client_methods, tags);
}
static int nua_publish_client_template(nua_client_request_t *cr,
msg_t **return_msg,
tagi_t const *tags)
{
nua_dialog_usage_t *du;
if (cr->cr_event == nua_r_publish)
return 0;
du = nua_dialog_usage_get(cr->cr_owner->nh_ds, nua_publish_usage, NULL);
if (du && du->du_cr) {
if (nua_client_set_target(cr, du->du_cr->cr_target) < 0)
return -1;
*return_msg = msg_copy(du->du_cr->cr_msg);
return 1;
}
return 0;
}
static int nua_publish_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
nua_handle_t *nh = cr->cr_owner;
nua_dialog_usage_t *du;
struct publish_usage *pu;
if (cr->cr_event == nua_r_publish) {
du = nua_dialog_usage_add(nh, nh->nh_ds, nua_publish_usage, NULL);
if (!du)
return -1;
pu = nua_dialog_usage_private(du);
pu->pu_published = 0;
if (sip->sip_if_match) {
pu->pu_etag = sip_etag_dup(nh->nh_home, sip->sip_if_match);
if (!pu->pu_etag)
return -1;
sip_header_remove(msg, sip, (sip_header_t *)sip->sip_if_match);
}
}
else
du = nua_dialog_usage_get(nh->nh_ds, nua_publish_usage, NULL);
cr->cr_usage = du;
return 0;
return nua_stack_publish2(nua, nh, e, 0, tags);
}
static
int nua_publish_client_request(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
int nua_stack_publish2(nua_t *nua, nua_handle_t *nh, nua_event_t e,
int refresh,
tagi_t const *tags)
{
nua_dialog_usage_t *du = cr->cr_usage;
int un, done;
sip_etag_t const *etag = NULL;
nua_dialog_usage_t *du;
struct publish_usage *pu;
nua_client_request_t *cr = nh->nh_ds->ds_cr;
msg_t *msg = NULL;
sip_t *sip;
int remove_body = 0;
un = cr->cr_terminating ||
cr->cr_event != nua_r_publish ||
(du && du->du_shutdown) ||
if (nua_stack_set_handle_special(nh, nh_has_nothing, nua_r_publish) < 0)
return UA_EVENT2(e, 900, "Invalid handle for PUBLISH");
if (cr->cr_orq) {
return UA_EVENT2(e, 900, "Request already in progress");
}
nua_stack_init_handle(nua, nh, TAG_NEXT(tags));
if (e == nua_r_unpublish) {
du = nua_dialog_usage_get(nh->nh_ds, nua_publish_usage, NULL);
if (du)
refresh = 1;
else
du = nua_dialog_usage_add(nh, nh->nh_ds, nua_publish_usage, NULL);
}
else if (!refresh)
du = nua_dialog_usage_add(nh, nh->nh_ds, nua_publish_usage, NULL);
else
du = nua_dialog_usage_get(nh->nh_ds, nua_publish_usage, NULL);
if (!du)
return UA_EVENT1(e, NUA_INTERNAL_ERROR);
nua_dialog_usage_reset_refresh(du);
pu = nua_dialog_usage_private(du); assert(pu);
if (refresh) {
if (cr->cr_msg)
msg_destroy(cr->cr_msg);
cr->cr_msg = msg_copy(du->du_msg);
remove_body = pu->pu_etag != NULL;
}
msg = nua_creq_msg(nua, nh, cr, cr->cr_retry_count || refresh,
SIP_METHOD_PUBLISH,
NUTAG_ADD_CONTACT(0),
TAG_NEXT(tags));
sip = sip_object(msg);
if (!msg || !sip)
goto error;
du->du_terminating =
e != nua_r_publish ||
(sip->sip_expires && sip->sip_expires->ex_delta == 0);
cr->cr_terminating = un;
done = un;
if (du) {
struct publish_usage *pu = nua_dialog_usage_private(du);
if (nua_client_bind(cr, du) < 0)
return -1;
if (pu->pu_published)
done = 1;
etag = pu->pu_etag;
if (!du->du_terminating && !refresh) {
/* Save template */
if (du->du_msg)
msg_destroy(du->du_msg);
du->du_msg = msg_ref_create(cr->cr_msg);
}
return nua_base_client_trequest(cr, msg, sip,
SIPTAG_IF_MATCH(etag),
TAG_IF(done, SIPTAG_PAYLOAD(NONE)),
TAG_IF(done, SIPTAG_CONTENT_TYPE(NONE)),
TAG_IF(un, SIPTAG_EXPIRES_STR("0")),
TAG_NEXT(tags));
cr->cr_orq =
nta_outgoing_mcreate(nua->nua_nta,
process_response_to_publish, nh, NULL,
msg,
SIPTAG_IF_MATCH(pu->pu_etag),
TAG_IF(remove_body, SIPTAG_PAYLOAD(NONE)),
TAG_IF(remove_body, SIPTAG_CONTENT_TYPE(NONE)),
TAG_IF(e != nua_r_publish,
SIPTAG_EXPIRES_STR("0")),
SIPTAG_END(), TAG_NEXT(tags));
if (!cr->cr_orq)
goto error;
cr->cr_usage = du;
return cr->cr_event = e;
error:
msg_destroy(msg);
if (!du->du_ready == 0)
nua_dialog_usage_remove(nh, nh->nh_ds, du);
return UA_EVENT1(e, NUA_INTERNAL_ERROR);
}
static int nua_publish_client_response(nua_client_request_t *cr,
int status, char const *phrase,
sip_t const *sip)
static void
restart_publish(nua_handle_t *nh, tagi_t *tags)
{
nua_handle_t *nh = cr->cr_owner;
nua_creq_restart(nh, nh->nh_ds->ds_cr, process_response_to_publish, tags);
}
static
int process_response_to_publish(nua_handle_t *nh,
nta_outgoing_t *orq,
sip_t const *sip)
{
int status = sip->sip_status->st_status;
nua_client_request_t *cr = nh->nh_ds->ds_cr;
nua_dialog_usage_t *du = cr->cr_usage;
struct publish_usage *pu = nua_dialog_usage_private(du);
unsigned saved_retry_count = cr->cr_retry_count + 1;
if (!cr->cr_terminated && du && sip) {
struct publish_usage *pu = nua_dialog_usage_private(du);
sip_expires_t const *ex = sip->sip_expires;
if (nua_creq_check_restart(nh, cr, orq, sip, restart_publish))
return 0;
/* Reset state */
pu->pu_published = 0;
if (pu->pu_etag)
su_free(nh->nh_home, pu->pu_etag), pu->pu_etag = NULL;
if (status < 200 || pu == NULL)
return nua_stack_process_response(nh, cr, orq, sip, TAG_END());
if (status == 412) {
if (nua_client_restart(cr, 100, phrase))
return 0;
if (pu->pu_etag)
su_free(nh->nh_home, pu->pu_etag), pu->pu_etag = NULL;
if (!du->du_terminating) {
int retry = 0, invalid_expiration = 0;
if (status < 300) {
if (!sip->sip_expires)
invalid_expiration = 1;
else if (sip->sip_expires->ex_delta == 0)
retry = 1, invalid_expiration = 1;
}
else if (status < 300) {
if (ex && ex->ex_delta == 0 &&
nua_client_restart(cr, 100, "Trying re-PUBLISH"))
return 0;
else if (status == 412)
retry = 1;
pu->pu_published = 1;
if (status < 300 && !invalid_expiration && !retry) {
pu->pu_etag = sip_etag_dup(nh->nh_home, sip->sip_etag);
if (!ex || ex->ex_delta == 0 || !pu->pu_etag) {
cr->cr_terminated = 1;
if (!ex || ex->ex_delta == 0)
SET_STATUS(900, "Received Invalid Expiration Time");
else
SET_STATUS1(NUA_INTERNAL_ERROR);
}
du->du_ready = 1;
nua_dialog_usage_set_expires(du, sip->sip_expires->ex_delta);
}
else if (retry && saved_retry_count < NH_PGET(nh, retry_count)) {
msg_t *response = nta_outgoing_getresponse(orq);
nua_stack_event(nh->nh_nua, nh, response, cr->cr_event,
100, "Trying re-PUBLISH",
TAG_END());
nua_creq_deinit(cr, orq);
nua_stack_publish2(nh->nh_nua, nh, cr->cr_event, 1, NULL);
cr->cr_retry_count = saved_retry_count;
return 0;
}
else if (invalid_expiration) {
msg_t *response = nta_outgoing_getresponse(orq);
nua_stack_event(nh->nh_nua, nh, response, cr->cr_event,
900, "Received Invalid Expiration Time",
TAG_END());
nua_dialog_usage_remove(nh, nh->nh_ds, cr->cr_usage);
nua_creq_deinit(cr, orq);
cr->cr_usage = NULL;
return 0;
}
}
return nua_base_client_response(cr, status, phrase, sip, NULL);
return nua_stack_process_response(nh, cr, orq, sip, TAG_END());
}
static void nua_publish_usage_refresh(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du,
sip_time_t now)
nua_dialog_state_t *ds,
nua_dialog_usage_t *du,
sip_time_t now)
{
nua_client_request_t *cr = du->du_cr;
if (cr) {
if (nua_client_is_queued(cr) /* Already publishing. */
|| nua_client_resend_request(cr, 0, NULL) >= 0)
return;
}
nua_stack_event(nh->nh_nua, nh, NULL,
nua_r_publish, NUA_INTERNAL_ERROR,
NULL);
nua_dialog_usage_remove(nh, ds, du);
if (ds->ds_cr->cr_usage == du) /* Already publishing. */
return;
nua_stack_publish2(nh->nh_nua, nh, nua_r_publish, 1, NULL);
}
/** @interal Shut down PUBLISH usage.
/** @interal Shut down PUBLISH usage.
*
* @retval >0 shutdown done
* @retval 0 shutdown in progress
* @retval <0 try again later
*/
static int nua_publish_usage_shutdown(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
nua_client_request_t *cr = du->du_cr;
nua_client_request_t *cr = ds->ds_cr;
if (cr) {
if (nua_client_is_queued(cr)) /* Already publishing. */
return -1;
if (nua_client_resend_request(cr, 1, NULL) >= 0)
return 0;
if (!cr->cr_usage) {
/* Unpublish */
nua_stack_publish2(nh->nh_nua, nh, nua_r_destroy, 1, NULL);
return cr->cr_usage != du;
}
/* XXX - report to user */
nua_dialog_usage_remove(nh, ds, du);
return 200;
if (!du->du_ready && !cr->cr_orq)
return 1; /* had unauthenticated initial request */
return -1; /* Request in progress */
}
/* ---------------------------------------------------------------------- */
/* Server side */
static
int respond_to_publish(nua_server_request_t *sr, tagi_t const *tags);
/** @NUA_EVENT nua_i_publish
*
* Incoming PUBLISH request.
@ -475,35 +481,48 @@ static int nua_publish_usage_shutdown(nua_handle_t *nh,
* @END_NUA_EVENT
*/
int nua_publish_server_init(nua_server_request_t *sr);
nua_server_methods_t const nua_publish_server_methods =
{
SIP_METHOD_PUBLISH,
nua_i_publish, /* Event */
{
0, /* Do not create dialog */
0, /* Initial request */
0, /* Not a target refresh request */
1, /* Add Contact */
},
nua_publish_server_init,
nua_base_server_preprocess,
nua_base_server_params,
nua_base_server_respond,
nua_base_server_report,
};
int nua_publish_server_init(nua_server_request_t *sr)
int nua_stack_process_publish(nua_t *nua,
nua_handle_t *nh,
nta_incoming_t *irq,
sip_t const *sip)
{
sip_allow_events_t *allow_events = NH_PGET(sr->sr_owner, allow_events);
sip_event_t *o = sr->sr_request.sip->sip_event;
nua_server_request_t *sr, sr0[1];
sip_allow_events_t *allow_events = NUA_PGET(nua, nh, allow_events);
sip_event_t *o = sip->sip_event;
char const *event = o ? o->o_type : NULL;
sr = SR_INIT(sr0);
if (!allow_events)
return SR_STATUS1(sr, SIP_501_NOT_IMPLEMENTED);
SR_STATUS1(sr, SIP_501_NOT_IMPLEMENTED);
else if (!event || !msg_header_find_param(allow_events->k_common, event))
return SR_STATUS1(sr, SIP_489_BAD_EVENT);
SR_STATUS1(sr, SIP_489_BAD_EVENT);
return 0;
sr = nua_server_request(nua, nh, irq, sip, sr, sizeof *sr,
respond_to_publish, 0);
return nua_stack_server_event(nua, sr, nua_i_publish, TAG_END());
}
static
int respond_to_publish(nua_server_request_t *sr, tagi_t const *tags)
{
nua_handle_t *nh = sr->sr_owner;
nua_t *nua = nh->nh_nua;
msg_t *msg;
msg = nua_server_response(sr, sr->sr_status, sr->sr_phrase, TAG_NEXT(tags));
if (msg) {
nta_incoming_mreply(sr->sr_irq, msg);
}
else {
SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
nta_incoming_treply(sr->sr_irq, sr->sr_status, sr->sr_phrase, TAG_END());
nua_stack_event(nua, nh, NULL,
nua_i_error, 900, "PUBLISH Response Fails",
TAG_END());
}
return sr->sr_status >= 200 ? sr->sr_status : 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,8 @@
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sip_util.h>
#define NTA_LEG_MAGIC_T struct nua_handle_s
#define NTA_OUTGOING_MAGIC_T struct nua_handle_s
#define NTA_INCOMING_MAGIC_T struct nua_handle_s
#define NTA_RELIABLE_MAGIC_T struct nua_handle_s
@ -87,19 +89,15 @@
* @END_NUA_EVENT
*/
nua_server_methods_t const nua_register_server_methods =
{
SIP_METHOD_REGISTER,
nua_i_register, /* Event */
{
0, /* Do not create dialog */
0, /* Initial request */
0, /* Not a target refresh request */
0, /* Do not add Contact */
},
nua_base_server_init,
nua_base_server_preprocess,
nua_base_server_params,
nua_base_server_respond,
nua_base_server_report,
};
int nua_stack_process_register(nua_t *nua,
nua_handle_t *nh,
nta_incoming_t *irq,
sip_t const *sip)
{
nua_server_request_t *sr, sr0[1];
sr = nua_server_request(nua, nh, irq, sip, SR_INIT(sr0), sizeof *sr,
nua_default_respond, 0);
return nua_stack_server_event(nua, sr, nua_i_register, TAG_END());
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -103,32 +103,6 @@ typedef struct register_usage nua_registration_t;
TAG_IF((include) && (soa) && soa_is_remote_chat_active(soa) >= 0, \
SOATAG_ACTIVE_CHAT(soa_is_remote_chat_active(soa)))
#if HAVE_NUA_HANDLE_DEBUG
#define nua_handle_ref(nh) nua_handle_ref_by((nh), __func__)
#define nua_handle_unref(nh) nua_handle_unref_by((nh), __func__)
static inline nua_handle_t *nua_handle_ref_by(nua_handle_t *nh,
char const *by)
{
if (nh)
SU_DEBUG_0(("nua_handle_ref(%p) => "MOD_ZU" by %s\n", nh,
su_home_refcount((su_home_t *)nh) + 1,
by));
return (nua_handle_t *)su_home_ref((su_home_t *)nh);
}
static inline int nua_handle_unref_by(nua_handle_t *nh, char const *by)
{
if (nh)
SU_DEBUG_0(("nua_handle_unref(%p) => "MOD_ZU" by %s\n", nh,
su_home_refcount((su_home_t *)nh) - 1,
by));
return su_home_unref((su_home_t *)nh);
}
#endif
/** NUA handle.
*
*/
@ -139,8 +113,7 @@ struct nua_handle_s
nua_handle_t **nh_prev;
nua_t *nh_nua; /**< Pointer to NUA object */
void *nh_valid; /**< Cookie */
#define nua_valid_handle_cookie ((void *)(intptr_t)nua_handle)
void *nh_valid;
nua_hmagic_t *nh_magic; /**< Application context */
tagi_t *nh_tags; /**< Initial tags */
@ -181,8 +154,7 @@ struct nua_handle_s
nea_server_t *nh_notifier; /**< SIP notifier */
};
#define NH_IS_VALID(nh) \
((nh) && (nh)->nh_valid == nua_valid_handle_cookie)
#define NH_IS_VALID(nh) ((nh) && (nh)->nh_valid)
#define NH_STATUS(nh) \
(nh)->nh_status, \
@ -313,23 +285,20 @@ nua_stack_signal_handler
nua_stack_method;
#define UA_EVENT1(e, statusphrase) \
nua_stack_event(nua, nh, NULL, e, statusphrase, NULL)
nua_stack_event(nua, nh, NULL, e, statusphrase, TAG_END())
#define UA_EVENT2(e, status, phrase) \
nua_stack_event(nua, nh, NULL, e, status, phrase, NULL)
nua_stack_event(nua, nh, NULL, e, status, phrase, TAG_END())
#define UA_EVENT3(e, status, phrase, tag) \
nua_stack_event(nua, nh, NULL, e, status, phrase, tag, NULL)
int nua_stack_tevent(nua_t *nua, nua_handle_t *nh, msg_t *msg,
nua_event_t event, int status, char const *phrase,
tag_type_t tag, tag_value_t value, ...);
nua_stack_event(nua, nh, NULL, e, status, phrase, tag, TAG_END())
int nua_stack_event(nua_t *nua, nua_handle_t *nh, msg_t *msg,
nua_event_t event, int status, char const *phrase,
tagi_t const *tags);
tag_type_t tag, tag_value_t value, ...);
nua_handle_t *nh_create_handle(nua_t *nua, nua_hmagic_t *hmagic, tagi_t *tags);
nua_handle_t *nh_create_handle(nua_t *nua, nua_hmagic_t *hmagic,
tagi_t *tags);
nua_handle_t *nua_stack_incoming_handle(nua_t *nua,
nta_incoming_t *irq,
@ -380,8 +349,48 @@ int nua_stack_process_request(nua_handle_t *nh,
nta_incoming_t *irq,
sip_t const *sip);
int nua_stack_process_response(nua_handle_t *nh,
nua_client_request_t *cr,
nta_outgoing_t *orq,
sip_t const *sip,
tag_type_t tag, tag_value_t value, ...);
int nua_stack_launch_network_change_detector(nua_t *nua);
msg_t *nua_creq_msg(nua_t *nua, nua_handle_t *nh,
nua_client_request_t *cr,
int restart,
sip_method_t method, char const *name,
tag_type_t tag, tag_value_t value, ...);
int nua_tagis_have_contact_tag(tagi_t const *t);
int nua_creq_check_restart(nua_handle_t *nh,
nua_client_request_t *cr,
nta_outgoing_t *orq,
sip_t const *sip,
nua_creq_restart_f *f);
int nua_creq_restart_with(nua_handle_t *nh,
nua_client_request_t *cr,
nta_outgoing_t *orq,
int status, char const *phrase,
nua_creq_restart_f *f,
tag_type_t tag, tag_value_t value, ...);
int nua_creq_save_restart(nua_handle_t *nh,
nua_client_request_t *cr,
nta_outgoing_t *orq,
int status, char const *phrase,
nua_creq_restart_f *f);
int nua_creq_restart(nua_handle_t *nh,
nua_client_request_t *cr,
nta_response_f *cb,
tagi_t *tags);
void nua_creq_deinit(nua_client_request_t *cr, nta_outgoing_t *orq);
sip_contact_t const *nua_stack_get_contact(nua_registration_t const *nr);
int nua_registration_add_contact_to_request(nua_handle_t *nh,
@ -396,6 +405,51 @@ int nua_registration_add_contact_to_response(nua_handle_t *nh,
sip_record_route_t const *,
sip_contact_t const *remote);
msg_t *nh_make_response(nua_t *nua, nua_handle_t *nh,
nta_incoming_t *irq,
int status, char const *phrase,
tag_type_t tag, tag_value_t value, ...);
typedef int nua_stack_process_request_t(nua_t *nua,
nua_handle_t *nh,
nta_incoming_t *irq,
sip_t const *sip);
nua_stack_process_request_t nua_stack_process_invite;
nua_stack_process_request_t nua_stack_process_info;
nua_stack_process_request_t nua_stack_process_update;
nua_stack_process_request_t nua_stack_process_bye;
nua_stack_process_request_t nua_stack_process_message;
nua_stack_process_request_t nua_stack_process_options;
nua_stack_process_request_t nua_stack_process_publish;
nua_stack_process_request_t nua_stack_process_subscribe;
nua_stack_process_request_t nua_stack_process_notify;
nua_stack_process_request_t nua_stack_process_refer;
nua_stack_process_request_t nua_stack_process_unknown;
nua_stack_process_request_t nua_stack_process_register;
nua_stack_process_request_t nua_stack_process_method;
nua_client_request_t
*nua_client_request_pending(nua_client_request_t const *),
*nua_client_request_restarting(nua_client_request_t const *),
*nua_client_request_by_orq(nua_client_request_t const *cr,
nta_outgoing_t const *orq);
nua_server_request_t *nua_server_request(nua_t *nua,
nua_handle_t *nh,
nta_incoming_t *irq,
sip_t const *sip,
nua_server_request_t *sr,
size_t size,
nua_server_respond_f *respond,
int create_dialog);
int nua_stack_server_event(nua_t *nua,
nua_server_request_t *sr,
nua_event_t event,
tag_type_t tag, tag_value_t value, ...);
/* ---------------------------------------------------------------------- */
#ifndef SDP_MIME_TYPE
@ -412,6 +466,15 @@ extern char const nua_application_sdp[];
#define NUTAG_ADD_CONTACT(v) _nutag_add_contact, tag_bool_v(v)
extern tag_typedef_t _nutag_add_contact;
#define NUTAG_ADD_CONTACT_REF(v) _nutag_add_contact_ref, tag_bool_vr(&v)
extern tag_typedef_t _nutag_add_contact_ref;
#define NUTAG_COPY(v) _nutag_copy, tag_bool_v(v)
extern tag_typedef_t _nutag_copy;
#define NUTAG_COPY_REF(v) _nutag_copy_ref, tag_bool_vr(&v)
extern tag_typedef_t _nutag_copy_ref;
/* ---------------------------------------------------------------------- */
typedef unsigned longlong ull;

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,6 @@ tag_typedef_t nutag_answer_recv = BOOLTAG_TYPEDEF(answer_recv);
tag_typedef_t nutag_offer_sent = BOOLTAG_TYPEDEF(offer_sent);
tag_typedef_t nutag_answer_sent = BOOLTAG_TYPEDEF(answer_sent);
tag_typedef_t nutag_substate = INTTAG_TYPEDEF(substate);
tag_typedef_t nutag_newsub = BOOLTAG_TYPEDEF(newsub);
tag_typedef_t nutag_invite_timer = UINTTAG_TYPEDEF(invite_timer);
tag_typedef_t nutag_session_timer = UINTTAG_TYPEDEF(session_timer);
tag_typedef_t nutag_min_se = UINTTAG_TYPEDEF(min_se);
@ -148,3 +147,6 @@ tag_typedef_t nutag_service_route_enable =
tag_typedef_t nutag_detect_network_updates = UINTTAG_TYPEDEF(detect_network_updates);
tag_typedef_t nutag_with = PTRTAG_TYPEDEF(with);
tag_typedef_t _nutag_add_contact = BOOLTAG_TYPEDEF(add_contact);
tag_typedef_t _nutag_copy = BOOLTAG_TYPEDEF(copy);

View File

@ -117,6 +117,7 @@ struct outbound {
char const *ob_instance; /**< Our instance ID */
int32_t ob_reg_id; /**< Flow-id */
char const *ob_features; /**< Feature parameters for rcontact */
sip_contact_t *ob_rcontact; /**< Our contact */
sip_contact_t *ob_dcontact; /**< Contact for dialogs */
sip_contact_t *ob_previous; /**< Stale contact */
@ -293,8 +294,7 @@ int outbound_set_options(outbound_t *ob,
else if (MATCH(use-upnp) || MATCH(use_upnp)) prefs->use_upnp = value;
else if (MATCH(use-stun) || MATCH(use_stun)) prefs->use_stun = value;
else
SU_DEBUG_1(("outbound(%p): unknown option \"%.*s\"\n",
(void *)ob->ob_owner, (int)len, s));
SU_DEBUG_1(("outbound_t: unknown option \"%.*s\"\n", (int)len, s));
s += len;
len = strspn(s, " \t\n\r,;");
@ -304,8 +304,7 @@ int outbound_set_options(outbound_t *ob,
}
if (s && s[0]) {
SU_DEBUG_1(("outbound(%p): invalid options \"%s\"\n",
(void *)ob->ob_owner, options));
SU_DEBUG_1(("outbound_t: invalid options \"%s\"\n", options));
return -1;
}
@ -316,8 +315,7 @@ int outbound_set_options(outbound_t *ob,
prefs->use_socks ||
prefs->use_upnp ||
prefs->use_stun)) {
SU_DEBUG_1(("outbound(%p): no nat traversal method given\n",
(void *)ob->ob_owner));
SU_DEBUG_1(("outbound(%p): no nat traversal method given\n", ob->ob_owner));
}
ob->ob_prefs = *prefs;
@ -326,27 +324,60 @@ int outbound_set_options(outbound_t *ob,
return 0;
}
/* ---------------------------------------------------------------------- */
/** Obtain contacts for REGISTER */
int outbound_get_contacts(outbound_t *ob,
sip_contact_t **return_current_contact,
sip_contact_t **return_previous_contact)
/** Set the feature string (added to the Contact header when registering). */
int outbound_set_features(outbound_t *ob, char *features)
{
if (ob) {
if (ob->ob_contacts)
*return_current_contact = ob->ob_rcontact;
*return_previous_contact = ob->ob_previous;
}
char *old_features = (char *)ob->ob_features;
char *new_features = su_strdup(ob->ob_home, features);
if (features && !new_features)
return -1;
ob->ob_features = new_features;
su_free(ob->ob_home, old_features);
return 0;
}
/** REGISTER request has been sent */
int outbound_start_registering(outbound_t *ob)
/* ---------------------------------------------------------------------- */
/** Hook for sending register request with extra outbound-ish headers. */
nta_outgoing_t *outbound_register_request(outbound_t *ob, int terminating,
sip_contact_t *stack_contact,
nta_agent_t *nta,
nta_response_f *callback,
nta_outgoing_magic_t *magic,
url_string_t *next_hop,
msg_t *msg,
tag_type_t tag, tag_value_t value,
...)
{
if (ob)
sip_contact_t *previous_contact = NULL;
ta_list ta;
nta_outgoing_t *orq;
if (stack_contact) {
if (ob) {
if (ob->ob_contacts)
stack_contact = ob->ob_rcontact;
previous_contact = ob->ob_previous;
}
}
ta_start(ta, tag, value);
orq = nta_outgoing_mcreate(nta, callback, magic, next_hop, msg,
TAG_IF(previous_contact,
SIPTAG_CONTACT(previous_contact)),
TAG_IF(stack_contact,
SIPTAG_CONTACT(stack_contact)),
ta_tags(ta));
ta_end(ta);
if (orq && ob)
ob->ob_registering = 1;
return 0;
return orq;
}
/** Process response to REGISTER request */
@ -360,16 +391,17 @@ int outbound_register_response(outbound_t *ob,
if (!ob)
return 0;
if (terminating) {
ob->ob_registering = ob->ob_registered = 0;
return 0; /* Cleanup is done separately */
}
assert(!request || request->sip_request);
assert(!response || response->sip_status);
if (!response || !request)
return 0;
assert(request->sip_request); assert(response->sip_status);
if (terminating) {
ob->ob_registered = ob->ob_registering = 0;
return 0; /* Cleanup is done separately */
}
reregister = outbound_check_for_nat(ob, request, response);
if (reregister)
return reregister;
@ -391,13 +423,7 @@ int outbound_register_response(outbound_t *ob,
}
/** @internal Check if there is a NAT between us and registrar.
*
* @retval -1 upon an error
* @retval #ob_register_ok (0) if the registration was OK
* @retval #ob_reregister (1) if client needs to re-register
* @retval #ob_reregister_now (2) if client needs to re-register immediately
*/
/** @internal Check if there is a NAT between us and registrar */
static
int outbound_check_for_nat(outbound_t *ob,
sip_t const *request,
@ -431,11 +457,11 @@ int outbound_check_for_nat(outbound_t *ob,
if (!m || binding_changed >= ob_nat_changed) {
if (ob->ob_stun) {
/* Use STUN? */
return ob_reregister;
return 1;
}
else if (ob->ob_upnp) {
/* Use UPnP */
return ob_reregister;
return 1;
}
else {
if (outbound_contacts_from_via(ob, response->sip_via) < 0)
@ -486,7 +512,7 @@ int outbound_nat_detect(outbound_t *ob,
if (!host_is_ip_address(received)) {
if (received[0])
SU_DEBUG_3(("outbound(%p): Via with invalid received=%s\n",
(void *)ob->ob_owner, received));
ob->ob_owner, received));
return 0;
}
@ -504,14 +530,14 @@ int outbound_nat_detect(outbound_t *ob,
if (!nat_detected) {
SU_DEBUG_1(("outbound(%p): detected NAT: %s != %s\n",
(void *)ob->ob_owner, v->v_host, received));
ob->ob_owner, v->v_host, received));
if (ob->ob_oo && ob->ob_oo->oo_status)
ob->ob_oo->oo_status(ob->ob_owner, ob, 101, "NAT detected", TAG_END());
}
else {
SU_DEBUG_1(("outbound(%p): NAT binding changed: "
"[%s]:%s != [%s]:%s\n",
(void *)ob->ob_owner, nat_detected, nat_port, received, rport));
ob->ob_owner, nat_detected, nat_port, received, rport));
if (ob->ob_oo && ob->ob_oo->oo_status)
ob->ob_oo->oo_status(ob->ob_owner, ob, 102, "NAT binding changed", TAG_END());
}
@ -683,32 +709,21 @@ static int create_keepalive_message(outbound_t *ob, sip_t const *regsip)
{
msg_t *msg = nta_msg_create(ob->ob_nta, MSG_FLG_COMPACT), *previous;
sip_t *osip = sip_object(msg);
sip_contact_t *m = ob->ob_rcontact;
sip_accept_contact_t *ac;
char const *p1 = ob->ob_instance;
char const *p2 = ob->ob_features;
unsigned d = ob->ob_keepalive.interval;
assert(regsip); assert(regsip->sip_request);
if (m && m->m_params) {
sip_accept_contact_t *ac;
size_t i;
int features = 0;
ac = sip_accept_contact_make(msg_home(msg), "*;require;explicit");
for (i = 0; m->m_params[i]; i++) {
char const *s = m->m_params[i];
if (!sip_is_callerpref(s))
continue;
features++;
s = su_strdup(msg_home(msg), s);
msg_header_add_param(msg_home(msg), ac->cp_common, s);
}
if (features)
msg_header_insert(msg, NULL, (void *)ac);
else
msg_header_free(msg_home(msg), (void *)ac);
if (p1 || p2) {
ac = sip_accept_contact_format(msg_home(msg), "*;require;explicit;%s%s%s",
p1 ? p1 : "",
p2 && p2 ? ";" : "",
p2 ? p2 : "");
msg_header_insert(msg, NULL, (void *)ac);
}
if (0 >
@ -862,19 +877,18 @@ static int response_to_keepalive_options(outbound_t *ob,
if (loglevel >= SU_LOG->log_level) {
su_llog(SU_LOG, loglevel,
"outbound(%p): %s <" URL_PRINT_FORMAT ">\n",
(void *)ob->ob_owner,
failed ? "FAILED to validate" : "validated",
ob->ob_owner, failed ? "FAILED to validate" : "validated",
URL_PRINT_ARGS(ob->ob_rcontact->m_url));
if (failed)
su_llog(SU_LOG, loglevel, "outbound(%p): FAILED with %u %s\n",
(void *)ob->ob_owner, status, phrase);
ob->ob_owner, status, phrase);
}
if (failed)
ob->ob_oo->oo_probe_error(ob->ob_owner, ob, status, phrase, TAG_END());
}
else if (status == 408) {
SU_DEBUG_1(("outbound(%p): keepalive timeout\n", (void *)ob->ob_owner));
SU_DEBUG_1(("outbound(%p): keepalive timeout\n", ob->ob_owner));
ob->ob_oo->oo_keepalive_error(ob->ob_owner, ob, status, phrase, TAG_END());
return 0;
}
@ -968,7 +982,7 @@ int outbound_process_request(outbound_t *ob,
if (ob->ob_keepalive.validating) {
SU_DEBUG_1(("outbound(%p): registration check OPTIONS received\n",
(void *)ob->ob_owner));
ob->ob_owner));
ob->ob_keepalive.validated = 1;
}
@ -1004,16 +1018,48 @@ int outbound_contacts_from_via(outbound_t *ob, sip_via_t const *via)
v = v0; *v0 = *via; v0->v_next = NULL;
dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 1,
dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home,
NULL, v, v->v_protocol, NULL);
if (ob->ob_instance && ob->ob_reg_id != 0)
snprintf(reg_id_param, sizeof reg_id_param, ";reg-id=%u", ob->ob_reg_id);
rcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 0,
rcontact = ob->ob_oo->oo_contact(ob->ob_owner, home,
NULL, v, v->v_protocol,
ob->ob_features ? ob->ob_features : "",
ob->ob_instance, reg_id_param, NULL);
#if 0
char *uri;
/* uri contains < > */
uri = sip_contact_string_from_via(NULL, via, NULL, v->v_protocol);
dcontact = sip_contact_make(home, uri);
if (ob->ob_instance) {
char reg_id[20];
if (ob->ob_instance && ob->ob_reg_id)
snprintf(reg_id, sizeof reg_id, ";reg-id=%u", ob->ob_reg_id);
else
strcpy(reg_id, "");
rcontact = sip_contact_format(home, "%s;%s%s%s%s",
uri, ob->ob_instance, reg_id,
ob->ob_features ? ";" : "",
ob->ob_features ? ob->ob_features : "");
}
else if (ob->ob_features)
rcontact = sip_contact_format(home, "%s;%s", uri, ob->ob_features);
else
rcontact = dcontact;
free(uri);
#endif
v = sip_via_dup(home, v);
if (!rcontact || !dcontact || !v) {
@ -1105,7 +1151,7 @@ int outbound_set_contact(outbound_t *ob,
char const *tport = !v->v_next ? v->v_protocol : NULL;
char reg_id_param[20];
dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 1,
dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home,
NULL, v, tport, NULL);
if (!dcontact)
return -1;
@ -1113,8 +1159,9 @@ int outbound_set_contact(outbound_t *ob,
if (ob->ob_instance && ob->ob_reg_id != 0)
snprintf(reg_id_param, sizeof reg_id_param, ";reg-id=%u", ob->ob_reg_id);
rcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 0,
rcontact = ob->ob_oo->oo_contact(ob->ob_owner, home,
NULL, v, v->v_protocol,
ob->ob_features ? ob->ob_features : "",
ob->ob_instance, reg_id_param, NULL);
if (!rcontact)
return -1;
@ -1125,10 +1172,8 @@ int outbound_set_contact(outbound_t *ob,
previous = ob->ob_contacts ? ob->ob_rcontact : NULL;
}
}
ob->ob_by_stack = application_contact == NULL;
ob->ob_contacts = rcontact != NULL;
ob->ob_by_stack = application_contact == NULL;
ob->ob_rcontact = rcontact;
ob->ob_dcontact = dcontact;
@ -1160,11 +1205,6 @@ sip_contact_t const *outbound_dialog_contact(outbound_t const *ob)
return ob->ob_dcontact;
}
sip_contact_t const *outbound_dialog_gruu(outbound_t const *ob)
{
return ob ? ob->ob_gruu : NULL;
}
/* ---------------------------------------------------------------------- */

View File

@ -70,11 +70,17 @@ int outbound_set_options(outbound_t *ob,
unsigned dgram_interval,
unsigned stream_interval);
int outbound_get_contacts(outbound_t *ob,
sip_contact_t **return_current_contact,
sip_contact_t **return_previous_contact);
int outbound_set_features(outbound_t *ob, char *features);
int outbound_start_registering(outbound_t *ob);
nta_outgoing_t *outbound_register_request(outbound_t *ob, int terminating,
sip_contact_t *stack_contact,
nta_agent_t *nta,
nta_response_f *callback,
nta_outgoing_magic_t *magic,
url_string_t *next_hop,
msg_t *msg,
tag_type_t tag, tag_value_t value,
...);
int outbound_register_response(outbound_t *ob,
int terminating,
@ -96,8 +102,6 @@ int outbound_set_contact(outbound_t *ob,
sip_contact_t const *outbound_dialog_contact(outbound_t const *ob);
sip_contact_t const *outbound_dialog_gruu(outbound_t const *ob);
int outbound_gruuize(outbound_t *ob, sip_t const *sip);
void outbound_start_keepalive(outbound_t *ob,
@ -118,7 +122,6 @@ struct outbound_owner_vtable
int oo_size;
sip_contact_t *(*oo_contact)(outbound_owner_t *,
su_home_t *home,
int used_in_dialog,
char const *extra_username,
sip_via_t const *v,
char const *transport,

View File

@ -262,12 +262,6 @@ SOFIAPUBFUN char const *nua_event_name(nua_event_t event);
/** Get name for NUA callstate. */
SOFIAPUBFUN char const *nua_callstate_name(enum nua_callstate state);
/** Return name of subscription state. @NEW_1_12_5. */
SOFIAPUBFUN char const *nua_substate_name(enum nua_substate substate);
/** Convert string to enum nua_substate. @NEW_1_12_5. */
SOFIAPUBFUN enum nua_substate nua_substate_make(char const *sip_substate);
/** Send SIP REGISTER request to the registrar. */
SOFIAPUBFUN void nua_register(nua_handle_t *nh, tag_type_t, tag_value_t, ...);

View File

@ -1074,7 +1074,7 @@ SOFIAPUBVAR tag_typedef_t nutag_registrar_ref;
*
* The outbound option string can specify how the NAT traversal is handled.
* The option tokens are as follows:
* - "gruuize": try to generate a GRUU contact from REGISTER response
* - "gruuize": try to generate a GRUU
* - "outbound": use SIP outbound extension (off by default)
* - "validate": validate registration behind a NAT by sending OPTIONS to self
* - "natify": try to traverse NAT
@ -1084,10 +1084,6 @@ SOFIAPUBVAR tag_typedef_t nutag_registrar_ref;
* An option token with "no-" or "not-" prefix turns the option off. For
* example, if you want to try to traverse NATs but not to use OPTIONS
* keepalive, use NUTAG_OUTBOUND("natify no-options-keepalive").
*
* An empty string can be passed to let the stack choose the
* default values for outbound usage (in the 1.12.5 release, the
* defaults are: "gruuize no-outbound validate use-port options-keepalive").
*
* @note
* Options string is used so that no new tags need to be added when the
@ -1211,7 +1207,7 @@ SOFIAPUBVAR tag_typedef_t nutag_outbound_set4_ref;
* nua_create()
*
* @par Parameter type
* msg_mclass_t const *
* msg_mclass_t *
*
* @par Values
* Pointer to an extended SIP parser.
@ -1247,9 +1243,6 @@ SOFIAPUBVAR tag_typedef_t nutag_auth;
SOFIAPUBVAR tag_typedef_t nutag_auth_ref;
/** Keepalive interval in milliseconds.
*
* This setting applies to OPTIONS/STUN keepalives. See documentation
* for nua_register() for more detailed information.
*
* @par Used with
* nua_register() \n
@ -1275,8 +1268,6 @@ SOFIAPUBVAR tag_typedef_t nutag_keepalive;
SOFIAPUBVAR tag_typedef_t nutag_keepalive_ref;
/** Transport-level keepalive interval for streams.
*
* See documentation for nua_register() for more detailed information.
*
* @par Used with
* nua_register() \n
@ -1336,7 +1327,6 @@ SOFIAPUBVAR tag_typedef_t nutag_authtime_ref;
*
* @par Used with
* nua_register(), nua_set_hparams(), nua_set_params().
* nua_invite(), nua_respond(), nua_subscribe(), nua_notify()
*
* @par Parameter type
* string (char *)
@ -1368,7 +1358,6 @@ SOFIAPUBVAR tag_typedef_t nutag_m_display_ref;
*
* @par Used with
* nua_register(), nua_set_hparams(), nua_set_params().
* nua_invite(), nua_respond(), nua_subscribe(), nua_notify()
*
* @par Parameter type
* string (char *)
@ -1399,8 +1388,7 @@ SOFIAPUBVAR tag_typedef_t nutag_m_username_ref;
* user-agent.
*
* @par Used with
* nua_register(), nua_set_hparams(), nua_set_params(),
* nua_invite(), nua_respond(), nua_subscribe(), nua_notify()
* nua_register(), nua_set_hparams(), nua_set_params().
*
* @par Parameter type
* string (char *)
@ -1871,39 +1859,26 @@ enum nua_callstate {
/** Get name for NUA call state */
SOFIAPUBFUN char const *nua_callstate_name(enum nua_callstate state);
/**Subscription state.
/** Subscription state
*
* @par Used with
* #nua_notify() \n
* #nua_r_subscribe \n
* #nua_i_notify \n
* #nua_i_subscribe \n
* #nua_r_notify \n
* nua_notify() \n
* nua_respond() to SUBSCRIBE
* #nua_i_notify
*
* @par Parameter type
* int
*
* @par Values
* - #nua_substate_embryonic (0)
* - #nua_substate_pending (1)
* - #nua_substate_active (2)
* - #nua_substate_terminated (3)
* @c nua_substate_embryonic (0) \n
* @c nua_substate_pending (1) \n
* @c nua_substate_active (2) \n
* @c nua_substate_terminated (3) \n
*
* Note that the @SubscriptionState or @Expires headers specified by
* application overrides the subscription state specified by
* NUTAG_SUBSTATE(). Application can terminate subscription by including
* NUTAG_SUBSTATE(nua_substate_terminated), @SubscriptionState with value
* "terminated" or @Expires header with value 0 in the NOTIFY request sent
* by nua_notify().
*
* @sa @RFC3265, @SubscriptionState, SIPTAG_SUBSCRIPTION_STATE(),
* SIPTAG_SUBSCRIPTION_STATE_STR(), #nua_r_subscribe, #nua_i_subscribe,
* #nua_i_refer, #nua_r_notify, #nua_i_notify.
* see
* <a href="http://www.ietf.org/rfc/rfc3265.txt">RFC 3265</a>
*
* Corresponding tag taking reference parameter is NUTAG_SUBSTATE_REF()
*/
*/
#define NUTAG_SUBSTATE(x) nutag_substate, tag_int_v(x)
SOFIAPUBVAR tag_typedef_t nutag_substate;
@ -1921,46 +1896,6 @@ enum nua_substate {
nua_substate_terminated = nea_terminated /**< Terminated subscription */
};
/** Return name of subscription state. @NEW_1_12_5. */
SOFIAPUBFUN char const *nua_substate_name(enum nua_substate substate);
/** Convert string to enum nua_substate. @NEW_1_12_5. */
SOFIAPUBFUN enum nua_substate nua_substate_make(char const *sip_substate);
/**Send unsolicited NOTIFY request.
*
* Some applications may require sending unsolicited NOTIFY requests, that
* is, NOTIFY without SUBSCRIBE or REFER request sent by event watcher.
* However, sending NOTIFY request requires an existing dialog usage by
* default. If NUTAG_NEWSUB(1) is included in the nua_notify() the usage
* is create the usage by itself.
*
* If you want to create a subscription that does not terminate immediately
* include SIPTAG_SUBSCRIPTION_STATE_STR() with an "expires" parameter in
* the argument list, too.
*
* @par Used with
* nua_notify()
*
* @par Parameter type
* int (boolean)
*
* @par Values
* - 0 - false (default) - do not create new subscription
* but reject NOTIFY with 481 locally \n
* - 1 - true - create a subscription if it does not exist \n
*
* Corresponding tag taking reference parameter is NUTAG_NEWSUB().
*
* @since @NEW_1_12_5.
*/
#define NUTAG_NEWSUB(x) nutag_newsub, tag_bool_v(x)
SOFIAPUBVAR tag_typedef_t nutag_newsub;
#define NUTAG_NEWSUB_REF(x) nutag_newsub_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_newsub_ref;
/**Default lifetime for implicit subscriptions created by REFER.
*
* Default expiration time in seconds for implicit subscriptions created by

View File

@ -1578,310 +1578,6 @@ int test_update_by_uas(struct context *ctx)
END();
}
int cancel_when_pracked(CONDITION_PARAMS);
int alert_call(CONDITION_PARAMS);
int test_180rel_cancel1(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
if (print_headings)
printf("TEST NUA-10.6: CANCEL after PRACK\n");
/* Test for 100rel:
A B
|-------INVITE------>|
|<----100 Trying-----|
| |
|<-------180---------|
|-------PRACK------->|
|<-------200---------|
| |
|------CANCEL------->|
|<------200 OK-------|
| |
|<-------487---------|
|--------ACK-------->|
| |
*/
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
nua_set_params(ctx->a.nua,
NUTAG_EARLY_MEDIA(1),
NUTAG_ONLY183_100REL(0),
TAG_END());
run_a_until(ctx, nua_r_set_params, until_final_response);
nua_set_params(ctx->b.nua,
NUTAG_EARLY_MEDIA(1),
NUTAG_ONLY183_100REL(0),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
run_ab_until(ctx, -1, cancel_when_pracked, -1, alert_call);
/* Client transitions:
INIT -(C1)-> CALLING: nua_invite(), nua_i_state
CALLING -(C2)-> PROCEEDING: nua_r_invite, nua_i_state, nua_r_prack
PROCEEDING -(C3+C4)-> TERMINATED: nua_r_invite, nua_i_state
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
TEST_1(is_offer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_cancel);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 487);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
/*
Server transitions:
INIT -(S1)-> RECEIVED: nua_i_invite, nua_i_state
RECEIVED -(S2a)-> EARLY: nua_respond(), nua_i_state
Option A:
EARLY -(S10)-> TERMINATED: nua_i_cancel, nua_i_state
Option B:
EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
/* Responded with 180 Ringing */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(is_answer_sent(e->data->e_tags));
/* 180 is PRACKed */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_prack);
/* Does not have effect on call state */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_cancel);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
free_events_in_list(ctx, b->events);
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
printf("TEST NUA-10.6: PASSED\n");
END();
}
int cancel_when_pracked(CONDITION_PARAMS)
{
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
return 0;
save_event_in_list(ctx, event, ep, call);
if (event == nua_r_prack)
CANCEL(ep, call, nh, TAG_END());
switch (callstate(tags)) {
case nua_callstate_proceeding:
return 0;
case nua_callstate_ready:
return 1;
case nua_callstate_terminated:
return 1;
default:
return 0;
}
}
int test_180rel_cancel2(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
if (print_headings)
printf("TEST NUA-10.7: CANCEL after 100rel 180\n");
/* Test for 100rel:
A B
|-------INVITE------>|
|<----100 Trying-----|
| |
|<-------180---------|
|-------PRACK------->|
|<-------200---------|
| |
|------CANCEL------->|
|<------200 OK-------|
| |
|<-------487---------|
|--------ACK-------->|
| |
*/
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
nua_set_params(ctx->a.nua,
NUTAG_EARLY_MEDIA(1),
NUTAG_ONLY183_100REL(0),
TAG_END());
run_a_until(ctx, nua_r_set_params, until_final_response);
nua_set_params(ctx->b.nua,
NUTAG_EARLY_MEDIA(1),
NUTAG_ONLY183_100REL(0),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
run_ab_until(ctx, -1, cancel_when_ringing, -1, accept_pracked2);
/* Client transitions:
INIT -(C1)-> CALLING: nua_invite(), nua_i_state
CALLING -(C2)-> PROCEEDING: nua_r_invite, nua_i_state, nua_r_prack
PROCEEDING -(C3+C4)-> TERMINATED: nua_r_invite, nua_i_state
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
TEST_1(is_offer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
#define NEXT_SKIP_PRACK_CANCEL() \
do { TEST_1(e = e->next); } \
while (e->data->e_event == nua_r_prack || e->data->e_event == nua_r_cancel)
NEXT_SKIP_PRACK_CANCEL();
TEST_E(e->data->e_event, nua_r_invite);
if (e->data->e_status == 487) {
TEST(e->data->e_status, 487);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST_1(!e->next);
}
else {
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready);
BYE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
NEXT_SKIP_PRACK_CANCEL(); TEST_E(e->data->e_event, nua_r_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
}
free_events_in_list(ctx, a->events);
/*
Server transitions:
INIT -(S1)-> RECEIVED: nua_i_invite, nua_i_state
RECEIVED -(S2a)-> EARLY: nua_respond(), nua_i_state
Option A:
EARLY -(S10)-> TERMINATED: nua_i_cancel, nua_i_state
Option B:
EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
/* Responded with 180 Ringing */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(is_answer_sent(e->data->e_tags));
/* 180 is PRACKed */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_prack);
/* Does not have effect on call state */
if (e->next->data->e_event == nua_i_cancel) {
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_cancel);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
}
else {
/* Respond with 200 OK */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(!is_offer_answer_done(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_ack);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!is_offer_answer_done(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
}
free_events_in_list(ctx, b->events);
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
printf("TEST NUA-10.7: PASSED\n");
END();
}
int test_100rel(struct context *ctx)
{
@ -1893,29 +1589,6 @@ int test_100rel(struct context *ctx)
retval = test_preconditions(ctx); RETURN_ON_SINGLE_FAILURE(retval);
retval = test_preconditions2(ctx); RETURN_ON_SINGLE_FAILURE(retval);
retval = test_update_by_uas(ctx); RETURN_ON_SINGLE_FAILURE(retval);
retval = test_180rel_cancel1(ctx); RETURN_ON_SINGLE_FAILURE(retval);
retval = test_180rel_cancel2(ctx); RETURN_ON_SINGLE_FAILURE(retval);
nua_set_params(ctx->a.nua,
NUTAG_EARLY_MEDIA(0),
SIPTAG_SUPPORTED(ctx->a.supported),
TAG_END());
run_a_until(ctx, nua_r_set_params, until_final_response);
nua_set_params(ctx->b.nua,
NUTAG_EARLY_MEDIA(0),
NUTAG_ONLY183_100REL(0),
SIPTAG_SUPPORTED(ctx->b.supported),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
nua_set_params(ctx->c.nua,
NUTAG_EARLY_MEDIA(0),
NUTAG_ONLY183_100REL(0),
SIPTAG_SUPPORTED(ctx->c.supported),
TAG_END());
run_c_until(ctx, nua_r_set_params, until_final_response);
return retval;
}

View File

@ -117,8 +117,6 @@ int accept_call_with_early_sdp(CONDITION_PARAMS)
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
NUTAG_M_DISPLAY("Bob"),
NUTAG_M_USERNAME("b+b"),
TAG_END());
return 0;
case nua_callstate_early:
@ -219,8 +217,6 @@ int test_basic_call_1(struct context *ctx)
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SOATAG_USER_SDP_STR(a_call->sdp),
NUTAG_M_USERNAME("a+a"),
NUTAG_M_DISPLAY("Alice"),
TAG_END());
run_ab_until(ctx, -1, until_ready, -1, accept_call_with_early_sdp);
@ -267,11 +263,8 @@ int test_basic_call_1(struct context *ctx)
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_payload);
TEST_1(sip->sip_contact);
TEST_S(sip->sip_contact->m_display, "Bob");
TEST_S(sip->sip_contact->m_url->url_user, "b+b");
TEST_1(sip = sip_object(e->data->e_msg));
/* Test that B uses application-specific contact */
if (ctx->proxy_tests)
TEST_1(sip->sip_contact->m_url->url_user);
@ -289,10 +282,6 @@ int test_basic_call_1(struct context *ctx)
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_contact);
TEST_S(sip->sip_contact->m_display, "Alice");
TEST_S(sip->sip_contact->m_url->url_user, "a+a");
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
@ -415,7 +404,6 @@ int test_basic_call_2(struct context *ctx)
INVITE(a, a_call, a_call->nh,
NUTAG_URL(b->contact->m_url),
SOATAG_USER_SDP_STR(a_call->sdp),
NUTAG_ALLOW("INFO"),
TAG_END());
run_ab_until(ctx, -1, until_ready, -1, accept_early_answer);
@ -478,96 +466,32 @@ int test_basic_call_2(struct context *ctx)
TEST_1(nua_handle_has_active_call(b_call->nh));
TEST_1(!nua_handle_has_call_on_hold(b_call->nh));
/* Send a NOTIFY from B to A */
if (print_headings)
printf("TEST NUA-3.2.2: send a NOTIFY within a dialog\n");
/* Make A to accept NOTIFY */
nua_set_params(a->nua, NUTAG_APPL_METHOD("NOTIFY"), TAG_END());
run_a_until(ctx, nua_r_set_params, until_final_response);
NOTIFY(b, b_call, b_call->nh,
NUTAG_NEWSUB(1),
SIPTAG_SUBJECT_STR("NUA-3.2.2"),
SIPTAG_EVENT_STR("message-summary"),
SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"),
SIPTAG_PAYLOAD_STR("Messages-Waiting: no"),
TAG_END());
run_ab_until(ctx, -1, accept_notify, -1, save_until_final_response);
/* Notifier events: nua_r_notify */
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_r_notify);
TEST(e->data->e_status, 200);
TEST_1(tl_find(e->data->e_tags, nutag_substate));
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
nua_substate_terminated);
/* watcher events: nua_i_notify */
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_notify);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_subscription_state);
TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
TEST_1(tl_find(e->data->e_tags, nutag_substate));
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
nua_substate_terminated);
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
free_events_in_list(ctx, b->events);
if (print_headings)
printf("TEST NUA-3.2.2: PASSED\n");
INFO(b, b_call, b_call->nh, TAG_END());
BYE(b, b_call, b_call->nh, TAG_END());
INFO(b, b_call, b_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
while (!b->events->head || /* r_info */
!b->events->head->next || /* r_bye */
!b->events->head->next->next || /* i_state */
!b->events->head->next->next->next) /* r_info */
run_ab_until(ctx, -1, save_events, -1, save_until_final_response);
/* B transitions:
nua_info()
READY --(T2)--> TERMINATING: nua_bye()
nua_r_info with 200
TERMINATING --(T3)--> TERMINATED: nua_r_bye, nua_i_state
nua_r_info with 481/900
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_r_info);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_info);
TEST_1(e->data->e_status >= 900 || e->data->e_status == 481);
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
TEST_1(!nua_handle_has_active_call(b_call->nh));
/* A transitions:
nua_i_info
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_info);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
BYE(a, a_call, a_call->nh, TAG_END());
run_a_until(ctx, -1, save_until_final_response);
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e->data->e_status >= 900);
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
TEST_1(!nua_handle_has_active_call(a_call->nh));
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;

View File

@ -467,7 +467,7 @@ int test_call_hold(struct context *ctx)
*/
if (print_headings)
printf("TEST NUA-7.6.1: re-INVITE without auto-ack\n");
printf("TEST NUA-7.6: re-INVITE without auto-ack\n");
/* Turn off auto-ack */
nua_set_hparams(b_call->nh, NUTAG_AUTOACK(0), TAG_END());
@ -517,7 +517,7 @@ int test_call_hold(struct context *ctx)
free_events_in_list(ctx, a->events);
if (print_headings)
printf("TEST NUA-7.6.1: PASSED\n");
printf("TEST NUA-7.6: PASSED\n");
/* ---------------------------------------------------------------------- */
@ -528,7 +528,7 @@ int test_call_hold(struct context *ctx)
*/
if (print_headings)
printf("TEST NUA-7.6.2: terminate call\n");
printf("TEST NUA-7.6: terminate call\n");
BYE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
@ -555,7 +555,7 @@ int test_call_hold(struct context *ctx)
free_events_in_list(ctx, b->events);
if (print_headings)
printf("TEST NUA-7.6.2: PASSED\n");
printf("TEST NUA-7.6: PASSED\n");
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
@ -725,6 +725,9 @@ int test_reinvite(struct context *ctx)
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
printf("TEST NUA-7.8: PASSED\n");
END();
}
@ -781,211 +784,6 @@ int ringing_until_terminated(CONDITION_PARAMS)
}
}
/* ======================================================================== */
int accept_and_attempt_reinvite(CONDITION_PARAMS);
int until_ready2(CONDITION_PARAMS);
/* test_reinvite2 message sequence looks like this:
A B
| |
|-------INVITE------>|
|<----100 Trying-----|
| |
|<----180 Ringing----|
| |
| /-INVITE-|
| \---900->|
| |
|<--------200--------|
|---------ACK------->|
: :
: queue INVITE :
: :
|-----re-INVITE----->|
|<--------200--------|
|---------ACK------->|
|-----re-INVITE----->|
|<--------200--------|
|---------ACK------->|
: :
: glare :
: :
|-----re-INVITE----->|
|<----re-INVITE------|
|<--------491--------|
|---------491------->|
|---------ACK------->|
|<--------ACK--------|
: :
|---------BYE------->|
|<--------200--------|
*/
int test_reinvite2(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
if (print_headings)
printf("TEST NUA-7.8.1: Test re-INVITE glare\n");
a_call->sdp = "m=audio 5008 RTP/AVP 0 8\n";
b_call->sdp = "m=audio 5010 RTP/AVP 8\n";
TEST_1(a_call->nh =
nua_handle(a->nua, a_call,
SIPTAG_FROM_STR("Alice <sip:alice@example.com>"),
SIPTAG_TO(b->to),
TAG_END()));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
run_ab_until(ctx, -1, until_ready, -1, accept_and_attempt_reinvite);
TEST_1(nua_handle_has_active_call(a_call->nh));
TEST_1(nua_handle_has_active_call(b_call->nh));
free_events_in_list(ctx, a->events);
free_events_in_list(ctx, b->events);
/* Check that we can queue INVITEs */
INVITE(a, a_call, a_call->nh, TAG_END());
INVITE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_ready2, -1, until_ready2);
free_events_in_list(ctx, a->events);
free_events_in_list(ctx, b->events);
/* Check that INVITE glare works */
INVITE(a, a_call, a_call->nh, TAG_END());
INVITE(b, b_call, b_call->nh, TAG_END());
a->flags.n = 0, b->flags.n = 0;
run_ab_until(ctx, -1, until_ready2, -1, until_ready2);
free_events_in_list(ctx, a->events);
free_events_in_list(ctx, b->events);
if (print_headings)
printf("TEST NUA-7.8.1: PASSED\n");
/* ---------------------------------------------------------------------- */
/*
A B
|---------BYE------->|
|<--------200--------|
*/
if (print_headings)
printf("TEST NUA-7.8.2: terminate call\n");
BYE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
/*
Transitions of A:
READY --(T2)--> TERMINATING: nua_bye()
TERMINATING --(T3)--> TERMINATED: nua_r_bye, nua_i_state
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
/* Transitions of B:
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
if (print_headings)
printf("TEST NUA-7.8.2: PASSED\n");
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
END();
}
int accept_and_attempt_reinvite(CONDITION_PARAMS)
{
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
return 0;
save_event_in_list(ctx, event, ep, call);
if (event == nua_i_prack) {
INVITE(ep, call, nh, TAG_END());
RESPOND(ep, call, nh, SIP_200_OK,
TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
TAG_END());
}
else switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
SIPTAG_REQUIRE_STR("100rel"),
TAG_END());
return 0;
case nua_callstate_early:
return 0;
case nua_callstate_ready:
return 1;
case nua_callstate_terminated:
if (call)
nua_handle_destroy(call->nh), call->nh = NULL;
return 1;
default:
return 0;
}
return 0;
}
/*
X INVITE
| |
|-------INVITE------>|
|<--------200--------|
|---------ACK------->|
*/
int until_ready2(CONDITION_PARAMS)
{
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
return 0;
save_event_in_list(ctx, event, ep, call);
if (event == nua_r_invite && status == 491) {
if (ep == &ctx->a && ++ctx->b.flags.n >= 2) ctx->b.running = 0;
if (ep == &ctx->b && ++ctx->a.flags.n >= 2) ctx->a.running = 0;
}
switch (callstate(tags)) {
case nua_callstate_ready:
return ++ep->flags.n >= 2;
case nua_callstate_terminated:
if (call)
nua_handle_destroy(call->nh), call->nh = NULL;
return 1;
default:
return 0;
}
}
int test_reinvites(struct context *ctx)
{
int retval = 0;
@ -996,10 +794,7 @@ int test_reinvites(struct context *ctx)
retval = test_call_hold(ctx);
if (retval == 0)
retval = test_reinvite(ctx);
if (retval == 0)
retval = test_reinvite2(ctx);
retval |= test_reinvite(ctx);
if (print_headings && retval == 0)
printf("TEST NUA-7: PASSED\n");

View File

@ -638,12 +638,11 @@ int test_reject_401(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_proxy_authorization);
/* Ensure that nua_authenticate() tags get added to the request */
TEST_1(sip->sip_subject);
TEST_S(sip->sip_subject->g_value, "Got 407");
TEST_1(sip->sip_proxy_authorization);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
@ -912,7 +911,7 @@ int test_mime_negotiation(struct context *ctx)
/*
Client transitions in reject-3:
INIT -(C1)-> CALLING -(C6a)-> TERMINATED
INIT -(C1)-> PROCEEDING -(C6a)-> TERMINATED
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
@ -928,7 +927,7 @@ int test_mime_negotiation(struct context *ctx)
/* No content-encoding is supported */
TEST_S(sip->sip_accept_encoding->aa_value, "");
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* CALLING */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
@ -945,316 +944,3 @@ int test_mime_negotiation(struct context *ctx)
END();
}
/* ---------------------------------------------------------------------- */
size_t filter_200_OK(void *message, size_t len)
{
if (len >= 11 && strncasecmp(message, "SIP/2.0 200", 11) == 0)
return 0;
return len;
}
size_t filter_ACK(void *message, size_t len)
{
if (len >= 7 && strncasecmp(message, "ACK sip", 7) == 0)
return 0;
return len;
}
int call_with_bad_ack(CONDITION_PARAMS);
int accept_call_with_bad_contact(CONDITION_PARAMS);
int test_call_timeouts(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
struct nat_filter *f;
if (print_headings)
printf("TEST NUA-4.7: check for error and timeout handling\n");
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
if (!ctx->nat)
goto completed_4_7_1;
if (print_headings)
printf("TEST NUA-4.7.1: ACK timeout (200 OK filtered)\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
TEST_1(f = test_nat_add_filter(ctx->nat, filter_200_OK, nat_inbound));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SIPTAG_SUBJECT_STR("NUA-4.7.1"),
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, accept_call);
/*
A accept_call B
| |
|-------INVITE------>|
|<----100 Trying-----|
| |
|<----180 Ringing----|
| |
| X-----200--------|
| X-----200--------|
| X-----200--------|
| |
|<--------BYE--------|
|--------200 OK----->|
*/
/*
Client transitions:
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
/*
Server transitions:
-(S1)-> RECEIVED -(S2a)-> EARLY -(S3b)-> COMPLETED -(S5)-> TERMINATING
-(S10)-> TERMINATED -X
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_error);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminating); /* TERMINATING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
TEST_1(test_nat_remove_filter(ctx->nat, f) == 0);
if (print_headings)
printf("TEST NUA-4.7.1: PASSED\n");
completed_4_7_1:
if (!ctx->nat)
goto completed_4_7_2;
if (print_headings)
printf("TEST NUA-4.7.2: ACK timeout (ACK filtered)\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
TEST_1(f = test_nat_add_filter(ctx->nat, filter_ACK, nat_outbound));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SIPTAG_SUBJECT_STR("NUA-4.7.2"),
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, accept_call);
/*
A accept_call B
| |
|-------INVITE------>|
|<----100 Trying-----|
| |
|<----180 Ringing----|
| |
|<--------200--------|
|--------ACK-----X |
| |
|<--------200--------|
|--------ACK-----X |
| |
|<--------200--------|
|--------ACK-----X |
| |
|<--------BYE--------|
|--------200 OK----->|
*/
/*
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST_1(!e->next);
/*
Server transitions:
-(S1)-> RECEIVED -(S2a)-> EARLY -(S3b)-> COMPLETED -(S5)-> TERMINATING
-(S10)-> TERMINATED -X
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_error);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminating); /* TERMINATING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
TEST_1(test_nat_remove_filter(ctx->nat, f) == 0);
if (print_headings)
printf("TEST NUA-4.7.2: PASSED\n");
completed_4_7_2:
if (print_headings)
printf("TEST NUA-4.7.3: sending ACK fails\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SIPTAG_SUBJECT_STR("NUA-4.7.3"),
SOATAG_USER_SDP_STR(a_call->sdp),
NUTAG_AUTOACK(0),
TAG_END());
run_ab_until(ctx, -1, call_with_bad_ack, -1, accept_call);
/*
A accept_call B
| |
|-------INVITE------>|
|<----100 Trying-----|
| |
|<----180 Ringing----|
| |
|<--------200--------|
|--ACK-X |
| |
|---------BYE------->|
|<-------200 OK------|
*/
/*
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completing); /* COMPLETING */
/* try to send ACK */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminating);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST_1(!e->next);
/*
Server transitions:
-(S1)-> RECEIVED -(S2a)-> EARLY -(S3b)-> COMPLETED -(S5)-> TERMINATING
-(S10)-> TERMINATED -X
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
printf("TEST NUA-4.7.3: PASSED\n");
/* XXX - PRACK timeout, PRACK failing, media failing, re-INVITEs */
if (print_headings)
printf("TEST NUA-4.7: PASSED\n");
END();
}
int call_with_bad_ack(CONDITION_PARAMS)
{
if (!check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR))
return 0;
save_event_in_list(ctx, event, ep, call);
if (event == nua_r_invite && 200 <= status && status < 300) {
ACK(ep, call, nh,
/* Syntax error - sending ACK fails, we send BYE */
SIPTAG_MAX_FORWARDS_STR("blue"),
TAG_END());
}
return event == nua_i_state && callstate(tags) == nua_callstate_terminated;
}

View File

@ -118,8 +118,6 @@ int cancel_when_ringing(CONDITION_PARAMS)
case nua_callstate_proceeding:
CANCEL(ep, call, nh, TAG_END());
return 0;
case nua_callstate_ready:
return 1;
case nua_callstate_terminated:
return 1;
default:
@ -498,13 +496,13 @@ int destroy_when_early(CONDITION_PARAMS)
return 0;
case nua_callstate_early:
if (call)
DESTROY(ep, call, nh), call->nh = NULL;
nua_handle_destroy(call->nh), call->nh = NULL;
return 1;
case nua_callstate_completed:
case nua_callstate_ready:
case nua_callstate_terminated:
if (call)
DESTROY(ep, call, nh), call->nh = NULL;
nua_handle_destroy(call->nh), call->nh = NULL;
return 1;
default:
return 0;
@ -596,7 +594,7 @@ int destroy_when_completed(CONDITION_PARAMS)
case nua_callstate_ready:
case nua_callstate_terminated:
if (call)
DESTROY(ep, call, nh), call->nh = NULL;
nua_handle_destroy(call->nh), call->nh = NULL;
return 1;
default:
return 0;
@ -675,82 +673,6 @@ int test_call_destroy_4(struct context *ctx)
END();
}
/* Destroy when one INVITE is queued. */
int test_call_destroy_5(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
if (print_headings)
printf("TEST NUA-5.7: destroy when re-INVITE is queued\n");
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
NUTAG_AUTOACK(0),
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
INVITE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, destroy_when_completed);
/* Client transitions:
INIT -(C1)-> CALLING: nua_invite(), ...
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
TEST_1(is_offer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completing); /* COMPLETING */
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 481);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
/*
Server transitions:
INIT -(S1)-> RECEIVED: nua_i_invite, nua_i_state
RECEIVED -(S2a)-> EARLY: nua_respond(), nua_i_state
EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state ... DESTROY
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
printf("TEST NUA-5.7: PASSED\n");
END();
}
int test_call_destroy(struct context *ctx)
{
struct endpoint *a = &ctx->a, *b = &ctx->b;
@ -763,12 +685,10 @@ int test_call_destroy(struct context *ctx)
test_call_destroy_1(ctx) ||
test_call_destroy_2(ctx) ||
test_call_destroy_3(ctx) ||
test_call_destroy_4(ctx) ||
test_call_destroy_5(ctx);
test_call_destroy_4(ctx);
}
/* ======================================================================== */
/* Early BYE
A B
@ -811,27 +731,12 @@ int bye_when_ringing(CONDITION_PARAMS)
}
}
int bye_when_completing(CONDITION_PARAMS);
static int ack_sent = 0;
size_t count_acks(void *message, size_t len)
{
if (strncasecmp(message, "ACK sip:", 8) == 0)
ack_sent++;
return len;
}
int test_early_bye(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
struct nat_filter *f = NULL;
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
if (print_headings)
printf("TEST NUA-6.1: BYE call when ringing\n");
@ -901,119 +806,6 @@ int test_early_bye(struct context *ctx)
if (print_headings)
printf("TEST NUA-6.1: PASSED\n");
/* Early BYE 2
A B
|-------INVITE------>|
|<----100 Trying-----|
| |
|<----180 Ringing----|
|<-------200---------|
| |
|--------BYE-------->|
|<------200 OK-------|
|--------ACK-------->|
| |
| |
*/
if (print_headings)
printf("TEST NUA-6.2: BYE call when completing\n");
if (ctx->nat)
TEST_1(f = test_nat_add_filter(ctx->nat, count_acks, nat_outbound));
ack_sent = 0;
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SOATAG_USER_SDP_STR(a_call->sdp),
NUTAG_AUTOACK(0),
TAG_END());
run_ab_until(ctx, -1, bye_when_completing, -1, accept_until_terminated);
/* Client transitions:
INIT -(C1)-> CALLING: nua_invite(), nua_i_state
CALLING -(C2)-> PROCEEDING: nua_r_invite(180, nua_i_state, nua_cancel()
PROCEEDING -(C6b)-> TERMINATED: nua_r_invite(487), nua_i_state
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling);
TEST_1(is_offer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completing);
TEST_1(e = e->next);
TEST_E(e->data->e_event, nua_r_bye); TEST(e->data->e_status, 200);
TEST_1(e->data->e_msg);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
if (ctx->nat) {
while (ack_sent == 0)
su_root_step(ctx->root, 100);
TEST_1(ack_sent > 0);
TEST_1(test_nat_remove_filter(ctx->nat, f) == 0);
}
/*
Server transitions:
INIT -(S1)-> RECEIVED: nua_i_invite, nua_i_state
RECEIVED -(S2a)-> EARLY: nua_respond(180), nua_i_state
EARLY -(S6b)--> TERMINATED: nua_i_cancel, nua_i_state
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* EARLY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
printf("TEST NUA-6.2: PASSED\n");
END();
}
int bye_when_completing(CONDITION_PARAMS)
{
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
return 0;
save_event_in_list(ctx, event, ep, call);
switch (callstate(tags)) {
case nua_callstate_completing:
ack_sent = 0;
BYE(ep, call, nh, TAG_END());
return 0;
case nua_callstate_terminated:
return 1;
default:
return 0;
}
}

Some files were not shown because too many files have changed in this diff Show More