[Build-System] Remove Sofia-Sip library from the FreeSWITCH tree and use packages instead.

This commit is contained in:
Andrey Volk 2020-07-28 21:10:23 +04:00
parent 08112e9989
commit 2fc0e3b80a
848 changed files with 252 additions and 322003 deletions

View File

@ -14,6 +14,7 @@ steps:
image: signalwire/freeswitch-public-base
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- echo "applications/mod_test" >> modules.conf
- echo 'codecs/mod_openh264' >> modules.conf
- sed -i '/applications\\/mod_http_cache/s/^#//g' modules.conf
@ -27,6 +28,7 @@ steps:
image: signalwire/freeswitch-public-base
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- echo '#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./build-status.txt\n' > build.sh
- chmod +x build.sh
- ./build.sh
@ -35,6 +37,7 @@ steps:
image: signalwire/freeswitch-public-base
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- make install || true
- cd tests/unit
- ./run-tests.sh
@ -80,6 +83,7 @@ steps:
image: signalwire/freeswitch-public-base:stretch
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- cp build/modules.conf.most modules.conf
#Enable/Uncomment mods
- echo 'codecs/mod_openh264' >> modules.conf
@ -109,6 +113,7 @@ steps:
image: signalwire/freeswitch-public-base:stretch
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- mkdir -p scan-build
- echo '#!/bin/bash\nscan-build-4.0 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh
- chmod +x scan.sh
@ -139,6 +144,6 @@ trigger:
---
kind: signature
hmac: 430f5a243e6029b985fa0219e9fb44c71a59931af44a3230751e238f8b64dd32
hmac: 9f536d54b3df4db408a9e23a412185d0c95e66d22d15ba7ff00c7cfc85bff3ab
...

1
.gitattributes vendored
View File

@ -6,7 +6,6 @@
*.c text eol=lf
*.cxx text eol=lf
*.cpp text eol=lf
/libs/sofia-sip/libsofia-sip-ua/sip/sip_bad_mask text eol=lf
*.txt text eol=lf
*.exe -diff binary executable windows dfsg-nonfree debian-ignore
*.wav -diff binary sound

2
.gitignore vendored
View File

@ -260,6 +260,8 @@ libs/libsilk-*/
libs/rabbitmq-c-*/
libs/rabbitmq-c-*.zip
libs/ffmpeg-*/
libs/sofia-sip*/
libs/sofia-sip*
src/mod/applications/mod_test/test/test_asr
src/mod/event_handlers/mod_rayo/test/test_iks

View File

@ -30,9 +30,8 @@ endif
AM_CFLAGS = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
AM_CPPFLAGS =
AM_CPPFLAGS += -I$(switch_srcdir)/libs/libvpx
AM_CPPFLAGS += $(SWITCH_AM_CXXFLAGS) -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/sdp
AM_CPPFLAGS += -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/su -I$(switch_builddir)/libs/sofia-sip/libsofia-sip-ua/su
AM_LDFLAGS = $(SWITCH_AM_LDFLAGS) $(AM_LIBAPR_LDFLAGS) $(AM_LIBAPU_LDFLAGS)
AM_CPPFLAGS += $(SWITCH_AM_CXXFLAGS) $(SOFIA_SIP_CFLAGS)
AM_LDFLAGS = $(SWITCH_AM_LDFLAGS) $(AM_LIBAPR_LDFLAGS) $(AM_LIBAPU_LDFLAGS) $(SOFIA_SIP_LIBS)
DEFAULT_SOUNDS=en-us-callie-8000
MY_DEFAULT_ARGS= --build=$(build) --host=$(host) --target=$(target) --prefix="$(prefix)" --exec_prefix="$(exec_prefix)" --libdir="$(libdir)"
@ -593,14 +592,6 @@ libs/libvpx/Makefile: libs/libvpx/.update
libs/libvpx/libvpx.a: libs/libvpx/Makefile libs/libvpx/.update
@cd libs/libvpx && $(MAKE)
libs/sofia-sip/Makefile:
cd libs/sofia-sip && sh ./configure.gnu $(MY_DEFAULT_ARGS)
libs/sofia-sip/libsofia-sip-ua/sdp/.libs/libsdp.a libs/sofia-sip/libsofia-sip-ua/su/.libs/libsu.a: libs/sofia-sip/.update libs/sofia-sip/Makefile
@cd libs/sofia-sip && $(MAKE) noop
@cd libs/sofia-sip && $(MAKE) SOFIA_CFLAGS="$(SWITCH_AM_CFLAGS)"
@$(TOUCH_TARGET)
libs/apr/Makefile: libs/apr/Makefile.in libs/apr/config.status libs/apr libs/apr/.update
@cd libs/apr && ./config.status
@$(TOUCH_TARGET)
@ -756,7 +747,6 @@ pristine:
git reset --hard
update-clean: clean python-reconf
cd libs/sofia-sip && $(MAKE) clean
cd libs/esl && $(MAKE) clean
cd libs/srtp && $(MAKE) clean
@ -796,11 +786,6 @@ spandsp-reconf:
cd libs/spandsp && sh ./configure.gnu $(MY_DEFAULT_ARGS)
cd libs/spandsp && $(MAKE)
sofia-reconf:
cd libs/sofia-sip && sh ./autogen.sh
cd libs/sofia-sip && $(MAKE) clean
cd libs/sofia-sip && ./configure $(MY_DEFAULT_ARGS) --with-pic --with-glib=no --disable-shared
cluecon:
@clear
@echo Thank you for updating. This is going to take a while so relax.

View File

@ -9,8 +9,8 @@ m4_include([build/config/ax_check_java.m4])
m4_include([build/config/uuid.m4])
m4_include([build/config/erlang.m4])
m4_include([build/config/odbc.m4])
m4_include([build/config/sac-pkg-config.m4])
m4_include([build/config/sac-openssl.m4])
m4_include([build/config/sched_setaffinity.m4])
m4_include([libs/apr/build/apr_common.m4])
m4_include([libs/sofia-sip/m4/sac-pkg-config.m4])
m4_include([libs/sofia-sip/m4/sac-openssl.m4])
m4_include([libs/iksemel/build/libgnutls.m4])

View File

@ -8,7 +8,7 @@ BGJOB=false
VERBOSE=false
BASEDIR=`pwd`;
LIBDIR=${BASEDIR}/libs;
SUBDIRS="apr libzrtp iksemel libdingaling sofia-sip srtp freetdm spandsp unimrcp fs";
SUBDIRS="apr libzrtp iksemel libdingaling srtp freetdm spandsp unimrcp fs";
while getopts 'jhd:v' o; do
case "$o" in

View File

@ -714,6 +714,11 @@ PKG_CHECK_MODULES([MARIADB], [libmariadb >= 3.0.9],[
])
])
PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.12.12],[
AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[
AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent])
])
AC_ARG_ENABLE(deprecated-core-db-events,
[AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"])
@ -2104,7 +2109,6 @@ if test "$use_system_aprutil" != "yes"; then
fi
AC_CONFIG_SUBDIRS([libs/iksemel])
AC_CONFIG_SUBDIRS([libs/libdingaling])
AC_CONFIG_SUBDIRS([libs/sofia-sip])
AC_CONFIG_SUBDIRS([libs/freetdm])
AC_CONFIG_SUBDIRS([libs/unimrcp])
AC_CONFIG_SUBDIRS([libs/spandsp])

2
debian/bootstrap.sh vendored
View File

@ -332,7 +332,7 @@ Build-Depends:
uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev,
# used by many modules
libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev,
bison, zlib1g-dev,
bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.12.12)
# module build-depends
$(debian_wrap "${mod_build_depends}")
Standards-Version: 3.9.3

View File

@ -152,6 +152,7 @@ BuildRequires: gnutls-devel
BuildRequires: libtool >= 1.5.17
BuildRequires: ncurses-devel
BuildRequires: openssl-devel >= 1.0.1e
BuildRequires: sofia-sip-devel >= 1.12.12
BuildRequires: pcre-devel
BuildRequires: speex-devel
BuildRequires: sqlite-devel

1
libs/.gitignore vendored
View File

@ -837,7 +837,6 @@ iksemel/configure
libdingaling/configure
libyuv/Makefile
libyuv/convert
sofia-sip/configure
spandsp/configure
srtp/configure
tiff-4.0.2/configure

View File

@ -1 +0,0 @@
Fri Jul 31 17:46:57 CDT 2020

View File

@ -1,49 +0,0 @@
Current development team
------------------------
Pekka Pessi <pekka.pessi -at nokia -dot com>
Martti Mela <martti.mela -at nokia -dot com>
Kai Vehmanen <kai.vehmanen -at nokia -dot com>
Contributors (in alphabetical order, surname first)
---------------------------------------------------
Alaoui, Youness <youness -dot alaoui -at collabora -dot co -dot uk>
Chan, Tat <first.surname@nokia.com>
Ciarkowski, Andrzej <wp-voigtkampff -at users -dot sourceforge -dot net>
Czapiga, Brian <rys -at evool -dot com>
Denis-Courmont, Remi <first.surname@nokia.com>
Ferrari, Fabio <fabioferrari -at gmail -dot 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>
Jerris, Michael <mike -at jerris -dot com>
Katcipis, Tiago <katcipis AT inf DOT ufcs DOT br>
Knoblich, Stefan
Legostayev, Denis <legostayev -at neic -dot nsk -dot su>
Lenk, Jeff <jlenk -at frontiernet -dot net>
Leuenberger, Stefan <first.surname -at netmodule -dot com>
Margarido, Fabio <fabiomargarido AT gmail DOT com>
Neuner, Jarod <janeuner -at networkharbor -dot com>
Paul, Johan <johan -dot paul -at plenware -dot fi>
Pizarro, Paulo <paulo -dot pizarro -at gmail -dot com>
Prado, Dimitri E. <dprado -at e3c -dot com -dot br>
Puolakka, Petteri <first.surname@nokia.com>
Puustinen, Ismo <first.surname@nokia.com>
Rinne-Rahkola, Pasi <first.surname@nokia.com>
Richards, Jerry <jerryr at tonecommander dot com>
Rondina, Daniele <geaary -at gmail -dot com>
Saari, Mika <first.surname@nokia.com>
Sabatini, Stefano
Selin, Jari <first.surname@nokia.com>
Suttner, Bernhard <suttner -at comdasys -dot com>
Underwood, Steve <steveu -at coppice -dot org>
Urpalainen, Jari <first.surname@nokia.com>
Whittaker, Colin <colinw -at occamnetworks -dot com>
Zabaluev, Mikhail <first.surname@nokia.com>
Zaikin, Maxim <Maxim -at amsd -dot 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

@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,251 +0,0 @@
This package contains the Sofia-SIP library.
Copyright (C) 2005-2006 Nokia Corporation and others (see the
in individual files for a detailed list of copyright holders).
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 (LICENSE) for more details.
----------------------------------------------------------------------------
libsofia-sip-ua/su/inet_ntop.c
The package also contains files licensed by Internet Software Consortium.
These files are distributed with the following copyright notice:
Copyright (c) 1996 by Internet Software Consortium.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
----------------------------------------------------------------------------
libsofia-sip-ua/su/inet_pton.c
The package also contains files licensed by Internet Software Consortium and
Internet Systems Consortium, Inc.. These files are distributed with the
following copyright notice:
Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
Copyright (c) 1996,1999 by Internet Software Consortium.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
----------------------------------------------------------------------------
libsofia-sip-ua/su/sofia-sip/su_addrinfo.h
libsofia-sip-ua/su/su_addrinfo.c
The package also contains files licensed by WIDE Project. These files are
distributed with the following copyright notice:
Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
----------------------------------------------------------------------------
libsofia-sip-ua/su/getopt.c
The package also contains files licensed by IBM Corporation. These files are
distributed with the following copyright notice:
This module contains code made available by IBM
Corporation on an AS IS basis. Any one receiving the
module is considered to be licensed under IBM copyrights
to use the IBM-provided source code in any way he or she
deems fit, including copying it, compiling it, modifying
it, and redistributing it, with or without
modifications. No license under any IBM patents or
patent applications is to be implied from this copyright
license.
A user of the module should understand that IBM cannot
provide technical support for the module and will not be
responsible for any consequences of use of the program.
Any notices, including this one, are not to be removed
from the module without the prior written consent of
IBM.
----------------------------------------------------------------------------
libsofia-sip-ua/su/su_md5.c
The package also contains files written by Colin Plumb. These files are
distributed with the following copyright notice:
This code implements the MD5 message-digest algorithm. The algorithm is due
to Ron Rivest. This code was initially written by Colin Plumb in 1993, no
copyright is claimed. This code is in the public domain; do with it what you
wish.
Equivalent code is available from RSA Data Security, Inc. This code has
been tested against that, and is equivalent, except that you don't need
to include two pages of legalese with every copy.
----------------------------------------------------------------------------
libsofia-sip-ua/su/strtoull.c
The package also contains files licensed by University of California and Sun
Microsystems. These files are distributed with the following copyright
notice:
Copyright (c) 1988 The Regents of the University of California.
Copyright (c) 1994 Sun Microsystems, Inc.
The following license.terms for information on usage and redistribution
of this individual file, and for a DISCLAIMER OF ALL WARRANTIES.
This software is copyrighted by the Regents of the University of
California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
Corporation and other parties. The following terms apply to all files
associated with the software unless explicitly disclaimed in
individual files.
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
----------------------------------------------------------------------------
libsofia-sip-ua/ipt/rc4.c
The package also contains files written by Pekka Pessi. These files are
distributed with the following copyright notice:
Copyright (c) 1996 Pekka Pessi. All rights reserved.
This source code is provided for unrestricted use. Users may copy or
modify this source code without charge.
THIS SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND
INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A
PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE
PRACTICE.
This source code is provided with no support and without any obligation
on the part of author to assist in its use, correction, modification or
enhancement.
AUTHOR SHALL HAVE NO LIABILITY WITH RESPECT TO THE INFRINGEMENT OF
COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE OR ANY PART
THEREOF.
In no event will author be liable for any lost revenue or profits or
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

@ -1,18 +0,0 @@
===============================================================
ChangeLog / Sofia-SIP - SIP User-Agent library
===============================================================
Sofia-SIP library ChangeLog files are available in the
following places:
- per subdirectory ChangeLog files
- all non-trivial changes to files (unless documented
elsewhere)
- version control system changelogs
- darcs and CVS tree repositories (see README.developers
for latest repository location information)
- RELEASE files
- changes for the current version store in top-level
RELEASE files of the source tree
- old RELEASE files available at:
http://sofia-sip.sourceforge.net/relnotes/

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
#
# Makefile.am for sofia-sip package
#
# Copyright (C) 2005,2006 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
AUTOMAKE_OPTIONS = foreign 1.7
SUBDIRS = libsofia-sip-ua $(GLIB_SUBDIRS) packages tests s2check utils
DIST_SUBDIRS = s2check libsofia-sip-ua libsofia-sip-ua-glib utils packages \
tests win32 open_c
# note: when glib devel files are not available, make should not
# enter the libsofia-sip-ua-glib subdir at all
if HAVE_GLIB
GLIB_SUBDIRS = libsofia-sip-ua-glib
endif
PACKAGE = @PACKAGE@
VERSION = @VERSION@
EXTRA_DIST = AUTHORS COPYING COPYRIGHTS ChangeLog.ext-trees \
README README.developers RELEASE TODO
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST += m4/sac-general.m4 m4/sac-coverage.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
EXTRA_DIST += scripts/lcov-report scripts/uncovered \
scripts/hide_emails.sh
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
noop:
@echo ok
$(dist_man_MANS): manpages
manpages:
-mkdir -p man man/man1 2> /dev/null
if HAVE_DOXYGEN
$(MAKE) $(AM_MAKEFLAGS) -C libsofia-sip-ua/docs built-sources
@echo 'cd utils && $(DOXYGEN)'
@cd utils && \
{ exec 3>&1 1>&2; { $(DOXYGEN) 2>&1; echo $$? >& 3 ;} | \
fgrep -v 'Warning: explicit' ;} | { read x; exit $$x ;}
@rm -f man/man1/_*.1
else
-touch $(dist_man_MANS)
endif
CLEANFILES = $(dist_man_MANS)
built-sources clean-built-sources valcheck doxygen:
@failcom='exit 1'; for f in x $$MAKEFLAGS; do \
case $$f in *=* | --[!k]*);; *k*) failcom='fail=yes';; esac; done; \
for i in libsofia-sip-ua $(GLIB_SUBDIRS) ; do \
(cd $$i && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \
done ; \
test -z "$$fail"
PHONY = built-sources clean-built-sources valcheck doxygen manpages
# s2check depends on generated headers within libsofia-sip-ua
all check: built-sources
if HAVE_LCOV
include $(top_srcdir)/rules/lcov.am
lcov-upload: lcov
rsync -rvz -e ssh --delete lcov/* sofia-sip.org:/var/www/coverage/lcov/
endif
.PHONY: $(PHONY)

View File

@ -1,66 +0,0 @@
=============================================================
README / Sofia-SIP - RFC3261 compliant SIP User-Agent library
=============================================================
Introduction
------------
Sofia-SIP is an open-source SIP User-Agent library, compliant
with the IETF RFC3261 specification. It can be used as
a building block for SIP client software for uses such as VoIP,
IM, and many other real-time and person-to-person communication
services. The primary target platform for Sofia-SIP is
GNU/Linux. Sofia-SIP is based on a SIP stack developed at
the Nokia Research Center. Sofia-SIP is licensed under the LGPL.
Quick start
-----------
Sofia-SIP uses the GNU autotools, so building procedure
is the usual:
sh> sh autogen.sh (if building from darcs)
sh> ./configure
sh> make
sh> make install
See also 'docs/devel_platform_notes.txt' for notes on compiling
Sofia-SIP in different environments.
See the "options-client-example" (available using darcs at
http://sofia-sip.org/repos/options-client-example/ or with CVS as
a module in Sofia-SIP CVS tree) for an example of a small app that
is utilizing Sofia-SIP, and specifically the libsofia-sip-ua
library component.
There are also multiple example clients under
the "sofia-sip/utils" directory:
- sip-options, query using SIP OPTIONS method
- sip-date, SIP date printer/parser
The Sofia-SIP su submodule also provides some small utilities:
- addrinfo (libsofia-sip-ua/su), resolve host names
- localinfo (libsofia-sip-ua/su), prints information about
local network interfaces
References
----------
Project website:
- http://sofia-sip.sourceforge.net
- http://www.sourceforge.net/projects/sofia-sip
Mailing list:
- http://sourceforge.net/mail/?group_id=143636
Version control repositories:
- see the project website (link above)
Licensing
---------
Sofia-SIP is licensed under terms of the GNU LGPL.
See the file "COPYING" for more information.

View File

@ -1,134 +0,0 @@
===============================================================
README.developers - Sofia-SIP development practices
===============================================================
Introduction
============
This file is a collection of practices and rules for Sofia-SIP
development. If you have questions, or would like to make
changes, raise the issue on sofia-sip-devel (see
http://lists.sourceforge.net/lists/listinfo/sofia-sip-devel ).
Important files for developers
==============================
AUTHORS
List of contributors. When contributing new code, add
yourself to AUTHORS, and also remember to update the
per source file copyright statements.
COPYRIGHTS
List of licenses and related copyright statements. While
majority of Sofia-SIP is licensed under LGPL, there are
a few files with different, but LGPL compatible, licensing
terms.
README.developers
This file.
TODO
Not in active use yet.
<dir>/ChangeLog files
All non-trivial changes to the source code should
be documented in the ChangeLog files. See also the
top-level ChangeLog.
Version numbering
=================
Package version
---------------
For public releases, the package version is:
vMAJOR.MINOR.REVISION, where MINOR is even
For development releases and snaphots the version is one of:
vMAJOR.MINOR.REVISION, where minor is odd
vMAJOR.MINOR.REVISION.YEAR.MONTH.DAY, where minor is odd
For all releases, the version should be changed in configure.ac
and committed to Darcs/CVS before making the release package. The person
doing the release is responsible for updating the version number.
Library interface versions
--------------------------
Sofia-SIP libraries utilize libtool interface versioning. See
- http://www.gnu.org/software/libtool/manual.html#Versioning
- http://www.gnu.org/software/libtool/manual.html#Using-Automake
The interface versions are set in top-level 'configure.ac' file.
Additionally, the SONAME version (CURRENT-AGE) is set in the
same place. These version numbers are available for use as autoconf
variables (see the library 'Makefile.am' files and
'packages/sofia-sip.spec.in').
All changes to the library versions should be marked to the
appropriate library 'ChangeLog' file. The library version should
be changed at the same time as the first interface change is
committed since the previous release. The interface version is
frozen (should be marked to the 'ChangeLog' file) at the time
the next release is tagged (in other words, intra-release changes
need not be tracked with libtool versions).
The goal should always be to avoid breaking the API/ABIs until
absolutely necessary. Interfaces clearly marked as private can
be changed without change to library interface version, but
otherwise all public functions, types, variables and definitions
fall under interface change control.
Version control tags
====================
Tagging releases and snapshots
------------------------------
- source repository (*)
- master Darcs tree at:
http://sofia-sip.org/repos/sofia-sip
- CVS tree (only used to track major releases) at:
http://sourceforge.net/cvs/?group_id=143636
- tags: rel-sofia-sip-x_y_z
- stable and development releases (matches release
version sofia-sip-x.y.z)
- tags: snapshot_rel_YEARMMDD
- snapshot releases at
http://sofia-sip.sourceforge.net/snapshots/
Notes (*):
- Information about Darcs:
http://abridgegame.org/darcs/
http://lwn.net/Articles/110516/
Sending patches
===============
People without Darcs access
---------------------------
Send your patches to sofia-sip-devel. Someone from the
development team (see AUTHORS) will handle the patch.
People with Darcs access
------------------------
Trivial changes can be committed without review. For non-trivial
changes, you should first send a proposal to sofia-sip-devel and
wait for comments. There are no strict approval rules so use of
common sense is recommended. ;)
Tips for making patches
-----------------------
- test your patch on a clean checkout from version control system
- remember to check for updates before pushing your changes
to the master repository

View File

@ -1,108 +0,0 @@
==============================================
Release notes for current version of Sofia-SIP
==============================================
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 />
Bugs in blaa and foo have been fixed. The stack now supports
use of foobar...
API/ABI changes and versioning
------------------------------
<see previous release notes at
http://sofia-sip.sourceforge.net/relnotes/ for examples ;
- should include all changes to public headers, and
other important information to developers;
- and should be updated _continuously_! />
**template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
libsofia-sip-ua:
- **template**: Added foobar() function (sofia-sip/foobar.h).
- Timing out CANCELed INVITE client transactions is now done with timer D.
Previously, the INVITE client transactions were restarted instead of
timing out under certain circumstances.
- An INVITE transaction that has been timed out with stack timer C is now
CANCELed automatically. Previously, such the INVITE client transactions
were restarted instead of timing out under certain circumstances.
- Timing out forked INVITE client transactions is now done by stack.
The stack generates a 408 response to each INVITE transaction fork that
has not received a final response within 32 seconds (or 64 times SIP T1)
after first final response to the INVITE was received.
- The mp_len type was changed from usize_t to unsigned.
The change is binary-incompatible on 64-bit platforms when compiled with
the configure opetion --disable-size-compat
- 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.
Removed globals which should have been static in first place:
- su_t64_to_time()
- mutex_trylocker()
- su_port_set_system_preferences()
- t_null_next(), t_null_move(), t_null_dup(), t_null_copy(), t_null_find()
- t_skip_next(), t_skip_move(), t_skip_len(), t_skip_dup(), t_skip_filter()
- t_next_next(), t_next_move(), t_next_len(), t_next_dup(), t_next_filter()
- t_filter_with(), t_any_filter()
- sres_record_class(), urandom
- u2s_alloc()
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.
Contributors to this release
----------------------------
Jarod Neuner <j dot neuner at networkharbor dot com>
Michael Jerris <mike at jerris dot com>
<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)
- name of the contributor should be enough (email addresses in AUTHORS),
plus a _brief_ description of what was contributed
- roughly sorted by number of patches accepted
/>
- **template**: First Surname (patch to nua/soa/msg)
See the AUTHORS file in the distribution package.
Notes on new features
---------------------
Jarod Neuner has improved certificate validation facilities of TLS
transport. Significant changes include:
1) The TLS handshake is no longer handled via transparent negotiation.
Certain static methods from tport.c were exposed to make this possible.
2) Certificate subjects are copied out of the peer certificate before
the first message is sent. The next patch will include code that allows
the stack to reject messages sent to a untrusted peer.
3) The tport module can now report whether a secondary has a verified
certificate chain and the subjects of the peer certificate.
Bugs fixed in this release
--------------------------
< notable bugs fixed in this release
- check the sf.net bug tracker; see closed bugs,
sorted by closing date
- other bugs as fixed in CVS/darcs
/>
- **template**: #9499652 sf.net bug item title
- Accept multiple WWW-Authenticate and Authorization headers.
Bug reported by Andrew Rechenberg.

View File

@ -1,73 +0,0 @@
==============================================
Release notes for current version of Sofia-SIP
==============================================
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 />
Bugs in blaa and foo have been fixed. The stack now supports
use of foobar...
API/ABI changes and versioning
------------------------------
<see previous release notes at
http://sofia-sip.sourceforge.net/relnotes/ for examples ;
- should include all changes to public headers, and
other important information to developers;
- and should be updated _continuously_! />
**template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
libsofia-sip-ua:
- **template**: Added foobar() function (sofia-sip/foobar.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.
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)
- name of the contributor should be enough (email addresses in AUTHORS),
plus a _brief_ description of what was contributed
- roughly sorted by number of patches accepted
/>
- **template**: First Surname (patch to nua/soa/msg)
See the AUTHORS file in the distribution package.
Notes on new features
---------------------
<information about major new features
- new/changed/removed functionality
- links to further documentation
- section may be omitted for minor releases
/>
Bugs fixed in this release
--------------------------
< notable bugs fixed in this release
- check the sf.net bug tracker; see closed bugs,
sorted by closing date
- other bugs as fixed in CVS/darcs
/>
- **template**: #9499652 sf.net bug item title

View File

@ -1,29 +0,0 @@
===============================================================
TODO / Sofia-SIP
===============================================================
version: 20060907-2
Release roadmap
---------------
1.11/1.12 series
- first version of the new nua+soa API
- nua_respond_nit() (non-INVITEs)
- nua_set_hparams()/nua_get_hparams() [DONE]
- session object ownership changes [DONE]
- allow multiple registrations (lines) and selecting
service route, outbound proxy, and transport independently
for each handle; NUTAG_IDENTITY
- doxygen documentation updates [DONE]
- rpm and dpkg packaging [DONE]
- NAT work: STUN fixes (DNS support) [DONE]
not roadmapped:
- expand the call-state-change mechanism
- update http headers TE, Cookie, Set-Cookie
2.0 serias
- a verified stable API (1.12 is the current stable candidate)
See README.developers for information about versioning.

View File

@ -1,7 +0,0 @@
m4_include([m4/sac-pkg-config.m4])
m4_include([m4/sac-general.m4])
m4_include([m4/sac-openssl.m4])
m4_include([m4/sac-su2.m4])
m4_include([m4/sac-su.m4])
m4_include([m4/sac-tport.m4])
m4_include([m4/sac-coverage.m4])

View File

@ -1,5 +0,0 @@
@setlocal
@cd open_c
@call autogen.cmd

View File

@ -1,8 +0,0 @@
#!/bin/sh
set -x
AUTOMAKE=${AUTOMAKE:-automake-1.9} ACLOCAL=${ACLOCAL:-aclocal-1.9}
export AUTOMAKE ACLOCAL
${AUTORECONF:-autoreconf} -i
find . \( -name 'run*' -o -name '*.sh' \) -a -type f | xargs chmod +x
chmod +x scripts/*

View File

@ -1,389 +0,0 @@
dnl Copyright (C) 2005-2006 Nokia Corporation
dnl Contact: Pekka Pessi <pekka.pessi@nokia.com>
dnl Licensed under LGPL. See file COPYING.
dnl
dnl ref: http://www.gnu.org/software/autoconf/manual/autoconf.info.gz
dnl
AC_PREREQ(2.57)
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.10devel])
CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
AC_CONFIG_MACRO_DIR([m4])
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, [6])
AC_SUBST(LIBVER_SOFIA_SIP_UA_REV, [0])
AC_SUBST(LIBVER_SOFIA_SIP_UA_AGE, [6])
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])
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_AGE, [0])
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_SOVER, [3]) # CUR-AGE
# dnl calls AC_CANONICAL_ macros that are required by AM_INIT_AUTOMAKE
SAC_CANONICAL_SYSTEM_CACHE_CHECK
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AC_GNU_SOURCE
CFLAGS="$CFLAGS -DSU_DEBUG=0 $DEBUG_CFLAGS"
### checks for programs
### -------------------
AC_LANG([C])
AC_CHECK_COMPILATION_ENVIRONMENT
SAC_TOOL_CC
AC_PROG_INSTALL
AC_PROG_CPP
AC_CHECK_PROG(ETAGS, etags, etags, echo)
AC_CHECK_TOOL(AR, ar, ar)
AC_CHECK_TOOL(LD, ld, ld)
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
SAC_ENABLE_NDEBUG
SAC_ENABLE_EXPENSIVE_CHECKS
dnl Add parameters for aclocal
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
AC_ARG_WITH(doxygen,
[ --with-doxygen[[=CMD]] use doxygen command CMD [[doxygen]]],[
case $enable_doxygen in
yes ) doxygen=doxygen ;;
no ) doxygen=echo ;;
esac], doxygen=doxygen)
AC_CHECK_PROG([DOXYGEN], [doxygen], [$doxygen], [echo])
AM_CONDITIONAL([HAVE_DOXYGEN], [test $DOXYGEN != echo])
AC_DEFUN([AX_COMPILER_VENDOR],
[
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
# note: don't check for gcc first since some other compilers define __GNUC__
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
thisisanerror;
#endif
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
done
])
])
AX_COMPILER_VENDOR
# Enable 64 bit build
AC_ARG_ENABLE(64,
[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
if test "${enable_64}" = "yes"; then
SOFIA_CFLAGS="$SOFIA_CFLAGS -m64"
LDFLAGS="-m64 -Wl,-64"
export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig
fi
fi
SOFIA_PLAT_CFLAGS=
# openbsd seems to not define NULL as a void pointer, I blame standards by committee for this.
# This is a dirty hack, but shuts up all the warnings
case "$host" in
*-openbsd*) SOFIA_PLAT_CFLAGS="-DNULL='(void *) 0L'";;
*) ;;
esac
AC_SUBST(SOFIA_PLAT_CFLAGS, $SOFIA_PLAT_CFLAGS)
### checks for header files
### -----------------------
AC_HEADER_STDC
### checks for declarations
### -----------------------
### checks for types
### ----------------
AC_TYPE_SIGNAL
AC_TYPE_LONGLONG
dnl
dnl Define HAVE_C99_FORMAT to 1 if the formatted IO functions (printf/scanf
dnl et.al.) support the C99 'size specifiers', namely ll, hh, j, z, t
dnl (representing long long int, char, intmax_t, size_t, ptrdiff_t). Some C
dnl compilers supported these specifiers prior to C99 as an extension.
dnl
AC_CACHE_CHECK([whether IO functions support C99 size specifiers],
[ac_cv_c_c99_format],[
ac_cv_c_c99_format=yes
AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[char buf[64];
if (sprintf(buf, "%lld%hhd%jd%zd%td", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5)
exit(1);
else if (strcmp(buf, "12345"))
exit(2);]])],
[ac_cv_c_c99_format=yes],
[ac_cv_c_c99_format=no],
[ac_cv_c_c99_format=yes])
])
if test $ac_cv_c_c99_format = yes; then
AC_DEFINE([HAVE_C99_FORMAT], [1], [Define to 1 if printf supports C99 size specifiers])dnl
AC_DEFINE([LLU], ["%llu"], [Format (%llu) for unsigned long long])dnl
AC_DEFINE([LLI], ["%lli"], [Format (%lli) for long long])dnl
AC_DEFINE([LLX], ["%llx"], [Format (%llx) for long long hex])dnl
AC_DEFINE([MOD_ZD], ["%zd"], [Define printf() modifier for ssize_t])dnl
AC_DEFINE([MOD_ZU], ["%zu"], [Define printf() modifier for size_t])dnl
else
AC_CACHE_CHECK([whether IO functions support size specifier for long long],
[ac_cv_c_ll_format],[
ac_cv_c_ll_format=yes
AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[char buf[64];
if (sprintf(buf, "%lld", (long long int)1) != 1)
exit(1);
else if (strcmp(buf, "1"))
exit(2);]])],
[ac_cv_c_ll_format=yes],
[ac_cv_c_ll_format=no],
[ac_cv_c_ll_format=yes])
])
if test $ac_cv_c_ll_format = yes; then
AC_DEFINE([LLU], ["%llu"], [Format (%llu) for unsigned long long])dnl
AC_DEFINE([LLI], ["%lli"], [Format (%lli) for long long])dnl
AC_DEFINE([LLX], ["%llx"], [Format (%llx) for long long hex])dnl
else
AC_MSG_ERROR("printf cannot handle 64-bit integers")
fi
AC_CACHE_CHECK([whether IO functions support size specifier for size_t],
[ac_cv_c_z_format],[
ac_cv_c_z_format=yes
AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[char buf[64];
if (sprintf(buf, "%zd", (size_t)1) != 1)
exit(1);
else if (strcmp(buf, "1"))
exit(2);]])],
[ac_cv_c_z_format=yes],
[ac_cv_c_z_format=no],
[ac_cv_c_z_format=yes])
])
if test $ac_cv_c_z_format = yes; then
AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
else
dnl Cross fingers
AC_MSG_WARN("printf cannot handle size_t, using long instead")
AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
fi
fi
### checks for structures
### ---------------------
### checks for typedefs, structures, and compiler characteristics.
### --------------------------------------------------------------
AC_C_CONST
AC_C_INLINE
AC_C_INLINE_DEFINE
AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
AC_C_VAR_FUNC
AC_C_MACRO_FUNCTION
AC_C_KEYWORD_STRUCT
AC_HEADER_TIME
AC_TYPE_SIZE_T
AC_SYS_SA_LEN
### checks for library functions
### ----------------------------
### checks for system services
### --------------------------
AC_DEV_URANDOM
### checks for libraries
### --------------------
SAC_SOFIA_SU
SAC_OPENSSL
SAC_TPORT
dnl Check is used for testing
PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no")
AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
if test x"$have_check" = "xyes"; then
AC_DEFINE([HAVE_CHECK], 1, [Define to 1 if check library is available])
fi
AC_CHECK_HEADERS([fnmatch.h])
AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])])
AC_CHECK_LIB(z, compress, [have_zlib=yes],[have_zlib=no])
if test x"$have_zlib" = "xyes"; then
AC_DEFINE(HAVE_ZLIB_COMPRESS, 1, [Define if you have zlib compress])
fi
AM_CONDITIONAL([HAVE_ZLIB], [test "x$have_zlib" = xyes])
dnl dl is currently used only in testing
AC_CHECK_LIB([dl], [dlopen], [
dnl Note: -ldl is not added to LIBS
AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dl library is available])
])
### internal modules
### ----------------
AC_DEFINE([HAVE_SOFIA_SIP], 1, [Define to 1 always])
AC_DEFINE([HAVE_SOFIA_SRESOLV], 1, [Define to 1 if we use DNS library])
AC_DEFINE([HAVE_SOFIA_SMIME], 0, [Define to 1 if we use S/MIME library])
AC_ARG_ENABLE(stun,
[ --disable-stun disable stun module (enabled)],
, enable_stun=yes)
if test x$enable_stun = xno ; then
AC_MSG_WARN([** STUN support disabled **])
elif test x${HAVE_OPENSSL} != x1 ; then
dnl compile STUN only if OPENSSL is available
AC_MSG_WARN([** TLS support for STUN disabled as OpenSSL headers and/or libraries were not found **])
AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
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 HTTP-related modules nth and http (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])
AC_DEFINE([HAVE_SOFIA_HTTP], 1, [Define to 1 if we use HTTP parser library])
fi
dnl Disable NTLM support by default
AC_ARG_ENABLE(ntlm,
[ --enable-ntlm enable NTLM support [[disabled]]],
, enable_ntlm=no)
if test x$enable_ntlm = xyes ; then
AC_DEFINE([HAVE_SOFIA_NTLM], 1, [Define to 1 if we use NTLM library])
fi
AM_CONDITIONAL([HAVE_NTLM], [test "x$enable_ntlm" = xyes])
AC_DEFINE([HAVE_SRTP], 0, [Define to 1 if we use SRTP])
AC_DEFINE([HAVE_UPNP], 0, [Define to 1 if we use UPnP])
AC_ARG_ENABLE(memleak_log,
[ --enable-memleak-log enable logging of possible memory leaks [[disabled]]],
, enable_memleak_log=no)
if test x$enable_memleak_log = xyes ; then
AC_DEFINE([HAVE_MEMLEAK_LOG], 1, [Define to 1 for memory-leak-related logging])
fi
### output
### ------
AC_CONFIG_FILES([
Makefile
packages/Makefile
packages/sofia-sip-ua.pc
packages/sofia-sip-ua-glib.pc
libsofia-sip-ua/Makefile
libsofia-sip-ua/bnf/Makefile
libsofia-sip-ua/bnf/Doxyfile
libsofia-sip-ua/docs/Makefile
libsofia-sip-ua/docs/Doxyfile
libsofia-sip-ua/docs/Doxyfile.version
libsofia-sip-ua/docs/sofia-footer.html
libsofia-sip-ua/features/Doxyfile
libsofia-sip-ua/features/Makefile
libsofia-sip-ua/http/Doxyfile
libsofia-sip-ua/http/Makefile
libsofia-sip-ua/ipt/Doxyfile
libsofia-sip-ua/ipt/Makefile
libsofia-sip-ua/iptsec/Doxyfile
libsofia-sip-ua/iptsec/Makefile
libsofia-sip-ua/msg/Doxyfile
libsofia-sip-ua/msg/Makefile
libsofia-sip-ua/nea/Doxyfile
libsofia-sip-ua/nea/Makefile
libsofia-sip-ua/nta/Doxyfile
libsofia-sip-ua/nta/Makefile
libsofia-sip-ua/nth/Doxyfile
libsofia-sip-ua/nth/Makefile
libsofia-sip-ua/nua/Doxyfile
libsofia-sip-ua/nua/Makefile
libsofia-sip-ua/sdp/Doxyfile
libsofia-sip-ua/sdp/Makefile
libsofia-sip-ua/sip/Doxyfile
libsofia-sip-ua/sip/Makefile
libsofia-sip-ua/soa/Doxyfile
libsofia-sip-ua/soa/Makefile
libsofia-sip-ua/sresolv/Doxyfile
libsofia-sip-ua/sresolv/Makefile
libsofia-sip-ua/stun/Doxyfile
libsofia-sip-ua/stun/Makefile
libsofia-sip-ua/su/Doxyfile
libsofia-sip-ua/su/Makefile
libsofia-sip-ua/tport/Doxyfile
libsofia-sip-ua/tport/Makefile
libsofia-sip-ua/url/Doxyfile
libsofia-sip-ua/url/Makefile
libsofia-sip-ua/features/sofia-sip/sofia_features.h
s2check/Makefile
libsofia-sip-ua-glib/Makefile
libsofia-sip-ua-glib/su-glib/Makefile
libsofia-sip-ua-glib/su-glib/Doxyfile
utils/Makefile
utils/Doxyfile
tests/Makefile
win32/Makefile
win32/config.h
open_c/Makefile
open_c/config.h
])
AC_CONFIG_COMMANDS([version],,[PACKAGE_VERSION=${PACKAGE_VERSION}])
AC_CONFIG_FILES([packages/sofia-sip-${PACKAGE_VERSION}.spec:packages/sofia-sip.spec.in])
AC_OUTPUT

View File

@ -1,4 +0,0 @@
#! /bin/sh
srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
$srcpath/configure "$@" --with-pic --with-glib=no --disable-shared --without-doxygen --disable-stun

View File

@ -1,105 +0,0 @@
=============================
Sofia-SIP build system README
=============================
:Author: Kai Vehmanen <kai -dot vehmanen -at- nokia -dot- com>
:Author: Pekka Pessi <pekka -dot pessi -at- nokia -dot- com>
:Version: 20051011-5
:Formatting: reStructuredText, http://docutils.sourceforge.net/rst.html
Introduction
============
The Sofia-SIP build system practices are documented in this
file. The instructions are aimed at developers.
Quick start
===========
To build Sofia-IP::
sh> ``./autogen.sh`` (if building from a fresh CVS checkout)
sh> ``./configure``
sh> ``make``
Autotool notes
==============
Macros
------
Sofia-SIP specific macros are prefixed with "``SAC\_``" and are
defined in files under the toplevel "m4/" directory.
Makefile target notes
---------------------
- all optionally compiled source files should be listed
separately in ``DIST_SOURCES`` variable (otherwise ``make dist``
will fail)
Makefile fragments
------------------
Some common makefile rules are in 'rules' subdirectory.
Maintainer mode
---------------
Sofia-SIP tree is by default configured with automake
maintainer mode disable. In other words, Makefiles do not
contain rules for recreating or updating configure, Makefiles
or other autotool-generated files. To update these files,
you need to run top-level autogen.sh script.
Those developers who need to often modify configure.ac, Makefile.am
and macro files, can enable maintainer mode with configure
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
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
================
Most of the code resides in the libsofia-sip-ua directory.
The main library, libsofia-sip-ua.so, is created by
collecting object files (for example bnf/bnf_objs.o) from
individual modules.
There are some portability issues with the way the
shared library is currently built, and we are looking
for ways to improve the situation.
Making releases
===============
See sofia-sip/docs/release_management.txt
Developer documentation
=======================
Generating reference documentation from source code
---------------------------------------------------
The libsofia-sip-ua library has a top-level make target
"doxygen" for generating the HTML reference documentation.
The pages will be created to libsofia-sip-ua/docs
subdirectory.
This special target is primarily meant for use by
the Sofia-SIP website admins, but can be used by anyone
with the proper set of tools:
- Doxygen, http://www.stack.nl/~dimitri/doxygen/
- Dot graph tool, http://www.research.att.com/sw/tools/graphviz/

View File

@ -1,58 +0,0 @@
======================================================
Notes on compiling Sofia-SIP in different environments
======================================================
Using GNU Autotools
-------------------
If you modify autoconf or automake files (configure.ac or Makefile.am) or if
you compile Sofia SIP that you pulled from darcs or CVS repo, you need
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
for more information.
The configure script accepts various options. See "./configure --help"
for the full list.
Mac OS X
--------
TBD
Win32 / Mingw
-------------
TBD
Win32 / Cygwin
--------------
TBD
Visual-C on win32
-----------------
See sofia-sip/win32/README.txt
LocalWords: automake

View File

@ -1,136 +0,0 @@
===================================
Sofia-SIP release management README
===================================
:Author: Kai Vehmanen <kai -dot vehmanen -at- nokia -dot- com>
:Version: 20060809-12
:Formatting: reStructuredText, http://docutils.sourceforge.net/rst.html
Introduction
============
This README contains instructions for making new Sofia-SIP releases.
Links to other resources
========================
sofia-sip/README.developers
The release notes
=================
The release notes should contain the following sections:
- about Sofia-SIP
- copied verbatim from sofia-sip/README
- list of changes since last release
- maintained in sofia-sip/RELEASE
- see diff between cvs/darcs between previous and
this version
- written in freshmeat.net "Changes:" style
- notes on API/ABI interface changes
- maintained in sofia-sip/RELEASE
- all changes in public interfaces, plus other
notes that developers should be aware of
- contributors to this release
- maintained in sofia-sip/RELEASE
- also sofia-sip/AUTHORS should be updated (file
should list all persons/companies who have code/scripts/etc
copyrighted to them in the sofia-sip tree)
See the RELEASE.template file for a full list of release note
sections.
Making the release tarball
==========================
- basics: check system clock of the build host ;)
- update the version number in sofia-sip/configure.ac
- make sure the library versions are correct, and you've
frozen all library interfaces (with correct entries in
ChangeLog files), see README.developers for more information
on library versioning in general
- make sure everything that is supposed to be in the
release is in the master darcs tree
- run 'make distcheck' to verify everything is ready for
release (requires automake-1.7 or newer)
- tag repos (darcs and any slave trees) with release tag
'rel-sofia-sip-x_y_z', where x_y_z is the version number (see
README.developers):
sh> darcs tag -m"rel-sofia-sip-x_y_z"
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)
- calculate md5 and sha1 hashes using md5sum and sha1sum utilities,
and copy the values to the release-notes (see below)
Creating the release notes and updating the website
===================================================
- combine the sofia-sip/RELEASE contents with
the template found from sfnet_www/templates/relnotes.txt
- store the resulting release notes to
sfnet_www/relnotes/relnotes-sofia-sip-x.y.z.txt
- add explicit link to the release notes to
sfnet_www/download.html (three most recent releases,
see guidelines in the html comments)
- update sfnet_www/index.html to mention the latest
release
- commit the change to sf.net website CVS, and run the
sfnet_www/put_online.sh script
Uploading the release to sourceforge.net
========================================
- use the the 'Admin' -> 'File releases' tool for
creating a new release
- to upload the file, you can use for example rsync:
rsync -avP -e ssh sofia-sip-x.y.z.tar.gz USER@frs.sourceforge.net:uploads/
- attach the release notes (relnotes-sofia-sip-x.y.z.txt)
to the file release
Announcing releases
===================
- send an announcement mail, containing the
release notes, to sofia-sip-devel@lists.sourceforge.net
- post a news item to freshmeat.net 'sofia-sip'
project (current project owner: Kai Vehmanen)
After release
=============
- replace the RELEASE file with RELEASE.template, and
commit it to master source repository (see sofia-sip/README.developers)
- change version in configure.ac from "X.Y.Z" to
"X.Y.Zdevel" (as it is in many cases unknown what the
next version will be)
- make a "tree open for development" commit
Syncing CVS and darcs (or some other VCS)
=========================================
Some tips for synchronizing from/to different version controlled
tree.
- As CVS cannot trace file addition/move/removals, you need
to be extra careful with these. With darcs, you can use the
'darcs changes -v' command to track down all fileops since
last synchronization.
- Always tag the src-tree with "syncuser-fromvcs-to-tovcs-yearmmdd".
- Add a top-level ChangeLog entry that documents all the
changes made outside the target tree (what, who and when -
for example produced with the "darcs changes --summary"
command).
Checking API/ABI compatibility
==============================
- Use a unit test binary built against an old library,
to verify a new library version (forwards-compatibility).
- Use the 'icheck' tool (in Debian) to make comparison
between two released versions.

View File

@ -1,25 +0,0 @@
2006-12-05 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua-glib interface v3 frozen, version to 3:0:0 (for 1.12.5 release).
* nua-glib submodule has been moved from libsofia-sip-ua-glib,
and sofia-sip, to a standalone sofia-nua-glib package.
2006-11-22 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua-glib interface v2 frozen, version to 2:0:2 (for 1.12.4 release).
2006-07-25 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua-glib interface v1 frozen, version to 1:0:1 (for 1.12.2 release).
2006-06-16 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua-glib interface v0 frozen, version to 0:0:0.
2006-04-12 Kai Vehmanen <kai.vehmanen@nokia.com>
* Modified build system to require glib-2.4 or newer to compile libsofia-sip-ua-glib.
2006-03-09 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua-glib created.

View File

@ -1,60 +0,0 @@
#
# Makefile.am for sofia-sip/libsofia-sip-ua-glib
#
# Copyright (C) 2006 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
#
AUTOMAKE_OPTIONS = foreign 1.7
SUBDIRS=su-glib
GLIB_TARGETS=su-glib/libsu-glib.la
lib_LTLIBRARIES =
if HAVE_GLIB
lib_LTLIBRARIES += libsofia-sip-ua-glib.la
endif
libsofia_sip_ua_glib_la_SOURCES =
libsofia_sip_ua_glib_la_LIBADD = $(GLIB_TARGETS) $(GLIB_LIBS)
# set the libtool version info version:revision:age for libsofia-sip-ua-glib
# - soname to 'libsofia-sip-ua-glib.so.(CUR-AGE)'
libsofia_sip_ua_glib_la_LDFLAGS = \
-version-info $(LIBVER_SOFIA_SIP_UA_GLIB_CUR):$(LIBVER_SOFIA_SIP_UA_GLIB_REV):$(LIBVER_SOFIA_SIP_UA_GLIB_AGE)
DOXYGEN = doxygen
EXTRA_DIST = docs/Doxyfile.aliases \
docs/Doxyfile.conf \
docs/Doxyfile.version
doxygen: built-sources
@mkdir -p docs docs/html &&\
for d in $(DIST_SUBDIRS) $(DIST_SUBDIRS); do \
test -r $$d/Doxyfile \
&& pushd $$d > /dev/null \
&& echo running ${DOXYGEN} in $$d \
&& ${DOXYGEN} \
&& popd > /dev/null ; \
done
${top_srcdir}/scripts/hide_emails.sh docs/html
PHONY = doxygen
include $(top_srcdir)/rules/recursive.am
if HAVE_LCOV
include $(top_srcdir)/rules/lcov.am
endif
include $(top_srcdir)/rules/silent.am
.PHONY = $(PHONY)
CLEANFILES = docs/*.doxytags
distclean-local:
-rm -rf docs/html

View File

@ -1 +0,0 @@
@INCLUDE = ../../libsofia-sip-ua/docs/Doxyfile.aliases

View File

@ -1,18 +0,0 @@
@INCLUDE = ../../libsofia-sip-ua/docs/Doxyfile.conf
@INCLUDE = ../../libsofia-sip-ua/docs/Doxyfile.rfc
HTML_FOOTER = ../../libsofia-sip-ua/docs/sofia-footer.html
TAGFILES += ../../libsofia-sip-ua/docs/docs.doxytags=../docs
TAGFILES += ../../libsofia-sip-ua/docs/su.doxytags=../su
TAGFILES += ../../libsofia-sip-ua/docs/ipt.doxytags=../ipt
TAGFILES += ../../libsofia-sip-ua/docs/bnf.doxytags=../bnf
TAGFILES += ../../libsofia-sip-ua/docs/url.doxytags=../url
TAGFILES += ../../libsofia-sip-ua/docs/msg.doxytags=../msg
TAGFILES += ../../libsofia-sip-ua/docs/sip.doxytags=../sip
TAGFILES += ../../libsofia-sip-ua/docs/sresolv.doxytags=../sresolv
TAGFILES += ../../libsofia-sip-ua/docs/tport.doxytags=../tport
TAGFILES += ../../libsofia-sip-ua/docs/nta.doxytags=../nta
TAGFILES += ../../libsofia-sip-ua/docs/sdp.doxytags=../sdp
TAGFILES += ../../libsofia-sip-ua/docs/nua.doxytags=../nua

View File

@ -1,2 +0,0 @@
@INCLUDE = ../../libsofia-sip-ua/docs/Doxyfile.version

View File

@ -1,12 +0,0 @@
PROJECT_NAME = "sofia-sip/su-glib"
OUTPUT_DIRECTORY = ../docs/html/su-glib
INPUT = @srcdir@/su_glib.docs @srcdir@ . @srcdir@/sofia-sip
@INCLUDE_PATH = @srcdir@ .
@INCLUDE = ../docs/Doxyfile.conf
GENERATE_TAGFILE = ../docs/su_glib.doxytags
ALIASES +=

View File

@ -1,62 +0,0 @@
#
# Makefile.am for su-glib module
#
# Copyright (C) 2006 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
#
# ----------------------------------------------------------------------
# Headers
S_BASE = $(top_srcdir)/libsofia-sip-ua
B_BASE = $(top_builddir)/libsofia-sip-ua
AM_CPPFLAGS = -I$(S_BASE)/su -I$(B_BASE)/su $(GLIB_CFLAGS) \
$(SOFIA_GLIB_CFLAGS)
# ----------------------------------------------------------------------
# Build targets
noinst_LTLIBRARIES = libsu-glib.la
check_PROGRAMS = su_source_test torture_su_glib_timer
# ----------------------------------------------------------------------
# Tests
TESTS = su_source_test torture_su_glib_timer
# ----------------------------------------------------------------------
# Rules for building the targets
nobase_include_sofia_HEADERS =
if HAVE_GLIB
nobase_include_sofia_HEADERS += \
sofia-sip/su_source.h \
sofia-sip/su_glib.h
endif
libsu_glib_la_SOURCES = su_source.c
libsu_glib_la_DEPENDENCIES = \
../../libsofia-sip-ua/libsofia-sip-ua.la
LDADD = libsu-glib.la \
../../libsofia-sip-ua/libsofia-sip-ua.la \
$(GLIB_LIBS)
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = Doxyfile su_glib.docs
# ----------------------------------------------------------------------
# Automake options
AUTOMAKE_OPTIONS = foreign
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am

View File

@ -1,50 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 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
*
*/
#ifndef SU_GLIB_SOURCE_H
#define SU_GLIB_SOURCE_H
/**
* @file su_glib.h
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <first.surname@nokia.com>
*/
#ifndef SU_WAIT_H
#include <sofia-sip/su_wait.h>
#endif
#ifndef __GLIB_H__
#include <glib.h>
#endif
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
#endif /* !defined SU_GLIB_SOURCE_H */

View File

@ -1,56 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SU_SOURCE_H /** Defined when su_source.h has been included. */
#define SU_SOURCE_H
/**
* @file su_source.h
* @brief
*
* NOTE: This file (su_source.h) is DEPRECATED as of 1.12.2 release.
* Please use su_glib.h instead.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <first.surname@nokia.com>
*
* @date Created: Thu Mar 4 19:58:50 2004 ppessi
*
*/
#ifndef SU_WAIT_H
#include <sofia-sip/su_wait.h>
#endif
#ifndef __GLIB_H__
#include <glib.h>
#endif
SOFIA_BEGIN_DECLS
SOFIAPUBFUN su_root_t *su_root_source_create(su_root_magic_t *) __attribute__((__malloc__));
SOFIAPUBFUN GSource *su_root_source(su_root_t *);
SOFIA_END_DECLS
#endif /* !defined SU_SOURCE_H */

View File

@ -1,59 +0,0 @@
/**
@mainpage Sofia-SIP su-glib Module
@section su_glib_meta Module Meta Information
The su-glib module provides an interface to connect Sofia-SIP event loop
to an existing glib main loop. Without this interface, a glib based
application would have to create a separate thread for running
the Sofia-SIP event loop.
@CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
@STATUS Core library
@LICENSE LGPL
@section su_glib_contents Contents of su-glib Module
The su-glib module contains the public header files as follows:
- <su_glib.h> the public API of the module
- <su_source.h> deprecated API (1.12.1 and earlier)
@section su_glib_examples Examples of use
Below is a simple example of how to use su-glib:
@code
#include <glib.h>
#include <sofia-sip/su_glib.h>
/* ... */
GMainLoop *ptr = g_main_loop_new(NULL, FALSE);
GSource *gsource;
su_root_t *sofia_event_loop;
su_timer_t *timer;
/* create a sofia event loop using su-glib function su_glib_root_source_create() */
sofia_event_loop = su_glib_root_create(NULL);
/* attach the created GSource to glib event loop */
gsource = su_glib_root_gsource(sofia_event_loop);
g_source_attach(gsource, g_main_loop_get_context(ptr));
/* use the sofia event loop with libsofia-sip-ua modules */
timer = su_timer_create(su_root_task(sofia_event_loop), 200L);
/* ... initialize other Sofia-SIP modules/functrions */
/* run the glib mainloop */
g_main_loop_run(ptr);
@endcode
@section su_glib_todo Todo
- see sourceforge.net issue tracker for sofia-sip
(-> http://sofia-sip.sourceforge.net/development.html )
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,536 +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
*
*/
/**@ingroup su_root_ex
* @CFILE su_source_test.c
*
* @brief Test program for glib and su root event loop integration.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Thu Mar 18 19:40:51 1999 pessi
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <assert.h>
struct pinger;
#define SU_ROOT_MAGIC_T struct pinger
#define SU_INTERNAL_P su_root_t *
#define SU_MSG_ARG_T su_sockaddr_t
#include "sofia-sip/su.h"
#include "sofia-sip/su_wait.h"
#include "sofia-sip/su_log.h"
#include <glib/gthread.h>
#include "sofia-sip/su_glib.h"
struct pinger {
enum { PINGER = 1, PONGER = 2 } const sort;
char const * name;
unsigned running : 1;
unsigned : 0;
su_root_t *root;
su_socket_t s;
su_timer_t *t;
int id;
int rindex;
su_time_t when;
su_sockaddr_t addr;
double rtt_total;
int rtt_n;
};
short opt_family = AF_INET;
short opt_verbatim = 0;
short opt_singlethread = 0;
GMainLoop *global_gmainloop = NULL;
static su_socket_t udpsocket(void)
{
su_socket_t s;
su_sockaddr_t su = { 0 };
socklen_t sulen = sizeof(su);
char nbuf[64];
su.su_family = opt_family;
su_getlocalip(&su);
s = su_socket(su.su_family, SOCK_DGRAM, 0);
if (s == INVALID_SOCKET) {
su_perror("udpsocket: socket");
exit(1);
}
if (bind(s, &su.su_sa, su_sockaddr_size(&su)) == SOCKET_ERROR) {
su_perror("udpsocket: bind");
exit(1);
}
if (getsockname(s, &su.su_sa, &sulen) == SOCKET_ERROR) {
su_perror("udpsocket: getsockname");
exit(1);
}
if (opt_verbatim)
printf("udpsocket: using address [%s]:%u\n",
inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
ntohs(su.su_sin.sin_port));
return s;
}
static char *snow(su_time_t now)
{
static char buf[24];
su_time_print(buf, sizeof(buf), &now);
return buf;
}
void
do_ping(struct pinger *p, su_timer_t *t, void *p0)
{
char buf[1024];
assert(p == su_root_magic(su_timer_root(t)));
assert(p->sort == PINGER);
p->when = su_now();
snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
if (sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_ping: send");
}
if (opt_verbatim) {
puts(buf);
fflush(stdout);
}
}
int
do_rtt(struct pinger *p, su_wait_t *w, void *p0)
{
su_sockaddr_t su;
struct sockaddr * const susa = &su.su_sa;
socklen_t susize[] = { sizeof(su)};
char buf[1024];
char nbuf[1024];
int n;
su_time_t now = su_now();
double rtt;
assert(p0 == p);
assert(p->sort == PINGER);
rtt = su_time_diff(now, p->when);
p->rtt_total += rtt, p->rtt_n++;
su_wait_events(w, p->s);
n = recvfrom(p->s, buf, sizeof(buf) - 1, 0, susa, susize);
if (n < 0) {
su_perror("do_rtt: recvfrom");
return 0;
}
buf[n] = 0;
if (opt_verbatim)
printf("do_rtt: %d bytes from [%s]:%u: \"%s\", rtt = %lg ms\n",
n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
ntohs(su.su_sin.sin_port), buf, rtt / 1000);
do_ping(p, p->t, NULL);
return 0;
}
void
do_pong(struct pinger *p, su_timer_t *t, void *p0)
{
char buf[1024];
assert(p == su_root_magic(su_timer_root(t)));
assert(p->sort == PONGER);
p->id = 0;
snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now()));
if (sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_pong: send");
}
if (opt_verbatim) {
puts(buf);
fflush(stdout);
}
}
int
do_recv(struct pinger *p, su_wait_t *w, void *p0)
{
su_sockaddr_t su;
socklen_t susize[] = { sizeof(su)};
char buf[1024];
char nbuf[1024];
int n;
su_time_t now = su_now();
assert(p0 == p);
assert(p->sort == PONGER);
su_wait_events(w, p->s);
n = recvfrom(p->s, buf, sizeof(buf) - 1, 0, &su.su_sa, susize);
if (n < 0) {
su_perror("do_recv: recvfrom");
return 0;
}
buf[n] = 0;
if (opt_verbatim)
printf("do_recv: %d bytes from [%s]:%u: \"%s\" at %s\n",
n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
ntohs(su.su_sin.sin_port), buf, snow(now));
fflush(stdout);
#if 0
if (p->id)
puts("do_recv: already a pending reply");
if (su_timer_set(p->t, do_pong, p) < 0) {
fprintf(stderr, "do_recv: su_timer_set() error\n");
return 0;
}
p->id = 1;
#else
do_pong(p, p->t, NULL);
#endif
return 0;
}
void
do_exit(struct pinger *x, su_timer_t *t, void *x0)
{
g_assert(global_gmainloop);
if (opt_verbatim)
printf("do_exit at %s\n", snow(su_now()));
g_main_loop_quit(global_gmainloop);
}
int
do_init(su_root_t *root, struct pinger *p)
{
su_wait_t w;
su_socket_t s;
long interval;
su_timer_t *t;
su_wakeup_f f;
int index, index0;
switch (p->sort) {
case PINGER: f = do_rtt; interval = 200; break;
case PONGER: f = do_recv; interval = 40; break;
default:
return SU_FAILURE;
}
/* Create a sockets, */
s = udpsocket();
if (su_wait_create(&w, s, SU_WAIT_IN) == SOCKET_ERROR)
su_perror("su_wait_create"), exit(1);
p->s = s;
p->t = t = su_timer_create(su_root_task(root), interval);
if (t == NULL) {
su_perror("su_timer_create");
return SU_FAILURE;
}
index0 = su_root_register(root, &w, f, p, 0);
if (index0 == SOCKET_ERROR) {
su_perror("su_root_register");
return SU_FAILURE;
}
index = su_root_register(root, &w, f, p, 0);
if (index == SOCKET_ERROR) {
su_perror("su_root_register");
return SU_FAILURE;
}
su_root_deregister(root, index0);
p->rindex = index;
return 0;
}
void
do_destroy(su_root_t *root, struct pinger *p)
{
if (opt_verbatim)
printf("do_destroy %s at %s\n", p->name, snow(su_now()));
su_root_deregister(root, p->rindex);
su_timer_destroy(p->t), p->t = NULL;
p->running = 0;
}
void
start_ping(struct pinger *p, su_msg_r msg, su_sockaddr_t *arg)
{
if (!p->running)
return;
if (opt_verbatim)
printf("start_ping: %s\n", p->name);
p->addr = *arg;
p->id = 1;
su_timer_set_at(p->t, do_ping, p, su_now());
}
void
start_pong(struct pinger *p, su_msg_r msg, su_sockaddr_t *arg)
{
su_msg_r reply;
if (!p->running)
return;
if (opt_verbatim)
printf("start_pong: %s\n", p->name);
p->addr = *arg;
if (su_msg_reply(reply, msg, start_ping, sizeof(p->addr)) == 0) {
socklen_t sinsize[1] = { sizeof(p->addr) };
if (getsockname(p->s, (struct sockaddr*)su_msg_data(reply), sinsize)
== SOCKET_ERROR)
su_perror("start_pong: getsockname()"), exit(1);
su_msg_send(reply);
}
else {
fprintf(stderr, "su_msg_create failed!\n");
}
}
void
init_ping(struct pinger *p, su_msg_r msg, su_sockaddr_t *arg)
{
su_msg_r reply;
if (opt_verbatim)
printf("init_ping: %s\n", p->name);
if (su_msg_reply(reply, msg, start_pong, sizeof(p->addr)) == 0) {
socklen_t sinsize[1] = { sizeof(p->addr) };
if (getsockname(p->s, (struct sockaddr*)su_msg_data(reply), sinsize)
== SOCKET_ERROR)
su_perror("start_pong: getsockname()"), exit(1);
su_msg_send(reply);
}
else {
fprintf(stderr, "su_msg_reply failed!\n");
}
}
#if HAVE_SIGNAL
static
RETSIGTYPE term(int n)
{
exit(1);
}
#endif
void
time_test(void)
{
su_time_t now = su_now(), then = now;
su_duration_t t1, t2;
su_duration_t us;
for (us = 0; us < 1000000; us += 300) {
then.tv_sec = now.tv_sec;
if ((then.tv_usec = now.tv_usec + us) >= 1000000)
then.tv_usec -= 1000000, then.tv_sec++;
t1 = su_duration(now, then);
t2 = su_duration(then, now);
assert(t1 == -t2);
}
if (opt_verbatim)
printf("time_test: passed\n");
}
char const name[] = "su_test";
void
usage(int exitcode)
{
fprintf(stderr, "usage: %s [-6vs] [pid]\n", name);
exit(exitcode);
}
/*
* test su_wait functionality:
*
* Create a ponger, waking up do_recv() when data arrives,
* then scheduling do_pong() by timer
*
* Create a pinger, executed from timer, scheduling do_ping(),
* waking up do_rtt() when data arrives
*
* Create a timer, executing do_exit() after 10 seconds
*/
int main(int argc, char *argv[])
{
su_root_t *root;
su_clone_r ping = SU_CLONE_R_INIT, pong = SU_CLONE_R_INIT;
su_msg_r start_msg = SU_MSG_R_INIT;
su_timer_t *t;
unsigned long sleeppid = 0;
struct pinger
pinger = { PINGER, "ping", 1 },
ponger = { PONGER, "pong", 1 };
char *argv0 = argv[0];
#if HAVE_OPEN_C
dup2(1, 2);
#endif
while (argv[1]) {
if (strcmp(argv[1], "-v") == 0) {
opt_verbatim = 1;
argv++;
}
#if SU_HAVE_IN6
else if (strcmp(argv[1], "-6") == 0) {
opt_family = AF_INET6;
argv++;
}
#endif
else if (strcmp(argv[1], "-s") == 0) {
opt_singlethread = 1;
argv++;
}
else if (strlen(argv[1]) == strspn(argv[1], "0123456789")) {
sleeppid = strtoul(argv[1], NULL, 10);
argv++;
}
else {
usage(1);
}
}
#if HAVE_OPEN_C
opt_verbatim = 1;
opt_singlethread = 1;
su_log_soft_set_level(su_log_default, 9);
#endif
#if HAVE_SIGNAL
signal(SIGTERM, term);
#endif
su_init(); atexit(su_deinit);
time_test();
global_gmainloop = g_main_loop_new(NULL, FALSE);
g_assert(global_gmainloop);
root = su_glib_root_create(NULL);
if (!root) perror("su_root_glib_create"), exit(1);
if (!g_source_attach(su_glib_root_gsource(root), g_main_loop_get_context(global_gmainloop)))
perror("g_source_attach"), exit(1);
su_root_threading(root, 0 && !opt_singlethread);
if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0)
perror("su_clone_start"), exit(1);
if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0)
perror("su_clone_start"), exit(1);
/* Test timer, exiting after 200 milliseconds */
t = su_timer_create(su_root_task(root), 200L);
if (t == NULL)
su_perror("su_timer_create"), exit(1);
su_timer_set(t, (su_timer_f)do_exit, NULL);
su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong),
init_ping, 0);
su_msg_send(start_msg);
g_main_loop_run(global_gmainloop);
su_clone_wait(root, ping);
su_clone_wait(root, pong);
su_timer_destroy(t);
if (pinger.rtt_n) {
printf("%s executed %u pings in %g, mean rtt=%g sec\n", name,
pinger.rtt_n, pinger.rtt_total, pinger.rtt_total / pinger.rtt_n);
}
su_root_destroy(root);
g_main_loop_unref(global_gmainloop), global_gmainloop = NULL;
if (opt_verbatim)
printf("%s exiting\n", argv0);
#ifndef HAVE_WIN32
#if HAVE_SIGNAL
if (sleeppid)
kill(sleeppid, SIGTERM);
#endif
#endif
#if HAVE_OPEN_C
sleep(7);
#endif
return 0;
}

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,427 +0,0 @@
2007-04-25 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v4 frozen (5:0:5) for the 1.12.6 release
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
2006-08-30 Pekka Pessi <Pekka.Pessi@nokia.com>
* nua: added tag nutag_refer_with_id.
2006-08-28 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v2 opened to development, version to 2:0:2.
2006-08-25 Pekka Pessi <Pekka.Pessi@nokia.com>
* Added urltag_scan().
2006-08-23 Pekka Pessi <Pekka.Pessi@nokia.com>
* nta.c, nta.h: added nta_leg_make_replaces(), nta_leg_by_replaces().
* nua: event watcher (nua_subscribe, nua_watcher) now tries to re-establish
subscription if the subscription was terminated with reason "deactivated" or
"probation". Likewise, if SUBSCRIBE was returned a suitable error response
with Retry-After header, nua tries to re-establish subscription after
given interval.
2006-07-27 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v1 frozen (1.12.1), version to 1:0:1.
2006-06-16 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v0 frozen (1.12.0), version to 0:0:0.
2005-11-28 Kai Vehmanen <kai.vehmanen@nokia.com>
* <SUBDIRS>/Doxyfile: Fixed the use of doxytags. Now
a separate 'doxytags_MODNAME' file is created for each
module.
2005-11-15 Kai Vehmanen <kai.vehmanen@nokia.com>
* <SUBDIRS>/Makefile.am: Changed to use the 'include_sofia_HEADERS'
variable for listing public library headers. The variable
is defined in the top-level configure.ac.
2005-10-27 Pekka Pessi <Pekka.Pessi@nokia.com>
* Always including stun library.
M ./libsofia-sip-ua/Makefile.am -6 +3
* Added rule to make missing module libraries in libsofia-sip-ua/sofia.am
M ./libsofia-sip-ua/sofia.am -1 +6
* Added LDFLAG -static to all test programs in their Makefile.am
M ./libsofia-sip-ua/bnf/Makefile.am -1 +1
M ./libsofia-sip-ua/http/Makefile.am -2 +2
M ./libsofia-sip-ua/ipt/Makefile.am -1 +2
M ./libsofia-sip-ua/iptsec/Makefile.am +2
M ./libsofia-sip-ua/msg/Makefile.am -2 +2
M ./libsofia-sip-ua/nta/Makefile.am -1 +1
M ./libsofia-sip-ua/nth/Makefile.am +2
M ./libsofia-sip-ua/nua/Makefile.am +2
M ./libsofia-sip-ua/sdp/Makefile.am +3
M ./libsofia-sip-ua/sip/Makefile.am +4
M ./libsofia-sip-ua/soa/Makefile.am +2
M ./libsofia-sip-ua/sresolv/Makefile.am -2 +2
M ./libsofia-sip-ua/stun/Makefile.am -6 +1
2005-10-14 Pekka Pessi <Pekka.Pessi@nokia.com>
* Shell syntax exercise.
M ./autogen.sh -4 +4
2005-10-13 Pekka Pessi <Pekka.Pessi@nokia.com>
* <SUBDIRS>/Makefile.am: fixed COVERAGE_INPUT.
2005-10-13 Kai Vehmanen <kai.vehmanen@nokia.com>
* <SUBDIRS>/Makefile.am: Build all submodules as proper shared
libraries (noinst_LTLIBRARIES). Fixes sf.net:#1264030.
2005-09-09 Pekka Pessi <Pekka.Pessi@nokia.com>
* darcs changes --from-tag pessi-darcs-1:
Thu Sep 8 21:50:24 EEST 2005 Pekka.Pessi@nokia.com
* There is no separate TLS test anymore.
M ./tport/Makefile.am -1 +1
Thu Sep 8 21:36:46 EEST 2005 Pekka.Pessi@nokia.com
* Logging.
M ./nua/nua_stack.c -4 +2
Thu Sep 8 21:36:39 EEST 2005 Pekka.Pessi@nokia.com
* Added tests for tport_convert_addr.
M ./tport/tport_test.c +22
Thu Sep 8 21:36:27 EEST 2005 Pekka.Pessi@nokia.com
* Fixed receiving empty SigComp message.
M ./tport/tport.c +7
Thu Sep 8 21:32:48 EEST 2005 Pekka.Pessi@nokia.com
* Updated ChangeLogs.
M ./nta/ChangeLog -2 +10
Thu Sep 8 21:32:37 EEST 2005 Pekka.Pessi@nokia.com
* Updated ChangeLog.
M ./iptsec/ChangeLog +11
Thu Sep 8 21:31:16 EEST 2005 Pekka.Pessi@nokia.com
* Added more tests.
M ./nta/nta.c -2 +2
M ./nta/nta_test.c -2 +44
Thu Sep 8 21:30:19 EEST 2005 Pekka.Pessi@nokia.com
* Handling changes in alias list.
M ./nta/nta.c -9 +22
M ./nta/nta_test.c +1
Thu Sep 8 21:18:47 EEST 2005 Pekka.Pessi@nokia.com
* Gcc4 fixes.
M ./ipt/base64.c -1 +1
M ./iptsec/auth_module.c -1 +1
M ./iptsec/auth_plugin_delayed.c +4
M ./nua/nua_stack.c -1 +1
M ./nua/nua_tag.c -1 +1
M ./nua/nua_tag.h -5 +5
M ./su/htable2.h -1 +1
M ./su/su.c -1 +1
M ./tport/tport.c -7 +7
Thu Sep 8 21:16:39 EEST 2005 Pekka.Pessi@nokia.com
* Added tests for tport_shutdown(). Do not assert() on invalid
input.
M ./tport/tport.c -2
M ./tport/tport_test.c +5
Thu Sep 8 21:13:18 EEST 2005 Pekka.Pessi@nokia.com
* Log when password file is read.
M ./iptsec/auth_module.c +3
Thu Sep 8 21:12:49 EEST 2005 Pekka.Pessi@nokia.com
* Allow empty allow list.
M ./iptsec/auth_module.c -1 +1
Thu Sep 8 21:12:26 EEST 2005 Pekka.Pessi@nokia.com
* Use unsigned as auth_htable_t hash type.
M ./iptsec/auth_module.c -5 +5
Thu Sep 8 21:10:23 EEST 2005 Pekka.Pessi@nokia.com
* Added auth_digest_credentials().
Use opaque to match Authorization header.
M ./iptsec/auth_digest_test.c -2 +3
M ./iptsec/auth_module.c -1 +78
M ./iptsec/auth_plugin.h +4
Thu Sep 8 21:07:57 EEST 2005 Pekka.Pessi@nokia.com
* Fixed gcc4 problems with tag classes.
M ./http/http_tag.h.in +3
M ./msg/msg_mime_protos.h.in +3
M ./sdp/sdp_tag.h +3
M ./su/su_tag_class.h +12
M ./su/su_tag_inline.h -1 +1
M ./url/url_tag_class.h +3
Thu Sep 8 21:06:22 EEST 2005 Pekka.Pessi@nokia.com
* Added sip_security_client_select().
M ./sip/sip_util.c -37 +14
M ./sip/sip_util.h +4
Thu Sep 8 19:32:19 EEST 2005 Pekka.Pessi@nokia.com
* Not using su_home_deinit() to destroy homes that are not
initialized.
M ./nth/nth_server.c -3 +2
M ./nua/nua.c -2 +1
M ./su/su_vector.c -2 +1
Thu Sep 8 19:06:31 EEST 2005 Pekka.Pessi@nokia.com
* Moved function types to msg_types.h.
M ./msg/msg_header.h -7
M ./msg/msg_types.h +9
Thu Sep 8 18:35:12 EEST 2005 Pekka.Pessi@nokia.com
* Fixed su_clone_start() return value.
M ./su/su_root.c -1 +1
Thu Sep 8 18:34:26 EEST 2005 Pekka.Pessi@nokia.com
* Removed SIP_DLL_VAR.
M ./sip/sip_dll.h -7
Thu Sep 8 18:29:27 EEST 2005 Pekka.Pessi@nokia.com
* Avoid __func__.
M ./sresolv/sresolv.c -3 +4
Thu Sep 8 18:29:09 EEST 2005 Pekka.Pessi@nokia.com
* Fix includes.
M ./nta/nta.c -2 +1
M ./sresolv/sresolv.c -4 +7
M ./sresolv/sresolv.h -1 +1
Thu Sep 8 18:26:35 EEST 2005 Pekka.Pessi@nokia.com
* Using autoconf to figure out 64-bit types. Avoid off_t and
64-bit constants.
M ../configure.ac +6
M ./nta/sl_read_payload.c -1 +1
M ./nua/nua_stack.c -6 +5
M ./sdp/sdp_parse.c -3 +2
M ./sdp/sdp_print.c -5 +5
M ./sip/validator.c -18 +18
M ./soa/soa.c -3 +4
M ./su/su_time.c -1 +1
M ./su/tstdef.h -3 +3
Thu Sep 8 18:17:58 EEST 2005 Pekka.Pessi@nokia.com
* Using RETSIGTYPE.
M ../configure.ac -3 +4
M ./nth/http-server.c -2 +2
M ./soa/test_soa.c -1 +3
M ./su/su_test.c -1 +1
M ./su/su_timer_test.c -1 +1
Thu Sep 8 18:13:35 EEST 2005 Pekka.Pessi@nokia.com
* Fixed macro expansion problem with VC6
M ./nta/nta_test.c -2 +2
Thu Sep 8 18:12:45 EEST 2005 Pekka.Pessi@nokia.com
* Compile without sresolv, too.
M ./nta/nta.c -3 +5
Thu Sep 8 18:12:16 EEST 2005 Pekka.Pessi@nokia.com
* Fixed const/non-const problems with gcc4/vc6.
M ./msg/msg_mime.c -6 +6
M ./msg/msg_parser.c -1 +1
M ./nta/nta.c -4 +4
M ./sip/sip_basic.c -1 +1
M ./sip/sip_security.c -1 +1
M ./sip/sip_util.c -2 +2
M ./su/htable.h -10 +10
Thu Sep 8 18:06:04 EEST 2005 Pekka.Pessi@nokia.com
* Moved msg_hclass_t definition into msg_types.h
M ./msg/msg_header.h -37
M ./msg/msg_types.h +40
Thu Sep 8 18:05:32 EEST 2005 Pekka.Pessi@nokia.com
* Silenced vc6 warning.
M ./iptsec/auth_module.c -1 +1
Thu Sep 8 18:05:07 EEST 2005 Pekka.Pessi@nokia.com
* Not using __func__.
M ./iptsec/auth_digest.c -2 +2
Thu Sep 8 18:04:38 EEST 2005 Pekka.Pessi@nokia.com
* Silenced gcc4 warning.
M ./tport/tport.c -1 +1
Thu Sep 8 18:04:16 EEST 2005 Pekka.Pessi@nokia.com
* Better following autoconf macros
M ./tport/tport.c +9
Thu Sep 8 18:02:53 EEST 2005 Pekka.Pessi@nokia.com
* Using TPORT_DLL.
M ./tport/tport.h -10 +19
Thu Sep 8 18:01:58 EEST 2005 Pekka.Pessi@nokia.com
* Not using IS_EXCLUDED_MASK.
M ./url/url.c -1 +6
Thu Sep 8 18:01:17 EEST 2005 Pekka.Pessi@nokia.com
* Explicitly using <errno.h>
M ./msg/msg.c +2
M ./msg/msg_mclass.c +1
M ./msg/msg_mime.c +1
M ./msg/msg_parser.c +1
M ./nta/nta.c +3
M ./nth/nth_client.c +2
M ./nth/nth_server.c +2
M ./su/su_port.c +1
M ./su/su_proxy.c +1
M ./su/su_root.c +1
Thu Sep 8 17:54:28 EEST 2005 Pekka.Pessi@nokia.com
* Using http_off_t instead of off_t.
M ./http/http_basic.c -5 +5
Thu Sep 8 18:56:58 EEST 2005 Pekka.Pessi@nokia.com
* Not using su_home_deinit().
M ./nua/nua.c -3 +2
Thu Sep 8 16:40:30 EEST 2005 Pekka.Pessi@nokia.com
* Adding soa_asynch.c
A ./soa/soa_asynch.c
Thu Sep 8 03:23:00 EEST 2005 Pekka.Pessi@nokia.com
* stab 2 at soa
Added more functionality to soa. Stab at asynchronous API, too.
M ./soa/Makefile.am -1 +2
M ./soa/soa.c -146 +564
M ./soa/soa.h -5 +24
M ./soa/soa_add.h -2 +5
M ./soa/soa_session.h -21 +48
M ./soa/soa_static.c -30 +89
M ./soa/soa_tag.c +64
M ./soa/test_soa.c -7 +224
M ./m4/sac-su2.m4 -1 +1
Thu Sep 8 03:12:28 EEST 2005 Pekka.Pessi@nokia.com
* really run sdp tests
Now really running SDP tests.
M ./sdp/run-tests -1 +1
Thu Sep 8 03:11:35 EEST 2005 Pekka.Pessi@nokia.com
* su_home_new and su_home_unref
Added su_home_new() and su_home_unref().
Fixed su_home_mutex_lock() and su_home_mutex_unlock().
Slightly changed semantics of su_home_clone() versus
su_home_threadsafe().
M ./http/http_test.c -6 +6
M ./msg/msg_test.c -2 +2
M ./su/htable_test.c +3
M ./su/su_alloc.c -173 +337
M ./su/su_alloc.h -10 +18
M ./su/su_alloc_lock.c -8 +31
M ./su/su_alloc_test.c -5 +12
Thu Sep 8 03:07:17 EEST 2005 Pekka.Pessi@nokia.com
* More liberal sdp parsing for config files.
Be more liberal when parsing config files
(do not require v=, accept -1 as len argument).
M ./sdp/sdp_parse.c -9 +25
Thu Sep 8 01:05:02 EEST 2005 Pekka.Pessi@nokia.com
* su_msg_is_non_null
Added su_msg_is_non_null().
M ./su/su_wait.h +11
Thu Sep 8 01:03:31 EEST 2005 Pekka.Pessi@nokia.com
* sdp_parser_home
Added sdp_parser_home()
M ./sdp/sdp.h +2
M ./sdp/sdp_parse.c +10
2005-09-08 Kai Vehmanen <kai.vehmanen@nokia.com>
* Makefile.am: Workaround for automake bug related to adding
custom targets to RECURSIVE_TARGETS.
2005-08-25 Kai Vehmanen <kai.vehmanen@nokia.com>
* Makefile.am: soa depends on ipt and sip, so has to
be after them in SUBDIRS.
2005-08-17 Pekka Pessi <Pekka.Pessi@nokia.com>
* Fixed BEGIN()/END() pairs in test programs.
2005-08-04 Pekka Pessi <Pekka.Pessi@nokia.com>
* Added soa module.
2005-07-18 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua created.

View File

@ -1,116 +0,0 @@
#
# Makefile.am for sofia-sip/libsofia-sip-ua
#
# Copyright (C) 2005,2006 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
#
# ref: http://www.gnu.org/software/automake/manual/automake.html
AUTOMAKE_OPTIONS = foreign
# select which optional sofia-sip modules have been enabled
# in the build
OPT_LIBADD =
OPT_SUBDIRS_STUN =
OPT_SUBDIRS_HTTP =
OPT_SUBDIRS_NTH =
if HAVE_STUN
OPT_LIBADD += stun/libstun.la
OPT_SUBDIRS_STUN += stun
endif
if HAVE_NTH
OPT_LIBADD += http/libhttp.la nth/libnth.la
OPT_SUBDIRS_HTTP += http
OPT_SUBDIRS_NTH += nth
endif
# note: order does matter in the subdir list
SUBDIRS = su features bnf sresolv ipt sdp url msg sip $(OPT_SUBDIRS_HTTP) \
$(OPT_SUBDIRS_STUN) soa tport nta $(OPT_SUBDIRS_NTH) \
nea iptsec nua
DIST_SUBDIRS = su features bnf sresolv ipt sdp url msg sip http \
stun soa tport nta nth \
nea iptsec nua docs
DOXYGEN = doxygen
noinst_LTLIBRARIES = libsofia-sip-ua.la
libsofia_sip_ua_la_SOURCES =
libsofia_sip_ua_la_LIBADD = 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 \
$(OPT_LIBADD)
# 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)
if HAVE_ZLIB
libsofia_sip_ua_la_LDFLAGS += -lz
endif
PHONY = doxygen built-sources
include $(top_srcdir)/rules/recursive.am
checklib: checklib-recursive $(lib_LTLIBRARIES)
doxygen: built-sources
@echo Generating empty doxytags
mkdir -p docs/html ; \
for d in $(DIST_SUBDIRS); do \
test -r $$d/Doxyfile || continue ; \
if ! test -r docs/$$d.doxytags ; then \
echo '<?xml version="1.0"?><tagfile/>' > docs/$$d.doxytags ; \
else \
sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \
docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
fi ; \
done
for d in $(DIST_SUBDIRS); do \
( test -r $$d/Doxyfile && \
cd $$d > /dev/null && \
echo running ${DOXYGEN} first time in $$d && \
${DOXYGEN} 2>&1 ) | \
egrep -v -i -e 'Warning: (unsupported (xml/)?html tag|unable to resolve reference|explicit link.*could not be resolved)' ; \
test -r docs/$$d.doxytags && \
sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \
docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
done
for d in $(DIST_SUBDIRS); do \
( test -r $$d/Doxyfile && \
cd $$d > /dev/null \
echo running ${DOXYGEN} second time in $$d && \
${DOXYGEN} 2>&1 ) | \
egrep -v -i -e 'Warning: Unsupported (xml/)?html tag' ; \
test -r docs/$$d.doxytags && \
sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \
docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
done
${top_srcdir}/scripts/hide_emails.sh docs/html
if HAVE_LCOV
include $(top_srcdir)/rules/lcov.am
endif
include $(top_srcdir)/rules/silent.am
.PHONY: $(PHONY)

View File

@ -1,7 +0,0 @@
2006-06-15 Kai Vehmanen <kai.vehmanen@nokia.com>
* sofia-sip/hostdomain.h (host_is_local): Function added.
2005-07-18 Kai Vehmanen <kai.vehmanen@nokia.com>
* Initial import of the module to Sofia-SIP tree.

View File

@ -1,15 +0,0 @@
PROJECT_NAME = "bnf"
OUTPUT_DIRECTORY = ../docs/html/bnf
INPUT = @srcdir@/bnf.docs @srcdir@/sofia-sip @srcdir@ .
@INCLUDE_PATH = . @srcdir@
@INCLUDE = ../docs/Doxyfile.conf
TAGFILES += ../docs/su.doxytags=../su
GENERATE_TAGFILE = ../docs/bnf.doxytags
PREDEFINED += "static="
MAX_INITIALIZER_LINES = 2

View File

@ -1,47 +0,0 @@
#
# Makefile.am for bnf module
#
# Copyright (C) 2005,2006 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
# ----------------------------------------------------------------------
# Header paths
AM_CPPFLAGS = -I$(srcdir)/../su -I../su
# ----------------------------------------------------------------------
# Build targets
noinst_LTLIBRARIES = libbnf.la
check_PROGRAMS = torture_bnf
# ----------------------------------------------------------------------
# Rules for building the targets
nobase_include_sofia_HEADERS = sofia-sip/bnf.h sofia-sip/hostdomain.h
libbnf_la_SOURCES = bnf.c
COVERAGE_INPUT = $(libbnf_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libbnf.la ../su/libsu.la
torture_bnf_LDFLAGS = -static
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = bnf.docs
# ----------------------------------------------------------------------
# Tests
TESTS = torture_bnf
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am

View File

@ -1,922 +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
*
*/
/**@CFILE bnf.c
* @brief Character syntax table for HTTP-like protocols.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
*
* @date Created: Thu Jun 8 19:28:55 2000 ppessi
*/
#include "config.h"
#include "sofia-sip/bnf.h"
#include "sofia-sip/su_string.h"
#include <stdio.h>
#include <assert.h>
#define ws bnf_ws
#define crlf bnf_crlf
#define alpha bnf_alpha
#define digit bnf_mark|bnf_token0|bnf_safe
#define sep bnf_separator
#define msep bnf_mark|bnf_separator
#define psep bnf_param0|bnf_separator
#define tok bnf_token0
#define mtok bnf_mark|bnf_token0
#define smtok bnf_mark|bnf_token0|bnf_safe
#define safe bnf_safe
/** Table for determining class of a character */
unsigned char const _bnf_table[256] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, ws, crlf, 0, 0, crlf, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
ws, mtok, sep, 0, safe, mtok, 0, mtok, /* !"#$%&' */
msep, msep, mtok, tok, sep, smtok, smtok, psep, /* ()*+,-./ */
digit, digit, digit, digit, digit, digit, digit, digit, /* 01234567 */
digit, digit, psep, sep, sep, sep, sep, sep, /* 89:;<=>? */
sep, alpha, alpha, alpha, alpha, alpha, alpha, alpha, /* @ABCDEFG */
alpha, alpha, alpha, alpha, alpha, alpha, alpha, alpha, /* HIJKLMNO */
alpha, alpha, alpha, alpha, alpha, alpha, alpha, alpha, /* PQRSTUVW */
alpha, alpha, alpha, psep, sep, psep, 0, smtok, /* XYZ[\]^_ */
tok, alpha, alpha, alpha, alpha, alpha, alpha, alpha, /* `abcdefg */
alpha, alpha, alpha, alpha, alpha, alpha, alpha, alpha, /* hijklmno */
alpha, alpha, alpha, alpha, alpha, alpha, alpha, alpha, /* pqrstuvw */
alpha, alpha, alpha, sep, 0, sep, mtok, 0, /* xyz{|}~ */
};
#if 0 /* This escaped lab */
#define BM(c, m00, m32, m64, m96) \
((c < 64) \
? ((c < 32) \
? (m00 & (1 << (31 - c))) \
: (m32 & (1 << (63 - c)))) \
: ((c < 96) \
? (m64 & (1 << (95 - c))) \
: (m96 & (1 << (127 - c)))))
/** Span of a token */
size_t bnf_span_token(char const *s)
{
char const *e = s;
unsigned const m32 = 0x4536FFC0U, m64 = 0x7FFFFFE1U, m96 = 0xFFFFFFE2U;
while (BM(*e, 0, m32, m64, m96))
e++;
return e - s;
}
/** Span of a token */
size_t bnf_span_token4(char const *s)
{
char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & bnf_token)
e++;
return e - s;
}
char * bnf_span_token_end(char const *s)
{
return (char *)s;
}
#endif
/** Return length of decimal-octet */
su_inline int span_ip4_octet(char const *host)
{
/*
decimal-octet = DIGIT
/ DIGIT DIGIT
/ (("0"/"1") 2*(DIGIT))
/ ("2" ("0"/"1"/"2"/"3"/"4") DIGIT)
/ ("2" "5" ("0"/"1"/"2"/"3"/"4"/"5"))
*/
if (!IS_DIGIT(host[0]))
return 0;
/* DIGIT */
if (!IS_DIGIT(host[1]))
return 1;
if (host[0] == '2') {
/* ("2" "5" ("0"/"1"/"2"/"3"/"4"/"5")) */
if (host[1] == '5' && host[2] >= '0' && host[2] <= '5')
return 3;
/* ("2" ("0"/"1"/"2"/"3"/"4") DIGIT) */
if (host[1] >= '0' && host[1] <= '4' &&
host[2] >= '0' && host[2] <= '9')
return 3;
}
else if (host[0] == '0' || host[0] == '1') {
if (IS_DIGIT(host[2]))
/* ("1" 2*(DIGIT)) ... or "0" 2*(DIGIT) */
return 3;
}
/* POS-DIGIT DIGIT */
return 2;
}
/** Return length of valid IP4 address */
static
int span_canonic_ip4_address(char const *host, int *return_canonize)
{
int n, len, canonize = 0;
if (host == NULL)
return 0;
/* IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet */
len = span_ip4_octet(host);
if (len == 0 || host[len] != '.')
return 0;
if (len > 1 && host[0] == '0')
canonize = 1;
n = len + 1;
len = span_ip4_octet(host + n);
if (len == 0 || host[n + len] != '.')
return 0;
if (len > 1 && host[n] == '0')
canonize = 1;
n += len + 1;
len = span_ip4_octet(host + n);
if (len == 0 || host[n + len] != '.')
return 0;
if (len > 1 && host[n] == '0')
canonize = 1;
n += len + 1;
len = span_ip4_octet(host + n);
if (len == 0 || IS_DIGIT(host[n + len]) || host[n + len] == '.')
return 0;
if (len > 1 && host[n] == '0')
canonize = 1;
n += len;
if (canonize && return_canonize)
*return_canonize = 1;
return n;
}
/** Return length of valid IP4 address.
*
* Note that we accept here up to two leading zeroes
* which makes "dotted decimal" notation ambiguous:
* 127.000.000.001 is interpreted same as 127.0.0.1
*
* Note that traditionally IP address octets starting
* with zero have been interpreted as octal:
* 172.055.055.001 has been same as 172.45.45.1
*
* @b However, we interpret them as @b decimal,
* 172.055.055.001 is same as 172.55.55.1.
*/
int span_ip4_address(char const *host)
{
return span_canonic_ip4_address(host, NULL);
}
/** Scan and canonize a valid IP4 address. */
int scan_ip4_address(char **inout_host)
{
char *src = *inout_host, *dst = src;
issize_t n;
int canonize = 0;
if (src == NULL)
return -1;
n = span_canonic_ip4_address(src, &canonize);
if (n == 0)
return -1;
*inout_host += n;
if (!canonize)
return n;
for (;;) {
char c = *dst++ = *src++;
if (IS_DIGIT(*src)) {
if (canonize && c == '0')
dst--;
else if (c == '.')
canonize = 1;
else
canonize = 0;
}
else if (*src != '.') {
break;
}
}
*dst = '\0';
return n;
}
/** Return length of hex4 */
su_inline int span_hex4(char const *host)
{
if (!IS_HEX(host[0]))
return 0;
if (!IS_HEX(host[1]))
return 1;
if (!IS_HEX(host[2]))
return 2;
if (!IS_HEX(host[3]))
return 3;
return 4;
}
/** Return length of valid IP6 address */
su_inline
int span_canonic_ip6_address(char const *host,
int *return_canonize,
char *hexparts[9])
{
int n = 0, len, hex4, doublecolon = 0, canonize = 0;
/*
IPv6address = hexpart [ ":" IPv4address ]
hexpart = hexseq / hexseq "::" [ hexseq ] / "::" [ hexseq ]
hexseq = hex4 *( ":" hex4)
hex4 = 1*4HEXDIG
There is at most 8 hex4, 6 hex4 if IPv4address is included.
*/
if (host == NULL)
return 0;
for (hex4 = 0; hex4 < 8; ) {
len = span_hex4(host + n);
if (return_canonize) {
if ((len > 1 && host[n + 1] == '0') || host[n] == '0')
canonize = 1;
if (hexparts)
hexparts[hex4 + doublecolon] = (char *)(host + n);
}
if (host[n + len] == ':') {
if (len != 0) {
hex4++;
n += len + 1;
if (!doublecolon && host[n] == ':') {
if (return_canonize && hexparts) {
hexparts[hex4] = (char *)(host + n - 1);
}
doublecolon++, n++;
}
}
else if (n == 0 && host[1] == ':') {
doublecolon++, n = 2;
}
else
break;
}
else if (host[n + len] == '.') {
len = span_canonic_ip4_address(host + n, return_canonize);
if (len == 0 || hex4 > 6 || !(doublecolon || hex4 == 6))
return 0;
if (canonize && return_canonize)
*return_canonize = 1;
return n + len;
}
else {
if (len != 0)
hex4++;
n += len;
break;
}
}
if (hex4 != 8 && !doublecolon)
return 0;
if (IS_HEX(host[n]) || host[n] == ':')
return 0;
if (canonize && return_canonize)
*return_canonize = canonize;
return n;
}
/** Canonize scanned IP6 address.
*
* @retval Length of canonized IP6 address.
*/
su_inline
int canonize_ip6_address(char *host, char *hexparts[9])
{
char *dst, *hex, *ip4 = NULL;
int i, doublecolon, j, maxparts, maxspan, span, len;
char buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
/*
Canonic representation has fewest chars
- except for mapped/compatible IP4 addresses, like
::15.21.117.42 or ::ffff:15.21.117.42 which have non-canonic forms of
::f15:752a or ::ffff:f15:752a
=> we just canonize hexparts and ip4part separately
and select optimal place for doublecolon
(with expection of ::1 and ::, which are canonized)
*/
for (i = 0, doublecolon = -1; i < 9; i++) {
hex = hexparts[i];
if (!hex)
break;
if (hex[0] == ':')
doublecolon = i;
while (hex[0] == '0' && IS_HEX(hex[1]))
hex++;
hexparts[i] = hex;
}
assert(i > 0);
if (hexparts[i - 1][span_hex4(hexparts[i - 1])] == '.')
ip4 = hexparts[--i];
maxparts = ip4 ? 6 : 8;
if (doublecolon >= 0) {
/* Order at most 8 (or 6) hexparts */
assert(i <= maxparts + 1);
if (i == maxparts + 1) {
/* There is an extra doublecolon */
for (j = doublecolon; j + 1 < i; j++)
hexparts[j] = hexparts[j + 1];
i--;
}
else {
for (j = maxparts; i > doublecolon + 1; )
hexparts[--j] = hexparts[--i];
for (;j > doublecolon;)
hexparts[--j] = "0:";
i = maxparts;
}
}
assert(i == maxparts);
/* Scan for optimal place for "::" */
for (i = 0, maxspan = 0, span = 0, doublecolon = 0; i < maxparts; i++) {
if (hexparts[i][0] == '0')
span++;
else if (span > maxspan)
doublecolon = i - span, maxspan = span, span = 0;
else
span = 0;
}
if (span > maxspan)
doublecolon = i - span, maxspan = span;
dst = buf;
for (i = 0; i < maxparts; i++) {
if (i == doublecolon)
hex = i == 0 ? "::" : ":", len = 1;
else if (i > doublecolon && i < doublecolon + maxspan)
continue;
else
hex = hexparts[i], len = span_hex4(hex);
if (hex[len] == ':')
len++;
memcpy(dst, hex, len);
dst += len;
}
if (ip4) {
hex = ip4;
len = scan_ip4_address(&hex); assert(len > 0);
/* Canonize :: and ::1 */
if (doublecolon == 0 && maxspan == 6) {
if (len == 7 && strncmp(ip4, "0.0.0.0", len) == 0)
ip4 = "", len = 0;
else if (len == 7 && strncmp(ip4, "0.0.0.1", len) == 0)
ip4 = "1", len = 1;
}
memcpy(dst, ip4, len);
dst += len;
}
len = dst - buf;
memcpy(host, buf, len);
return len;
}
/** Return length of valid IP6 address */
int span_ip6_address(char const *host)
{
return span_canonic_ip6_address(host, NULL, NULL);
}
/** Scan and canonize valid IP6 address.
*
* @param inout_host input pointer to string to scan
* output pointer to first character after valid IP6 address
*
* @retval Length of valid IP6 address or -1 upon an error.
*
* @note Scanned IP6 is not always NUL-terminated.
*/
int scan_ip6_address(char **inout_host)
{
int n, canonize = 0;
char *host = *inout_host;
char *hexparts[9] = { NULL };
n = span_canonic_ip6_address(host, &canonize, hexparts);
if (n == 0)
return -1;
*inout_host += n;
if (canonize) {
int len = canonize_ip6_address(host, hexparts);
assert(len <= n);
if (len < n)
host[len] = '\0';
}
return n;
}
/** Return length of valid IP6 reference. */
int span_ip6_reference(char const *host)
{
/* IPv6reference = "[" IPv6address "]" */
if (host && host[0] == '[') {
int n = span_ip6_address(host + 1);
if (n > 0 && host[n + 1] == ']')
return n + 2;
}
return 0;
}
/** Scan valid IP6 reference. */
int scan_ip6_reference(char **inout_host)
{
int n, canonize = 0;
char *host = *inout_host;
char *hexparts[9] = { NULL };
/* IPv6reference = "[" IPv6address "]" */
if (host == NULL ||
host[0] != '[' ||
(n = span_canonic_ip6_address(host + 1, &canonize, hexparts)) == 0 ||
host[n + 1] != ']')
return -1;
*inout_host += n + 2;
if (canonize) {
int len = canonize_ip6_address(host + 1, hexparts);
assert(len <= n);
host[len + 1] = ']';
if (len + 2 < n + 2)
host[len + 2] = '\0';
}
return n + 2;
}
/** Return length of valid IP4 or IP6 address. */
int span_ip_address(char const *host)
{
if (!host || !host[0])
return 0;
/* IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet */
if (IS_DIGIT(host[0])) {
int n = span_ip4_address(host);
if (n)
return n;
}
if (host[0] == '[')
return span_ip6_reference(host);
else
return span_ip6_address(host);
}
/** Scan valid IP4/IP6 address. */
int scan_ip_address(char **inout_host)
{
char *host = *inout_host;
if (host == NULL)
return -1;
/* IPv6reference = "[" IPv6address "]" */
if (host[0] == '[')
return scan_ip6_reference(inout_host);
if (IS_DIGIT(host[0])) {
int n = scan_ip4_address(inout_host);
if (n > 0)
return n;
}
return scan_ip6_address(inout_host);
}
/** Return length of a valid domain label */
su_inline
size_t span_domain_label(char const *label)
{
/* domainlabel = alphanum / alphanum *( alphanum / "-" ) alphanum */
if (IS_ALPHANUM(*label)) {
size_t n;
for (n = 1; IS_ALPHANUM(label[n]) || label[n] == '-'; n++)
;
if (IS_ALPHANUM(label[n - 1]))
return n;
}
return 0;
}
/** Scan valid domain name and count number of labels in it. */
su_inline
size_t span_domain_labels(char const *host, size_t *return_labels)
{
size_t len, n, labels;
int c;
if (!host || !host[0])
return 0;
for (n = 0, labels = 0; ; n += len) {
len = span_domain_label(host + n);
if (len == 0)
return 0;
labels++;
if (host[n + len] != '.')
break;
len++;
if (!IS_ALPHANUM(host[n + len]))
break;
}
/* Check that last label does not start with number */
if (!IS_ALPHA(host[n]))
return 0;
c = host[n + len];
if (IS_ALPHANUM(c) || c == '-' || c == '.')
return 0;
if (return_labels)
*return_labels = labels;
return n + len;
}
/** Return length of a valid domain name.
*
* @code
* hostname = *( domainlabel "." ) toplabel [ "." ]
* domainlabel = alphanum
* / alphanum *( alphanum / "-" ) alphanum
* toplabel = ALPHA / ALPHA *( alphanum / "-" ) alphanum
* @endcode
*/
isize_t span_domain(char const *host)
{
return span_domain_labels(host, NULL);
}
/** Scan valid domain name. */
issize_t scan_domain(char **inout_host)
{
char *host;
size_t n, labels;
n = span_domain_labels(host = *inout_host, &labels);
if (n == 0)
return -1;
/* Remove extra dot at the end of hostname */
if (labels > 1 && host[n - 1] == '.')
host[n - 1] = '\0';
*inout_host += n;
return n;
}
/** Return length of a valid domain name or IP address. */
isize_t span_host(char const *host)
{
if (!host || !host[0])
return 0;
if (host[0] == '[')
return span_ip6_reference(host);
if (IS_DIGIT(host[0])) {
int n = span_ip4_address(host);
if (n)
return (isize_t)n;
}
return span_domain(host);
}
/** Scan valid domain name or IP address. */
issize_t scan_host(char **inout_host)
{
char *host = *inout_host;
if (host == NULL)
return -1;
/* IPv6reference = "[" IPv6address "]" */
if (host[0] == '[')
return scan_ip6_reference(inout_host);
if (IS_DIGIT(host[0])) {
int n = scan_ip4_address(inout_host);
if (n > 0)
return (issize_t)n;
}
return scan_domain(inout_host);
}
#include <sofia-sip/hostdomain.h>
/** Return true if @a string is valid IP4 address in dot-notation.
*
* @note Only 4-octet form is accepted, e.g., @c 127.1 is not considered
* valid IP4 address.
*/
int host_is_ip4_address(char const *string)
{
int n = span_ip4_address(string);
return n > 0 && string[n] == '\0';
}
/** Return true if @a string is valid IP6 address in hex notation.
*
* E.g., fe80::1 is a valid IP6 address.
*/
int host_is_ip6_address(char const *string)
{
int n = span_ip6_address(string);
return n > 0 && string[n] == '\0';
}
int host_ip6_reference(char const *string)
{
return host_is_ip6_reference(string);
}
/** Return true if @a string is valid IP6 reference,
* i.e. hex notation in square brackets.
*
* E.g., [::1] is a valid IP6 reference.
*/
int host_is_ip6_reference(char const *string)
{
int n = span_ip6_reference(string);
return n > 0 && string[n] == '\0';
}
/** Return true if @a string is valid IP address.
*
* Valid IP address is either a IP4 adddress in quad-octet notation,
* IP6 hex address or IP6 reference in square brackets ([]).
*/
int host_is_ip_address(char const *string)
{
int n = span_ip_address(string);
return n > 0 && string[n] == '\0';
}
/** Return true if @a string is valid a domain name.
*
* Valid domain name consists of alphanumeric labels separated with
* dot ("."). There can be a "-" in the middle of label.
* The last label must start with a letter.
*
* @code
* hostname = *( domainlabel "." ) toplabel [ "." ]
* domainlabel = alphanum
* / alphanum *( alphanum / "-" ) alphanum
* toplabel = ALPHA / ALPHA *( alphanum / "-" ) alphanum
* @endcode
*/
int host_is_domain(char const *string)
{
size_t n = string ? span_domain(string) : 0;
return string && n > 0 && string[n] == '\0';
}
/** Return true if @a string is valid a host name.
*
* Check if the @a string is a domain name, IP address or IP6 reference.
*/
int host_is_valid(char const *string)
{
size_t n = span_host(string);
return n > 0 && string[n] == '\0';
}
/** Returns true if @a string is describing a local address.
*
* Uses the definitions of local addresses found in RFC1700 and
* RFC4291.
*/
int host_is_local(char const *host)
{
size_t n;
if (host_is_ip6_reference(host))
return (strcmp(host, "[::1]") == 0);
else if (host_is_ip6_address(host))
return (strcmp(host, "::1") == 0);
else if (host_is_ip4_address(host))
return (strncmp(host, "127.", 4) == 0);
n = span_domain(host);
return
n >= 9 /* strlen("localhost") */ &&
su_casenmatch(host, "localhost", 9) &&
(n == 9 ||
((n == 10 || /* localhost. */
n == 21 || /* strlen("localhost.localdomain") */
n == 22) && /* strlen("localhost.localdomain.") */
su_casenmatch(host + 9, ".localdomain.", n - 9)));
}
/** Return true if @a string has domain name in "invalid." domain.
*
*/
int host_has_domain_invalid(char const *string)
{
size_t n = span_domain(string);
if (n >= 7 && string[n] == '\0') {
static char const invalid[] = ".invalid";
if (string[n - 1] == '.') /* .invalid. perhaps? */
n--;
if (n == 7 /* strlen("invalid") */)
return su_casenmatch(string, invalid + 1, 7);
else
return su_casenmatch(string + n - 8, invalid, 8);
}
return 0;
}
#include <sofia-sip/su.h>
static size_t convert_ip_address(char const *s,
uint8_t addr[16],
size_t *return_addrlen)
{
size_t len;
int canonize = 0;
char buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
#if SU_HAVE_IN6
len = span_ip6_reference(s);
if (len) {
assert(len - 2 < sizeof buf); assert(len > 2);
if (s[len])
return 0;
len = len - 2;
s = memcpy(buf, s + 1, len), buf[len] = '\0';
}
else
len = span_ip6_address(s);
if (len) {
if (s[len] == '\0' && su_inet_pton(AF_INET6, s, addr) == 1) {
if (SU_IN6_IS_ADDR_V4MAPPED(addr) ||
SU_IN6_IS_ADDR_V4COMPAT(addr)) {
memcpy(addr, addr + 12, 4);
return (void)(*return_addrlen = 4), len;
}
return (void)(*return_addrlen = 16), len;
}
}
else
#endif
len = span_canonic_ip4_address(s, &canonize);
if (len) {
if (canonize) {
char *tmp = buf;
s = memcpy(tmp, s, len + 1);
scan_ip4_address(&tmp);
}
if (s[len] == '\0' && su_inet_pton(AF_INET, s, addr) == 1)
return (void)(*return_addrlen = 4), len;
}
return 0;
}
/** Compare two host names or IP addresses
*
* Converts valid IP addresses to the binary format before comparing them.
* Note that IP6-mapped IP4 addresses and IP6-compatible IP4 addresses are
* compared as IP4 addresses; that is, ::ffff:127.0.0.1, ::127.0.0.1 and
* 127.0.0.1 all are all equal.
*
* @param a IP address or domain name
* @param b IP address or domain name
*
* @retval -1 if a < b
* @retval 0 if a == b
* @retval 1 if a > b
*
* @since New in @VERSION_1_12_4.
*/
int host_cmp(char const *a, char const *b)
{
uint8_t a6[16], b6[16];
size_t alen, blen, asize = 0, bsize = 0;
int retval;
if (a == NULL || b == NULL) {
retval = (a != NULL) - (b != NULL);
}
else {
alen = convert_ip_address(a, a6, &asize);
blen = convert_ip_address(b, b6, &bsize);
if (alen > 0 && blen > 0) {
if (asize < bsize)
retval = -1;
else if (asize > bsize)
retval = 1;
else
retval = memcmp(a6, b6, asize);
}
else {
retval = su_strcasecmp(a, b);
}
}
return retval;
}

View File

@ -1,19 +0,0 @@
/* -*- C -*- */
/**@MODULEPAGE "bnf" - String Parser Module
*
* @section bnf_meta Module Meta Information
*
* The Sofia @b bnf module contains macros and functions for parsing
* text-based formats, for example, for SIP. The interface is described in
* <sofia-sip/bnf.h>.
*
* The interface used for validating hostnames and IP addresses is in
* <sofia-sip/hostdomain.h>.
*
* @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @STATUS @SofiaSIP Core library
*
* @LICENSE LGPL
*/

View File

@ -1,325 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef BNF_H /** Defined when <sofia-sip/bnf.h> has been included. */
#define BNF_H
/**@file sofia-sip/bnf.h
*
* Parsing macros and prototypes for HTTP-like protocols.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Tue Jun 06 10:59:34 2000 ppessi
*
*/
#include <sofia-sip/su_types.h>
#include <string.h>
SOFIA_BEGIN_DECLS
/* Parsing tokens */
/** Control characters. */
#define CTL "\001\002\003\004\005\006\007" \
"\010\011\012\013\014\015\016\017" \
"\020\021\022\023\024\025\026\027" \
"\030\031\032\033\034\035\036\037" "\177" "\0"
/** Space */
#define SP " "
/** Horizontal tab */
#define HT "\t"
/** Carriage return */
/* CR conflicts with Windows SDK 10, so it is now _CR */
#define _CR "\r"
/** Line feed */
#define LF "\n"
/** Line-ending characters */
#define CRLF _CR LF
/** Whitespace */
#define WS SP HT
/** Linear whitespace */
#define LWS SP HT _CR LF
/** Lower-case alphabetic characters */
#define LOALPHA "abcdefghijklmnopqrstuvwxyz"
/** Upper-case alphabetic characters */
#define UPALPHA "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
/** Alphabetic characters */
#define ALPHA LOALPHA UPALPHA
/** Digits */
#define DIGIT "0123456789"
/** RTSP safe characters */
#define SAFE "$-_." /* RTSP stuff */
#define ALPHANUM DIGIT ALPHA
#define HEX DIGIT "ABCDEF" "abcdef"
/** SIP token characters.
* @note $|&^# were token chars in RFC 2543, but no more in RFC 3261.
*/
#define SIP_TOKEN ALPHANUM "-.!%*_+`'~"
/** SIP separator characters */
#define SIP_SEPARATOR "()<>@,;:\\\"/[]?={}" SP HT
/** SIP Word characters (that are not token characters) */
#define SIP_WORD "()<>:\\\"/[]?{}"
/** Skip whitespace (SP HT) */
#define skip_ws(ss) (*(ss) += span_ws(*(ss)))
/** Skip linear whitespace (SP HT CR LF) */
#define skip_lws(ss) (*(ss) += span_lws(*(ss)))
/** Skip [a-zA-Z] */
#define skip_alpha(ss) (*(ss) += span_alpha(*(ss)))
/** Skip digits */
#define skip_digit(ss) (*(ss) += span_digit(*(ss)))
/** Skip characters belonging to an RTSP token. */
#define skip_alpha_digit_safe(ss) (*(ss) += span_alpha_digit_safe(*(ss)))
/** Skip characters belonging to a SIP token. */
#define skip_token(ss) (*(ss) += span_token(*(ss)))
/** Skip characters belonging to a SIP parameter value. */
#define skip_param(ss) (*(ss) += span_param(*(ss)))
/** Skip characters belonging to a SIP word. */
#define skip_word(ss) (*(ss) += span_word(*(ss)))
/** Test if @c is CR or LF */
#define IS_CRLF(c) ((c) == '\r' || (c) == '\n')
/** Test if @c is linear whitespace */
#define IS_LWS(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
/*#define IS_LWS(c) ((_bnf_table[(unsigned char)(c)] & bnf_lws))*/
/** Test if @c is normal whitespace */
#define IS_WS(c) ((c) == ' ' || (c) == '\t')
/** Test if @c is not whitespace (and not NUL). */
#define IS_NON_WS(c) (c && !IS_WS(c))
/*#define IS_NON_WS(c) (c && !(_bnf_table[(unsigned char)c] & bnf_ws))*/
/** Test if @c is not linear whitespace (and not NUL). */
#define IS_NON_LWS(c) (c && !IS_LWS(c))
/*#define IS_NON_LWS(c) (c && !(_bnf_table[(unsigned char)c] & bnf_lws))*/
/** Test if @c is a digit. */
#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
/** Test if @c is alphabetic. */
#define IS_ALPHA(c) (c && ((_bnf_table[(unsigned char)c] & bnf_alpha)))
/** Test if @c is alphanumeric. */
#define IS_ALPHANUM(c) (c && (IS_DIGIT(c) || IS_ALPHA(c)))
/** Test if @c is URL-unreserved. */
#define IS_UNRESERVED(c) ((_bnf_table[(unsigned char)c] & bnf_unreserved))
/** Test if @c is URL-reserved. */
#define IS_RESERVED(c) (c && !(_bnf_table[(unsigned char)c] & bnf_unreserved))
/** Test if @c is valid in tokens. */
#define IS_TOKEN(c) ((_bnf_table[(unsigned char)c] & bnf_token))
/** Test if @c is valid for SIP parameter value. */
#define IS_PARAM(c) ((_bnf_table[(unsigned char)c] & (bnf_token|bnf_param)))
/** Test if @c is a hex digit. */
#define IS_HEX(c) (((c) >= '0' && (c) <= '9') || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
/** Test if @c is a linear whitespace or valid in tokens. */
#define IS_TOKENLWS(c) ((_bnf_table[(unsigned char)c] & (bnf_token|bn_lws)))
enum {
bnf_ws = 1, /**< Whitespace character */
bnf_crlf = 2, /**< Line end character */
bnf_lws = 3, /**< Linear whitespace */
bnf_alpha = 4, /**< Alphabetic */
bnf_safe = 8, /**< RTSP safe */
bnf_mark = 16, /**< URL mark */
bnf_unreserved = bnf_alpha | bnf_mark, /**< URL unreserved */
bnf_separator = 32, /**< SIP separator */
/** SIP token, not alphabetic (0123456789-.!%*_+`'~) */
bnf_token0 = 64 | bnf_safe,
bnf_token = bnf_token0 | bnf_alpha, /**< SIP token */
bnf_param0 = 128, /**< SIP parameter, not token */
bnf_param = bnf_token | bnf_param0 /**< SIP/HTTP parameter */
};
/** Table for determining class of a character. */
SOFIAPUBVAR unsigned char const _bnf_table[256];
/** Get number of characters before CRLF */
#define span_non_crlf(s) strcspn(s, _CR LF)
/** Get number of characters before whitespace */
#define span_non_ws(s) strcspn(s, WS)
/** Get number of whitespace characters */
#define span_ws(s) strspn(s, WS)
/** Get number of characters before linear whitespace */
#define span_non_lws(s) strcspn(s, LWS)
/** Calculate span of a linear whitespace.
* LWS = [*WSP CRLF] 1*WSP
*/
su_inline isize_t span_lws(char const *s)
{
char const *e = s;
int i = 0;
e += strspn(s, WS);
if (e[i] == '\r') i++;
if (e[i] == '\n') i++;
if (IS_WS(e[i]))
e += i + strspn(e + i, WS);
return e - s;
}
/** Calculate span of a token or linear whitespace characters. */
su_inline isize_t span_token_lws(char const *s)
{
char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & (bnf_token | bnf_lws))
e++;
return e - s;
}
/** Calculate span of a token characters. */
su_inline isize_t span_token(char const *s)
{
char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & bnf_token)
e++;
return e - s;
}
/** Calculate span of a alphabetic characters. */
su_inline isize_t span_alpha(char const *s)
{
char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & bnf_alpha)
e++;
return e - s;
}
/** Calculate span of a digits. */
su_inline isize_t span_digit(char const *s)
{
char const *e = s;
while (*e >= '0' && *e <= '9')
e++;
return e - s;
}
/** Calculate span of a hex. */
su_inline isize_t span_hexdigit(char const *s)
{
char const *e = s;
while (IS_HEX(*e))
e++;
return e - s;
}
/** Calculate span of characters belonging to an RTSP token */
su_inline isize_t span_alpha_digit_safe(char const *s)
{
char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & (bnf_alpha | bnf_safe))
e++;
return e - s;
}
/** Calculate span of a characters valid in parameters. */
su_inline isize_t span_param(char const *s)
{
char const *e = s;
while (IS_PARAM(*e))
e++;
return e - s;
}
/** Calculate span of a SIP word. */
su_inline isize_t span_word(char const *s)
{
char const *e = s;
while (*e && (IS_TOKEN(*e) || strchr(SIP_WORD, *e)))
e++;
return e - s;
}
/** Calculate span of a unreserved characters. */
su_inline isize_t span_unreserved(char const *s)
{
char const *e = s;
while (IS_UNRESERVED(*e))
e++;
return e - s;
}
/** Calculate span of a double quoted string (with escaped chars inside) */
su_inline isize_t span_quoted(char const *s)
{
char const *b = s;
if (*s++ != '"')
return 0;
for (;;) {
s += strcspn(s, "\\\"");
if (!*s)
return 0;
if (*s++ == '"')
return s - b;
if (!*s++)
return 0;
}
}
/* RFC 2396 defines URL chars */
/** Reserved in URLs */
#define URL_RESERVED ";/?:=+$,"
/** Non-alphanumeric characters without syntactical meaning. */
#define URL_MARK "-_.!~*'()"
/** Unreserved characters. */
#define URL_UNRESERVED ALPHANUM URL_MARK
/** URL hex escape. */
#define URL_ESCAPED "%"
#define URL_DELIMS "<>#%\""
#define URL_UNWISE "{}|\\^[]`"
#define URL_SCHEME ALPHANUM "+-."
/** Get number of characters belonging to url scheme */
#define span_url_scheme(s) strspn(s, URL_SCHEME)
SOFIAPUBFUN int span_ip4_address(char const *host);
SOFIAPUBFUN int span_ip6_address(char const *host);
SOFIAPUBFUN int span_ip6_reference(char const *host);
SOFIAPUBFUN int span_ip_address(char const *host);
SOFIAPUBFUN isize_t span_domain(char const *host);
SOFIAPUBFUN isize_t span_host(char const *host);
SOFIAPUBFUN int scan_ip4_address(char **inout_host);
SOFIAPUBFUN int scan_ip6_address(char **inout_host);
SOFIAPUBFUN int scan_ip6_reference(char **inout_host);
SOFIAPUBFUN int scan_ip_address(char **inout_host);
SOFIAPUBFUN issize_t scan_domain(char **inout_host);
SOFIAPUBFUN issize_t scan_host(char **inout_host);
SOFIA_END_DECLS
#endif /* !defined BNF_H */

View File

@ -1,60 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 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
*
*/
#ifndef SOFIA_SIP_HOSTDOMAIN_H
/** Defined when <sofia-sip/hostdomain.h> has been included. */
#define SOFIA_SIP_HOSTDOMAIN_H
/**@file sofia-sip/hostdomain.h
*
* Predicates for handling host names: IP addresses or domain names.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Thu Mar 9 16:15:22 EET 2006 ppessi
*/
#ifndef SU_CONFIG_H
#include <sofia-sip/su_config.h>
#endif
SOFIA_BEGIN_DECLS
SOFIAPUBFUN int host_is_ip4_address(char const *string);
SOFIAPUBFUN int host_is_ip6_address(char const *string);
SOFIAPUBFUN int host_is_ip6_reference(char const *string);
SOFIAPUBFUN int host_is_ip_address(char const *string);
SOFIAPUBFUN int host_is_domain(char const *string);
SOFIAPUBFUN int host_is_valid(char const *string);
SOFIAPUBFUN int host_is_local(char const *string);
SOFIAPUBFUN int host_has_domain_invalid(char const *string);
SOFIAPUBFUN int host_cmp(char const *a, char const *b);
/** This is typo. @deprecated Use host_is_ip6_reference() instead. */
SOFIAPUBFUN int host_ip6_reference(char const *string);
SOFIA_END_DECLS
#endif /* !defined(SOFIA_SIP_HOSTDOMAIN_H) */

View File

@ -1,376 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
/**@CFILE torture_bnf.c
*
* Torture tests for BNF functions.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Tue Aug 21 15:18:26 2001 ppessi
*/
#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <assert.h>
#include "sofia-sip/bnf.h"
static int test_flags = 0;
#define TSTFLAGS test_flags
#include <sofia-sip/tstdef.h>
char const name[] = "torture_bnf";
static int count_bnf(int bnf_flags)
{
int i, n;
for (i = 0, n = 0; i < 128; i++)
if (_bnf_table[i] & bnf_flags)
n++;
return n;
}
static int bnf_test(void)
{
BEGIN();
TEST_1(IS_TOKEN('a'));
TEST_1(IS_TOKEN('b'));
/* Fixed for 1.12.2: lws = [*wsp crlf] 1*wsp */
TEST_SIZE(span_lws(" \r\n \r\nLoppuu"), 5);
TEST_SIZE(span_lws(" \r\r \nLoppuu"), 2);
TEST_SIZE(span_lws(" \n\r \nLoppuu"), 2);
TEST_SIZE(span_lws(" \r \nLoppuu"), 4);
TEST_SIZE(span_lws(" \n\t \nLoppuu"), 5);
TEST_SIZE(span_lws(" \r\n\t \nLoppuu"), 6);
TEST_SIZE(span_token(SIP_TOKEN), strlen(SIP_TOKEN));
TEST_SIZE(count_bnf(bnf_token), strlen(SIP_TOKEN "$"));
#define SIP_PARAM SIP_TOKEN "[:]/"
TEST_SIZE(span_param(SIP_PARAM), strlen(SIP_PARAM));
TEST_SIZE(count_bnf(bnf_param), strlen(SIP_PARAM "$"));
TEST_SIZE(span_unreserved(URL_UNRESERVED URL_ESCAPED),
strlen(URL_UNRESERVED URL_ESCAPED));
TEST_SIZE(count_bnf(bnf_unreserved),
strlen(URL_UNRESERVED URL_ESCAPED));
{
char word[] = ALPHA DIGIT "-.!%*_+`'~()<>:\\\"/[]?{}";
TEST_SIZE(span_word(word), strlen(word));
}
END();
}
static int ip_test(void)
{
BEGIN();
char *s;
TEST(span_ip4_address("127.255.249.000,"), 15);
TEST(span_ip4_address("0.00.000.000:,"), 12);
/* Test error detection */
TEST(span_ip4_address("256.00.000.000:,"), 0);
TEST(span_ip4_address("255.00.000.0000,"), 0);
TEST(span_ip4_address("255.00.000.199."), 0);
{
char ip0[] = "010.250.020.000,";
char ip1[] = "0.00.000.000:,";
char ip2[] = "256.00.000.000:,";
char ip3[] = "255.00.000.0000,";
char ip4[] = "255.00.000.199.";
s = ip0;
TEST(scan_ip4_address(&s), 15); TEST_S(s, ","); TEST_S(ip0, "10.250.20.0");
s = ip1;
TEST(scan_ip4_address(&s), 12); TEST_S(s, ":,"); TEST_S(ip1, "0.0.0.0");
/* Test error detection */
s = ip2; TEST(scan_ip4_address(&s), -1);
s = ip3; TEST(scan_ip4_address(&s), -1);
s = ip4; TEST(scan_ip4_address(&s), -1);
}
TEST(span_ip6_address("dead:beef:feed:ded:0:1:2:3"), 26);
TEST(span_ip6_address("::beef:feed:ded:0:1:2:3"), 23);
TEST(span_ip6_address("::255.0.0.0,"), 11);
TEST(span_ip6_address("::,"), 2);
TEST(span_ip_address("[dead:beef:feed:ded:0:1:2:3]"), 28);
TEST(span_ip_address("::255.0.0.0,"), 11);
TEST(span_ip_address("[::255.0.0.0]:"), 13);
TEST(span_ip6_address("dead:beef:feed::0ded:0:1:2:3"), 28);
TEST(span_ip6_address("dead:beef:feed::0ded:0000:0001:0002:0003"), 40);
TEST(span_ip6_address("dead:beef:feed::0ded::0000:0001:0002:0003"), 0);
TEST(span_ip6_address("::dead:beef:feed::0ded:0000:0001:0002:0003"), 0);
TEST(span_ip6_address("dead:beef:feed:ded:0:1:2:3:4"), 0);
TEST(span_ip6_address("dead:beef:feed:00ded:0:1:2:3"), 0);
TEST(span_ip6_address("dead:beef:feed:ded:0:1:2:127.0.0.1"), 0);
TEST(span_ip6_address(":255.0.0.0,"), 0);
TEST(span_ip6_address("255.0.0.0,"), 0);
/* Accept colon after IP4-quad */
TEST(span_ip_address("::255.0.0.0:5060"), 11);
/* This is a reference */
TEST(span_ip6_address("[dead:beef:feed:ded:0:1:2:3]"), 0);
TEST(span_ip6_reference("[dead:beef:feed:ded:0:1:2:3]:1"), 28);
TEST(span_ip_address("[dead:beef:feed:ded:0:1:2:3]:1"), 28);
TEST(span_ip_address("[127.0.0.1]:1"), 0);
{
char ip0[] = "dead:beef:feed:ded:0:1:2:3,";
char ip1[] = "::beef:feed:ded:0:1:2:3;";
char ip1b[] = "::beef:feed:ded:0:0:2:3;";
char ip2[] = "::255.00.0.0,";
char ip3[] = "::,";
char ip4[] = "0:0:0:0:0:0:0:0,";
char ip4b[] = "0:0:0:0:0:0:0.0.0.0,";
char ip4c[] = "0:0:0:0:0:0:0.0.0.1,";
char ip5[] = "dead:beef:feed::0ded:0:1:2:3";
char ip6[] = "dead:beef:feed::0ded:0000:0001:0002:0003+";
char ip7[] = "1:0:0:2:0:0:0:3,";
char ip8[] = "1:0:0:2:0:0:3:4,";
char ip9[] = "1::2:0:0:0:3,";
s = ip0; TEST(scan_ip6_address(&s), 26); TEST_S(s, ",");
TEST_S(ip0, "dead:beef:feed:ded::1:2:3");
s = ip1; TEST(scan_ip6_address(&s), 23); TEST_S(s, ";");
TEST_S(ip1, "::beef:feed:ded:0:1:2:3;");
s = ip1b; TEST(scan_ip6_address(&s), 23); TEST_S(s, ";");
TEST_S(ip1b, "0:beef:feed:ded::2:3");
s = ip2; TEST(scan_ip6_address(&s), 12); TEST_S(s, ",");
TEST_S(ip2, "::255.0.0.0");
s = ip3; TEST(scan_ip6_address(&s), 2); TEST_S(s, ",");
TEST_S(ip3, "::,");
s = ip4; TEST(scan_ip6_address(&s), 15); TEST_S(s, ",");
TEST_S(ip4, "::");
s = ip4b; TEST(scan_ip6_address(&s), 19); TEST_S(s, ",");
TEST_S(ip4b, "::");
s = ip4c; TEST(scan_ip6_address(&s), 19); TEST_S(s, ",");
TEST_S(ip4c, "::1");
TEST_S(ip5, "dead:beef:feed::0ded:0:1:2:3");
s = ip5; TEST(scan_ip6_address(&s), 28); TEST_S(s, "");
TEST_S(ip5, "dead:beef:feed:ded::1:2:3");
s = ip6; TEST(scan_ip6_address(&s), 40); TEST_S(s, "+");
TEST_S(ip6, "dead:beef:feed:ded::1:2:3");
s = ip7; TEST(scan_ip6_address(&s), 15); TEST_S(s, ",");
TEST_S(ip7, "1:0:0:2::3");
s = ip8; TEST(scan_ip6_address(&s), 15); TEST_S(s, ",");
TEST_S(ip8, "1::2:0:0:3:4");
s = ip9; TEST(scan_ip6_address(&s), 12); TEST_S(s, ",");
TEST_S(ip9, "1:0:0:2::3");
}
{
char err0[] = "dead:beef:feed::0ded::0000:0001:0002:0003";
char err1[] = "::dead:beef:feed::0ded:0000:0001:0002:0003";
char err2[] = "dead:beef:feed:ded:0:1:2:3:4";
char err3[] = "dead:beef:feed:00ded:0:1:2:3";
char err4[] = "dead:beef:feed:ded:0:1:2:127.0.0.1";
char err5[] = ":255.0.0.0,";
char err6[] = "255.0.0.0,";
char err7[] = "dead:beef:feed:ded:0:1:2:3:4:5,";
TEST(scan_ip6_address((s = err0, &s)), -1);
TEST(scan_ip6_address((s = err1, &s)), -1);
TEST(scan_ip6_address((s = err2, &s)), -1);
TEST(scan_ip6_address((s = err3, &s)), -1);
TEST(scan_ip6_address((s = err4, &s)), -1);
TEST(scan_ip6_address((s = err5, &s)), -1);
TEST(scan_ip6_address((s = err6, &s)), -1);
TEST(scan_ip6_address((s = err7, &s)), -1);
}
{
char err0[] = "[dead:beef:feed::0ded::0000:0001:0002:0003]:";
char err1[] = "[::dead:beef:feed::0ded:0000:0001:0002:0003]+";
char err2[] = "[dead:beef:feed:ded:0:1:2:3:4]+";
char err3[] = "[dead:beef:feed:00ded:0:1:2:3]+";
char err4[] = "[dead:beef:feed:ded:0:1:2:127.0.0.1]";
char err5[] = "[:255.0.0.0],";
char err6[] = "[255.0.0.0],";
char err7[] = "[dead:beef:feed:ded:0:1:2:]";
TEST(scan_ip6_reference((s = err0, &s)), -1);
TEST(scan_ip6_reference((s = err1, &s)), -1);
TEST(scan_ip6_reference((s = err2, &s)), -1);
TEST(scan_ip6_reference((s = err3, &s)), -1);
TEST(scan_ip6_reference((s = err4, &s)), -1);
TEST(scan_ip6_reference((s = err5, &s)), -1);
TEST(scan_ip6_reference((s = err6, &s)), -1);
TEST(scan_ip6_reference((s = err7, &s)), -1);
}
END();
}
#define TEST_SCAN(scanner, input, canonic, output) \
do { char s0[] = input; char *s = s0; \
size_t n = sizeof(input) - sizeof(output); \
TEST_SIZE(scanner(&s), n); \
TEST_S(s, output); \
TEST_S(s0, canonic); } while(0)
#include <sofia-sip/hostdomain.h>
static int host_test(void)
{
BEGIN();
TEST(host_is_ip4_address(NULL), 0);
TEST(host_is_ip6_address(NULL), 0);
TEST(host_ip6_reference(NULL), 0);
TEST(host_is_ip_address(NULL), 0);
TEST(host_is_domain(NULL), 0);
TEST(host_is_valid(NULL), 0);
TEST(host_has_domain_invalid(NULL), 0);
TEST_SIZE(span_host("rama"), 4);
TEST_SIZE(span_host("ra-ma.1-2.3-4.a4-9."), 19);
TEST_SIZE(span_host("a.1.b"), 5);
TEST_SIZE(span_host("127.255.249.000.a,"), 17);
TEST_SIZE(span_host("127.255.249.000,"), 15);
TEST_SIZE(span_host("0.00.000.000:,"), 12);
TEST_SIZE(span_host("127.255.249.000,"), 15);
TEST_SIZE(span_host("[dead:beef:feed:ded:0:1:2:3]:1"), 28);
TEST_SIZE(span_host("[dead:beef:feed:ded::1:2:3]:1"), 27);
TEST_SIZE(span_host("[::127.0.0.1]:1"), 13);
TEST_SCAN(scan_host, "rama", "rama", "");
TEST_SCAN(scan_host, "rama.", "rama.", "");
TEST_SCAN(scan_ip4_address, "127.255.249.000,", "127.255.249.0", ",");
TEST_SCAN(scan_host, "127.255.249.000,", "127.255.249.0", ",");
TEST_SCAN(scan_host, "a.1.b.", "a.1.b", "");
TEST_SCAN(scan_host, "ra-ma.1-2.3-4.a4-9.", "ra-ma.1-2.3-4.a4-9", "");
TEST_SCAN(scan_host, "127.255.249.000.a,", "127.255.249.000.a,", ",");
TEST_SCAN(scan_host, "0.00.000.000:,", "0.0.0.0", ":,");
TEST_SCAN(scan_host, "127.255.249.000,", "127.255.249.0", ",");
TEST_SCAN(scan_host, "[dead:beef:feed:ded:0:1:2:3]:1",
"[dead:beef:feed:ded::1:2:3]", ":1");
TEST_SCAN(scan_host, "[::127.0.0.1]:1", "[::127.0.0.1]:1", ":1");
/* Test error detection */
TEST_SIZE(span_host("256.00.000.000:,"), 0);
TEST_SIZE(span_host("255.00.000.0000,"), 0);
TEST_SIZE(span_host("255.00.000.199."), 0);
TEST_SIZE(span_host("[127.0.0.1]:1"), 0);
TEST_SIZE(span_domain("rama.1"), 0);
TEST_SIZE(span_domain("-ma.1-2.3-4.a4-9."), 0);
TEST_SIZE(span_domain("a..b"), 0);
TEST_SIZE(span_domain("a.b.-"), 0);
TEST_SIZE(span_domain("a.b-"), 0);
TEST(host_is_local("126.0.0.0"), 0);
TEST(host_is_local("127.0.0.0"), 1);
TEST(host_is_local("127.0.0.2"), 1);
TEST(host_is_local("0.0.0.0"), 0);
TEST(host_is_local("::1"), 1);
TEST(host_is_local("::1"), 1);
TEST(host_is_local("::1:3fff"), 0);
TEST(host_is_local("[::1]"), 1);
TEST(host_is_local("localdomain.domain.org"), 0);
TEST(host_is_local("localhost.domain.org"), 0);
TEST(host_is_local("localhost"), 1);
TEST(host_is_local("localhost.localdomain"), 1);
TEST(host_is_local("localhost."), 1);
TEST(host_is_local("localhost.localdomain."), 1);
TEST(host_is_local("localhost.localdomain.org"), 0);
TEST(host_has_domain_invalid("invalid"), 1);
TEST(host_has_domain_invalid("invalid."), 1);
TEST(host_has_domain_invalid("1.invalid"), 1);
TEST(host_has_domain_invalid("1.invalid."), 1);
TEST(host_has_domain_invalid("1invalid"), 0);
TEST(host_has_domain_invalid("valid."), 0);
TEST(host_has_domain_invalid("1-.invalid."), 0);
TEST(host_is_domain("127.0.0.1"), 0);
TEST(host_is_domain("3.com"), 1);
TEST(host_is_domain("127.0.0.com"), 1);
TEST(host_is_domain("actra.0.1"), 0);
/* Invalid IP4 address (extra leading zeros) */
TEST_1(!host_cmp("127.0.0.1", "127.0.0.01"));
/* Invalid reference (extra leading zeros) */
TEST_1(host_cmp("[0ffff:0ffff:0ffff:0ffff:0ffff:0ffff:255.255.255.255]",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
#if SU_HAVE_IN6
TEST_1(!host_cmp("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
TEST_1(!host_cmp("::1", "::001"));
TEST_1(!host_cmp("[::1]", "::1"));
TEST_1(!host_cmp("[::1]", "::0.0.0.1"));
TEST_1(!host_cmp("::ffff:127.0.0.1", "127.0.0.1"));
TEST_1(!host_cmp("::ffff:127.0.0.1", "::ffff:7f00:1"));
TEST_1(!host_cmp("::ffff:127.0.0.1", "::ffff:7f00:1"));
TEST_1(!host_cmp("[::ffff:127.0.0.1]", "[::7f00:1]"));
#endif
TEST_1(host_cmp("::", "0.0.0.0"));
TEST_1(host_cmp("::1", "0.0.0.1"));
END();
}
static void usage(int exitcode)
{
fprintf(stderr, "usage: %s [-v] [-a]\n", name);
exit(exitcode);
}
int main(int argc, char *argv[])
{
int retval = 0;
int i;
for (i = 1; argv[i]; i++) {
if (strcmp(argv[i], "-v") == 0)
test_flags |= tst_verbatim;
else if (strcmp(argv[i], "-a") == 0)
test_flags |= tst_abort;
else
usage(1);
}
retval |= bnf_test(); fflush(stdout);
retval |= ip_test(); fflush(stdout);
retval |= host_test(); fflush(stdout);
return retval;
}

View File

@ -1,20 +0,0 @@
2005-10-27 Pekka Pessi <Pekka.Pessi@nokia.com>
* Added aliases for RFC links in libsofia-sip-ua/docs/Doxyfile.aliases.
M ./libsofia-sip-ua/docs/Doxyfile.aliases -7 +2208
2005-10-12 Pekka Pessi <Pekka.Pessi@nokia.com>
* Fixed aliases for Doxygen 1.4.
M ./libsofia-sip-ua/docs/Doxyfile.aliases -6 +6
2005-09-08 Kai Vehmanen <kai.vehmanen@nokia.com>
* hide_emails.sh: Fixed bug in hiding addresses of
form foo.bar-bar@something.org. Fixed sf.net
bug #1277167.

View File

@ -1,66 +0,0 @@
# Doxyfile 1.0.0 format
#
PREDEFINED = DOX \
DOXYGEN_ONLY=1 \
DOCUMENTATION_ONLY=1 \
SU_HAVE_INLINE=1 su_inline=inline \
SOFIA_BEGIN_DECLS SOFIA_END_DECLS SOFIAPUBFUN SOFIACALL \
SOFIAPUBVAR=extern \
SU_DLL SIP_DLL RTSP_DLL SU_DLL NTA_DLL NUA_DLL MSG_DLL AUTH_DLL \
NTH_DLL HTTP_DLL \
__attribute__()=
ALIASES = \
"MODULEPAGE=\mainpage Sofia SIP User Agent Library - " \
"CONTACT=\par Contact:\n" \
"STATUS=\par Status:\n" \
"LICENSE=\par License:\n" \
"SofiaSIP=<a href=\"../index.html\">Sofia SIP</a>" \
"SU=@ref su_index \"SU\"" "su=@ref su_index \"su\"" \
"msg=@ref msg_index \"msg\"" \
"sip=@ref sip_index \"sip\"" \
"nua=@ref nua_index \"nua\"" \
"nta=@ref nta_index \"nta\"" \
"soa=@ref soa_index \"soa\"" \
"DEF=\def" \
"TAGS=\par Related Tags:" \
"TAG=\par \n" \
"EVENTS=\par Events:\n" \
"RESPONSES=\par Related Response Codes:\n" \
"CFILE=\internal \file" \
"IFILE=\file" \
"HI=\hideinitializer " \
"HIDE=\hideinitializer " \
"SHOW=\showinitializer " \
"LGPL2=\par Lesser GNU Public License Version 2:\n \ref lgpl2\n \if 0\n" \
"ENDLGPL2=\endif \n" \
"GPL2=\par GNU Public License Version 2:\n \ref gpl2\n \if 0\n" \
"ENDGPL2=\endif \n" \
"ERRORS=\par Errors: " \
"ERROR=\par \n \b " \
"NEW_1_12_2=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.2.txt\">1.12.2</a>" \
"VERSION_1_12_2=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.2.txt\">1.12.2</a>" \
"NEW_1_12_4=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.4.txt\">1.12.4</a>" \
"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" \
"VERSION_1_12_6=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>" \
"NEW_1_12_6=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>" \
"EXP_1_12_6=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>, available if --enable-experimental configuration option is given" \
"VERSION_1_12_7=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>" \
"NEW_1_12_7=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>" \
"EXP_1_12_7=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>, available if --enable-experimental configuration option is given" \
"VERSION_1_12_8=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.8.txt\">1.12.8</a>" \
"NEW_1_12_8=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.8.txt\">1.12.8</a>" \
"VERSION_1_12_9=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
"NEW_1_12_9=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
"VERSION_1_12_10=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.10.txt\">1.12.10</a>" \
"NEW_1_12_10=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.10.txt\">1.12.10</a>" \
"VERSION_1_12_11=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.11.txt\">1.12.11</a>" \
"NEW_1_12_11=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.11.txt\">1.12.11</a>" \
"VERSION_UNRELEASED=UNRELEASED" \
"NEW_UNRELEASED=@since Not yet released" \

View File

@ -1,65 +0,0 @@
# Doxyfile 1.0.0 format
#
@INCLUDE = "../../libsofia-sip-ua/docs/Doxyfile.version"
@INCLUDE = "../../libsofia-sip-ua/docs/Doxyfile.aliases"
@INCLUDE = "../../libsofia-sip-ua/docs/Doxyfile.rfc"
OUTPUT_LANGUAGE = English
DETAILS_AT_TOP = YES
OPTIMIZE_OUTPUT_FOR_C = YES
SHOW_USED_FILES = NO
QUIET = YES
WARNINGS = YES
DISABLE_INDEX = NO
HAVE_DOT = YES
CLASS_GRAPH = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = NO
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = NO
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
VERBATIM_HEADERS = YES
HIDE_UNDOC_RELATIONS = YES
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_SCOPE_NAMES = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
JAVADOC_AUTOBRIEF = YES
MAX_INITIALIZER_LINES = 0
ENUM_VALUES_PER_LINE = 1
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
# HTML
GENERATE_HTML = YES
HTML_OUTPUT = .
HTML_ALIGN_MEMBERS = YES
HTML_FOOTER = ../../libsofia-sip-ua/docs/sofia-footer.html
ALLEXTERNALS = NO
EXTERNAL_GROUPS = NO
# LATEX
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = pdflatex
USE_PDFLATEX = YES
PDF_HYPERLINKS = YES
COMPACT_LATEX = YES
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_BATCHMODE = YES
FILE_PATTERNS = *.h *.c
EXCLUDE_PATTERNS = acconfig.h config.h confdefs.h \
test*.h test*.c torture*.c *test.c *torture.c \
*_tag_dll.c *_tag_ref.c

View File

@ -1,34 +0,0 @@
PROJECT_NAME = "libsofia-sip-ua"
OUTPUT_DIRECTORY = ../docs/html
INPUT = @srcdir@/mainpage.docs @srcdir@/docguide.docs @srcdir@/conformance.docs
# release.docs
@INCLUDE_PATH = . @srcdir@
@INCLUDE = ../docs/Doxyfile.conf
@INCLUDE = ../sip/sip.doxyaliases
GENERATE_TAGFILE = docs.doxytags
TAGFILES =
TAGFILES += su.doxytags=su
TAGFILES += ipt.doxytags=ipt
TAGFILES += bnf.doxytags=bnf
TAGFILES += url.doxytags=url
TAGFILES += msg.doxytags=msg
TAGFILES += sip.doxytags=sip
TAGFILES += sresolv.doxytags=sresolv
TAGFILES += stun.doxytags=stun
TAGFILES += tport.doxytags=tport
TAGFILES += nta.doxytags=nta
TAGFILES += iptsec.doxytags=iptsec
TAGFILES += sdp.doxytags=sdp
TAGFILES += soa.doxytags=soa
TAGFILES += nea.doxytags=nea
TAGFILES += nua.doxytags=nua
TAGFILES += features.doxytags=features
EXAMPLE_PATH = @srcdir@/../sip

View File

@ -1,3 +0,0 @@
PROJECT_NUMBER = @VERSION@
IMAGE_PATH = @top_srcdir@/libsofia-sip-ua/docs/pictures

View File

@ -1,50 +0,0 @@
EXTRA_DIST = Doxyfile.aliases Doxyfile.conf \
docguide.docs \
mainpage.docs \
conformance.docs \
ChangeLog \
pictures/SIP_basic_incoming_operation.eps \
pictures/SIP_basic_incoming_operation.gif \
pictures/SIP_basic_incoming_operation.vsd \
pictures/SIP_basic_outgoing_operation.eps \
pictures/SIP_basic_outgoing_operation.gif \
pictures/SIP_basic_outgoing_operation.vsd \
pictures/SIP_incoming_call.eps \
pictures/SIP_incoming_call.gif \
pictures/SIP_incoming_call.vsd \
pictures/SIP_outgoing_call.eps \
pictures/SIP_outgoing_call.gif \
pictures/SIP_outgoing_call.vsd \
pictures/SIP_outgoing_operation_with_auth.eps \
pictures/SIP_outgoing_operation_with_auth.gif \
pictures/SIP_outgoing_operation_with_auth.vsd \
pictures/autotools.eps \
pictures/autotools.gif \
pictures/autotools.vsd \
pictures/nta-receiving-message.eps \
pictures/nta-receiving-message.gif
BUILT_SOURCES = Doxyfile.rfc
# Including Doxyfile.rfc in dist breaks make manpages
Doxyfile.rfc: Makefile.am
$(AWK) 'END { b="\\"; q="\\\""; \
print "# Autogenerated aliases for RFCs "from" .. "to ; \
print "ALIASES += " b; \
for (i=from; i < to; i++) { \
print "RFC"i"=\"<a href="q site i type q">RFC "i"</a>\" "b; \
}}' \
site=http://www.faqs.org/rfcs/rfc type=.html \
from=700 to=5500 \
/dev/null > $@
CLEANFILES = Doxyfile.rfc *.doxytags
distclean-local:
-rm -rf html
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am

File diff suppressed because it is too large Load Diff

View File

@ -1,249 +0,0 @@
/*!
@page docguide Documentation Guidelines
@section doxygen Using Doxygen
Doxygen is a document generation program, used by many C/C++ projects. Its
home page is at <a href="http://www.doxygen.org">http://www.doxygen.org</a>.
The Sofia documentation is written using Doxygen.
Doxygen works by extracting the documentation data both from the actual
C/C++ source code and from the specially formatted comments.
The comments can contain some Javadoc-like
@ref doxycommands "special commands".
In general the the style of the comments and documentation should follow the
<a href="http://java.sun.com/j2se/javadoc/writingdoccomments/">
javadoc style guide</a>.
A Doxygen comment must either contain reference about the entity
it is describing, e.g., command
\@file when describing files:
@verbatim
/**
* @file foo.c
*
* Implementation of foo. The foo takes care of grokking xyzzy.
*
* @author Jaska Jokunen <jaska.jokunen@company.com> \n
*
* @date Created: Wed Oct 20 15:06:51 EEST 2004 jasjoku
*/
@endverbatim
Usually the entity that is documented comes straight after the documentation
comment. For example, documenting a function happens like this:
@anchor orch
@verbatim
/**
* Orches a candometer. If orching candometer is not possible, it
* tries to schadule hearping.
*
* @param[in] k pointer to a candometer
* @param[in] level orching level
* @param[out] return_hearping return value for schaduled hearping
*
* @return
* The function orch() returns the candometer value, or #ERROR upon an error.
* If the returned value is 0, the newly schaduled hearping is returned in
* @a return_hearping.
*/
int orch(cando_t *k, int level, hearping_t *return_hearping)
{
...
}
@endverbatim
@subsection doxyfile Doxyfile and Doxyfile.conf
The doxygen options are specified through a configuration file,
<i>Doxyfile</i>. As a convention, a module-specific Doxyfile includes
a common file libsofia-sip-ua/docs/Doxyfile.conf. This makes it possible
to keep the module-specific Doxyfiles as clean as possible:
@code
PROJECT_NAME = "ipt"
OUTPUT_DIRECTORY = ../docs/ipt
INPUT = ipt.docs .
@INCLUDE = ../Doxyfile.conf
TAGFILES += ../docs/docs/doxytags=../docs
TAGFILES += ../docs/su/doxytags=../su
GENERATE_TAGFILE = ../docs/ipt/doxytags
@endcode
From the file above, you can observe some conventions. The
Doxygen-generated HTML documentation is collected in @b docs
subdirectory at top level. A separate output directory is created for
each submodule under it. Doxytags for the module are generated in the @e
doxytags file in the output directory.
@subsection module_docs Module documentation in \<module\>.docs
Each module contains a documentation file containing at least the module
mainpage called @e \<module\>.docs. There should be the module
boilerplate information, for instance the following example is excerpt
contents of file @e ipt.docs:
@verbatim
/**
@MODULEPAGE "ipt" - Utility Module
@section ipt_meta Module Meta Information
Utility library for IP Telephony applications.
@CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
@STATUS @SofiaSIP Core library
@LICENSE LGPL
@section ipt_overview Overview
This module contain some routines useful for IPT applications, like
- ...
- ...
*/
@endverbatim
@section doxycommands Common Doxygen Commands
In this section we go through the most common Doxygen commands. All
the commands are explained in the manual.
The commands include
- @ref doxystyle "style commands (@@a, @@b, @@c, @@e, @@em, @@p)"
- @ref doxyfuncs "function parameters and return values (@@param, @@return, @@retval)"
@subsection doxystyle Style Commands - @a, @b, @c, @e
The text style can be changed with @@b @b (bold), @@c @c (code), or
@@e @e (italic) commands. Function argument names use style command
@@a.
For example, a sentence "The @b Content-Type header @a ct specifies the @e
media-type of the message body, e.g., @c audio/amr would be AMR-encoded
audio." is produced with commands like
@code
The @b Content-Type header @a ct specifies the @e media-type of
the message body, e.g., @c audio/amr would be AMR-encoded audio.
@endcode
The style commands have synonyms, e.g., @@em and @@e mean same, as
well as @@c and @@p.
@subsection doxyfuncs Function Parameters and Return Values - @param, @return, @retval
Parameters to a function are documented with @@param commands. (See
the @ref orch "orch()" function above.) As a convention, the data flow
direction [in], [out] or [in,out] is indicated in the brackets after the
@@param command keyword.
Return values can be documented in two alternative manners, either
using @@return command (see @ref orch "orch()") or @@retval command. The
latter is used if the function returns a small number of possible
values, e.g., enumeration or success/failure indication.
@verbatim
/**Schadule hearping.
*
* The function schadule() schadules a hearping.
*
* @param[in] h pointer to hearping
*
* @retval 0 hearping was successful
* @retval -1 an error occurred
*/
int schadule(hearping_t *h)
{
...
}
@endverbatim
@subsection doxyexamples Example Blocks - @code, @endcode
An example code fragment can be included using @@code and @@endcode
commands.
@verbatim
/**Destroy a hearping.
*
* The function hearping_destroy() deinitializes a hearping and
* reclaims the memory allocated for it.
*
* @param[in,out] h pointer to pointer to hearping
*
* The function clears the pointer to hearping, so it must be called
* with a pointer to pointer:
* @code
* hearping_destroy(&x->hearping);
* @endcode
*/
void hearping_destroy(hearping_t **h)
{
@endverbatim
@subsection docpar Paragraphs
The command @@par can be used to divide text into paragraphs. The text on
the same line with @@par is used as a subtitle for the paragraph. The
commands @@date, @@note, @@bug, @@todo, @@sa (See Also) and
@@deprecated can be used to add common paragraphs to documentation entries.
@subsection docfiles Documenting Files
In most files there is documentation entry for the file itself. It is
usually at top after the LGPL reference, containing @@file command or alias
@@CFILE/@@IFILE. There are Emacs macros for creating the boilerplate entry.
@subsection docgrouping Grouping Entries
When the structure of the documentation does not follow directory or file
structure, it is possible to use grouping commands @@defgroup and @@ingroup.
The command @@defgroup creates a group, and @@ingroup adds an entry to an
group.
@subsection doclinking Creating Links
Normally, Doxygen creates links to classes (and C structs) when it
encounters the struct/class name. It is also possible to add links to
functions, type names and variables. If the function name is followed by
pair of parenthesis (), Doxygen creates a link to it. If a type name or
variable is prefixed with hash @#, Doxygen creates a link to it.
It is also possible to create links with freely selected link to
documentation entries with @@link and @@endlink commands.
When the link target is a named page, section, or subsection, it is possible
to use the @@ref command.
@subsection doctext Writing Body Text
The main body of the documentation is specified with @@mainpage command. The
contents of the @@mainpage entry become the HTML home page of the
documentation set. In each documentation set generated with Doxygen there
can be only one @@mainpage command. Commands @@section, @@subsection, and
@@subsubsection can be used to structure the body text.
It is also possible to add individual HTML pages to the documentation. It
happens with @@page command. These individual pages are like the home page
added with @@mainpage, they can be accessed with the Related Pages link from
the navigation bar.
@subsection docimages Adding Images
Images are added with @@image command. As the different documentation
formats support different image formats, the @@image has list the image file
name for each supported documentation format. The following example uses
bitmap image for HTML documentation and Encapsulate PostScript for
print documents:
@code
@image html sip-parser.gif
@image latex sip-parser.eps
@endcode
*/

View File

@ -1,741 +0,0 @@
/* -*- text -*- */
/**@mainpage Sofia SIP User Agent Library - sofia-sip-ua
@section Introduction
This document contains automatically generated reference documentation
for Sofia-SIP components. Some introductory material and
pointers to the example code are also included.
For a list of module specific pages, see @ref subdirs
"source tree structure" or direct links to submodules:<br>
<a href="nua/index.html">nua</a>
<a href="su/index.html">su</a>
<a href="features/index.html">features</a>
<a href="soa/index.html">soa</a>
<a href="sdp/index.html">sdp</a>
<a href="nta/index.html">nta</a>
<a href="tport/index.html">tport</a>
<a href="sresolv/index.html">sresolv</a>
<a href="sip/index.html">sip</a>
<a href="msg/index.html">msg</a>
<a href="url/index.html">url</a>
<a href="stun/index.html">stun</a>
<a href="iptsec/index.html">iptsec</a>
<a href="nea/index.html">nea</a>
<a href="nth/index.html">nth</a>
<a href="http/index.html">http</a>
<a href="bnf/index.html">bnf</a>
<a href="ipt/index.html">ipt</a>
@section who Contact Information
You can download latest Sofia SIP from the project
<a href="http://sofia-sip.sf.net">home page</a> at
<a href="sf.net">Sourceforge.net</a>.
Please contact us if you have questions regarding this software:
<ul>
<li>Pekka Pessi <Pekka.Pessi@nokia.com></li>
<li>Kai Vehmanen <Kai.Vehmanen@nokia.com></li>
</ul>
Or post to the Sofia-SIP mailing list:
<ul>
<li>mailto:sofia-sip-devel@lists.sourceforge.net</li>
<li>http://lists.sourceforge.net/lists/listinfo/sofia-sip-devel</li>
</ul>
*/
/**@page building Source Tree Structure
@section subdirs Directory Structure
In libsofia-sip-ua, there are subdirectories for different modules listed
below.
Terminal and high-level libraries used for both signaling and media:
Common runtime library:
- <a href="su/index.html">"su" - sockets, memory management, threads</a>
- <a href="sresolv/index.html">"sresolv" - Asynchronous DNS resolver</a>
- <a href="ipt/index.html">"ipt" - IPT utility library</a>
SIP Signaling:
- <a href="nua/index.html">"nua" - SIP User Agent library</a>
- <a href="nea/index.html">"nea" - SIP Event API</a>
- <a href="iptsec/index.html">"iptsec" -
Digest authentication for HTTP and SIP</a>
- <a href="nta/index.html">"nta" - SIP transaction engine</a>
- <a href="tport/index.html">"tport" - Message transport</a>
- <a href="sip/index.html">"sip" - SIP messages and headers</a>
- <a href="msg/index.html">"msg" - Message handling </a>
- <a href="url/index.html">"url" - URL handling</a>
- <a href="bnf/index.html">"url" - low level parsing</a>
HTTP subsystem:
- <a href="nth/index.html">"nth" - HTTP protocol engine</a>
- <a href="http/index.html">"http" - HTTP messages and headers</a>
SDP processing:
- <a href="soa/index.html">"soa" - SDP Offer/Answer engine for SIP</a>
- <a href="sdp/index.html">"sdp" - SDP parser</a>
Other:
- <a href="stun/index.html">"stun" - STUN library</a>
Features provided by Sofia-SIP library:
- <a href="features/index.html">"features" - Features provided by Sofia SIP</a>
Documentation:
- "docs" - Doxygen reference documentation
*/
/**
@page styleguide C Style Guide
This document gives general guidelines on generic C style and code
formatting within Sofia-SIP. The guidelines include identifier naming
conventions, indenting convention, and tool usage directions.
Please note that C style is always a matter of taste.
@section naming Naming Conventions
Generally, identifiers within each module are prefixed with the name of
that module. For instance, the functions within http parser module @b http
have prefix @c http_. Identifiers composed of multiple words have an
underscore "_" between the words, the words themselves are in lower
case. For instance, http_request_create().
Macros should be in upper case. File names should be in lower case using
underscore as delimiter if needed.
Normal typedefs have suffix @c _t, however, function types have suffix @c
_f. The enum names also sometimes have @c _e, struct names have @c _s and
union names @c _u.
It is recommended that type itself is typedef'ed, not a pointer to the
type. It should be clear from variable declaration if the variable is a
pointer or not.
@code
typedef struct foo_s foo_t;
typedef int f_fun(foo_t *f, char const *s);
@endcode
Struct and union members should have common prefix. For instance,
@code
struct foo_s {
int f_len;
char *f_name;
fun_f *f_fun;
};
@endcode
This prefix makes it easier to find where members are used.
@section formatting Indenting and Formatting code
Indentation in Sofia-SIP C code generally follows the @e K&R style with indent
of 2 characters (so you can use the default "GNU" c-style in Emacs). The
maximum line length should be 80 characters.
For example,
@code
void kluge(int foo)
{
if (foo) {
bar();
}
else {
switch (baz()) {
case a:
eeny();
break;
case b:
meeny();
break;
default:
moe();
break;
}
}
}
@endcode
The default indentation can be achieved with GNU indent with options
@code
-nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci2 -cli0 -cp33 -cs
-d0 -di1 -nfc1 -nfca -hnl -i2 -ip0 -l79 -lp -npcs -nprs -npsl -saf -sai
-saw -nsc -nsob -nss
@endcode
Loops without condition use @c for @c (;;) instead of @c while @c (1).
@code
for (;;) {
foo();
if (bar())
break;
baz();
}
@endcode
There should be whitespace on both sides of infix operators, except
<code>.</code> or <code>-></code>, which require no space, or
<code>,</code> (comma) which requires space only after). There should be
whitespace between a keyword and parenthesis following it, but no
whitespace between an identifier and parenthesis following it. E.g.,
@code
while (i++ < n)
baz();
for (;;) {
x->x_foo();
if (bar())
break;
z.z_baz++;
}
return (13 * i);
@endcode
*/
/**
@page programming Programming Guide
@section porting Writing Portable Code
Most of Sofia-SIP software is written as portable. All core modules are
(or at least should be) written in ANSI C 89 with some ANSI C 99
features. If there are platform specific parts, they are collected to
separate C files and isolated from the rest of the software with a
wrapper interface.
SU module handles abstraction to OS specific functionality such as
memory management, sockets, threads and time functions.
@subsection ansi_99 ANSI C 99 features
The following ANSI C 99 features are to be used in Sofia-SIP software:
- Integer types
- functions va_copy() and snprintf()
The following ANSI C 99 features shall not be used in Sofia-SIP software:
- definition of a variable in the middle of function code.
(so always define your variables in the beginning of the block)
@subsection port_ints Integer Types
As you should know, the length of native storage size depends on hardware,
OS and compiler. This means in practice that the length of int or long is
not necessarily 32 bits. As a consequence, you need to make sure that the
value you intend to store in the int, can actually fit in int on different
platforms. As a rule of thumb, if the integer value can exceed 8 bits, you
should use types that have a defined length.
Nevertheless its OK to use native integer types if you bear in mind
what was said above. The original reason for having only native
data type was performance. The int type is always stored in the
fastest (and usually biggest size) possible.
Never assume anything on the length of the type. Alway use sizeof()
operator to find out the length.
C 99 standard defines the following fixed length data types:
- int64_t
- uint64_t
- int32_t
- uint32_t
- int16_t
- uint16_t
- int8_t
- uint8_t
To use these data types you must include the <sofia-sip/su_types.h> header, which
takes care of including correct file. If @b su includes are not available,
you must include the following code segment to each file where you plan to
use them:
@code
#if HAVE_STDINT_H
#include <stdint.h>
#elif HAVE_INTTYPES_H
#include <inttypes.h>
#else
#error Define HAVE_STDINT_H as 1 if you have <stdint.h>, \
or HAVE_INTTYPES_H if you have <inttypes.h>
#endif
@endcode
@subsection port_byte_sex Byte order
The host byte order on different platforms vary. When you do only
local processing, need not to worry about the byte order. But as
soon as you start writing code that send or receives anything to
the network, you need to start worrying.
If you wish to convert the byte order, it is simply done by calling
one the following functions:
The htonl() function converts the unsigned integer hostlong from
host byte order to network byte order.
The htons() function converts the unsigned short integer hostshort
from host byte order to network byte order.
The ntohl() function converts the unsigned integer netlong from
network byte order to host byte order.
The ntohs() function converts the unsigned short integer netshort
from network byte order to host byte order.
You need to include <netinet/in.h> or <sofia-sip/su.h> to use these functions.
@subsection port_struct Packing structures
By default, compilers usually arrange structures so that they are
quick to access. This means that most fields in the structure start
at the 32 bit boundary. If you need to conserve memory, you may use
structure packing.
To tell the compiler that you only need certain amount of bits to
store a variable, you can use bit-fields. Compiler may or may not
pack the bit-fields.
@code
struct foo {
unsigned bar:5;
unsigned foo:2;
unsigned :0;
int something;
}
@endcode
If compiler decides to pack this structure, this code generates a
structure that has @a bar and @a foo in the first seven bits, and then
@a something beginning from the next 32 bit boundary.
One problem arises when using packed bit-fields: on ARM it is
generally not possible to access a 32 bit field that does not start from
the 32-bit boundary. Hence the example has the :0 padding member in the
structure. Seems handy but beware: initialization of this structure fails
on some ARM gcc compilers. (Ask Kai Vehmanen for details).
A way to force packing of a structure is to use preprocessor
directive @c @#pragma(pack). This directive is compiler specific, so if
you plan to write truly portable code, you cannot use it. We have
used it in some parts of the Sofia-SIP though. Only alternative is to
write functions that fetch the desired bits from a 32 bit field
with bit operations; not very handy and error prone.
The same aligment problem also arises if you cast for example char
buffer to a int32_t. You can only read int32_t from the 32bit boundary
on ARM platform. So be careful.
As a conclusion, when using bit-fields and stucture packing, beware
of the pitfalls. If you don't really need to use them (as in parsing
binary protocols), don't use them.
@section file_organization File and Directory Structure
A Sofia-SIP library module can be defined as a subdirectory under the
libsofia-sip-ua directory hierarchy that contains a file \<modulename\>.docs
(where the \<modulename\> of course referes to the actual name of
the module).
In case you like to start developing a new module, please
contact Sofia-SIP development team so that they can help you to set up
the basic module for you.
An overview of the contents of a module directory:
- file \<modulename\>.docs \n
Main documentation file for the module. See @ref module_docs
for more information
- subdirectory pictures \n
Contains any pictures/images
that are needed by the module documentation. The
file formats to use are GIF (for html pages) and
EPS (for latex). If some program (e.g. MS Visio) is
used to create the pictures, also the original
files must be stored here.\n
(Note that old modules may have "images" subdirectory instead of
"pictures")
- files Makefile.am \n
See section @ref build "dealing with GNU Autotools" below.
- (optionally) source code file(s) of the module and module tests.
The source code file(s) can also be located in subdirectories if necesary.
@section oo_with_c Writing Object-Oriented Code
While C does not provide any special object-oriented features on its own, it
is possible to program in object-oriented way using C, too. Sofia code make
use of many object-oriented features while being written entirely in C.
@subsection oo_hiding Data Hiding
Data hiding is a practice that makes separation between two modules very
clear. Outside code cannot directly access the data within a module, but it
has to use functions provided for that purpose. Data hiding also makes it
easier to define a protocol between two objects - all communication happens
using function calls.
How to implement data hiding in C? Easiest answer is to only declare data
structures in the header files, not to define them. We have a typedef #msg_t
for @link msg_s struct msg_s @endlink in <sofia-sip/msg.h>, but the actual
structure is defined in "msg_internal.h". Programs outside @b msg module
does not have access to the @link msg_s struct msg_s @endlink, but they have
to to access the #msg_t object through method functions provided in
<sofia-sip/msg.h>. The @b msg implementation is also free to change the
internal layout of the structure, only keeping the function interface
unmodified.
@subsection oo_interface Interfaces
Abstract interface is another object-oriented practice used in Sofia. Parser
headers, defined in <sofia-sip/msg_types.h>, is a good example of abstract
interface. The type for message headers, #msg_header_t, is defined using two
C structures @link msg_common_s struct msg_common_s @endlink
(#msg_common_t), and @link msg_hclass_s struct msg_hclass_s @endlink
(#msg_hclass_t).
Abstract interface is achieved using virtual function table in #msg_hclass_t
structure, bit like C++ typically implements abstract classes and virtual
functions. For implemenation of each header, the function table is
initialized with functions responsible for decoding, encoding and
manipulating the header structure. Unlike C++, the class of the object
(#msg_hclass_t) is represented by a real data structure which also contains
header-specific data, like header name.
@dontinclude sip_basic.c
@skipline msg_hclass_t sip_contact_class
@skip {{
@until }};
@subsection oo_derived Inheritance and Derived Objects
Inheritance is a object-oriented practice that has limited use in Sofia.
Most common example of inheritance is use of #su_home_t. Many objects are
derived from #su_home_t, which means that they can use the various
home-based memory management functions from <su_alloc.h>.
In this sence, inheritance means that a pointer to a derived object can be
casted as a pointer to a base object. In other words, the derived object
must have the base object at the beginning of its memory area:
@code
struct derived
{
struct base base[1];
int extra;
char *data;
};
@endcode
There are three alternatives to cast a pointer to derived to a pointer to
base:
@code
struct base *base1 = (struct base *)derived;
struct base *base2 = &derived->base;
struct base *base3 = derived->base;
@endcode
The third alternative works because base was used as a 1-element array.
@subsection oo_templates Templates
There are a few template types implemented as macros in Sofia libraries.
They include hash table, defined in <sofia-sip/htable.h>, which can be used
to define hash tables types and accessor functions for different object, and
red-black tree, defined in <sofia-sip/rbtree.h>.
@section memory Memory Management
The home-based memory management is useful when a lot of memory blocks are
allocated for given task. The allocations are done via the memory home,
which keeps a reference to each allocated memory block. When the memory
home is then freed, it will free all memory blocks to which it has
reference. This simplifies application logic because application code does
not need to keep track of the allocated memory and free every allocated block
separately.
See documentation of <sofia-sip/su_alloc.h> and @ref su_alloc "memory managment tutorial"
for more information of memory management services.
@subsection contextdata Memory management of context data
A typical example of use of a memory home is to have a memory home structure
(#su_home_t) as part of operation context information structure.
@code
/* context info structure */
struct context {
su_home_t ctx_home[1]; /* memory home */
other_t *ctx_other_stuff; /* example of memory areas */
...
};
/* context pointer */
struct context *ctx;
/* Allocate memory for context structure and initialize memory home */
ctx = su_home_clone(NULL, sizeof (struct context));
/* Allocate memory and register it with memory home */
ctx->ctx_other_stuff = su_zalloc(ctx->ctx_home, sizeof(other_t));
... processing and allocating more memory ...
/* Release registered memory areas, home, and context structure */
su_home_zap(ctx->ctx_home);
@endcode
@subsection combining Combining allocations
Another place where home-based memory management makes programmers
life easier is case where a sub-procedure makes multiple memory allocations
and, in case the sub-procedure fails, all the allocations must be released
and, in case the sub-procedure is succesfull, all allocations must be
controlled by upper level memory management.
@code
/* example sub-procedure. top_home is upper-level memory home */
int sub_procedure( su_home_t *top_home, ... )
{
su_home_t temphome[1] = { SU_HOME_INIT(temphome) };
... allocations and other processing ...
/* was processing successfull ? */
if (success) {
/* ok -> move registered allocated memory to upper level memory home */
su_home_move( top_home, temphome );
}
/* destroy temporary memory home (and registered allocations) */
/* Note than in case processing was succesfull the memory */
/* registrations were already moved to upper level home. */
su_home_deinit(temphome);
/* return ok/not-ok */
return success;
}
@endcode
@section testing Testing Your Code
See <sofia-sip/tstdef.h> for example of how to write module tests with macros provided
by Sofia.
Here are some ideas of what you should test:
- "Smoke test" \n
See that the module compiles, links and executes.
- Module API functions should be tested with\n
- valid args
- not valid args
- Aim for 100% line coverage\n
(If there is a line of code that you have not tested, you don't know
if its working.) \n
For selected part of code you should also aim for
100% branch/path coverage.\n
But be anyway reasonable with these because in practise complete
coverage is next to impossible to achive (so 80% is ok in practise).
- Create test to check assumptions and/or tricks used in code.\n
For example if you rely on some compiler feature, create a test that
will fail with a compiler that does not have that feature.
@subsection check Running Module Tests
Automake, which is used to build Sofia SIP, has builtin
support for unit tests. To add an automatically run test to your module,
you just have to add the following few lines to your module's Makefile.am
(of course, you have to write the test programs, too):
@code
TESTS = test_foo test_bar
check_PROGRAMS = test_foo test_bar
test_foo_SOURCES = foo.c foo.h
test_foo_LDADD = -L. -lmy
test_bar_SOURCES = bar.c bar.h
test_foo_LDADD = -L. -lmy
@endcode
Each test program should either return zero for success or a non-zero
error code in its main function. Now when you run "make check",
@b my_test_foo and @b my_test_bar will be built and then run.
Make will print a
summary of how the tests went. As these tests are run from the build
system, the tests must be non-interactive (no questions asked) and not
rely on any files that are not in version control system.
Sofia SIP's top-level makefile contains a recursive check target, so
you can use "cd sofia-sip ; make check" to run all the existing tests
with a single command.
@section build Dealing with GNU Autotools
Sofia-SIP build system is based on the GNU tools automake, autoconf and
libtool. This toolset has become the de-facto way of building Linux
software. Because of this there is a lot of publicly available documentation
about these tools, and of course, lots and lots of examples.
A good introduction to these tools is available at
<a href="http://developer.gnome.org/doc/books/WGA/generating-makefiles.html">
developer.gnome.org</a>. <a href="http://sources.redhat.com/autobook">Autobook</a>
provides more detailed documentation for autoconf and automake.
The <a href="http://www.gnu.org/manual/make/">GNU make manual</a>
is also a good source of information.
@subsection autogen_sh autogen.sh
At top-level there is a shell script called @b autogen.sh. It calls a
convenient tool called @b autoreconf which will generate configure script
for you. It also fixes the mode bits: the mode bits are not stored in
<a href="http://darcs.net">darcs</a> version control system.
@code
$ sh autogen.sh
$ ./configure ... with your configure options ...
@endcode
@subsection configure_ac configure.ac
The @b configure.ac file (older autoconf versions used also @b configure.in)
contains the primary configuration for autoconf. configure.ac contains
checks for all external libraries, non-standard language and compiler
features that are needed to build the target module.
This file is created by the developer of the module.
@subsection sofia_m4 m4 files
Sofia-SIP's own autoconf macros are stored in the top-level direcry called @b
m4. These macros, along with all other macros used by @b configure.ac, are
copied into the module-specific @b aclocal.m4 file by an utility called
aclocal.
Contact Sofia-SIP development team, if you need changes to these files.
@subsection aclocal_m4 aclocal.m4
The aclocal.m4 contains the definitions of the autoconf macros used in
@b configure.ac.
This file is generated by aclocal command.
@subsection Makefile_am Makefile.am
Makefile.am is where you define what programs and libraries should
be built, and also what source files are needed to create them.
When you run automake, it creates the file Makefile.in.
This file is created by the developer of the module.
@subsection configure configure
When you run configure script, it performs all the checks defined in
@b configure.ac and then replaces all @b xxx.in files with equivalent
@b xxx files. All @c @@FOO@@ variables in the source @b *.in files are
replaced with values found during the configuration process. For instance
the variable @c @@srcdir@@ in @b Makefile.in is replaced in @b Makefile
with the source directory path (useful when compiling outside the main
source tree).
This file is generated by autoconf command.
@subsection config_status config.status
This script stores the last parameters given to configre command.
If necessary you can rerun the last given configure script (with given
parameters) by using command "./config.status -r" or
"./config.status --recheck".
This file is generated by configure script.
@subsection config_cache config.cache
This file contains results of the various checks that configure script
performed. In case the configure script failed, you might try to
delete this file and run the configure script again.
This file is generated by configure script.
@subsection Makefile Makefile
The @b Makefile contains the actual rules how to build the target
libraries and program. It is used by the @c make program. @b Makefile
is generated from @b Makefile.in when you run @c autoconf command.
Ensure that "make dist" and "make install" targets work.
This file is generated by config.status and configure scripts.
@subsection config_h config.h
This file contains C language defines of various confurable issues.
This file is generated by config.status and configure script.
@subsection sofia_sip_configure_h sofia-sip/su_configure.h
This file contains C language defines describing how the Sofia SIP UA
library is configured.
This file is generated by config.status and configure script.
*/
/**
@page debug_logs Debugging Logs
The Sofia-SIP components can output various debugging information. The
detail of the debugging output is determined by the debugging level. The
level is usually module-specific and it can be modified by module-specific
environment variable. There is also a default level for all modules,
controlled by environment variable #SOFIA_DEBUG.
The environment variables controlling the logging and other debug output are
as follows:
- #SOFIA_DEBUG Default debug level (0..9)
- #NUA_DEBUG User Agent engine (<a href="nua/index.html">nua</a>) debug level (0..9)
- #SOA_DEBUG SDP Offer/Answer engine (<a href="soa/index.html">soa</a>) debug level (0..9)
- #NEA_DEBUG Event engine (<a href="nea/index.html">nea</a>) debug level (0..9)
- #IPTSEC_DEBUG HTTP/SIP autentication module debug level (0..9)
- #NTA_DEBUG Transaction engine debug level (0..9)
- #TPORT_DEBUG Transport event debug level (0..9)
- #TPORT_LOG If set, print out all parsed SIP messages on transport layer
- #TPORT_DUMP Filename for dumping unparsed messages from transport
- #SU_DEBUG <a href="nea/index.html">su</a> module debug level (0..9)
The defined debug output levels are:
- 0 SU_DEBUG_0() - fatal errors, panic
- 1 SU_DEBUG_1() - critical errors, minimal progress at subsystem level
- 2 SU_DEBUG_2() - non-critical errors
- 3 SU_DEBUG_3() - warnings, progress messages
- 5 SU_DEBUG_5() - signaling protocol actions (incoming packets, ...)
- 7 SU_DEBUG_7() - media protocol actions (incoming packets, ...)
- 9 SU_DEBUG_9() - entering/exiting functions, very verbatim progress
In addition to the macros mentioned above, there is also functions for
printing logging messages:
- su_llog(), su_vllog()
- su_perror(), su_perror2()
The log level can be set (to a level defined in a configuration file, for
instance) with following functions
- su_log_set_level(), su_log_soft_set_level()
The log output can be redirected to, e.g., system log or loggin server, with
su_log_redirect().
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -1,4 +0,0 @@
<hr />
Sofia-SIP @VERSION@ -
Copyright (C) 2006 Nokia Corporation. All rights reserved.
Licensed under the terms of the GNU Lesser General Public License.

View File

@ -1,32 +0,0 @@
2005-10-27 Pekka Pessi <Pekka.Pessi@nokia.com>
* Fixed features.
Added libfeatures.la into .so. Renamed sofia_has_* as sofia_sip_has_*. Using
features in nua_cli.c
M ./libsofia-sip-ua/Makefile.am +1
M ./libsofia-sip-ua/features/Makefile.am -2 +2
M ./libsofia-sip-ua/features/sofia_sip_features.c -14 +14
M ./libsofia-sip-ua/features/sofia_sip_features.docs -10 +10
M ./libsofia-sip-ua/features/sofia_sip_features.h.in -10 +10
M ./libsofia-sip-ua/stun/stun.c -2 +2
M ./utils/Makefile.am -1 +2
M ./utils/nua_cli.c -2 +29
* Added "features" module.
./libsofia-sip-ua/nua/sofia_config.c -> ./libsofia-sip-ua/sofia/sofia_sip_features.c
./libsofia-sip-ua/nua/sofia_config.h.in -> ./libsofia-sip-ua/sofia/sofia_sip_features.h.in
./libsofia-sip-ua/sofia -> ./libsofia-sip-ua/features
M ./configure.ac -2 +3
M ./libsofia-sip-ua/Makefile.am -1 +1
A ./libsofia-sip-ua/features/Doxyfile
A ./libsofia-sip-ua/features/Makefile.am
M ./libsofia-sip-ua/features/sofia_sip_features.c -21 +78
A ./libsofia-sip-ua/features/sofia_sip_features.docs
M ./libsofia-sip-ua/features/sofia_sip_features.h.in -15 +20
M ./libsofia-sip-ua/nua/Makefile.am -4 +3
A ./libsofia-sip-ua/sofia/
M ./libsofia-sip-ua/stun/stun.c -1 +6
M ./libsofia-sip-ua/stun/stun.h +2

View File

@ -1,23 +0,0 @@
PROJECT_NAME = "features"
OUTPUT_DIRECTORY = ../docs/html/features
INPUT = @srcdir@/features.docs @srcdir@/sofia-sip sofia-sip @srcdir@ .
@INCLUDE_PATH = . @srcdir@
@INCLUDE = ../docs/Doxyfile.conf
TAGFILES += ../docs/docs.doxytags=..
TAGFILES += ../docs/su.doxytags=../su
TAGFILES += ../docs/ipt.doxytags=../ipt
TAGFILES += ../docs/bnf.doxytags=../bnf
TAGFILES += ../docs/url.doxytags=../url
TAGFILES += ../docs/msg.doxytags=../msg
TAGFILES += ../docs/sip.doxytags=../sip
TAGFILES += ../docs/sresolv.doxytags=../sresolv
TAGFILES += ../docs/tport.doxytags=../tport
TAGFILES += ../docs/nta.doxytags=../nta
TAGFILES += ../docs/sdp.doxytags=../sdp
GENERATE_TAGFILE = ../docs/features.doxytags
ALIASES +=

View File

@ -1,35 +0,0 @@
#
# Makefile.am for sofia features module
#
# Copyright (C) 2005,2006 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
# ----------------------------------------------------------------------
# Header paths
AM_CPPFLAGS = $(INTERNAL_INCLUDES)
# ----------------------------------------------------------------------
# Build targets
noinst_LTLIBRARIES = libfeatures.la
# ----------------------------------------------------------------------
# Rules for building the targets
# This is used by platforms not supporting autoconf
nobase_include_sofia_HEADERS = sofia-sip/sofia_features.h
libfeatures_la_SOURCES = features.c
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = features.docs
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am

View File

@ -1,138 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
/**@CFILE features.c
* Provide features available through the sofia-sip library.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Mon Oct 24 14:51:32 2005 ppessi
*/
#include "config.h"
#include <stddef.h>
#include <sofia-sip/su_configure.h>
#include "tport_tls.h"
#include "sofia-sip/sofia_features.h"
/** The name and version of software package providing Sofia-SIP-UA library.
* @showinitializer
*/
char const * const sofia_sip_name_version = SOFIA_SIP_NAME_VERSION;
/** The name and version of software package providing S/MIME functionality,
* NULL if none.
*/
char const * sofia_sip_has_smime;
/** The name and version of software package providing TLS functionality,
* NULL if none.
*
* TLS over TCP is used as transport for SIP messages when using SIPS
* scheme. Using TLS over TCP with SIP is described in @RFC3261.
*/
#if HAVE_OPENSSL
char const * sofia_sip_has_tls = tls_version;
#else
char const * sofia_sip_has_tls;
#endif
/** The name and version of software package providing DTLS functionality,
* NULL if none.
*
* DTLS or TLS over datagram transport (UDP) can be used as transport for
* SIP messages.
*/
char const * sofia_sip_has_dtls;
/** The name and version of software package providing TLS over SCTP functionality,
* NULL if none.
*
* TLS over SCTP can be used as transport for SIP messages.
*/
char const * sofia_sip_has_tls_sctp;
#if HAVE_SOFIA_SIGCOMP
#include <sigcomp.h>
#endif
/** The name and version of software package providing SigComp functionality,
* NULL if none.
*
* SigComp can be used to compress SIP messages.
*/
#if HAVE_SOFIA_SIGCOMP
char const * sofia_sip_has_sigcomp = sigcomp_package_version;
#else
char const * sofia_sip_has_sigcomp;
#endif
/** The name and version of software package providing STUN functionality,
* NULL if none.
*
* STUN is a protocol used to traverse NATs with UDP.
*/
#if HAVE_SOFIA_STUN
extern char const stun_version[];
char const * sofia_sip_has_stun = stun_version;
#else
char const * sofia_sip_has_stun;
#endif
/** The name and version of software package providing TURN functionality,
* NULL if none.
*
* TURN is a protocol used to traverse NATs or firewalls with TCP or UDP.
*/
char const * sofia_sip_has_turn;
/** The name and version of software package providing UPnP functionality,
* NULL if none.
*
* UPnP (Universal Plug and Play) can be used to traverse NATs or firewalls.
*/
char const * sofia_sip_has_upnp;
/** The name and version of software package providing SCTP functionality,
* NULL if none.
*
* SCTP can be used as transport for SIP messages. The software providing it
* can be, for example, LKSCTP (Linux kernel SCTP) for Linux.
*/
char const * sofia_sip_has_sctp;
/* We don't have viable SCTP transport interface */
/** The name and version of software package providing IPv6 functionality,
* NULL if none.
*
* IPv6 can be used to send SIP messages.
*/
#if SU_HAVE_IN6
char const * sofia_sip_has_ipv6 = "IPv6";
#else
char const * sofia_sip_has_ipv6;
#endif

View File

@ -1,41 +0,0 @@
/* -*- text -*- */
/**@MODULEPAGE "features" Module
@section features_meta Module Meta Information
The @b features module provides application information about the various
features possibly available through the @ref subdirs "sofia-sip-ua" binary API.
@CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
@STATUS @SofiaSIP Core library
@LICENSE LGPL
@par Contributor(s):
- Pekka Pessi <Pekka.Pessi@nokia.com>
@section features_overview Overview
The #sofia_sip_name_version contains the name and release of currently
installed @a libsofia-sip-ua.so library. The macro #SOFIA_SIP_NAME_VERSION
contains the name and release of currently available include files.
The Sofia SIP binary API hides some protocols used under the SIP stack.
While the binary API stays the same, the features are not necessarily there.
These features are mainly related to encryption, compression and underlying
transports.
- #sofia_sip_has_smime
- #sofia_sip_has_tls
- #sofia_sip_has_dtls
- #sofia_sip_has_tls_sctp
- #sofia_sip_has_sigcomp
- #sofia_sip_has_stun
- #sofia_sip_has_turn
- #sofia_sip_has_upnp
- #sofia_sip_has_sctp
- #sofia_sip_has_ipv6
*/

View File

@ -1,67 +0,0 @@
/* This -*- C -*- file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
/* @configure_input@ */
/**@file sofia-sip/sofia_features.h
* @brief Sofia-SIP Library Features
*
* Macros and string constants listing features supported or not supported
* by sofia-sip-ua library.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Wed Feb 14 17:09:44 2001 ppessi
*/
#ifndef SOFIA_SIP_FEATURES_H
/** Defined when <sofia-sip/sofia_features.h> has been included. */
#define SOFIA_SIP_FEATURES_H
/** Current Sofia version. @showinitializer */
#define SOFIA_SIP_VERSION "@PACKAGE_VERSION@"
/** Current Sofia package name and version. @showinitializer */
#define SOFIA_SIP_NAME_VERSION "@PACKAGE_NAME@-@PACKAGE_VERSION@"
#ifdef __cplusplus
extern "C" {
#endif
SOFIAPUBVAR char const * const sofia_sip_name_version;
SOFIAPUBVAR char const * sofia_sip_has_smime;
SOFIAPUBVAR char const * sofia_sip_has_tls;
SOFIAPUBVAR char const * sofia_sip_has_dtls;
SOFIAPUBVAR char const * sofia_sip_has_tls_sctp;
SOFIAPUBVAR char const * sofia_sip_has_sigcomp;
SOFIAPUBVAR char const * sofia_sip_has_stun;
SOFIAPUBVAR char const * sofia_sip_has_turn;
SOFIAPUBVAR char const * sofia_sip_has_upnp;
SOFIAPUBVAR char const * sofia_sip_has_sctp;
SOFIAPUBVAR char const * sofia_sip_has_ipv6;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,7 +0,0 @@
2005-11-08 Pekka Pessi <Pekka.Pessi@nokia.com>
* Renamed http_test.c as test_http.c
2005-07-18 Kai Vehmanen <kai.vehmanen@nokia.com>
* Initial import of the module to Sofia-SIP tree.

View File

@ -1,19 +0,0 @@
PROJECT_NAME = "http"
OUTPUT_DIRECTORY = ../docs/html/http
INPUT = @srcdir@/http.docs @srcdir@/sofia-sip sofia-sip @srcdir@ .
@INCLUDE_PATH = . @srcdir@
@INCLUDE = ../docs/Doxyfile.conf
TAGFILES += \
../docs/su.doxytags=../su \
../docs/ipt.doxytags=../ipt \
../docs/bnf.doxytags=../bnf \
../docs/url.doxytags=../url \
../docs/msg.doxytags=../msg
GENERATE_TAGFILE = ../docs/http.doxytags
ALIASES += \
"HTTP_HEADER=@ingroup http_headers\n@defgroup" \

View File

@ -1,93 +0,0 @@
#
# Makefile.am for http module
#
# Copyright (C) 2005,2006 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
# ----------------------------------------------------------------------
# Header paths
AM_CPPFLAGS = -I$(srcdir)/../bnf -I../bnf \
-I$(srcdir)/../msg -I../msg \
-I$(srcdir)/../url -I../url \
-I$(srcdir)/../su -I../su -I../su
# ----------------------------------------------------------------------
# Build targets
noinst_LTLIBRARIES = libhttp.la
check_PROGRAMS = test_http
TESTS = test_http
# ----------------------------------------------------------------------
# Rules for building the targets
PUBLIC_H = sofia-sip/http.h sofia-sip/http_header.h \
sofia-sip/http_parser.h sofia-sip/http_tag_class.h \
sofia-sip/http_status.h sofia-sip/http_hclasses.h
BUILT_H = sofia-sip/http_protos.h sofia-sip/http_tag.h
BUILT_C = http_tag.c http_parser_table.c
BUILT_SOURCES = $(BUILT_H) $(BUILT_C) http_tag_ref.c
nobase_include_sofia_HEADERS = $(BUILT_H) $(PUBLIC_H)
libhttp_la_SOURCES = $(INTERNAL_H) \
http_parser.c http_header.c \
http_basic.c http_extra.c http_inlined.c \
http_status.c http_tag_class.c \
$(BUILT_SOURCES)
COVERAGE_INPUT = $(libhttp_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libhttp.la \
../bnf/libbnf.la \
../msg/libmsg.la \
../url/liburl.la \
../ipt/libipt.la \
../su/libsu.la
test_http_LDFLAGS = -static
# ----------------------------------------------------------------------
# Install and distribution rules
EXTRA_DIST = http.docs \
sofia-sip/http_protos.h.in \
sofia-sip/http_tag.h.in \
http_parser_table.c.in \
http_tag.c.in
# ----------------------------------------------------------------------
# Sofia specific rules
include $(top_srcdir)/rules/sofia.am
TAG_DLL_FLAGS = DLLREF=1
MSG_PARSER_AWK = ${srcdir}/../msg/msg_parser.awk
AWK_HTTP_AWK = LC_ALL=C ${AWK} -f ${MSG_PARSER_AWK} module=http
SS_HTTP_H = ${srcdir}/sofia-sip/http.h
${BUILT_H} ${BUILT_C}: ${srcdir}/sofia-sip/http.h ${MSG_PARSER_AWK}
sofia-sip/http_protos.h: ${srcdir}/sofia-sip/http_protos.h.in
@-mkdir sofia-sip 2>/dev/null || true
${AWK_HTTP_AWK} PR=$@ TEMPLATE=${srcdir}/sofia-sip/http_protos.h.in ${SS_HTTP_H}
sofia-sip/http_tag.h: ${srcdir}/sofia-sip/http_tag.h.in
@-mkdir sofia-sip 2>/dev/null || true
${AWK_HTTP_AWK} PR=$@ TEMPLATE=${srcdir}/sofia-sip/http_tag.h.in ${SS_HTTP_H}
http_tag.c: ${srcdir}/http_tag.c.in
${AWK_HTTP_AWK} PR=$@ TEMPLATE=${srcdir}/http_tag.c.in ${SS_HTTP_H}
http_parser_table.c: ${srcdir}/http_parser_table.c.in
${AWK_HTTP_AWK} PT=$@ TEMPLATE=${srcdir}/http_parser_table.c.in \
MC_HASH_SIZE=127 ${SS_HTTP_H}

View File

@ -1,48 +0,0 @@
accept Accept
accept_charset Accept-Charset
accept_encoding Accept-Encoding
accept_language Accept-Language
accept_ranges Accept-Ranges
age Age
allow Allow
authorization Authorization
cache_control Cache-Control
connection Connection
content_encoding Content-Encoding
content_language Content-Language
content_length Content-Length
content_location Content-Location
content_md5 Content-MD5
content_range Content-Range
content_type Content-Type
date Date
etag ETag
expect Expect
expires Expires
from From
host Host
if_match If-Match
if_modified_since If-Modified-Since
if_none_match If-None-Match
if_range If-Range
if_unmodified_since If-Unmodified-Since
last_modified Last-Modified
location Location
max_forwards Max-Forwards
mime_version MIME-Version
pragma Pragma
pr_authenticate Proxy-Authenticate
pr_authorization Proxy-Authorization
range Range
referer Referer
retry_after Retry-After
server Server
te TE
trailer Trailer
transfer_encoding Transfer-Encoding
upgrade Upgrade
user_agent User-Agent
vary Vary
via Via
warning Warning
www_authenticate WWW-Authenticate

View File

@ -1,17 +0,0 @@
; Template for http.def
LIBRARY "http"
DESCRIPTION 'HTTP Win32 Dynamic Link Library'
EXPORTS
; Explicit exports can go here
http_default_mclass
sip_#xxxxxx#_class
sip_#xxxxxx#_p
sip_#xxxxxx#_dup
sip_#xxxxxx#_copy
sip_#xxxxxx#_make

View File

@ -1,40 +0,0 @@
/* -*- c -*- */
/**@MODULEPAGE "http" - HTTP Parser Module
*
* @section http_meta Module Meta Information
*
* The @b http module contains interface to the HTTP parser and the header
* and message objects.
*
* @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @STATUS @SofiaSIP Core library
*
* @LICENSE LGPL
*
* @section http_overview Overview
*
* Each HTTP header has a structure defined for it in <sofia-sip/http.h>. All the
* variables, objects and functions related to a particular HTTP header are
* documented in a <a href="modules.html">submodule</a> for the header. In
* addition to the header structure, there is defined a @em header @em class
* structure and some standard functions for each header in the
* <sofia-sip/http_header.h> include file. For header @c X, there are types,
* functions, macros and header class as follows:
*
* - @c http_X_t is the structure used to store parsed header,
* - @c HTTP_X_INIT() initializes a static instance of http_X_t,
* - @c http_X_p() tests if header object is instance of header X,
* - @c http_X_make() is a macro that creates a header X object by
decoding given string,
* - @c http_X_dup() duplicates (deeply copies) the header X (macro),
* - @c http_X_copy() is a macro that copies the header X (macro),
* - @c #msg_hclass_t http_X_class[] contains the @em header @em class
* for header X.
*
* In addition to this interface, the parser provider interface is
* documented in the <a href="../sip/group__sip__parser.html">SIP Parser module</a>.
* The parser provider interface makes it possible to extend HTTP parser with
* new headers or extend existing ones.
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,471 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
/**@CFILE http_extra.c
*
* Extra HTTP headers
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Tue Jun 13 02:57:51 2000 ppessi
*/
#include "config.h"
#include <sofia-sip/su_string.h>
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
#define MSG_PUB_T struct http_s
#define MSG_HDR_T union http_header_u
#include "sofia-sip/http_parser.h"
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
/* ========================================================================== */
/**@HTTP_HEADER http_proxy_connection Proxy-Connection extension header. */
#define http_proxy_connection_d msg_list_d
#define http_proxy_connection_e msg_list_e
msg_hclass_t http_proxy_connection_class[] =
HTTP_HEADER_CLASS_LIST(proxy_connection, "Proxy-Connection", list);
/* ====================================================================== */
/**@HTTP_HEADER http_cookie Cookie extension header.
*
* The Cookie header is used to transmit state information from server
* back to the http client. Its syntax is defined in RFC 2109 section 4.3.4
* as follows:
*
* @code
* cookie = "Cookie:" cookie-version
* 1*((";" | ",") cookie-value)
* cookie-value = NAME "=" VALUE [";" path] [";" domain]
* cookie-version = "$Version" "=" value
* NAME = attr
* VALUE = value
* path = "$Path" "=" value
* domain = "$Domain" "=" value
* @endcode
*
*/
/**@ingroup http_cookie
*
* @typedef typedef struct http_cookie_s http_cookie_t;
*
* The structure http_cookie_t contains representation of @b Cookie
* header. Please note that a single http_cookie_t can contain many
* cookies.
*
* The http_cookie_t is defined as follows:
* @code
* typedef struct http_cookie_s
* {
* } http_cookie_t;
* @endcode
*/
/**Update Cookie parameters.
*
* The function http_cookie_update() updates a @b Cookie parameter
* shortcuts.
*
* @param sc pointer to a @c http_cookie_t object
*/
su_inline
void http_cookie_update(http_cookie_t *c)
{
size_t i;
c->c_name = NULL;
c->c_version = NULL, c->c_domain = NULL, c->c_path = NULL;
if (!c->c_params)
return;
if (!(MSG_PARAM_MATCH(c->c_version, c->c_params[0], "$Version")))
return;
if (!c->c_params[1] || c->c_params[1][0] == '$')
return;
c->c_name = c->c_params[1];
for (i = 2; ; i++) {
msg_param_t p = c->c_params[i];
if (!p || *p++ != '$')
break;
switch (p[0]) {
case 'd': case 'D':
MSG_PARAM_MATCH(c->c_domain, p, "Domain");
break;
case 'p': case 'P':
MSG_PARAM_MATCH(c->c_path, p, "Path");
break;
}
}
}
/* Scan a cookie parameter */
static issize_t cookie_scanner(char *s)
{
char *p = s;
size_t tlen;
skip_token(&s);
if (s == p) /* invalid parameter name */
return -1;
tlen = s - p;
if (IS_LWS(*s)) { *s++ = '\0'; skip_lws(&s); }
if (*s == '=') {
char *v;
s++;
skip_lws(&s);
v = s;
/* get value */
if (*s == '"') {
size_t qlen = span_quoted(s);
if (!qlen)
return -1;
s += qlen;
}
else {
s += strcspn(s, ",;" LWS);
if (s == v)
return -1;
}
if (p + tlen + 1 != v) {
memmove(p + tlen + 1, v, s - v);
p[tlen] = '=';
p[tlen + 1 + (s - v)] = '\0';
}
}
if (IS_LWS(*s)) { *s++ = '\0'; skip_lws(&s); }
return s - p;
}
/** Decode (parse) a Cookie header */
issize_t http_cookie_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
{
http_cookie_t *c = (http_cookie_t *)h;
assert(h); assert(sizeof(*h));
for (;*s;) {
/* Ignore empty entries (comma-whitespace) */
if (*s == ',') { *s++ = '\0'; skip_lws(&s); continue; }
if (msg_any_list_d(home, &s, (msg_param_t **)&c->c_params,
cookie_scanner, ';') == -1)
return -1;
if (*s != '\0' && *s != ',')
return -1;
if (!c->c_params)
return -1;
}
http_cookie_update(c);
return 0;
}
/** Encode (print) a Cookie header */
issize_t http_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
{
char *b0 = b, *end = b + bsiz;
http_cookie_t const *c = (http_cookie_t *)h;
size_t i;
if (c->c_params) {
for (i = 0; c->c_params[i]; i++) {
if (i > 0) MSG_CHAR_E(b, end, ';');
MSG_STRING_E(b, end, c->c_params[i]);
}
}
MSG_TERM_E(b, end);
return b - b0;
}
/** Calculate extra storage used by Cookie header field */
isize_t http_cookie_dup_xtra(msg_header_t const *h, isize_t offset)
{
http_cookie_t const *c = (http_cookie_t *)h;
MSG_PARAMS_SIZE(offset, c->c_params);
return offset;
}
/** Duplicate a Cookie header field */
char *http_cookie_dup_one(msg_header_t *dst, msg_header_t const *src,
char *b, isize_t xtra)
{
http_cookie_t *c = (http_cookie_t *)dst;
http_cookie_t const *o = (http_cookie_t const *)src;
char *end = b + xtra;
b = msg_params_dup(&c->c_params, o->c_params, b, xtra);
http_cookie_update(c);
assert(b <= end); (void)end;
return b;
}
msg_hclass_t http_cookie_class[] =
HTTP_HEADER_CLASS(cookie, "Cookie", c_params, append, cookie);
/* ====================================================================== */
/**@HTTP_HEADER http_set_cookie Set-Cookie extension header.
*
* The Set-Cookie header is used to transmit state information from server
* back to the http client. Its syntax is defined in RFC 2109 section 4.2.2
* as follows:
*
* @code
* set-cookie = "Set-Cookie:" cookies
* cookies = 1#cookie
* cookie = NAME "=" VALUE *(";" cookie-av)
* NAME = attr
* VALUE = value
* cookie-av = "Comment" "=" value
* | "Domain" "=" value
* | "Max-Age" "=" value
* | "Path" "=" value
* | "Secure"
* | "Version" "=" 1*DIGIT
*
* @endcode
*
*/
/**@ingroup http_set_cookie
*
* @typedef typedef struct http_set_cookie_s http_set_cookie_t;
*
* The structure http_set_cookie_t contains representation of @b Set-Cookie
* header.
*
* The http_set_cookie_t is defined as follows:
* @code
* typedef struct http_set_cookie_s
* {
* } http_set_cookie_t;
* @endcode
*/
/**Update Set-Cookie parameters.
*
* The function http_set_cookie_update() updates a @b Set-Cookie parameter
* shortcuts.
*
* @param sc pointer to a @c http_set_cookie_t object
*/
su_inline
void http_set_cookie_update(http_set_cookie_t *sc)
{
size_t i;
sc->sc_name = NULL;
sc->sc_version = NULL, sc->sc_domain = NULL, sc->sc_path = NULL;
sc->sc_comment = NULL, sc->sc_max_age = NULL, sc->sc_secure = 0;
if (!sc->sc_params)
return;
sc->sc_name = sc->sc_params[0];
for (i = 1; sc->sc_params[i]; i++) {
msg_param_t p = sc->sc_params[i];
switch (p[0]) {
case 'c': case 'C':
MSG_PARAM_MATCH(sc->sc_comment, p, "Comment");
break;
case 'd': case 'D':
MSG_PARAM_MATCH(sc->sc_domain, p, "Domain");
break;
case 'm': case 'M':
MSG_PARAM_MATCH(sc->sc_max_age, p, "Max-Age");
break;
case 'p': case 'P':
MSG_PARAM_MATCH(sc->sc_path, p, "Path");
break;
case 's': case 'S':
MSG_PARAM_MATCH_P(sc->sc_secure, p, "Secure");
break;
case 'v': case 'V':
MSG_PARAM_MATCH(sc->sc_version, p, "Version");
break;
}
}
}
#include <sofia-sip/msg_date.h>
/* Scan a cookie parameter */
static issize_t set_cookie_scanner(char *s)
{
char *rest;
#define LOOKING_AT(s, what) \
(su_casenmatch((s), what, strlen(what)) && (rest = s + strlen(what)))
/* Special cases from Netscape spec */
if (LOOKING_AT(s, "expires=")) {
msg_time_t value;
msg_date_d((char const **)&rest, &value);
} else if (LOOKING_AT(s, "path=/")) {
for (;;) {
rest += span_unreserved(rest);
if (*rest != '/')
break;
rest++;
}
} else {
return msg_attribute_value_scanner(s);
}
#undef LOOKING_AT
if (IS_LWS(*rest)) {
*rest++ = '\0'; skip_lws(&rest);
}
return rest - s;
}
/** Decode (parse) Set-Cookie header */
issize_t http_set_cookie_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
{
msg_header_t **hh = &h->sh_succ, *h0 = h;
http_set_cookie_t *sc = (http_set_cookie_t *)h;
msg_param_t *params;
assert(h); assert(sizeof(*h));
for (;*s;) {
/* Ignore empty entries (comma-whitespace) */
if (*s == ',') { *s++ = '\0'; skip_lws(&s); continue; }
if (!h) { /* Allocate next header structure */
if (!(h = msg_header_alloc(home, h0->sh_class, 0)))
return -1;
*hh = h; h->sh_prev = hh; hh = &h->sh_succ;
sc = sc->sc_next = (http_set_cookie_t *)h;
}
/* "Set-Cookie:" 1#(NAME "=" VALUE *(";" cookie-av))) */
params = su_zalloc(home, MSG_PARAMS_NUM(1) * sizeof(msg_param_t));
if (!params)
return -1;
params[0] = s, sc->sc_params = params;
s += strcspn(s, ",;" LWS);
if (*s) {
*s++ = '\0';
skip_lws(&s);
if (*s && msg_any_list_d(home, &s, (msg_param_t **)&sc->sc_params,
set_cookie_scanner, ';') == -1)
return -1;
}
if (*s != '\0' && *s != ',')
return -1;
if (sc->sc_params)
http_set_cookie_update(sc);
h = NULL;
}
return 0;
}
/** Encode (print) Set-Cookie header */
issize_t http_set_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
{
char *b0 = b, *end = b + bsiz;
http_set_cookie_t const *sc = (http_set_cookie_t *)h;
size_t i;
if (sc->sc_params) {
for (i = 0; sc->sc_params[i]; i++) {
if (i > 0) MSG_CHAR_E(b, end, ';');
MSG_STRING_E(b, end, sc->sc_params[i]);
}
}
MSG_TERM_E(b, end);
return b - b0;
}
/** Calculate extra storage used by Set-Cookie header field */
isize_t http_set_cookie_dup_xtra(msg_header_t const *h, isize_t offset)
{
http_set_cookie_t const *sc = (http_set_cookie_t *)h;
MSG_PARAMS_SIZE(offset, sc->sc_params);
return offset;
}
/** Duplicate a Set-Cookie header field */
char *http_set_cookie_dup_one(msg_header_t *dst, msg_header_t const *src,
char *b, isize_t xtra)
{
http_set_cookie_t *sc = (http_set_cookie_t *)dst;
http_set_cookie_t const *o = (http_set_cookie_t const *)src;
char *end = b + xtra;
b = msg_params_dup(&sc->sc_params, o->sc_params, b, xtra);
http_set_cookie_update(sc);
assert(b <= end); (void)end;
return b;
}
msg_hclass_t http_set_cookie_class[] =
HTTP_HEADER_CLASS(set_cookie, "Set-Cookie", sc_params, append, set_cookie);

View File

@ -1,307 +0,0 @@
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
/**@CFILE http_header.c
*
* HTTP header handling.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Tue Jun 13 02:57:51 2000 ppessi
*/
#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
#include <stdarg.h>
#include <assert.h>
#include <sofia-sip/su_alloc.h>
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
#define MSG_PUB_T struct http_s
#define MSG_HDR_T union http_header_u
#define HTTP_STATIC_INLINE
#include "sofia-sip/http_parser.h"
#include <sofia-sip/http_header.h>
#include <sofia-sip/http_status.h>
#ifndef UINT32_MAX
#define UINT32_MAX (0xffffffffU)
#endif
/** Complete a HTTP request. */
int http_request_complete(msg_t *msg)
{
size_t len = 0;
http_t *http = http_object(msg);
http_payload_t const *pl;
su_home_t *home = msg_home(msg);
if (!http)
return -1;
if (!http->http_request)
return -1;
if (!http->http_host)
return -1;
for (pl = http->http_payload; pl; pl = pl->pl_next)
len += pl->pl_len;
if (len > UINT32_MAX)
return -1;
if (!http->http_content_length) {
http->http_content_length = http_content_length_create(home, (uint32_t)len);
}
else {
if (http->http_content_length->l_length != len) {
http->http_content_length->l_length = (uint32_t)len;
msg_fragment_clear(http->http_content_length->l_common);
}
}
if (!http->http_separator)
http->http_separator = http_separator_create(home);
return 0;
}
/** Remove schema, host, port, and fragment from HTTP/HTTPS URL */
int http_strip_hostport(url_t *url)
{
if (url->url_type == url_http || url->url_type == url_https) {
url->url_type = url_unknown;
url->url_scheme = NULL;
url->url_user = NULL;
url->url_password = NULL;
url->url_host = NULL;
url->url_port = NULL;
if (url->url_path == NULL) {
url->url_root = '/';
url->url_path = "";
}
}
url->url_fragment = NULL;
return 0;
}
/** Add a Content-Length and separator to a message */
int http_message_complete(msg_t *msg, http_t *http)
{
#if 1
if (!http->http_content_length) {
http_content_length_t *l;
http_payload_t *pl;
size_t len = 0;
for (pl = http->http_payload; pl; pl = pl->pl_next)
len += pl->pl_len;
if (len > UINT32_MAX)
return -1;
l = http_content_length_create(msg_home(msg), (uint32_t)len);
if (msg_header_insert(msg, http, (http_header_t *)l) < 0)
return -1;
}
#endif
if (!http->http_separator) {
http_separator_t *sep = http_separator_create(msg_home(msg));
if (msg_header_insert(msg, http, (http_header_t *)sep) < 0)
return -1;
}
return 0;
}
/** Add headers from the request to the response message. */
int http_complete_response(msg_t *msg,
int status, char const *phrase,
http_t const *request)
{
su_home_t *home = msg_home(msg);
http_t *http = msg_object(msg);
if (!http || !request || !request->http_request)
return -1;
if (!http->http_status)
http->http_status = http_status_create(home, status, phrase, NULL);
if (!http->http_status)
return -1;
if (!http->http_separator) {
http_separator_t *sep = http_separator_create(msg_home(msg));
if (msg_header_insert(msg, http, (http_header_t *)sep) < 0)
return -1;
}
return 0;
}
/** Copy a HTTP header. */
http_header_t *http_header_copy(su_home_t *home, http_header_t const *h)
{
if (h == NULL || h == HTTP_NONE)
return NULL;
return msg_header_copy_as(home, h->sh_class, h);
}
/** Duplicate a HTTP header. */
http_header_t *http_header_dup(su_home_t *home, http_header_t const *h)
{
if (h == NULL || h == HTTP_NONE)
return NULL;
return msg_header_dup_as(home, h->sh_class, h);
}
/** Decode a HTTP header. */
http_header_t *http_header_d(su_home_t *home, msg_t const *msg, char const *b)
{
return msg_header_d(home, msg, b);
}
/** Encode a HTTP header. */
int http_header_e(char b[], int bsiz, http_header_t const *h, int flags)
{
return msg_header_e(b, bsiz, h, flags);
}
/** Encode HTTP header contents. */
int http_header_field_e(char b[], int bsiz, http_header_t const *h, int flags)
{
assert(h); assert(h->sh_class);
return h->sh_class->hc_print(b, bsiz, h, flags);
}
http_header_t *http_header_format(su_home_t *home,
msg_hclass_t *hc,
char const *fmt,
...)
{
http_header_t *h;
va_list ap;
va_start(ap, fmt);
h = http_header_vformat(home, hc, fmt, ap);
va_end(ap);
return h;
}
/** Add a duplicate of header object to a HTTP message. */
int http_add_dup(msg_t *msg,
http_t *http,
http_header_t const *o)
{
if (o == HTTP_NONE)
return 0;
if (msg == NULL || o == NULL)
return -1;
return msg_header_insert(msg, http, msg_header_dup(msg_home(msg), o));
}
int http_add_make(msg_t *msg,
http_t *http,
msg_hclass_t *hc,
char const *s)
{
if (s == NULL)
return 0;
if (msg == NULL)
return -1;
return msg_header_insert(msg, http, msg_header_make(msg_home(msg), hc, s));
}
int http_add_format(msg_t *msg,
http_t *http,
msg_hclass_t *hc,
char const *fmt,
...)
{
http_header_t *h;
va_list ap;
if (fmt == NULL)
return 0;
if (msg == NULL)
return -1;
va_start(ap, fmt);
h = http_header_vformat(msg_home(msg), hc, fmt, ap);
va_end(ap);
return msg_header_insert(msg, http, h);
}
/** Compare two HTTP URLs. */
int http_url_cmp(url_t const *a, url_t const *b)
{
int rv;
if ((rv = url_cmp(a, b)))
return rv;
if (a->url_path != b->url_path) {
if (a->url_path == NULL) return -1;
if (b->url_path == NULL) return +1;
if ((rv = strcmp(a->url_path, b->url_path)))
return rv;
}
/* Params? */
/* Query */
if (a->url_headers != b->url_headers) {
if (a->url_headers == NULL) return -1;
if (b->url_headers == NULL) return +1;
if ((rv = strcmp(a->url_headers, b->url_headers)))
return rv;
}
return 0;
}

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