merge whitespace fixes from sofia-sip tree

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10802 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2008-12-16 18:05:22 +00:00
parent 940dbe85c0
commit d8c4d22d40
489 changed files with 10298 additions and 10301 deletions

View File

@@ -31,7 +31,6 @@ Urpalainen, Jari <first.surname@nokia.com>
Whittaker, Colin <colinw -at occamnetworks -dot com> Whittaker, Colin <colinw -at occamnetworks -dot com>
Zabaluev, Mikhail <first.surname@nokia.com> Zabaluev, Mikhail <first.surname@nokia.com>
Note: for details on who did what, see the version control Note: for details on who did what, see the version control
system change history, and release notes for past releases at system change history, and release notes for past releases at
http://sofia-sip.sourceforge.net/relnotes/ http://sofia-sip.sourceforge.net/relnotes/

View File

@@ -146,7 +146,7 @@ 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 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 writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does. and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's 1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an you conspicuously and appropriately publish on each copy an

View File

@@ -1,6 +1,6 @@
This package contains the Sofia-SIP library. This package contains the Sofia-SIP library.
Copyright (C) 2005-2006 Nokia Corporation and others (see the Copyright (C) 2005-2006 Nokia Corporation and others (see the
in individual files for a detailed list of copyright holders). in individual files for a detailed list of copyright holders).
Contact: Pekka Pessi <Pekka.Pessi@nokia.com> Contact: Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -102,23 +102,23 @@ libsofia-sip-ua/su/getopt.c
The package also contains files licensed by IBM Corporation. These files are The package also contains files licensed by IBM Corporation. These files are
distributed with the following copyright notice: distributed with the following copyright notice:
This module contains code made available by IBM This module contains code made available by IBM
Corporation on an AS IS basis. Any one receiving the Corporation on an AS IS basis. Any one receiving the
module is considered to be licensed under IBM copyrights module is considered to be licensed under IBM copyrights
to use the IBM-provided source code in any way he or she to use the IBM-provided source code in any way he or she
deems fit, including copying it, compiling it, modifying deems fit, including copying it, compiling it, modifying
it, and redistributing it, with or without it, and redistributing it, with or without
modifications. No license under any IBM patents or modifications. No license under any IBM patents or
patent applications is to be implied from this copyright patent applications is to be implied from this copyright
license. license.
A user of the module should understand that IBM cannot A user of the module should understand that IBM cannot
provide technical support for the module and will not be provide technical support for the module and will not be
responsible for any consequences of use of the program. responsible for any consequences of use of the program.
Any notices, including this one, are not to be removed Any notices, including this one, are not to be removed
from the module without the prior written consent of from the module without the prior written consent of
IBM. IBM.
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
@@ -149,7 +149,7 @@ Copyright (c) 1994 Sun Microsystems, Inc.
The following license.terms for information on usage and redistribution The following license.terms for information on usage and redistribution
of this individual file, and for a DISCLAIMER OF ALL WARRANTIES. of this individual file, and for a DISCLAIMER OF ALL WARRANTIES.
This software is copyrighted by the Regents of the University of This software is copyrighted by the Regents of the University of
California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
Corporation and other parties. The following terms apply to all files Corporation and other parties. The following terms apply to all files
@@ -181,7 +181,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights" U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the software shall be classified as "Commercial Computer Software" and the
@@ -189,7 +189,7 @@ Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the permission to use and distribute the software in accordance with the
terms specified in this license. terms specified in this license.
---------------------------------------------------------------------------- ----------------------------------------------------------------------------

View File

@@ -2,11 +2,11 @@
ChangeLog / Sofia-SIP - SIP User-Agent library ChangeLog / Sofia-SIP - SIP User-Agent library
=============================================================== ===============================================================
Sofia-SIP library ChangeLog files are available in the Sofia-SIP library ChangeLog files are available in the
following places: following places:
- per subdirectory ChangeLog files - per subdirectory ChangeLog files
- all non-trivial changes to files (unless documented - all non-trivial changes to files (unless documented
elsewhere) elsewhere)
- version control system changelogs - version control system changelogs
- darcs and CVS tree repositories (see README.developers - darcs and CVS tree repositories (see README.developers

View File

@@ -20,18 +20,18 @@
* Fixed binding problems in nua and nta.c. * Fixed binding problems in nua and nta.c.
Returning more appropriate error code from tport_tbind(), too. Returning more appropriate error code from tport_tbind(), too.
This patch fixes tracked bugs This patch fixes tracked bugs
#1485624 (nua not binding to 5060), #1485624 (nua not binding to 5060),
#1485625 (nua_create() fails if STUN init fails) and #1485625 (nua_create() fails if STUN init fails) and
#1485632 (ncorrect error message for nua bind error). #1485632 (ncorrect error message for nua bind error).
Nua now also binds both to NUTAG_URL and NUTAG_SIPS_URL() URIs, nua_create() Nua now also binds both to NUTAG_URL and NUTAG_SIPS_URL() URIs, nua_create()
fails if binding either of them fails. fails if binding either of them fails.
* Fixed msg_addrlen() usage. * Fixed msg_addrlen() usage.
msg_addrlen() returns a pointer to ai_addrlen field of struct addrinfo msg_addrlen() returns a pointer to ai_addrlen field of struct addrinfo
inside the msg_t object. ai_addrlen has type size_t. However, system calls inside the msg_t object. ai_addrlen has type size_t. However, system calls
taking a return valur pointer to address length, use type socklen_t. taking a return valur pointer to address length, use type socklen_t.
Typically size_t is unsigned long, socklen_t is int, so casting Typically size_t is unsigned long, socklen_t is int, so casting
msg_addrlen() return value to (socklen_t *) will break on (high-endian) msg_addrlen() return value to (socklen_t *) will break on (high-endian)
64-bit platforms. svsp. 64-bit platforms. svsp.
@@ -74,22 +74,22 @@
- win32/tests/test_nua/test_nat_tags.cpp - win32/tests/test_nua/test_nat_tags.cpp
* Now building libsofia_sip_ua.dll on win32. * Now building libsofia_sip_ua.dll on win32.
We define both IN_LIBSOFIA_SIP_UA and IN_LIBSOFIA_SRES in We define both IN_LIBSOFIA_SIP_UA and IN_LIBSOFIA_SRES in
libsofia_sip_ua.dsp. libsofia_sip_ua.dsp.
Because of DLL linkage, we compile tags typedefs as C++ Because of DLL linkage, we compile tags typedefs as C++
(see win32/tests/test_nua/test_nat_tags.cpp). (see win32/tests/test_nua/test_nat_tags.cpp).
Removed LIBSOFIA_SIP_UA_STATIC from win32/sofia-sip/su_configure.h. Removed LIBSOFIA_SIP_UA_STATIC from win32/sofia-sip/su_configure.h.
Added libsofia_sip_ua_static.lib, too. If you want to compile against Added libsofia_sip_ua_static.lib, too. If you want to compile against
that, you need define LIBSOFIA_SIP_UA_STATIC by yourself. that, you need define LIBSOFIA_SIP_UA_STATIC by yourself.
Added libsofia-sip-ua-static/libsofia_sip_ua_static.dsp. Added libsofia-sip-ua-static/libsofia_sip_ua_static.dsp.
Using multithreaded DLL runtime for all projects. Using multithreaded DLL runtime for all projects.
* Added SOFIAPUBFUN/SOFIAPUBVAR to stun module, too. * Added SOFIAPUBFUN/SOFIAPUBVAR to stun module, too.
* Added test_nat_tags.c to nua module. * Added test_nat_tags.c to nua module.
@@ -99,11 +99,11 @@
* Added SRESPUBFUN and sres_config.h to sresolv module. * Added SRESPUBFUN and sres_config.h to sresolv module.
* Updated headers. * Updated headers.
Added sofia-sip/ prefix to documentation entries referring to include files. Added sofia-sip/ prefix to documentation entries referring to include files.
Added SOFIAPUBFUN and SOFIAPUBVAR to files that missed them. Added SOFIAPUBFUN and SOFIAPUBVAR to files that missed them.
Removed some deprecated functions and macros. Removed some deprecated functions and macros.
* Avoid #include ordering problem with sip_parser.h in sip_test_msg.c, too. * Avoid #include ordering problem with sip_parser.h in sip_test_msg.c, too.
@@ -118,7 +118,7 @@
Avoid #include ordering problem with <sofia-sip/http_parser.h>. Avoid #include ordering problem with <sofia-sip/http_parser.h>.
* Removed utf8 and unicode-related stuff from library. * Removed utf8 and unicode-related stuff from library.
Source files are still included in source tar. Source files are still included in source tar.
* Reordered #includes in sip module. * Reordered #includes in sip module.
@@ -137,9 +137,9 @@
* Fixed includes in outbound.[hc]. * Fixed includes in outbound.[hc].
* Added Doxyfiles to libsofia-sip-ua-glib. * Added Doxyfiles to libsofia-sip-ua-glib.
Note that the files are not actually commented. Note that the files are not actually commented.
* nua, soa: Adding Warnings to the response if appropriate. * nua, soa: Adding Warnings to the response if appropriate.
@@ -166,18 +166,18 @@
* nua_register.c: use nua-generated contact for refresh interval calculation. * nua_register.c: use nua-generated contact for refresh interval calculation.
Allow SIPS uris in contacts, too. Allow SIPS uris in contacts, too.
* nua_register.c: ignoring bad received parameters in Via header. * nua_register.c: ignoring bad received parameters in Via header.
* Updated config file handling in sresolv/sres.c.
* Updated config file handling in sresolv/sres.c.
Using reference counting with config structure when copying Using reference counting with config structure when copying
resolver objects. resolver objects.
Trying harder to avoid re-parsing resolv.conf and checking for Trying harder to avoid re-parsing resolv.conf and checking for
updated servers. updated servers.
Changed SRES_UPDATE_INTERVAL_SECS to 5 for non-WIN32 platforms. Changed SRES_UPDATE_INTERVAL_SECS to 5 for non-WIN32 platforms.
* su/su_alloc.c, su/sofia-sip/su_alloc.h: su_home_ref() takes const pointer. * su/su_alloc.c, su/sofia-sip/su_alloc.h: su_home_ref() takes const pointer.
2006-05-08 kai.vehmanen@nokia.com 2006-05-08 kai.vehmanen@nokia.com
@@ -252,10 +252,10 @@
* test_sresolv.v: added more tests for A6 record parsing. * test_sresolv.v: added more tests for A6 record parsing.
* sres.c, sres_cache.c: records are now allocated in a single chunk. * sres.c, sres_cache.c: records are now allocated in a single chunk.
Bug hunted down by Thomas Rosenblatt: strings and domains belonging to Bug hunted down by Thomas Rosenblatt: strings and domains belonging to
record were allocated from resolver home, not from cache home. record were allocated from resolver home, not from cache home.
* Fixed problem with config without search domains in sresolv/sres.c. * Fixed problem with config without search domains in sresolv/sres.c.
* Added information for COPYRIGHTS file to README.developers. * Added information for COPYRIGHTS file to README.developers.
@@ -277,7 +277,7 @@
* Added sofia-sip/auth_ntlm.h auth_ntlm.c to dist in iptsec module. * Added sofia-sip/auth_ntlm.h auth_ntlm.c to dist in iptsec module.
* Added license to Makefiles (kv) * Added license to Makefiles (kv)
Added copyright lines and reference to LGPL license to the Makefile.am and Added copyright lines and reference to LGPL license to the Makefile.am and
configure.ac files. configure.ac files.
@@ -286,7 +286,7 @@
* Added libsofia-sip-ua-glib/ChangeLog to darcs (kv) * Added libsofia-sip-ua-glib/ChangeLog to darcs (kv)
* Added win32 registry name server discovery (kv) * Added win32 registry name server discovery (kv)
Based on a patch from Dimitri E. Prado. Based on a patch from Dimitri E. Prado.
Decreased update interval to 180secs (SRES_UPDATE_INTERVAL_SECS). Decreased update interval to 180secs (SRES_UPDATE_INTERVAL_SECS).
@@ -371,7 +371,7 @@
const *, too. const *, too.
* Added SOFIAPUBFUN to auth_struct_copy(), too. * Added SOFIAPUBFUN to auth_struct_copy(), too.
* iptsec module (by Martti Mela): * iptsec module (by Martti Mela):
* ntlm support now compiles, not working. * ntlm support now compiles, not working.
@@ -393,7 +393,7 @@
* iptsec module: * iptsec module:
* Updated headers in iptsec module. * Updated headers in iptsec module.
Added SOFIAPUBFUN and SOFIAPUBVAR where needed. Added SOFIAPUBFUN and SOFIAPUBVAR where needed.
Removed auc_with_uicc(). Removed auc_with_uicc().
* Fixed memory management problems in iptsec module. * Fixed memory management problems in iptsec module.
@@ -403,7 +403,7 @@
freed. freed.
Now we are actually running the tests in test_auth_digest.c, too. Now we are actually running the tests in test_auth_digest.c, too.
The problem was reported and patch submitted by Colin Whittaker. The problem was reported and patch submitted by Colin Whittaker.
* sresolv module: * sresolv module:
* Updated sresolv API. * Updated sresolv API.
@@ -743,7 +743,7 @@
M ./libsofia-sip-ua/nua/test_nua.c +138 M ./libsofia-sip-ua/nua/test_nua.c +138
* Fixed NTA API test for SigComp options (they are now always processed). * Fixed NTA API test for SigComp options (they are now always processed).
M ./libsofia-sip-ua/nta/test_nta_api.c -8 +4 M ./libsofia-sip-ua/nta/test_nta_api.c -8 +4
@@ -800,7 +800,7 @@
2006-04-11 Kai Vehmanen <kai.vehmanen@nokia.com> 2006-04-11 Kai Vehmanen <kai.vehmanen@nokia.com>
Synchronizing CVS with darcs (other contributors pp = Pekka Pessi, Synchronizing CVS with darcs (other contributors pp = Pekka Pessi,
mm = Martti Mela). mm = Martti Mela).
* NDEBUG oops. (pp) * NDEBUG oops. (pp)
@@ -897,7 +897,7 @@
M ./libsofia-sip-ua/nua/nua_tag.c -2 M ./libsofia-sip-ua/nua/nua_tag.c -2
M ./libsofia-sip-ua/nua/sofia-sip/nua_tag.h -7 +6 M ./libsofia-sip-ua/nua/sofia-sip/nua_tag.h -7 +6
* Fixed su_root_run() usage in docs. (pp) * Fixed su_root_run() usage in docs. (pp)
Thanks for hint by Julio Auto. Thanks for hint by Julio Auto.
M ./libsofia-sip-ua/nua/nua.docs -1 +1 M ./libsofia-sip-ua/nua/nua.docs -1 +1
@@ -915,7 +915,7 @@
M ./libsofia-sip-ua/nua/nua_register.c -7 +11 M ./libsofia-sip-ua/nua/nua_register.c -7 +11
* Removed obsoleted nua events. (pp) * Removed obsoleted nua events. (pp)
Removed nua events nua_i_media_event, nua_r_set_media_param, Removed nua events nua_i_media_event, nua_r_set_media_param,
nua_r_get_media_param, nua_r_media_setup, nua_r_media_describe, nua_r_get_media_param, nua_r_media_setup, nua_r_media_describe,
nua_r_media_event, nua_i_announce, nua_i_describe, nua_i_get_parameter, nua_r_media_event, nua_i_announce, nua_i_describe, nua_i_get_parameter,
@@ -923,7 +923,7 @@
nua_i_setup, nua_i_teardown, nua_r_setup, nua_r_play, nua_r_record, nua_i_setup, nua_i_teardown, nua_r_setup, nua_r_play, nua_r_record,
nua_r_pause, nua_r_describe, nua_r_teardown, nua_r_options2, nua_r_announce, nua_r_pause, nua_r_describe, nua_r_teardown, nua_r_options2, nua_r_announce,
nua_r_get_parameter, and nua_r_set_parameter. nua_r_get_parameter, and nua_r_set_parameter.
Removed nua functions nua_announce(), nua_describe(), nua_get_media_param(), Removed nua functions nua_announce(), nua_describe(), nua_get_media_param(),
nua_get_parameter(), nua_media_describe(), nua_media_event(), nua_get_parameter(), nua_media_describe(), nua_media_event(),
nua_media_setup(), nua_options2(), nua_pause(), nua_play(), nua_record(), nua_media_setup(), nua_options2(), nua_pause(), nua_play(), nua_record(),
@@ -1330,7 +1330,7 @@
A ./libsofia-sip-ua/tport/tport_type_connect.c A ./libsofia-sip-ua/tport/tport_type_connect.c
* Split tport.c into multiple modules. (pp) * Split tport.c into multiple modules. (pp)
STUN, UPnP and SigComp still need some polishing. STUN, UPnP and SigComp still need some polishing.
M ./libsofia-sip-ua/tport/Makefile.am -3 +7 M ./libsofia-sip-ua/tport/Makefile.am -3 +7
M ./libsofia-sip-ua/tport/test_tport.c -13 +11 M ./libsofia-sip-ua/tport/test_tport.c -13 +11
@@ -1574,12 +1574,12 @@
M ./libsofia-sip-ua/nta/nta.c -3 +9 M ./libsofia-sip-ua/nta/nta.c -3 +9
* Using SOFIAPUBFUN in msg_header.h. Avoiding use of msg_param_t where possible. (pp) * Using SOFIAPUBFUN in msg_header.h. Avoiding use of msg_param_t where possible. (pp)
API CHANGE: API CHANGE:
Allowing NULL as message public pointer (using default) in calls to Allowing NULL as message public pointer (using default) in calls to
msg_serialize(), msg_header_add(), msg_header_prepend(), msg_serialize(), msg_header_add(), msg_header_prepend(),
msg_header_add_dup(), msg_header_add_dup_as(), msg_header_add_make(), msg_header_add_dup(), msg_header_add_dup_as(), msg_header_add_make(),
msg_header_add_str(), msg_header_insert(), msg_header_remove(), msg_header_add_str(), msg_header_insert(), msg_header_remove(),
msg_header_remove_all(), and msg_header_replace(). msg_header_remove_all(), and msg_header_replace().
M ./libsofia-sip-ua/msg/msg_parser.c -155 +182 M ./libsofia-sip-ua/msg/msg_parser.c -155 +182
@@ -1613,7 +1613,7 @@
* nua_dialog_store_peer_info() now optionally removes peer info. (pp) * nua_dialog_store_peer_info() now optionally removes peer info. (pp)
If the SIP message given to nua_dialog_store_peer_info() is redirection If the SIP message given to nua_dialog_store_peer_info() is redirection
response, reset peer info. response, reset peer info.
M ./libsofia-sip-ua/nua/nua_dialog.c +14 M ./libsofia-sip-ua/nua/nua_dialog.c +14
@@ -1645,7 +1645,7 @@
2006-03-16 Pekka Pessi <Pekka.Pessi@nokia.com> 2006-03-16 Pekka Pessi <Pekka.Pessi@nokia.com>
Synchronizing CVS with darcs. Synchronizing CVS with darcs.
* Fixed lib-sofia-sip-ua-glib Makefile.ams. * Fixed lib-sofia-sip-ua-glib Makefile.ams.
Tried to sanitize glib-less compilation. Tried to sanitize glib-less compilation.
@@ -1718,7 +1718,7 @@
* Using alarm() with su_test.c. * Using alarm() with su_test.c.
* Fixed hc_print usage in msg_header_prepare(). * Fixed hc_print usage in msg_header_prepare().
Some headers use snprintf() which may return -1 on some platforms if Some headers use snprintf() which may return -1 on some platforms if
buffer is too small. buffer is too small.
* Fixed problems in test_nua on win32. * Fixed problems in test_nua on win32.
@@ -1753,13 +1753,13 @@
M ./libsofia-sip-ua/nua/nua_stack.c -1 +1 M ./libsofia-sip-ua/nua/nua_stack.c -1 +1
2006-03-13 Martti Mela <martti.mela@nokia.com> 2006-03-13 Martti Mela <martti.mela@nokia.com>
* win32 defs, compiles and installs in mingw environment * win32 defs, compiles and installs in mingw environment
2006-03-09 Kai Vehmanen <kai.vehmanen@nokia.com> 2006-03-09 Kai Vehmanen <kai.vehmanen@nokia.com>
* Synchronized darcs and CVS. * Synchronized darcs and CVS.
* Added missing su_source_test.c file. * Added missing su_source_test.c file.
A ./libsofia-sip-ua-glib/su-glib/su_source_test.c A ./libsofia-sip-ua-glib/su-glib/su_source_test.c
@@ -1978,8 +1978,8 @@
2006-03-01 Pekka Pessi <Pekka.Pessi@nokia.com> 2006-03-01 Pekka Pessi <Pekka.Pessi@nokia.com>
* Synchronized darcs and CVS. * Synchronized darcs and CVS.
* Added utils/Doxyfile * Added utils/Doxyfile
A ./utils/Doxyfile A ./utils/Doxyfile
@@ -2122,7 +2122,7 @@
2006-02-15 Pekka Pessi <Pekka.Pessi@nokia.com> 2006-02-15 Pekka Pessi <Pekka.Pessi@nokia.com>
* Release 1.11.6. * Release 1.11.6.
* Fixed problems in doxygen documentation and dist. * Fixed problems in doxygen documentation and dist.
* Updated PRACK and nta_outgoing_prack(). * Updated PRACK and nta_outgoing_prack().
@@ -2173,19 +2173,19 @@
<sofia-sip/su.h>. <sofia-sip/su.h>.
You can either fix your applications to use the new include file names You can either fix your applications to use the new include file names
with the fix-include-sofia-sip sed script found in scripts/ directory, or with the fix-include-sofia-sip sed script found in scripts/ directory, or
add both ${sofiadir} and ${sofiadir}/sofia-sip into your include path, add both ${sofiadir} and ${sofiadir}/sofia-sip into your include path,
e.g., e.g.,
INCLUDES = -I/usr/include/sofia-1.11 -I/usr/include/sofia-1.11/sofia-sip INCLUDES = -I/usr/include/sofia-1.11 -I/usr/include/sofia-1.11/sofia-sip
At the same time, I took the liberty to rename two include files At the same time, I took the liberty to rename two include files
sofia_sip_features.h => sofia-sip/features.h sofia_sip_features.h => sofia-sip/features.h
su_memmem.h => sofia-sip/su_bm.h su_memmem.h => sofia-sip/su_bm.h
The fix-include-sofia-sip sed script takes care of both of them. The fix-include-sofia-sip sed script takes care of both of them.
* Improved 100rel handling in nua. * Improved 100rel handling in nua.
Added test_100rel to test_nua.c. Added test_100rel to test_nua.c.
@@ -2193,7 +2193,7 @@
* Improving getaddrinfo replacements. * Improving getaddrinfo replacements.
Testing functions getaddrinfo()/freeaddrinfo(), getnameinfo() and Testing functions getaddrinfo()/freeaddrinfo(), getnameinfo() and
gai_strerror() separately. gai_strerror() separately.
There is no gai_strerror() in windows, I think. There is no gai_strerror() in windows, I think.
2006-02-03 Pekka Pessi <Pekka.Pessi@nokia.com> 2006-02-03 Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -2286,12 +2286,12 @@
M ./libsofia-sip-ua/nea/nea_server.c -1 +1 M ./libsofia-sip-ua/nea/nea_server.c -1 +1
* Added functions for scanning domain names and IP addresses. * Added functions for scanning domain names and IP addresses.
Added span_ip4_address()/scan_ip4_address(), Added span_ip4_address()/scan_ip4_address(),
span_ip6_address()/scan_ip6_address(), span_ip6_address()/scan_ip6_address(),
span_ip6_reference()/scan_ip6_reference(), span_ip6_reference()/scan_ip6_reference(),
span_ip_address()/scan_ip_address(), span_ip_address()/scan_ip_address(),
span_domain()/scan_domain(), and span_domain()/scan_domain(), and
span_host()/scan_host(). span_host()/scan_host().
M ./libsofia-sip-ua/bnf/bnf.c -2 +588 M ./libsofia-sip-ua/bnf/bnf.c -2 +588
M ./libsofia-sip-ua/bnf/bnf.h -2 +18 M ./libsofia-sip-ua/bnf/bnf.h -2 +18
@@ -2393,7 +2393,7 @@
2006-01-03 Pekka Pessi <Pekka.Pessi@nokia.com> 2006-01-03 Pekka Pessi <Pekka.Pessi@nokia.com>
Syncinc darcs and CVS. Syncinc darcs and CVS.
* Added more tests for call hold. * Added more tests for call hold.
* Using msg_header_replace_param() in nua_stack.c. * Using msg_header_replace_param() in nua_stack.c.
@@ -2410,7 +2410,7 @@
* Removed msg_bnf.h * Removed msg_bnf.h
* Added NTATAG_TCP_RPORT(). * Added NTATAG_TCP_RPORT().
Do not use rport with TCP by default. Do not use rport with TCP by default.
* Added test for comp=sigcomp. * Added test for comp=sigcomp.
@@ -2420,7 +2420,7 @@
* Documented TP_AI_ flags. * Documented TP_AI_ flags.
Test our TP_AI_ assumptions. Test our TP_AI_ assumptions.
Added a test for asymmetric SigComp on TCP. Added a test for asymmetric SigComp on TCP.
We use TP_AI_COMPRESSED flag in this test. We use TP_AI_COMPRESSED flag in this test.
* Added TPTAG_FRESH() and a test for it. * Added TPTAG_FRESH() and a test for it.
@@ -2429,7 +2429,7 @@
* Use #include <stdio.h> for FILE. * Use #include <stdio.h> for FILE.
* Fixed include_sofiadir handling in pkg-config and rpm files. * Fixed include_sofiadir handling in pkg-config and rpm files.
2005-12-27 Martti Mela <martti.mela@nokia.com 2005-12-27 Martti Mela <martti.mela@nokia.com
@@ -2559,7 +2559,7 @@
M ./libsofia-sip-ua/sip/torture_sip.c -13 +137 M ./libsofia-sip-ua/sip/torture_sip.c -13 +137
* Added manipulation functions for header parameters. * Added manipulation functions for header parameters.
msg_header_find_param(), msg_header_add_param(), msg_header_find_param(), msg_header_add_param(),
msg_header_replace_param(), and msg_header_remove_param(). msg_header_replace_param(), and msg_header_remove_param().
M ./libsofia-sip-ua/http/http_basic.c -1 +1 M ./libsofia-sip-ua/http/http_basic.c -1 +1
@@ -2659,7 +2659,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/su/su_localinfo.c +3 M ./libsofia-sip-ua/su/su_localinfo.c +3
M ./libsofia-sip-ua/su/su_localinfo.h -2 +3 M ./libsofia-sip-ua/su/su_localinfo.h -2 +3
2005-12-02 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-12-02 Pekka Pessi <Pekka.Pessi@nokia.com>
Again, syncing darcs and CVS. Again, syncing darcs and CVS.
@@ -3025,11 +3025,11 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
* Cleaned up su_addrinfo.c. [pp] * Cleaned up su_addrinfo.c. [pp]
Cleaned up comments. Cleaned up comments.
Using SU_HAVE_ flags. Using SU_HAVE_ flags.
Added support for SCTP in getaddrinfo() replacement. Added support for SCTP in getaddrinfo() replacement.
M ./libsofia-sip-ua/su/su_addrinfo.c -10 +38 M ./libsofia-sip-ua/su/su_addrinfo.c -10 +38
* Declaring sockaddr_storage in su.h if it is not provided in environment. * Declaring sockaddr_storage in su.h if it is not provided in environment.
M ./libsofia-sip-ua/su/su.h +23 M ./libsofia-sip-ua/su/su.h +23
@@ -3052,7 +3052,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
2005-11-30 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-11-30 Pekka Pessi <Pekka.Pessi@nokia.com>
Syncing darcs with CVS. Syncing darcs with CVS.
* Silenced warning in su_addrinfo.c. * Silenced warning in su_addrinfo.c.
M ./libsofia-sip-ua/su/su_addrinfo.c -1 +2 M ./libsofia-sip-ua/su/su_addrinfo.c -1 +2
@@ -3158,16 +3158,16 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/nua/nua_stack.c -10 +18 M ./libsofia-sip-ua/nua/nua_stack.c -10 +18
* Rewrote uas_check_session_content(). * Rewrote uas_check_session_content().
Returning empty Accept-Encoding header in 415/406 responses. Returning empty Accept-Encoding header in 415/406 responses.
M ./libsofia-sip-ua/nua/nua_stack.c -21 +41 M ./libsofia-sip-ua/nua/nua_stack.c -21 +41
* Do not throttle at termination. [FIX] * Do not throttle at termination. [FIX]
nea_server now sends NOTIFYs that terminate subscription even if the nea_server now sends NOTIFYs that terminate subscription even if the
previous NOTIFY transaction has not completed yet. previous NOTIFY transaction has not completed yet.
This fixes the race condition in nua_terminate() (where terminating NOTIFY This fixes the race condition in nua_terminate() (where terminating NOTIFY
was is never sent). was is never sent).
@@ -3203,7 +3203,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./RELEASE -3 +16 M ./RELEASE -3 +16
* Fixed installing and distributing m4 files. * Fixed installing and distributing m4 files.
Not installing m4/sac-su2.m4. Not installing m4/sac-su2.m4.
Including m4/sac-tport.m4 and m4/sac-openssl.m4 in distribution. Including m4/sac-tport.m4 and m4/sac-openssl.m4 in distribution.
M ./Makefile.am -1 +2 M ./Makefile.am -1 +2
@@ -3219,7 +3219,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/docs/mainpage.docs -5 +7 M ./libsofia-sip-ua/docs/mainpage.docs -5 +7
* Updated subscriptuion authorization and nua_terminate() semantics. * Updated subscriptuion authorization and nua_terminate() semantics.
Subscription authorization now rejects SUBSCRIBE if Subscription authorization now rejects SUBSCRIBE if
NUTAG_SUBSTATE(nua_substate_terminated) parameter is set. NUTAG_SUBSTATE(nua_substate_terminated) parameter is set.
Correct status code is relayed to application, too. Correct status code is relayed to application, too.
nua_terminate() now always terminates whole notifier. nua_terminate() now always terminates whole notifier.
@@ -3253,7 +3253,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/docs/Doxyfile -1 +1 M ./libsofia-sip-ua/docs/Doxyfile -1 +1
M ./libsofia-sip-ua/features/Doxyfile -1 +1 M ./libsofia-sip-ua/features/Doxyfile -1 +1
M ./libsofia-sip-ua/nea/Doxyfile -1 +1 M ./libsofia-sip-ua/nea/Doxyfile -1 +1
* Moved typedefs nua_t and nua_handle_t into <nua_tag.h> * Moved typedefs nua_t and nua_handle_t into <nua_tag.h>
@@ -3409,9 +3409,9 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
2005-11-28 Martti Mela <martti.mela@nokia.com> 2005-11-28 Martti Mela <martti.mela@nokia.com>
* nua.h: added event nua_i_subscription * nua.h: added event nua_i_subscription
* nua_commmon.c: added event nua_i_subscription * nua_commmon.c: added event nua_i_subscription
* nua_stack.c: ua_event for nua_i_subscription (nea subscribers) * nua_stack.c: ua_event for nua_i_subscription (nea subscribers)
* nea.h, nea_tag.c, nea_tag_ref.c, nea_server.c: support for a new * nea.h, nea_tag.c, nea_tag_ref.c, nea_server.c: support for a new
@@ -3419,7 +3419,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
2005-11-15 Kai Vehmanen <kai.vehmanen@nokia.com> 2005-11-15 Kai Vehmanen <kai.vehmanen@nokia.com>
* configure.ac: Added VER_LIBSOFIA_SIP_UA variables. * configure.ac: Added VER_LIBSOFIA_SIP_UA variables.
2005-11-14 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-11-14 Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -3469,7 +3469,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/soa/test_soa.c -19 +382 M ./libsofia-sip-ua/soa/test_soa.c -19 +382
* Added funtions for rtp payload type management. * Added funtions for rtp payload type management.
Added sdp_media_uses_rtp(), sdp_rtpmap_match(), sdp_rtpmap_find_matching() Added sdp_media_uses_rtp(), sdp_rtpmap_match(), sdp_rtpmap_find_matching()
and sdp_rtpmap_well_known[]. Fixed RTP timestamp rate for G722: it was 16000 and sdp_rtpmap_well_known[]. Fixed RTP timestamp rate for G722: it was 16000
but it should be 8000. but it should be 8000.
@@ -3510,8 +3510,8 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/su/su_wait.h +3 M ./libsofia-sip-ua/su/su_wait.h +3
* Fixed tport.c on Win32 port. * Fixed tport.c on Win32 port.
Added a separate "connecting" phase. Added a separate "connecting" phase.
Checking EWOULDBLOCK in addition to EAGAIN. Checking EWOULDBLOCK in addition to EAGAIN.
Fixed TP_AI_CLOSE and TP_AI_SHUTDOWN flags. Fixed TP_AI_CLOSE and TP_AI_SHUTDOWN flags.
Improved logging. Improved logging.
@@ -3757,7 +3757,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
* Cleaned up nta module interfaces. * Cleaned up nta module interfaces.
Use uint32_t instead of sip_u32_t. Use uint32_t instead of sip_u32_t.
Removed old funtions not using reference counting with messages: Removed old funtions not using reference counting with messages:
Replaced nta_outgoing_getresponse() with nta_outgoing_getresponse_ref(), Replaced nta_outgoing_getresponse() with nta_outgoing_getresponse_ref(),
and nta_outgoing_getrequest() with nta_outgoing_getrequest_ref(). and nta_outgoing_getrequest() with nta_outgoing_getrequest_ref().
Removed nta_incoming_getresponse(), nta_leg_stateful(). Removed nta_incoming_getresponse(), nta_leg_stateful().
Removed nta_outgoing_tmcreate(): use nta_outgoing_mcreate() instead. Removed nta_outgoing_tmcreate(): use nta_outgoing_mcreate() instead.
@@ -3795,7 +3795,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/sip/sip_protos.h.in -1 +1 M ./libsofia-sip-ua/sip/sip_protos.h.in -1 +1
* Cleaned up sip types. * Cleaned up sip types.
Not using special typedefs sip_u32_t or sip_u16_t. Not using special typedefs sip_u32_t or sip_u16_t.
M ./libsofia-sip-ua/sip/sip.h -15 +11 M ./libsofia-sip-ua/sip/sip.h -15 +11
@@ -3816,7 +3816,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
* Removed annoying Last modified from iptsec. * Removed annoying Last modified from iptsec.
2005-11-04 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-11-04 Pekka Pessi <Pekka.Pessi@nokia.com>
* Removed annoying Last modified from msg module. * Removed annoying Last modified from msg module.
* Removed Last modified things from sip module. * Removed Last modified things from sip module.
@@ -3852,7 +3852,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/nua/test_nua.c +409 M ./libsofia-sip-ua/nua/test_nua.c +409
* Added nua_unpublish(). * Added nua_unpublish().
Some cosmetic changes, too. Some cosmetic changes, too.
M ./libsofia-sip-ua/nua/nua.h -1 +4 M ./libsofia-sip-ua/nua/nua.h -1 +4
@@ -3899,14 +3899,14 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
* Moved deprecated functions to nta/nta_compat.c. * Moved deprecated functions to nta/nta_compat.c.
nta_msg_vsend() and msg_msg_send() should not be used anymore. nta_msg_vsend() and msg_msg_send() should not be used anymore.
nta_msg_discard() is also deprecated, but getting rid of references to it nta_msg_discard() is also deprecated, but getting rid of references to it
takes time. takes time.
M ./libsofia-sip-ua/nta/nta.c -43 +42 M ./libsofia-sip-ua/nta/nta.c -43 +42
M ./libsofia-sip-ua/nta/nta_compat.c -1 +31 M ./libsofia-sip-ua/nta/nta_compat.c -1 +31
* Plugged memory leak in nth_engine_create() in nth/nth_client.c * Plugged memory leak in nth_engine_create() in nth/nth_client.c
Use su_home_new() instead of su_salloc(). Use su_home_new() instead of su_salloc().
M ./libsofia-sip-ua/nth/nth_client.c -3 +2 M ./libsofia-sip-ua/nth/nth_client.c -3 +2
@@ -4297,7 +4297,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
* Importing darcs-to-cvs-2005-10-04. * Importing darcs-to-cvs-2005-10-04.
* Using DIST_SUBDIRS when including dist-only dirs * Using DIST_SUBDIRS when including dist-only dirs
M ./Makefile.am -1 +2 M ./Makefile.am -1 +2
M ./libsofia-sip-ua/Makefile.am -1 +4 M ./libsofia-sip-ua/Makefile.am -1 +4
@@ -4308,7 +4308,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
2005-10-03 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-10-03 Pekka Pessi <Pekka.Pessi@nokia.com>
* Importing darcs-to-cvs-2005-10-03. * Importing darcs-to-cvs-2005-10-03.
* Removed old .def files. * Removed old .def files.
R ./libsofia-sip-ua/ipt/ipt.def R ./libsofia-sip-ua/ipt/ipt.def
@@ -4337,7 +4337,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
2005-09-29 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-09-29 Pekka Pessi <Pekka.Pessi@nokia.com>
* Importing darcs-to-cvs-2005-09-29. * Importing darcs-to-cvs-2005-09-29.
2005-09-28 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-09-28 Pekka Pessi <Pekka.Pessi@nokia.com>
* Added nua improvements. * Added nua improvements.
@@ -4347,7 +4347,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
2005-09-23 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-09-23 Pekka Pessi <Pekka.Pessi@nokia.com>
* darcs changes: * darcs changes:
Fri Sep 23 18:58:29 EEST 2005 Pekka.Pessi@nokia.com Fri Sep 23 18:58:29 EEST 2005 Pekka.Pessi@nokia.com
* Building msg_test class into msg_test library, use that in tport. * Building msg_test class into msg_test library, use that in tport.
@@ -4460,7 +4460,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
M ./libsofia-sip-ua/sip/sip_header.h +3 M ./libsofia-sip-ua/sip/sip_header.h +3
Mon Sep 19 20:12:33 EEST 2005 Pekka.Pessi@nokia.com Mon Sep 19 20:12:33 EEST 2005 Pekka.Pessi@nokia.com
* Updated. Added rules for ignoring SDP. corrected some * Updated. Added rules for ignoring SDP. corrected some
M ./libsofia-sip-ua/soa/soa.docs -8 +18 M ./libsofia-sip-ua/soa/soa.docs -8 +18
@@ -4567,7 +4567,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com
* Makefile.am: Added requirement for automake-1.6.1 * Makefile.am: Added requirement for automake-1.6.1
or newer. or newer.
* autogen.sh: Fixed interop problem with older automake * autogen.sh: Fixed interop problem with older automake
versions. versions.
* configure.ac: Do not compile STUN if OpenSSL is not * configure.ac: Do not compile STUN if OpenSSL is not

View File

@@ -21,12 +21,12 @@ PACKAGE = @PACKAGE@
VERSION = @VERSION@ VERSION = @VERSION@
EXTRA_DIST = AUTHORS COPYING COPYRIGHTS ChangeLog.ext-trees \ EXTRA_DIST = AUTHORS COPYING COPYRIGHTS ChangeLog.ext-trees \
README README.developers RELEASE TODO README README.developers RELEASE TODO
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST += m4/sac-general.m4 m4/sac-coverage.m4 \ EXTRA_DIST += m4/sac-general.m4 m4/sac-coverage.m4 \
m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4 m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4
EXTRA_DIST += docs/build_system.txt \ EXTRA_DIST += docs/build_system.txt \
docs/devel_platform_notes.txt \ docs/devel_platform_notes.txt \

View File

@@ -5,12 +5,12 @@ README / Sofia-SIP - RFC3261 compliant SIP User-Agent library
Introduction Introduction
------------ ------------
Sofia-SIP is an open-source SIP User-Agent library, compliant Sofia-SIP is an open-source SIP User-Agent library, compliant
with the IETF RFC3261 specification. It can be used as with the IETF RFC3261 specification. It can be used as
a building block for SIP client software for uses such as VoIP, a building block for SIP client software for uses such as VoIP,
IM, and many other real-time and person-to-person communication IM, and many other real-time and person-to-person communication
services. The primary target platform for Sofia-SIP is services. The primary target platform for Sofia-SIP is
GNU/Linux. Sofia-SIP is based on a SIP stack developed at GNU/Linux. Sofia-SIP is based on a SIP stack developed at
the Nokia Research Center. Sofia-SIP is licensed under the LGPL. the Nokia Research Center. Sofia-SIP is licensed under the LGPL.
@@ -42,9 +42,9 @@ the "sofia-sip/utils" directory:
The Sofia-SIP su submodule also provides some small utilities: The Sofia-SIP su submodule also provides some small utilities:
- addrinfo (libsofia-sip-ua/su), resolve host names - addrinfo (libsofia-sip-ua/su), resolve host names
- localinfo (libsofia-sip-ua/su), prints information about - localinfo (libsofia-sip-ua/su), prints information about
local network interfaces local network interfaces
References References
---------- ----------

View File

@@ -6,8 +6,8 @@ Introduction
============ ============
This file is a collection of practices and rules for Sofia-SIP This file is a collection of practices and rules for Sofia-SIP
development. If you have questions, or would like to make development. If you have questions, or would like to make
changes, raise the issue on sofia-sip-devel (see changes, raise the issue on sofia-sip-devel (see
http://lists.sourceforge.net/lists/listinfo/sofia-sip-devel ). http://lists.sourceforge.net/lists/listinfo/sofia-sip-devel ).
@@ -15,17 +15,17 @@ Important files for developers
============================== ==============================
AUTHORS AUTHORS
List of contributors. When contributing new code, add List of contributors. When contributing new code, add
yourself to AUTHORS, and also remember to update the yourself to AUTHORS, and also remember to update the
per source file copyright statements. per source file copyright statements.
COPYRIGHTS COPYRIGHTS
List of licenses and related copyright statements. While List of licenses and related copyright statements. While
majority of Sofia-SIP is licensed under LGPL, there are majority of Sofia-SIP is licensed under LGPL, there are
a few files with different, but LGPL compatible, licensing a few files with different, but LGPL compatible, licensing
terms. terms.
README.developers README.developers
This file. This file.
TODO TODO
@@ -33,11 +33,11 @@ TODO
<dir>/ChangeLog files <dir>/ChangeLog files
All non-trivial changes to the source code should All non-trivial changes to the source code should
be documented in the ChangeLog files. See also the be documented in the ChangeLog files. See also the
top-level ChangeLog. top-level ChangeLog.
Version numbering Version numbering
================= =================
Package version Package version
@@ -50,8 +50,8 @@ For development releases and snaphots the version is one of:
vMAJOR.MINOR.REVISION, where minor is odd vMAJOR.MINOR.REVISION, where minor is odd
vMAJOR.MINOR.REVISION.YEAR.MONTH.DAY, 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 For all releases, the version should be changed in configure.ac
and committed to Darcs/CVS before making the release package. The person and committed to Darcs/CVS before making the release package. The person
doing the release is responsible for updating the version number. doing the release is responsible for updating the version number.
Library interface versions Library interface versions
@@ -64,14 +64,14 @@ Sofia-SIP libraries utilize libtool interface versioning. See
The interface versions are set in top-level 'configure.ac' file. The interface versions are set in top-level 'configure.ac' file.
Additionally, the SONAME version (CURRENT-AGE) is set in the Additionally, the SONAME version (CURRENT-AGE) is set in the
same place. These version numbers are available for use as autoconf same place. These version numbers are available for use as autoconf
variables (see the library 'Makefile.am' files and variables (see the library 'Makefile.am' files and
'packages/sofia-sip.spec.in'). 'packages/sofia-sip.spec.in').
All changes to the library versions should be marked to the All changes to the library versions should be marked to the
appropriate library 'ChangeLog' file. The library version should appropriate library 'ChangeLog' file. The library version should
be changed at the same time as the first interface change is be changed at the same time as the first interface change is
committed since the previous release. The interface version is committed since the previous release. The interface version is
frozen (should be marked to the 'ChangeLog' file) at the time frozen (should be marked to the 'ChangeLog' file) at the time
the next release is tagged (in other words, intra-release changes the next release is tagged (in other words, intra-release changes
need not be tracked with libtool versions). need not be tracked with libtool versions).
@@ -95,7 +95,7 @@ Tagging releases and snapshots
- CVS tree (only used to track major releases) at: - CVS tree (only used to track major releases) at:
http://sourceforge.net/cvs/?group_id=143636 http://sourceforge.net/cvs/?group_id=143636
- tags: rel-sofia-sip-x_y_z - tags: rel-sofia-sip-x_y_z
- stable and development releases (matches release - stable and development releases (matches release
version sofia-sip-x.y.z) version sofia-sip-x.y.z)
- tags: snapshot_rel_YEARMMDD - tags: snapshot_rel_YEARMMDD
- snapshot releases at - snapshot releases at
@@ -113,13 +113,13 @@ Sending patches
People without Darcs access People without Darcs access
--------------------------- ---------------------------
Send your patches to sofia-sip-devel. Someone from the Send your patches to sofia-sip-devel. Someone from the
development team (see AUTHORS) will handle the patch. development team (see AUTHORS) will handle the patch.
People with Darcs access People with Darcs access
------------------------ ------------------------
Trivial changes can be committed without review. For non-trivial Trivial changes can be committed without review. For non-trivial
changes, you should first send a proposal to sofia-sip-devel and changes, you should first send a proposal to sofia-sip-devel and
wait for comments. There are no strict approval rules so use of wait for comments. There are no strict approval rules so use of
common sense is recommended. ;) common sense is recommended. ;)

View File

@@ -17,17 +17,17 @@ API/ABI changes and versioning
<see previous release notes at <see previous release notes at
http://sofia-sip.sourceforge.net/relnotes/ for examples ; http://sofia-sip.sourceforge.net/relnotes/ for examples ;
- should include all changes to public headers, and - should include all changes to public headers, and
other important information to developers; other important information to developers;
- and should be updated _continuously_! /> - and should be updated _continuously_! />
**template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X. **template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
libsofia-sip-ua: libsofia-sip-ua:
- **template**: Added foobar() function (sofia-sip/foobar.h). - **template**: Added foobar() function (sofia-sip/foobar.h).
- This release is ABI/API compatible with applications linked against - This release is ABI/API compatible with applications linked against
any 1.12.x release. However, applications built against this release won't 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 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. unit test (test_nua) built against original 1.12.0 release.
libsofia-sip-ua-glib: libsofia-sip-ua-glib:
@@ -41,12 +41,12 @@ Contributors to this release
<list of people who contributed to _this_ release <list of people who contributed to _this_ release
- update as people's patches are added, or when you commit stuff - update as people's patches are added, or when you commit stuff
- current development team members (see AUTHORS) may be omitted, - current development team members (see AUTHORS) may be omitted,
or listed at the end of the contribur list (depending on the scope or listed at the end of the contribur list (depending on the scope
of the work done since the last release) of the work done since the last release)
- name of the contributor should be enough (email addresses in AUTHORS), - name of the contributor should be enough (email addresses in AUTHORS),
plus a _brief_ description of what was contributed plus a _brief_ description of what was contributed
- roughly sorted by number of patches accepted - roughly sorted by number of patches accepted
/> />
- **template**: First Surname (patch to nua/soa/msg) - **template**: First Surname (patch to nua/soa/msg)
@@ -59,7 +59,7 @@ Notes on new features
- new/changed/removed functionality - new/changed/removed functionality
- links to further documentation - links to further documentation
- section may be omitted for minor releases - section may be omitted for minor releases
/> />
Bugs fixed in this release Bugs fixed in this release
-------------------------- --------------------------

View File

@@ -17,17 +17,17 @@ API/ABI changes and versioning
<see previous release notes at <see previous release notes at
http://sofia-sip.sourceforge.net/relnotes/ for examples ; http://sofia-sip.sourceforge.net/relnotes/ for examples ;
- should include all changes to public headers, and - should include all changes to public headers, and
other important information to developers; other important information to developers;
- and should be updated _continuously_! /> - and should be updated _continuously_! />
**template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X. **template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
libsofia-sip-ua: libsofia-sip-ua:
- **template**: Added foobar() function (sofia-sip/foobar.h). - **template**: Added foobar() function (sofia-sip/foobar.h).
- This release is ABI/API compatible with applications linked against - This release is ABI/API compatible with applications linked against
any 1.12.x release. However, applications built against this release won't 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 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. unit test (test_nua) built against original 1.12.0 release.
libsofia-sip-ua-glib: libsofia-sip-ua-glib:
@@ -41,12 +41,12 @@ Contributors to this release
<list of people who contributed to _this_ release <list of people who contributed to _this_ release
- update as people's patches are added, or when you commit stuff - update as people's patches are added, or when you commit stuff
- current development team members (see AUTHORS) may be omitted, - current development team members (see AUTHORS) may be omitted,
or listed at the end of the contribur list (depending on the scope or listed at the end of the contribur list (depending on the scope
of the work done since the last release) of the work done since the last release)
- name of the contributor should be enough (email addresses in AUTHORS), - name of the contributor should be enough (email addresses in AUTHORS),
plus a _brief_ description of what was contributed plus a _brief_ description of what was contributed
- roughly sorted by number of patches accepted - roughly sorted by number of patches accepted
/> />
- **template**: First Surname (patch to nua/soa/msg) - **template**: First Surname (patch to nua/soa/msg)
@@ -59,7 +59,7 @@ Notes on new features
- new/changed/removed functionality - new/changed/removed functionality
- links to further documentation - links to further documentation
- section may be omitted for minor releases - section may be omitted for minor releases
/> />
Bugs fixed in this release Bugs fixed in this release
-------------------------- --------------------------

View File

@@ -8,11 +8,11 @@ Release roadmap
--------------- ---------------
1.11/1.12 series 1.11/1.12 series
- first version of the new nua+soa API - first version of the new nua+soa API
- nua_respond_nit() (non-INVITEs) - nua_respond_nit() (non-INVITEs)
- nua_set_hparams()/nua_get_hparams() [DONE] - nua_set_hparams()/nua_get_hparams() [DONE]
- session object ownership changes [DONE] - session object ownership changes [DONE]
- allow multiple registrations (lines) and selecting - allow multiple registrations (lines) and selecting
service route, outbound proxy, and transport independently service route, outbound proxy, and transport independently
for each handle; NUTAG_IDENTITY for each handle; NUTAG_IDENTITY
- doxygen documentation updates [DONE] - doxygen documentation updates [DONE]

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
set -x set -x
AUTOMAKE=${AUTOMAKE:-automake-1.9} ACLOCAL=${ACLOCAL:-aclocal-1.9} AUTOMAKE=${AUTOMAKE:-automake-1.9} ACLOCAL=${ACLOCAL:-aclocal-1.9}

View File

@@ -2,7 +2,7 @@ dnl Copyright (C) 2005-2006 Nokia Corporation
dnl Contact: Pekka Pessi <pekka.pessi@nokia.com> dnl Contact: Pekka Pessi <pekka.pessi@nokia.com>
dnl Licensed under LGPL. See file COPYING. dnl Licensed under LGPL. See file COPYING.
dnl dnl
dnl ref: http://www.gnu.org/software/autoconf/manual/autoconf.info.gz dnl ref: http://www.gnu.org/software/autoconf/manual/autoconf.info.gz
dnl dnl
AC_PREREQ(2.57) AC_PREREQ(2.57)
@@ -24,7 +24,7 @@ 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_REV, [0])
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_AGE, [0]) AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_AGE, [0])
AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_SOVER, [3]) # CUR-AGE AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_SOVER, [3]) # CUR-AGE
# dnl calls AC_CANONICAL_ macros that are required by AM_INIT_AUTOMAKE # dnl calls AC_CANONICAL_ macros that are required by AM_INIT_AUTOMAKE
SAC_CANONICAL_SYSTEM_CACHE_CHECK SAC_CANONICAL_SYSTEM_CACHE_CHECK
@@ -56,7 +56,7 @@ AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
AC_ARG_WITH(doxygen, AC_ARG_WITH(doxygen,
[ --with-doxygen[[=CMD]] use doxygen command CMD [[doxygen]]],[ [ --with-doxygen[[=CMD]] use doxygen command CMD [[doxygen]]],[
case $enable_doxygen in case $enable_doxygen in
yes ) doxygen=doxygen ;; yes ) doxygen=doxygen ;;
no ) doxygen=echo ;; no ) doxygen=echo ;;
esac], doxygen=doxygen) esac], doxygen=doxygen)
@@ -249,12 +249,12 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
if test $ac_cv_c_z_format = yes; then if test $ac_cv_c_z_format = yes; then
AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
else else
dnl Cross fingers dnl Cross fingers
AC_MSG_WARN("printf cannot handle size_t, using long instead") 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_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
fi fi
fi fi
@@ -327,7 +327,7 @@ libsofia-sip-ua/sip/Makefile
libsofia-sip-ua/soa/Doxyfile libsofia-sip-ua/soa/Doxyfile
libsofia-sip-ua/soa/Makefile libsofia-sip-ua/soa/Makefile
libsofia-sip-ua/sresolv/Doxyfile libsofia-sip-ua/sresolv/Doxyfile
libsofia-sip-ua/sresolv/Makefile libsofia-sip-ua/sresolv/Makefile
libsofia-sip-ua/stun/Doxyfile libsofia-sip-ua/stun/Doxyfile
libsofia-sip-ua/stun/Makefile libsofia-sip-ua/stun/Makefile
libsofia-sip-ua/su/Doxyfile libsofia-sip-ua/su/Doxyfile

View File

@@ -73,8 +73,8 @@ Code-tree layout
================ ================
Most of the code resides in the libsofia-sip-ua directory. Most of the code resides in the libsofia-sip-ua directory.
The main library, libsofia-sip-ua.so, is created by The main library, libsofia-sip-ua.so, is created by
collecting object files (for example bnf/bnf_objs.o) from collecting object files (for example bnf/bnf_objs.o) from
individual modules. individual modules.
There are some portability issues with the way the There are some portability issues with the way the
@@ -89,13 +89,13 @@ See sofia-sip/docs/release_management.txt
Developer documentation Developer documentation
======================= =======================
Generating reference documentation from source code Generating reference documentation from source code
--------------------------------------------------- ---------------------------------------------------
The libsofia-sip-ua library has a top-level make target The libsofia-sip-ua library has a top-level make target
"doxygen" for generating the HTML reference documentation. "doxygen" for generating the HTML reference documentation.
The pages will be created to libsofia-sip-ua/docs The pages will be created to libsofia-sip-ua/docs
subdirectory. subdirectory.
This special target is primarily meant for use by This special target is primarily meant for use by
the Sofia-SIP website admins, but can be used by anyone the Sofia-SIP website admins, but can be used by anyone

View File

@@ -14,16 +14,16 @@ be at least 1.7. You can avoid running autoreconf explicitly if you use
Notes to distributors Notes to distributors
---------------------- ----------------------
Build options such as "--disable-stun" (HAVE_SOFIA_STUN) and Build options such as "--disable-stun" (HAVE_SOFIA_STUN) and
"--disable-nth" (HAVE_SOFIA_NTH) modify the public library API/ABI, "--disable-nth" (HAVE_SOFIA_NTH) modify the public library API/ABI,
by omitting certain interfaces from the resulting library and installed by omitting certain interfaces from the resulting library and installed
header files. header files.
Options such as '--disable-size-compat' modify the library Options such as '--disable-size-compat' modify the library
ABI by changing the types used in public library function ABI by changing the types used in public library function
signatures. signatures.
Generic POSIX (GNU/Linux, BSD, ...) Generic POSIX (GNU/Linux, BSD, ...)
----------------------------------- -----------------------------------
Sofia-SIP should compile out-of-the-box on generic POSIX Sofia-SIP should compile out-of-the-box on generic POSIX
@@ -35,17 +35,17 @@ The configure script accepts various options. See "./configure --help"
for the full list. for the full list.
Mac OS X Mac OS X
-------- --------
TBD TBD
Win32 / Mingw Win32 / Mingw
------------- -------------
TBD TBD
Win32 / Cygwin Win32 / Cygwin
-------------- --------------
TBD TBD

View File

@@ -27,8 +27,8 @@ The release notes should contain the following sections:
- maintained in sofia-sip/RELEASE - maintained in sofia-sip/RELEASE
- see diff between cvs/darcs between previous and - see diff between cvs/darcs between previous and
this version this version
- written in freshmeat.net "Changes:" style - written in freshmeat.net "Changes:" style
- notes on API/ABI interface changes - notes on API/ABI interface changes
- maintained in sofia-sip/RELEASE - maintained in sofia-sip/RELEASE
- all changes in public interfaces, plus other - all changes in public interfaces, plus other
notes that developers should be aware of notes that developers should be aware of
@@ -41,7 +41,7 @@ The release notes should contain the following sections:
See the RELEASE.template file for a full list of release note See the RELEASE.template file for a full list of release note
sections. sections.
Making the release tarball Making the release tarball
========================== ==========================
- basics: check system clock of the build host ;) - basics: check system clock of the build host ;)
@@ -71,15 +71,15 @@ Creating the release notes and updating the website
- combine the sofia-sip/RELEASE contents with - combine the sofia-sip/RELEASE contents with
the template found from sfnet_www/templates/relnotes.txt the template found from sfnet_www/templates/relnotes.txt
- store the resulting release notes to - store the resulting release notes to
sfnet_www/relnotes/relnotes-sofia-sip-x.y.z.txt sfnet_www/relnotes/relnotes-sofia-sip-x.y.z.txt
- add explicit link to the release notes to - add explicit link to the release notes to
sfnet_www/download.html (three most recent releases, sfnet_www/download.html (three most recent releases,
see guidelines in the html comments) see guidelines in the html comments)
- update sfnet_www/index.html to mention the latest - update sfnet_www/index.html to mention the latest
release release
- commit the change to sf.net website CVS, and run the - commit the change to sf.net website CVS, and run the
sfnet_www/put_online.sh script sfnet_www/put_online.sh script
Uploading the release to sourceforge.net Uploading the release to sourceforge.net
======================================== ========================================
@@ -104,8 +104,8 @@ After release
- replace the RELEASE file with RELEASE.template, and - replace the RELEASE file with RELEASE.template, and
commit it to master source repository (see sofia-sip/README.developers) commit it to master source repository (see sofia-sip/README.developers)
- change version in configure.ac from "X.Y.Z" to - change version in configure.ac from "X.Y.Z" to
"X.Y.Zdevel" (as it is in many cases unknown what the "X.Y.Zdevel" (as it is in many cases unknown what the
next version will be) next version will be)
- make a "tree open for development" commit - make a "tree open for development" commit
@@ -122,15 +122,15 @@ tree.
- Always tag the src-tree with "syncuser-fromvcs-to-tovcs-yearmmdd". - Always tag the src-tree with "syncuser-fromvcs-to-tovcs-yearmmdd".
- Add a top-level ChangeLog entry that documents all the - Add a top-level ChangeLog entry that documents all the
changes made outside the target tree (what, who and when - changes made outside the target tree (what, who and when -
for example produced with the "darcs changes --summary" for example produced with the "darcs changes --summary"
command). command).
Checking API/ABI compatibility Checking API/ABI compatibility
============================== ==============================
- Use a unit test binary built against an old library, - Use a unit test binary built against an old library,
to verify a new library version (forwards-compatibility). to verify a new library version (forwards-compatibility).
- Use the 'icheck' tool (in Debian) to make comparison - Use the 'icheck' tool (in Debian) to make comparison
between two released versions. between two released versions.

View File

@@ -17,7 +17,7 @@ if HAVE_GLIB
lib_LTLIBRARIES += libsofia-sip-ua-glib.la lib_LTLIBRARIES += libsofia-sip-ua-glib.la
endif endif
libsofia_sip_ua_glib_la_SOURCES = libsofia_sip_ua_glib_la_SOURCES =
libsofia_sip_ua_glib_la_LIBADD = $(GLIB_TARGETS) $(GLIB_LIBS) libsofia_sip_ua_glib_la_LIBADD = $(GLIB_TARGETS) $(GLIB_LIBS)
# set the libtool version info version:revision:age for libsofia-sip-ua-glib # set the libtool version info version:revision:age for libsofia-sip-ua-glib
@@ -42,7 +42,7 @@ doxygen: built-sources
done done
${top_srcdir}/scripts/hide_emails.sh docs/html ${top_srcdir}/scripts/hide_emails.sh docs/html
PHONY = doxygen PHONY = doxygen
include $(top_srcdir)/rules/recursive.am include $(top_srcdir)/rules/recursive.am

View File

@@ -27,7 +27,7 @@
/** /**
* @file su_glib.h * @file su_glib.h
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <first.surname@nokia.com> * @author Kai Vehmanen <first.surname@nokia.com>
*/ */

View File

@@ -27,16 +27,16 @@
/** /**
* @file su_source.h * @file su_source.h
* @brief * @brief
* *
* NOTE: This file (su_source.h) is DEPRECATED as of 1.12.2 release. * NOTE: This file (su_source.h) is DEPRECATED as of 1.12.2 release.
* Please use su_glib.h instead. * Please use su_glib.h instead.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <first.surname@nokia.com> * @author Kai Vehmanen <first.surname@nokia.com>
* *
* @date Created: Thu Mar 4 19:58:50 2004 ppessi * @date Created: Thu Mar 4 19:58:50 2004 ppessi
* *
*/ */
#ifndef SU_WAIT_H #ifndef SU_WAIT_H

View File

@@ -4,7 +4,7 @@
@section su_glib_meta Module Meta Information @section su_glib_meta Module Meta Information
The su-glib module provides an interface to connect Sofia-SIP event loop 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 to an existing glib main loop. Without this interface, a glib based
application would have to create a separate thread for running application would have to create a separate thread for running
the Sofia-SIP event loop. the Sofia-SIP event loop.
@@ -29,14 +29,14 @@ Below is a simple example of how to use su-glib:
#include <sofia-sip/su_glib.h> #include <sofia-sip/su_glib.h>
/* ... */ /* ... */
GMainLoop *ptr = g_main_loop_new(NULL, FALSE); GMainLoop *ptr = g_main_loop_new(NULL, FALSE);
GSource *gsource; GSource *gsource;
su_root_t *sofia_event_loop; su_root_t *sofia_event_loop;
su_timer_t *timer; su_timer_t *timer;
/* create a sofia event loop using su-glib function su_glib_root_source_create() */ /* create a sofia event loop using su-glib function su_glib_root_source_create() */
sofia_event_loop = su_glib_root_create(NULL); sofia_event_loop = su_glib_root_create(NULL);
/* attach the created GSource to glib event loop */ /* attach the created GSource to glib event loop */
gsource = su_glib_root_gsource(sofia_event_loop); gsource = su_glib_root_gsource(sofia_event_loop);
@@ -48,12 +48,12 @@ Below is a simple example of how to use su-glib:
/* ... initialize other Sofia-SIP modules/functrions */ /* ... initialize other Sofia-SIP modules/functrions */
/* run the glib mainloop */ /* run the glib mainloop */
g_main_loop_run(ptr); g_main_loop_run(ptr);
@endcode @endcode
@section su_glib_todo Todo @section su_glib_todo Todo
- see sourceforge.net issue tracker for sofia-sip - see sourceforge.net issue tracker for sofia-sip
(-> http://sofia-sip.sourceforge.net/development.html ) (-> http://sofia-sip.sourceforge.net/development.html )
*/ */

View File

@@ -25,15 +25,15 @@
/** /**
* @file su_source.c * @file su_source.c
* @brief Wrapper for glib GSource. * @brief Wrapper for glib GSource.
* *
* Refs: * Refs:
* - http://sofia-sip.sourceforge.net/refdocs/su/group__su__wait.html * - http://sofia-sip.sourceforge.net/refdocs/su/group__su__wait.html
* - http://developer.gnome.org/doc/API/glib/glib-the-main-event-loop.html * - http://developer.gnome.org/doc/API/glib/glib-the-main-event-loop.html
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com>. * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
* *
* @date Created: Thu Mar 4 15:15:15 2004 ppessi * @date Created: Thu Mar 4 15:15:15 2004 ppessi
* *
*/ */
#include "config.h" #include "config.h"
@@ -100,28 +100,28 @@ static struct _GSource *su_source_gsource(su_port_t *port);
static int su_source_send(su_port_t *self, su_msg_r rmsg); static int su_source_send(su_port_t *self, su_msg_r rmsg);
static int su_source_register(su_port_t *self, static int su_source_register(su_port_t *self,
su_root_t *root, su_root_t *root,
su_wait_t *wait, su_wait_t *wait,
su_wakeup_f callback, su_wakeup_f callback,
su_wakeup_arg_t *arg, su_wakeup_arg_t *arg,
int priority); int priority);
static int su_source_unregister(su_port_t *port, static int su_source_unregister(su_port_t *port,
su_root_t *root, su_root_t *root,
su_wait_t *wait, su_wait_t *wait,
su_wakeup_f callback, su_wakeup_f callback,
su_wakeup_arg_t *arg); su_wakeup_arg_t *arg);
static int su_source_deregister(su_port_t *self, int i); static int su_source_deregister(su_port_t *self, int i);
static int su_source_unregister_all(su_port_t *self, static int su_source_unregister_all(su_port_t *self,
su_root_t *root); su_root_t *root);
static int su_source_eventmask(su_port_t *self, static int su_source_eventmask(su_port_t *self,
int index, int socket, int events); int index, int socket, int events);
static void su_source_run(su_port_t *self); static void su_source_run(su_port_t *self);
static void su_source_break(su_port_t *self); static void su_source_break(su_port_t *self);
static su_duration_t su_source_step(su_port_t *self, su_duration_t tout); static su_duration_t su_source_step(su_port_t *self, su_duration_t tout);
static int su_source_thread(su_port_t *self, enum su_port_thread_op op); static int su_source_thread(su_port_t *self, enum su_port_thread_op op);
static int su_source_add_prepoll(su_port_t *port, static int su_source_add_prepoll(su_port_t *port,
su_root_t *root, su_root_t *root,
su_prepoll_f *, su_prepoll_f *,
su_prepoll_magic_t *); su_prepoll_magic_t *);
static int su_source_remove_prepoll(su_port_t *port, static int su_source_remove_prepoll(su_port_t *port,
su_root_t *root); su_root_t *root);
@@ -129,7 +129,7 @@ static int su_source_multishot(su_port_t *self, int multishot);
static char const *su_source_name(su_port_t const *self); static char const *su_source_name(su_port_t const *self);
static static
su_port_vtable_t const su_source_port_vtable[1] = su_port_vtable_t const su_source_port_vtable[1] =
{{ {{
/* su_vtable_size: */ sizeof su_source_port_vtable, /* su_vtable_size: */ sizeof su_source_port_vtable,
@@ -169,14 +169,14 @@ static char const *su_source_name(su_port_t const *self)
return "GSource"; return "GSource";
} }
/** /**
* Port is a per-thread reactor. * Port is a per-thread reactor.
* *
* Multiple root objects executed by single thread share a su_port_t object. * Multiple root objects executed by single thread share a su_port_t object.
*/ */
struct su_source_s { struct su_source_s {
su_base_port_t sup_base[1]; su_base_port_t sup_base[1];
GThread *sup_tid; GThread *sup_tid;
GStaticMutex sup_obtained[1]; GStaticMutex sup_obtained[1];
@@ -184,20 +184,20 @@ struct su_source_s {
GSource *sup_source; /**< Backpointer to source */ GSource *sup_source; /**< Backpointer to source */
GMainLoop *sup_main_loop; /**< Reference to mainloop while running */ GMainLoop *sup_main_loop; /**< Reference to mainloop while running */
/* Waits */ /* Waits */
unsigned sup_registers; /** Counter incremented by unsigned sup_registers; /** Counter incremented by
su_port_register() or su_port_register() or
su_port_unregister() su_port_unregister()
*/ */
unsigned sup_n_waits; unsigned sup_n_waits;
unsigned sup_size_waits; unsigned sup_size_waits;
unsigned sup_max_index; unsigned sup_max_index;
unsigned *sup_indices; unsigned *sup_indices;
su_wait_t *sup_waits; su_wait_t *sup_waits;
su_wakeup_f *sup_wait_cbs; su_wakeup_f *sup_wait_cbs;
su_wakeup_arg_t**sup_wait_args; su_wakeup_arg_t**sup_wait_args;
su_root_t **sup_wait_roots; su_root_t **sup_wait_roots;
}; };
typedef struct _SuSource typedef struct _SuSource
@@ -243,13 +243,13 @@ su_root_t *su_root_source_create(su_root_magic_t *magic)
return su_glib_root_create(magic); return su_glib_root_create(magic);
} }
/** /**
* Returns a GSource object for the root * Returns a GSource object for the root
* *
* Note that you need to unref the GSource with g_source_unref() * Note that you need to unref the GSource with g_source_unref()
* before destroying the root object. * before destroying the root object.
* *
* @return NULL on error (for instance if root was not created with * @return NULL on error (for instance if root was not created with
* su_glib_root_create()) * su_glib_root_create())
*/ */
GSource *su_glib_root_gsource(su_root_t *root) GSource *su_glib_root_gsource(su_root_t *root)
@@ -299,7 +299,7 @@ static void su_source_port_deinit(su_port_t *self)
/** @internal Destroy a port. */ /** @internal Destroy a port. */
static static
void su_source_finalize(GSource *gs) void su_source_finalize(GSource *gs)
{ {
SuSource *ss = (SuSource *)gs; SuSource *ss = (SuSource *)gs;
@@ -315,7 +315,7 @@ void su_source_port_lock(su_port_t *self, char const *who)
g_static_mutex_lock(self->sup_mutex); g_static_mutex_lock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...", PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
(void *)g_thread_self(), who, self)); (void *)g_thread_self(), who, self));
} }
@@ -323,7 +323,7 @@ void su_source_port_unlock(su_port_t *self, char const *who)
{ {
g_static_mutex_unlock(self->sup_mutex); g_static_mutex_unlock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n", PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
(void *)g_thread_self(), who, self)); (void *)g_thread_self(), who, self));
} }
@@ -351,7 +351,7 @@ int su_source_send(su_port_t *self, su_msg_r rmsg)
* Change or query ownership of the port object. * Change or query ownership of the port object.
* *
* @param self pointer to a port object * @param self pointer to a port object
* @param op operation * @param op operation
* *
* @ERRORS * @ERRORS
* @ERROR EALREADY port already has an owner (or has no owner) * @ERROR EALREADY port already has an owner (or has no owner)
@@ -392,7 +392,7 @@ static int su_source_thread(su_port_t *self, enum su_port_thread_op op)
/* -- Registering and unregistering ------------------------------------- */ /* -- Registering and unregistering ------------------------------------- */
/* Seconds from 1.1.1900 to 1.1.1970 */ /* Seconds from 1.1.1900 to 1.1.1970 */
#define NTP_EPOCH 2208988800UL #define NTP_EPOCH 2208988800UL
/** Prepare to wait - calculate time to next timer */ /** Prepare to wait - calculate time to next timer */
static static
@@ -402,7 +402,7 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
su_port_t *self = ss->ss_port; su_port_t *self = ss->ss_port;
enter; enter;
if (self->sup_base->sup_head) { if (self->sup_base->sup_head) {
*return_tout = 0; *return_tout = 0;
return TRUE; return TRUE;
@@ -450,7 +450,7 @@ gboolean su_source_check(GSource *gs)
return su_source_prepare(gs, &tout); return su_source_prepare(gs, &tout);
} }
static static
gboolean su_source_dispatch(GSource *gs, gboolean su_source_dispatch(GSource *gs,
GSourceFunc callback, GSourceFunc callback,
gpointer user_data) gpointer user_data)
@@ -489,8 +489,8 @@ gboolean su_source_dispatch(GSource *gs,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (waits[i].revents) { if (waits[i].revents) {
root = self->sup_wait_roots[i]; root = self->sup_wait_roots[i];
self->sup_wait_cbs[i](root ? su_root_magic(root) : NULL, self->sup_wait_cbs[i](root ? su_root_magic(root) : NULL,
&waits[i], &waits[i],
self->sup_wait_args[i]); self->sup_wait_args[i]);
/* Callback used su_register()/su_unregister() */ /* Callback used su_register()/su_unregister() */
if (version != self->sup_registers) if (version != self->sup_registers)
@@ -512,7 +512,7 @@ static void su_source_lock(su_port_t *self, char const *who)
(void *)g_thread_self(), who, self)); (void *)g_thread_self(), who, self));
g_static_mutex_lock(self->sup_mutex); g_static_mutex_lock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...", PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
(void *)g_thread_self(), who, self)); (void *)g_thread_self(), who, self));
} }
@@ -520,7 +520,7 @@ static void su_source_unlock(su_port_t *self, char const *who)
{ {
g_static_mutex_unlock(self->sup_mutex); g_static_mutex_unlock(self->sup_mutex);
PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n", PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
(void *)g_thread_self(), who, self)); (void *)g_thread_self(), who, self));
} }
@@ -548,21 +548,21 @@ GSource *su_source_gsource(su_port_t *self)
* *
* Please note if identical wait objects are inserted, only first one is * Please note if identical wait objects are inserted, only first one is
* ever signalled. * ever signalled.
* *
* @param self pointer to port * @param self pointer to port
* @param root pointer to root object * @param root pointer to root object
* @param waits pointer to wait object * @param waits pointer to wait object
* @param callback callback function pointer * @param callback callback function pointer
* @param arg argument given to callback function when it is invoked * @param arg argument given to callback function when it is invoked
* @param priority relative priority of the wait object * @param priority relative priority of the wait object
* (0 is normal, 1 important, 2 realtime) * (0 is normal, 1 important, 2 realtime)
* *
* @return * @return
* The function @su_source_register returns nonzero index of the wait object, * The function @su_source_register returns nonzero index of the wait object,
* or -1 upon an error. */ * or -1 upon an error. */
int su_source_register(su_port_t *self, int su_source_register(su_port_t *self,
su_root_t *root, su_root_t *root,
su_wait_t *wait, su_wait_t *wait,
su_wakeup_f callback, su_wakeup_f callback,
su_wakeup_arg_t *arg, su_wakeup_arg_t *arg,
int priority) int priority)
@@ -571,7 +571,7 @@ int su_source_register(su_port_t *self,
unsigned n; unsigned n;
enter; enter;
assert(SU_SOURCE_OWN_THREAD(self)); assert(SU_SOURCE_OWN_THREAD(self));
n = self->sup_n_waits; n = self->sup_n_waits;
@@ -587,7 +587,7 @@ int su_source_register(su_port_t *self,
if (self->sup_size_waits == 0) if (self->sup_size_waits == 0)
size = SU_WAIT_MIN; size = SU_WAIT_MIN;
else else
size = 2 * self->sup_size_waits; size = 2 * self->sup_size_waits;
indices = realloc(self->sup_indices, size * sizeof(*indices)); indices = realloc(self->sup_indices, size * sizeof(*indices));
@@ -600,14 +600,14 @@ int su_source_register(su_port_t *self,
for (i = 0; i < self->sup_n_waits; i++) for (i = 0; i < self->sup_n_waits; i++)
g_source_remove_poll(self->sup_source, (GPollFD*)&self->sup_waits[i]); g_source_remove_poll(self->sup_source, (GPollFD*)&self->sup_waits[i]);
waits = realloc(self->sup_waits, size * sizeof(*waits)); waits = realloc(self->sup_waits, size * sizeof(*waits));
if (waits) if (waits)
self->sup_waits = waits; self->sup_waits = waits;
for (i = 0; i < self->sup_n_waits; i++) for (i = 0; i < self->sup_n_waits; i++)
g_source_add_poll(self->sup_source, (GPollFD*)&waits[i]); g_source_add_poll(self->sup_source, (GPollFD*)&waits[i]);
wait_cbs = realloc(self->sup_wait_cbs, size * sizeof(*wait_cbs)); wait_cbs = realloc(self->sup_wait_cbs, size * sizeof(*wait_cbs));
if (wait_cbs) if (wait_cbs)
self->sup_wait_cbs = wait_cbs; self->sup_wait_cbs = wait_cbs;
@@ -618,7 +618,7 @@ int su_source_register(su_port_t *self,
/* Add sup_wait_roots array, if needed */ /* Add sup_wait_roots array, if needed */
wait_tasks = realloc(self->sup_wait_roots, size * sizeof(*wait_tasks)); wait_tasks = realloc(self->sup_wait_roots, size * sizeof(*wait_tasks));
if (wait_tasks) if (wait_tasks)
self->sup_wait_roots = wait_tasks; self->sup_wait_roots = wait_tasks;
if (!(indices && waits && wait_cbs && wait_args && wait_tasks)) { if (!(indices && waits && wait_cbs && wait_args && wait_tasks)) {
@@ -638,7 +638,7 @@ int su_source_register(su_port_t *self,
g_source_add_poll(self->sup_source, (GPollFD*)&self->sup_waits[n]); g_source_add_poll(self->sup_source, (GPollFD*)&self->sup_waits[n]);
self->sup_wait_cbs[n] = self->sup_wait_cbs[n-1]; self->sup_wait_cbs[n] = self->sup_wait_cbs[n-1];
self->sup_wait_args[n] = self->sup_wait_args[n-1]; self->sup_wait_args[n] = self->sup_wait_args[n-1];
self->sup_wait_roots[n] = self->sup_wait_roots[n-1]; self->sup_wait_roots[n] = self->sup_wait_roots[n-1];
} }
} }
else { else {
@@ -653,13 +653,13 @@ int su_source_register(su_port_t *self,
I = self->sup_max_index; I = self->sup_max_index;
for (i = 0; i < I; i++) for (i = 0; i < I; i++)
if (self->sup_indices[i] == UINT_MAX) if (self->sup_indices[i] == UINT_MAX)
break; break;
else if (self->sup_indices[i] >= n) else if (self->sup_indices[i] >= n)
self->sup_indices[i]++; self->sup_indices[i]++;
if (i == I) if (i == I)
self->sup_max_index++; self->sup_max_index++;
if (n + 1 < self->sup_n_waits) if (n + 1 < self->sup_n_waits)
@@ -676,23 +676,23 @@ int su_source_register(su_port_t *self,
} }
/** Unregister a su_wait_t object. /** Unregister a su_wait_t object.
* *
* The function su_source_unregister() unregisters a su_wait_t object. The * The function su_source_unregister() unregisters a su_wait_t object. The
* wait object, a callback function and a argument are removed from the * wait object, a callback function and a argument are removed from the
* port object. * port object.
* *
* @param self - pointer to port object * @param self - pointer to port object
* @param root - pointer to root object * @param root - pointer to root object
* @param wait - pointer to wait object * @param wait - pointer to wait object
* @param callback - callback function pointer (may be NULL) * @param callback - callback function pointer (may be NULL)
* @param arg - argument given to callback function when it is invoked * @param arg - argument given to callback function when it is invoked
* (may be NULL) * (may be NULL)
* *
* @return Nonzero index of the wait object, or -1 upon an error. * @return Nonzero index of the wait object, or -1 upon an error.
*/ */
int su_source_unregister(su_port_t *self, int su_source_unregister(su_port_t *self,
su_root_t *root, su_root_t *root,
su_wait_t *wait, su_wait_t *wait,
su_wakeup_f callback, /* XXX - ignored */ su_wakeup_f callback, /* XXX - ignored */
su_wakeup_arg_t *arg) su_wakeup_arg_t *arg)
{ {
@@ -700,7 +700,7 @@ int su_source_unregister(su_port_t *self,
unsigned i, I, j, *indices; unsigned i, I, j, *indices;
enter; enter;
assert(self); assert(self);
assert(SU_SOURCE_OWN_THREAD(self)); assert(SU_SOURCE_OWN_THREAD(self));
@@ -733,14 +733,14 @@ int su_source_unregister(su_port_t *self,
if (self->sup_indices[j] != UINT_MAX && if (self->sup_indices[j] != UINT_MAX &&
self->sup_indices[j] > n) self->sup_indices[j] > n)
self->sup_indices[j]--; self->sup_indices[j]--;
for (; n < N; n++) { for (; n < N; n++) {
g_source_remove_poll(self->sup_source, (GPollFD*)&self->sup_waits[n+1]); g_source_remove_poll(self->sup_source, (GPollFD*)&self->sup_waits[n+1]);
self->sup_waits[n] = self->sup_waits[n+1]; self->sup_waits[n] = self->sup_waits[n+1];
g_source_add_poll(self->sup_source, (GPollFD*)&self->sup_waits[n]); g_source_add_poll(self->sup_source, (GPollFD*)&self->sup_waits[n]);
self->sup_wait_cbs[n] = self->sup_wait_cbs[n+1]; self->sup_wait_cbs[n] = self->sup_wait_cbs[n+1];
self->sup_wait_args[n] = self->sup_wait_args[n+1]; self->sup_wait_args[n] = self->sup_wait_args[n+1];
self->sup_wait_roots[n] = self->sup_wait_roots[n+1]; self->sup_wait_roots[n] = self->sup_wait_roots[n+1];
} }
i += 1; /* 0 is failure */ i += 1; /* 0 is failure */
@@ -757,14 +757,14 @@ int su_source_unregister(su_port_t *self,
} }
/** Deregister a su_wait_t object. /** Deregister a su_wait_t object.
* *
* The function su_source_deregister() deregisters a su_wait_t registrattion. * The function su_source_deregister() deregisters a su_wait_t registrattion.
* The wait object, a callback function and a argument are removed from the * The wait object, a callback function and a argument are removed from the
* port object. * port object.
* *
* @param self - pointer to port object * @param self - pointer to port object
* @param i - registration index * @param i - registration index
* *
* @return Index of the wait object, or -1 upon an error. * @return Index of the wait object, or -1 upon an error.
*/ */
int su_source_deregister(su_port_t *self, int i) int su_source_deregister(su_port_t *self, int i)
@@ -774,7 +774,7 @@ int su_source_deregister(su_port_t *self, int i)
su_wait_t wait[1]; su_wait_t wait[1];
enter; enter;
assert(self); assert(self);
assert(SU_SOURCE_OWN_THREAD(self)); assert(SU_SOURCE_OWN_THREAD(self));
@@ -810,7 +810,7 @@ int su_source_deregister(su_port_t *self, int i)
g_source_add_poll(self->sup_source, (GPollFD*)&self->sup_waits[n]); g_source_add_poll(self->sup_source, (GPollFD*)&self->sup_waits[n]);
self->sup_wait_cbs[n] = self->sup_wait_cbs[n+1]; self->sup_wait_cbs[n] = self->sup_wait_cbs[n+1];
self->sup_wait_args[n] = self->sup_wait_args[n+1]; self->sup_wait_args[n] = self->sup_wait_args[n+1];
self->sup_wait_roots[n] = self->sup_wait_roots[n+1]; self->sup_wait_roots[n] = self->sup_wait_roots[n+1];
} }
indices[i - 1] = UINT_MAX; indices[i - 1] = UINT_MAX;
@@ -830,13 +830,13 @@ int su_source_deregister(su_port_t *self, int i)
* *
* The function su_source_unregister_all() unregisters all su_wait_t objects * The function su_source_unregister_all() unregisters all su_wait_t objects
* associated with given root object destroys all queued timers. * associated with given root object destroys all queued timers.
* *
* @param self - pointer to port object * @param self - pointer to port object
* @param root - pointer to root object * @param root - pointer to root object
* *
* @return Number of wait objects removed. * @return Number of wait objects removed.
*/ */
int su_source_unregister_all(su_port_t *self, int su_source_unregister_all(su_port_t *self,
su_root_t *root) su_root_t *root)
{ {
unsigned i, j; unsigned i, j;
@@ -847,15 +847,15 @@ int su_source_unregister_all(su_port_t *self,
su_root_t **wait_roots; su_root_t **wait_roots;
enter; enter;
assert(SU_SOURCE_OWN_THREAD(self)); assert(SU_SOURCE_OWN_THREAD(self));
n_waits = self->sup_n_waits; n_waits = self->sup_n_waits;
waits = self->sup_waits; waits = self->sup_waits;
wait_cbs = self->sup_wait_cbs; wait_cbs = self->sup_wait_cbs;
wait_args = self->sup_wait_args; wait_args = self->sup_wait_args;
wait_roots = self->sup_wait_roots; wait_roots = self->sup_wait_roots;
for (i = j = 0; (unsigned)i < n_waits; i++) { for (i = j = 0; (unsigned)i < n_waits; i++) {
if (wait_roots[i] == root) { if (wait_roots[i] == root) {
/* XXX - we should free all resources associated with this */ /* XXX - we should free all resources associated with this */
@@ -872,7 +872,7 @@ int su_source_unregister_all(su_port_t *self,
} }
j++; j++;
} }
self->sup_n_waits = j; self->sup_n_waits = j;
self->sup_registers++; self->sup_registers++;
@@ -898,7 +898,7 @@ int su_source_eventmask(su_port_t *self, int index, int socket, int events)
int retval; int retval;
enter; enter;
assert(self); assert(self);
assert(SU_SOURCE_OWN_THREAD(self)); assert(SU_SOURCE_OWN_THREAD(self));
assert(0 < index && (unsigned)index <= self->sup_max_index); assert(0 < index && (unsigned)index <= self->sup_max_index);
@@ -927,18 +927,18 @@ int su_source_multishot(su_port_t *self, int multishot)
return 1; return 1;
else if (multishot == 0 || multishot == 1) else if (multishot == 0 || multishot == 1)
return 1; /* Always enabled */ return 1; /* Always enabled */
else else
return (errno = EINVAL), -1; return (errno = EINVAL), -1;
} }
/** @internal Main loop. /** @internal Main loop.
* *
* The function @c su_source_run() runs the main loop * The function @c su_source_run() runs the main loop
* *
* The function @c su_source_run() runs until @c su_source_break() is called * The function @c su_source_run() runs until @c su_source_break() is called
* from a callback. * from a callback.
* *
* @param self pointer to root object * @param self pointer to root object
* */ * */
void su_source_run(su_port_t *self) void su_source_run(su_port_t *self)
@@ -947,7 +947,7 @@ void su_source_run(su_port_t *self)
GMainLoop *gml; GMainLoop *gml;
enter; enter;
gmc = g_source_get_context(self->sup_source); gmc = g_source_get_context(self->sup_source);
if (gmc && g_main_context_acquire(gmc)) { if (gmc && g_main_context_acquire(gmc)) {
gml = g_main_loop_new(gmc, TRUE); gml = g_main_loop_new(gmc, TRUE);
@@ -962,30 +962,30 @@ void su_source_run(su_port_t *self)
/** @internal /** @internal
* The function @c su_source_break() is used to terminate execution of @c * The function @c su_source_break() is used to terminate execution of @c
* su_source_run(). It can be called from a callback function. * su_source_run(). It can be called from a callback function.
* *
* @param self pointer to port * @param self pointer to port
* *
*/ */
void su_source_break(su_port_t *self) void su_source_break(su_port_t *self)
{ {
enter; enter;
if (self->sup_main_loop) if (self->sup_main_loop)
g_main_loop_quit(self->sup_main_loop); g_main_loop_quit(self->sup_main_loop);
} }
/** @internal Block until wait object is signaled or timeout. /** @internal Block until wait object is signaled or timeout.
* *
* This function waits for wait objects and the timers associated with * This function waits for wait objects and the timers associated with
* the root object. When any wait object is signaled or timer is * the root object. When any wait object is signaled or timer is
* expired, it invokes the callbacks. * expired, it invokes the callbacks.
* *
* This function returns when a callback has been invoked or @c tout * This function returns when a callback has been invoked or @c tout
* milliseconds is elapsed. * milliseconds is elapsed.
* *
* @param self pointer to port * @param self pointer to port
* @param tout timeout in milliseconds * @param tout timeout in milliseconds
* *
* @Return * @Return
* Milliseconds to the next invocation of timer, or @c SU_WAIT_FOREVER if * Milliseconds to the next invocation of timer, or @c SU_WAIT_FOREVER if
* there are no active timers. * there are no active timers.
@@ -995,7 +995,7 @@ su_duration_t su_source_step(su_port_t *self, su_duration_t tout)
GMainContext *gmc; GMainContext *gmc;
enter; enter;
gmc = g_source_get_context(self->sup_source); gmc = g_source_get_context(self->sup_source);
if (gmc && g_main_context_acquire(gmc)) { if (gmc && g_main_context_acquire(gmc)) {
@@ -1030,8 +1030,8 @@ su_duration_t su_source_step(su_port_t *self, su_duration_t tout)
} }
static int su_source_add_prepoll(su_port_t *port, static int su_source_add_prepoll(su_port_t *port,
su_root_t *root, su_root_t *root,
su_prepoll_f *prepoll, su_prepoll_f *prepoll,
su_prepoll_magic_t *magic) su_prepoll_magic_t *magic)
{ {
/* We could call prepoll in su_source_prepare()?? */ /* We could call prepoll in su_source_prepare()?? */
@@ -1066,7 +1066,7 @@ void su_source_dump(su_port_t const *self, FILE *f)
fprintf(f, "\tport tid %p\n", (void *)self->sup_tid); fprintf(f, "\tport tid %p\n", (void *)self->sup_tid);
fprintf(f, "\t%d wait objects\n", self->sup_n_waits); fprintf(f, "\t%d wait objects\n", self->sup_n_waits);
for (i = 0; i < self->sup_n_waits; i++) { for (i = 0; i < self->sup_n_waits; i++) {
} }
} }
@@ -1078,7 +1078,7 @@ void su_source_dump(su_port_t const *self, FILE *f)
* *
* @return * @return
* If successful a pointer to the new message port is returned, otherwise * If successful a pointer to the new message port is returned, otherwise
* NULL is returned. * NULL is returned.
*/ */
static su_port_t *su_source_port_create(void) static su_port_t *su_source_port_create(void)
{ {

View File

@@ -28,7 +28,7 @@
* @brief Test program for glib and su root event loop integration. * @brief Test program for glib and su root event loop integration.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Thu Mar 18 19:40:51 1999 pessi * @date Created: Thu Mar 18 19:40:51 1999 pessi
*/ */
@@ -74,7 +74,7 @@ short opt_verbatim = 0;
short opt_singlethread = 0; short opt_singlethread = 0;
GMainLoop *global_gmainloop = NULL; GMainLoop *global_gmainloop = NULL;
static su_socket_t udpsocket(void) static su_socket_t udpsocket(void)
{ {
su_socket_t s; su_socket_t s;
su_sockaddr_t su = { 0 }; su_sockaddr_t su = { 0 };
@@ -98,7 +98,7 @@ static su_socket_t udpsocket(void)
if (getsockname(s, &su.su_sa, &sulen) == SOCKET_ERROR) { if (getsockname(s, &su.su_sa, &sulen) == SOCKET_ERROR) {
su_perror("udpsocket: getsockname"); su_perror("udpsocket: getsockname");
exit(1); exit(1);
} }
if (opt_verbatim) if (opt_verbatim)
@@ -118,7 +118,7 @@ static char *snow(su_time_t now)
return buf; return buf;
} }
void void
do_ping(struct pinger *p, su_timer_t *t, void *p0) do_ping(struct pinger *p, su_timer_t *t, void *p0)
{ {
char buf[1024]; char buf[1024];
@@ -129,7 +129,7 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0)
p->when = su_now(); p->when = su_now();
snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when)); snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
if (sendto(p->s, buf, strlen(buf), 0, if (sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) { &p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_ping: send"); su_perror("do_ping: send");
} }
@@ -189,7 +189,7 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0)
p->id = 0; p->id = 0;
snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now())); snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now()));
if (sendto(p->s, buf, strlen(buf), 0, if (sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) { &p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_pong: send"); su_perror("do_pong: send");
} }
@@ -412,7 +412,7 @@ usage(int exitcode)
/* /*
* test su_wait functionality: * test su_wait functionality:
* *
* Create a ponger, waking up do_recv() when data arrives, * Create a ponger, waking up do_recv() when data arrives,
* then scheduling do_pong() by timer * then scheduling do_pong() by timer
* *
* Create a pinger, executed from timer, scheduling do_ping(), * Create a pinger, executed from timer, scheduling do_ping(),
@@ -428,8 +428,8 @@ int main(int argc, char *argv[])
su_timer_t *t; su_timer_t *t;
unsigned long sleeppid = 0; unsigned long sleeppid = 0;
struct pinger struct pinger
pinger = { PINGER, "ping", 1 }, pinger = { PINGER, "ping", 1 },
ponger = { PONGER, "pong", 1 }; ponger = { PONGER, "pong", 1 };
char *argv0 = argv[0]; char *argv0 = argv[0];
@@ -437,7 +437,7 @@ int main(int argc, char *argv[])
#if HAVE_OPEN_C #if HAVE_OPEN_C
dup2(1, 2); dup2(1, 2);
#endif #endif
while (argv[1]) { while (argv[1]) {
if (strcmp(argv[1], "-v") == 0) { if (strcmp(argv[1], "-v") == 0) {
opt_verbatim = 1; opt_verbatim = 1;
@@ -465,9 +465,9 @@ int main(int argc, char *argv[])
#if HAVE_OPEN_C #if HAVE_OPEN_C
opt_verbatim = 1; opt_verbatim = 1;
opt_singlethread = 1; opt_singlethread = 1;
su_log_soft_set_level(su_log_default, 9); su_log_soft_set_level(su_log_default, 9);
#endif #endif
#if HAVE_SIGNAL #if HAVE_SIGNAL
signal(SIGTERM, term); signal(SIGTERM, term);
#endif #endif
@@ -478,20 +478,20 @@ int main(int argc, char *argv[])
global_gmainloop = g_main_loop_new(NULL, FALSE); global_gmainloop = g_main_loop_new(NULL, FALSE);
g_assert(global_gmainloop); g_assert(global_gmainloop);
root = su_glib_root_create(NULL); root = su_glib_root_create(NULL);
if (!root) perror("su_root_glib_create"), exit(1); 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))) if (!g_source_attach(su_glib_root_gsource(root), g_main_loop_get_context(global_gmainloop)))
perror("g_source_attach"), exit(1); perror("g_source_attach"), exit(1);
su_root_threading(root, 0 && !opt_singlethread); su_root_threading(root, 0 && !opt_singlethread);
if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0) if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0)
perror("su_clone_start"), exit(1); perror("su_clone_start"), exit(1);
if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0) if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0)
perror("su_clone_start"), exit(1); perror("su_clone_start"), exit(1);
/* Test timer, exiting after 200 milliseconds */ /* Test timer, exiting after 200 milliseconds */
t = su_timer_create(su_root_task(root), 200L); t = su_timer_create(su_root_task(root), 200L);
@@ -499,7 +499,7 @@ int main(int argc, char *argv[])
su_perror("su_timer_create"), exit(1); su_perror("su_timer_create"), exit(1);
su_timer_set(t, (su_timer_f)do_exit, NULL); su_timer_set(t, (su_timer_f)do_exit, NULL);
su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong), su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong),
init_ping, 0); init_ping, 0);
su_msg_send(start_msg); su_msg_send(start_msg);
@@ -511,7 +511,7 @@ int main(int argc, char *argv[])
su_timer_destroy(t); su_timer_destroy(t);
if (pinger.rtt_n) { if (pinger.rtt_n) {
printf("%s executed %u pings in %g, mean rtt=%g sec\n", name, 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); pinger.rtt_n, pinger.rtt_total, pinger.rtt_total / pinger.rtt_n);
} }
su_root_destroy(root); su_root_destroy(root);
@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
g_main_loop_unref(global_gmainloop), global_gmainloop = NULL; g_main_loop_unref(global_gmainloop), global_gmainloop = NULL;
if (opt_verbatim) if (opt_verbatim)
printf("%s exiting\n", argv0); printf("%s exiting\n", argv0);
#ifndef HAVE_WIN32 #ifndef HAVE_WIN32
#if HAVE_SIGNAL #if HAVE_SIGNAL
@@ -531,6 +531,6 @@ int main(int argc, char *argv[])
#if HAVE_OPEN_C #if HAVE_OPEN_C
sleep(7); sleep(7);
#endif #endif
return 0; return 0;
} }

View File

@@ -23,7 +23,7 @@
*/ */
/** /**
* @brief Test program for su-glib timers * @brief Test program for su-glib timers
* *
* Based on torture_su_timer.c of libsofia-sip-ua. * Based on torture_su_timer.c of libsofia-sip-ua.
* *
@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
su_init(); atexit(su_deinit); su_init(); atexit(su_deinit);
tester->root = root = su_glib_root_create(tester); tester->root = root = su_glib_root_create(tester);
source = su_root_gsource(tester->root); source = su_root_gsource(tester->root);
g_source_attach(source, NULL /*g_main_context_default ()*/); g_source_attach(source, NULL /*g_main_context_default ()*/);

View File

@@ -9,7 +9,7 @@
2006-10-12 Kai Vehmanen <kai.vehmanen@nokia.com> 2006-10-12 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v3 frozen (3:0:3) for the 1.12.3 release * libsofia-sip-ua interface v3 frozen (3:0:3) for the 1.12.3 release
2006-09-26 Kai Vehmanen <kai.vehmanen@nokia.com> 2006-09-26 Kai Vehmanen <kai.vehmanen@nokia.com>
* libsofia-sip-ua interface v2 frozen (2:0:2) for the 1.12.2 release * libsofia-sip-ua interface v2 frozen (2:0:2) for the 1.12.2 release
@@ -27,9 +27,9 @@
* Added urltag_scan(). * Added urltag_scan().
2006-08-23 Pekka Pessi <Pekka.Pessi@nokia.com> 2006-08-23 Pekka Pessi <Pekka.Pessi@nokia.com>
* nta.c, nta.h: added nta_leg_make_replaces(), nta_leg_by_replaces(). * 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 * nua: event watcher (nua_subscribe, nua_watcher) now tries to re-establish
subscription if the subscription was terminated with reason "deactivated" or subscription if the subscription was terminated with reason "deactivated" or
"probation". Likewise, if SUBSCRIBE was returned a suitable error response "probation". Likewise, if SUBSCRIBE was returned a suitable error response
@@ -49,13 +49,13 @@
* <SUBDIRS>/Doxyfile: Fixed the use of doxytags. Now * <SUBDIRS>/Doxyfile: Fixed the use of doxytags. Now
a separate 'doxytags_MODNAME' file is created for each a separate 'doxytags_MODNAME' file is created for each
module. module.
2005-11-15 Kai Vehmanen <kai.vehmanen@nokia.com> 2005-11-15 Kai Vehmanen <kai.vehmanen@nokia.com>
* <SUBDIRS>/Makefile.am: Changed to use the 'include_sofia_HEADERS' * <SUBDIRS>/Makefile.am: Changed to use the 'include_sofia_HEADERS'
variable for listing public library headers. The variable variable for listing public library headers. The variable
is defined in the top-level configure.ac. is defined in the top-level configure.ac.
2005-10-27 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-10-27 Pekka Pessi <Pekka.Pessi@nokia.com>
* Always including stun library. * Always including stun library.
@@ -84,7 +84,7 @@
2005-10-14 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-10-14 Pekka Pessi <Pekka.Pessi@nokia.com>
* Shell syntax exercise. * Shell syntax exercise.
M ./autogen.sh -4 +4 M ./autogen.sh -4 +4
@@ -94,7 +94,7 @@
2005-10-13 Kai Vehmanen <kai.vehmanen@nokia.com> 2005-10-13 Kai Vehmanen <kai.vehmanen@nokia.com>
* <SUBDIRS>/Makefile.am: Build all submodules as proper shared * <SUBDIRS>/Makefile.am: Build all submodules as proper shared
libraries (noinst_LTLIBRARIES). Fixes sf.net:#1264030. libraries (noinst_LTLIBRARIES). Fixes sf.net:#1264030.
2005-09-09 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-09-09 Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -179,7 +179,7 @@
M ./iptsec/auth_module.c -5 +5 M ./iptsec/auth_module.c -5 +5
Thu Sep 8 21:10:23 EEST 2005 Pekka.Pessi@nokia.com Thu Sep 8 21:10:23 EEST 2005 Pekka.Pessi@nokia.com
* Added auth_digest_credentials(). * Added auth_digest_credentials().
Use opaque to match Authorization header. Use opaque to match Authorization header.
M ./iptsec/auth_digest_test.c -2 +3 M ./iptsec/auth_digest_test.c -2 +3
@@ -319,7 +319,7 @@
M ./url/url.c -1 +6 M ./url/url.c -1 +6
Thu Sep 8 18:01:17 EEST 2005 Pekka.Pessi@nokia.com Thu Sep 8 18:01:17 EEST 2005 Pekka.Pessi@nokia.com
* Explicitly using <errno.h> * Explicitly using <errno.h>
M ./msg/msg.c +2 M ./msg/msg.c +2
M ./msg/msg_mclass.c +1 M ./msg/msg_mclass.c +1
@@ -369,10 +369,10 @@
Thu Sep 8 03:11:35 EEST 2005 Pekka.Pessi@nokia.com Thu Sep 8 03:11:35 EEST 2005 Pekka.Pessi@nokia.com
* su_home_new and su_home_unref * su_home_new and su_home_unref
Added 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(). Fixed su_home_mutex_lock() and su_home_mutex_unlock().
Slightly changed semantics of su_home_clone() versus Slightly changed semantics of su_home_clone() versus
su_home_threadsafe(). su_home_threadsafe().
@@ -386,7 +386,7 @@
Thu Sep 8 03:07:17 EEST 2005 Pekka.Pessi@nokia.com Thu Sep 8 03:07:17 EEST 2005 Pekka.Pessi@nokia.com
* More liberal sdp parsing for config files. * More liberal sdp parsing for config files.
Be more liberal when parsing config files Be more liberal when parsing config files
(do not require v=, accept -1 as len argument). (do not require v=, accept -1 as len argument).
M ./sdp/sdp_parse.c -9 +25 M ./sdp/sdp_parse.c -9 +25
@@ -403,7 +403,7 @@
M ./sdp/sdp.h +2 M ./sdp/sdp.h +2
M ./sdp/sdp_parse.c +10 M ./sdp/sdp_parse.c +10
2005-09-08 Kai Vehmanen <kai.vehmanen@nokia.com> 2005-09-08 Kai Vehmanen <kai.vehmanen@nokia.com>
* Makefile.am: Workaround for automake bug related to adding * Makefile.am: Workaround for automake bug related to adding
@@ -416,7 +416,7 @@
2005-08-17 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-08-17 Pekka Pessi <Pekka.Pessi@nokia.com>
* Fixed BEGIN()/END() pairs in test programs. * Fixed BEGIN()/END() pairs in test programs.
2005-08-04 Pekka Pessi <Pekka.Pessi@nokia.com> 2005-08-04 Pekka Pessi <Pekka.Pessi@nokia.com>

View File

@@ -16,13 +16,13 @@ OPT_SUBDIRS_STUN =
OPT_SUBDIRS_HTTP = OPT_SUBDIRS_HTTP =
OPT_SUBDIRS_NTH = OPT_SUBDIRS_NTH =
if HAVE_STUN if HAVE_STUN
OPT_LIBADD += stun/libstun.la OPT_LIBADD += stun/libstun.la
OPT_SUBDIRS_STUN += stun OPT_SUBDIRS_STUN += stun
endif endif
if HAVE_NTH if HAVE_NTH
OPT_LIBADD += http/libhttp.la nth/libnth.la OPT_LIBADD += http/libhttp.la nth/libnth.la
OPT_SUBDIRS_HTTP += http OPT_SUBDIRS_HTTP += http
OPT_SUBDIRS_NTH += nth OPT_SUBDIRS_NTH += nth
endif endif
# note: order does matter in the subdir list # note: order does matter in the subdir list
@@ -37,7 +37,7 @@ DOXYGEN = doxygen
noinst_LTLIBRARIES = libsofia-sip-ua.la noinst_LTLIBRARIES = libsofia-sip-ua.la
libsofia_sip_ua_la_SOURCES = libsofia_sip_ua_la_SOURCES =
libsofia_sip_ua_la_LIBADD = bnf/libbnf.la \ libsofia_sip_ua_la_LIBADD = bnf/libbnf.la \
features/libfeatures.la \ features/libfeatures.la \
ipt/libipt.la \ ipt/libipt.la \
@@ -90,7 +90,7 @@ doxygen: built-sources
sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \ sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \
docs/$$d.doxytags > docs/$$d.doxytags.tmp && \ docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \ mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
done done
for d in $(DIST_SUBDIRS); do \ for d in $(DIST_SUBDIRS); do \
test -r $$d/Doxyfile \ test -r $$d/Doxyfile \
&& pushd $$d > /dev/null \ && pushd $$d > /dev/null \
@@ -102,7 +102,7 @@ doxygen: built-sources
sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \ sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \
docs/$$d.doxytags > docs/$$d.doxytags.tmp && \ docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \ mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
done done
${top_srcdir}/scripts/hide_emails.sh docs/html ${top_srcdir}/scripts/hide_emails.sh docs/html
if HAVE_LCOV if HAVE_LCOV

View File

@@ -96,10 +96,10 @@ size_t bnf_span_token(char const *s)
/** Span of a token */ /** Span of a token */
size_t bnf_span_token4(char const *s) size_t bnf_span_token4(char const *s)
{ {
char const *e = s; char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & bnf_token) while (_bnf_table[(unsigned char)(*e)] & bnf_token)
e++; e++;
return e - s; return e - s;
} }
char * bnf_span_token_end(char const *s) char * bnf_span_token_end(char const *s)
@@ -192,9 +192,9 @@ int span_canonic_ip4_address(char const *host, int *return_canonize)
/** Return length of valid IP4 address. /** Return length of valid IP4 address.
* *
* Note that we accept here up to two leading zeroes * Note that we accept here up to two leading zeroes
* which makes "dotted decimal" notation ambiguous: * which makes "dotted decimal" notation ambiguous:
* 127.000.000.001 is interpreted same as 127.0.0.1 * 127.000.000.001 is interpreted same as 127.0.0.1
* *
* Note that traditionally IP address octets starting * Note that traditionally IP address octets starting
* with zero have been interpreted as octal: * with zero have been interpreted as octal:
@@ -711,7 +711,7 @@ int host_is_ip4_address(char const *string)
/** Return true if @a string is valid IP6 address in hex notation. /** Return true if @a string is valid IP6 address in hex notation.
* *
* E.g., fe80::1 is a valid IP6 address. * E.g., fe80::1 is a valid IP6 address.
*/ */
int host_is_ip6_address(char const *string) int host_is_ip6_address(char const *string)
{ {
@@ -724,7 +724,7 @@ int host_ip6_reference(char const *string)
return host_is_ip6_reference(string); return host_is_ip6_reference(string);
} }
/** Return true if @a string is valid IP6 reference, /** Return true if @a string is valid IP6 reference,
* i.e. hex notation in square brackets. * i.e. hex notation in square brackets.
* *
* E.g., [::1] is a valid IP6 reference. * E.g., [::1] is a valid IP6 reference.
@@ -737,7 +737,7 @@ int host_is_ip6_reference(char const *string)
/** Return true if @a string is valid IP address. /** Return true if @a string is valid IP address.
* *
* Valid IP address is either a IP4 adddress in quad-octet notation, * Valid IP address is either a IP4 adddress in quad-octet notation,
* IP6 hex address or IP6 reference in square brackets ([]). * IP6 hex address or IP6 reference in square brackets ([]).
*/ */
int host_is_ip_address(char const *string) int host_is_ip_address(char const *string)
@@ -748,7 +748,7 @@ int host_is_ip_address(char const *string)
/** Return true if @a string is valid a domain name. /** Return true if @a string is valid a domain name.
* *
* Valid domain name consists of alphanumeric labels separated with * Valid domain name consists of alphanumeric labels separated with
* dot ("."). There can be a "-" in the middle of label. * dot ("."). There can be a "-" in the middle of label.
* The last label must start with a letter. * The last label must start with a letter.
* *
@@ -777,8 +777,8 @@ int host_is_valid(char const *string)
/** Returns true if @a string is describing a local address. /** Returns true if @a string is describing a local address.
* *
* Uses the definitions of local addresses found in RFC1700 and * Uses the definitions of local addresses found in RFC1700 and
* RFC4291. * RFC4291.
*/ */
int host_is_local(char const *host) int host_is_local(char const *host)
{ {
@@ -793,10 +793,10 @@ int host_is_local(char const *host)
n = span_domain(host); n = span_domain(host);
return return
n >= 9 /* strlen("localhost") */ && n >= 9 /* strlen("localhost") */ &&
strncasecmp(host, "localhost", 9) == 0 && strncasecmp(host, "localhost", 9) == 0 &&
(n == 9 || (n == 9 ||
((n == 10 || /* localhost. */ ((n == 10 || /* localhost. */
n == 21 || /* strlen("localhost.localdomain") */ n == 21 || /* strlen("localhost.localdomain") */
n == 22) && /* strlen("localhost.localdomain.") */ n == 22) && /* strlen("localhost.localdomain.") */
@@ -866,7 +866,7 @@ static size_t convert_ip_address(char const *s,
if (canonize) { if (canonize) {
char *tmp = buf; char *tmp = buf;
s = memcpy(tmp, s, len + 1); s = memcpy(tmp, s, len + 1);
scan_ip4_address(&tmp); scan_ip4_address(&tmp);
} }
if (s[len] == '\0' && su_inet_pton(AF_INET, s, addr) == 1) if (s[len] == '\0' && su_inet_pton(AF_INET, s, addr) == 1)
return (void)(*return_addrlen = 4), len; return (void)(*return_addrlen = 4), len;
@@ -877,14 +877,14 @@ static size_t convert_ip_address(char const *s,
/** Compare two host names or IP addresses /** Compare two host names or IP addresses
* *
* Converts valid IP addresses to the binary format before comparing them. * Converts valid IP addresses to the binary format before comparing them.
* Note that IP6-mapped IP4 addresses and IP6-compatible IP4 addresses are * 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 * compared as IP4 addresses; that is, ::ffff:127.0.0.1, ::127.0.0.1 and
* 127.0.0.1 all are all equal. * 127.0.0.1 all are all equal.
* *
* @param a IP address or domain name * @param a IP address or domain name
* @param b IP address or domain name * @param b IP address or domain name
* *
* @retval -1 if a < b * @retval -1 if a < b
* @retval 0 if a == b * @retval 0 if a == b
* @retval 1 if a > b * @retval 1 if a > b

View File

@@ -10,9 +10,9 @@
* *
* The interface used for validating hostnames and IP addresses is in * The interface used for validating hostnames and IP addresses is in
* <sofia-sip/hostdomain.h>. * <sofia-sip/hostdomain.h>.
* *
* @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com> * @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @STATUS @SofiaSIP Core library * @STATUS @SofiaSIP Core library
* *
* @LICENSE LGPL * @LICENSE LGPL

View File

@@ -26,11 +26,11 @@
#define BNF_H #define BNF_H
/**@file sofia-sip/bnf.h /**@file sofia-sip/bnf.h
* *
* Parsing macros and prototypes for HTTP-like protocols. * Parsing macros and prototypes for HTTP-like protocols.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Tue Jun 06 10:59:34 2000 ppessi * @date Created: Tue Jun 06 10:59:34 2000 ppessi
* *
*/ */
@@ -58,7 +58,7 @@ SOFIA_BEGIN_DECLS
/** Line-ending characters */ /** Line-ending characters */
#define CRLF CR LF #define CRLF CR LF
/** Whitespace */ /** Whitespace */
#define WS SP HT #define WS SP HT
/** Linear whitespace */ /** Linear whitespace */
#define LWS SP HT CR LF #define LWS SP HT CR LF
/** Lower-case alphabetic characters */ /** Lower-case alphabetic characters */
@@ -71,11 +71,11 @@ SOFIA_BEGIN_DECLS
#define DIGIT "0123456789" #define DIGIT "0123456789"
/** RTSP safe characters */ /** RTSP safe characters */
#define SAFE "$-_." /* RTSP stuff */ #define SAFE "$-_." /* RTSP stuff */
#define ALPHANUM DIGIT ALPHA #define ALPHANUM DIGIT ALPHA
#define HEX DIGIT "ABCDEF" "abcdef" #define HEX DIGIT "ABCDEF" "abcdef"
/** SIP token characters. /** SIP token characters.
* @note $|&^# were token chars in RFC 2543, but no more in RFC 3261. * @note $|&^# were token chars in RFC 2543, but no more in RFC 3261.
*/ */
#define SIP_TOKEN ALPHANUM "-.!%*_+`'~" #define SIP_TOKEN ALPHANUM "-.!%*_+`'~"
/** SIP separator characters */ /** SIP separator characters */
@@ -109,7 +109,7 @@ SOFIA_BEGIN_DECLS
#define skip_word(ss) (*(ss) += span_word(*(ss))) #define skip_word(ss) (*(ss) += span_word(*(ss)))
/** Test if @c is CR or LF */ /** Test if @c is CR or LF */
#define IS_CRLF(c) ((c) == '\r' || (c) == '\n') #define IS_CRLF(c) ((c) == '\r' || (c) == '\n')
/** Test if @c is linear whitespace */ /** Test if @c is linear whitespace */
#define IS_LWS(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') #define IS_LWS(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
/*#define IS_LWS(c) ((_bnf_table[(unsigned char)(c)] & bnf_lws))*/ /*#define IS_LWS(c) ((_bnf_table[(unsigned char)(c)] & bnf_lws))*/
@@ -150,7 +150,7 @@ enum {
bnf_unreserved = bnf_alpha | bnf_mark, /**< URL unreserved */ bnf_unreserved = bnf_alpha | bnf_mark, /**< URL unreserved */
bnf_separator = 32, /**< SIP separator */ bnf_separator = 32, /**< SIP separator */
/** SIP token, not alphabetic (0123456789-.!%*_+`'~) */ /** SIP token, not alphabetic (0123456789-.!%*_+`'~) */
bnf_token0 = 64 | bnf_safe, bnf_token0 = 64 | bnf_safe,
bnf_token = bnf_token0 | bnf_alpha, /**< SIP token */ bnf_token = bnf_token0 | bnf_alpha, /**< SIP token */
bnf_param0 = 128, /**< SIP parameter, not token */ bnf_param0 = 128, /**< SIP parameter, not token */
bnf_param = bnf_token | bnf_param0 /**< SIP/HTTP parameter */ bnf_param = bnf_token | bnf_param0 /**< SIP/HTTP parameter */
@@ -171,7 +171,7 @@ SOFIAPUBVAR unsigned char const _bnf_table[256];
/** Get number of characters before linear whitespace */ /** Get number of characters before linear whitespace */
#define span_non_lws(s) strcspn(s, LWS) #define span_non_lws(s) strcspn(s, LWS)
/** Calculate span of a linear whitespace. /** Calculate span of a linear whitespace.
* LWS = [*WSP CRLF] 1*WSP * LWS = [*WSP CRLF] 1*WSP
*/ */
su_inline isize_t span_lws(char const *s) su_inline isize_t span_lws(char const *s)
@@ -189,73 +189,73 @@ su_inline isize_t span_lws(char const *s)
/** Calculate span of a token or linear whitespace characters. */ /** Calculate span of a token or linear whitespace characters. */
su_inline isize_t span_token_lws(char const *s) su_inline isize_t span_token_lws(char const *s)
{ {
char const *e = s; char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & (bnf_token | bnf_lws)) while (_bnf_table[(unsigned char)(*e)] & (bnf_token | bnf_lws))
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of a token characters. */ /** Calculate span of a token characters. */
su_inline isize_t span_token(char const *s) su_inline isize_t span_token(char const *s)
{ {
char const *e = s; char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & bnf_token) while (_bnf_table[(unsigned char)(*e)] & bnf_token)
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of a alphabetic characters. */ /** Calculate span of a alphabetic characters. */
su_inline isize_t span_alpha(char const *s) su_inline isize_t span_alpha(char const *s)
{ {
char const *e = s; char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & bnf_alpha) while (_bnf_table[(unsigned char)(*e)] & bnf_alpha)
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of a digits. */ /** Calculate span of a digits. */
su_inline isize_t span_digit(char const *s) su_inline isize_t span_digit(char const *s)
{ {
char const *e = s; char const *e = s;
while (*e >= '0' && *e <= '9') while (*e >= '0' && *e <= '9')
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of a hex. */ /** Calculate span of a hex. */
su_inline isize_t span_hexdigit(char const *s) su_inline isize_t span_hexdigit(char const *s)
{ {
char const *e = s; char const *e = s;
while (IS_HEX(*e)) while (IS_HEX(*e))
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of characters belonging to an RTSP token */ /** Calculate span of characters belonging to an RTSP token */
su_inline isize_t span_alpha_digit_safe(char const *s) su_inline isize_t span_alpha_digit_safe(char const *s)
{ {
char const *e = s; char const *e = s;
while (_bnf_table[(unsigned char)(*e)] & (bnf_alpha | bnf_safe)) while (_bnf_table[(unsigned char)(*e)] & (bnf_alpha | bnf_safe))
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of a characters valid in parameters. */ /** Calculate span of a characters valid in parameters. */
su_inline isize_t span_param(char const *s) su_inline isize_t span_param(char const *s)
{ {
char const *e = s; char const *e = s;
while (IS_PARAM(*e)) while (IS_PARAM(*e))
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of a SIP word. */ /** Calculate span of a SIP word. */
su_inline isize_t span_word(char const *s) su_inline isize_t span_word(char const *s)
{ {
char const *e = s; char const *e = s;
while (*e && (IS_TOKEN(*e) || strchr(SIP_WORD, *e))) while (*e && (IS_TOKEN(*e) || strchr(SIP_WORD, *e)))
e++; e++;
return e - s; return e - s;
} }
/** Calculate span of a unreserved characters. */ /** Calculate span of a unreserved characters. */
@@ -290,13 +290,13 @@ su_inline isize_t span_quoted(char const *s)
/** Reserved in URLs */ /** Reserved in URLs */
#define URL_RESERVED ";/?:=+$," #define URL_RESERVED ";/?:=+$,"
/** Non-alphanumeric characters without syntactical meaning. */ /** Non-alphanumeric characters without syntactical meaning. */
#define URL_MARK "-_.!~*'()" #define URL_MARK "-_.!~*'()"
/** Unreserved characters. */ /** Unreserved characters. */
#define URL_UNRESERVED ALPHANUM URL_MARK #define URL_UNRESERVED ALPHANUM URL_MARK
/** URL hex escape. */ /** URL hex escape. */
#define URL_ESCAPED "%" #define URL_ESCAPED "%"
#define URL_DELIMS "<>#%\"" #define URL_DELIMS "<>#%\""
#define URL_UNWISE "{}|\\^[]`" #define URL_UNWISE "{}|\\^[]`"

View File

@@ -27,11 +27,11 @@
#define SOFIA_SIP_HOSTDOMAIN_H #define SOFIA_SIP_HOSTDOMAIN_H
/**@file sofia-sip/hostdomain.h /**@file sofia-sip/hostdomain.h
* *
* Predicates for handling host names: IP addresses or domain names. * Predicates for handling host names: IP addresses or domain names.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Thu Mar 9 16:15:22 EET 2006 ppessi * @date Created: Thu Mar 9 16:15:22 EET 2006 ppessi
*/ */
@@ -51,7 +51,7 @@ SOFIAPUBFUN int host_is_local(char const *string);
SOFIAPUBFUN int host_has_domain_invalid(char const *string); SOFIAPUBFUN int host_has_domain_invalid(char const *string);
SOFIAPUBFUN int host_cmp(char const *a, char const *b); SOFIAPUBFUN int host_cmp(char const *a, char const *b);
/** This is typo. @deprecated Use host_is_ip6_reference() instead. */ /** This is typo. @deprecated Use host_is_ip6_reference() instead. */
SOFIAPUBFUN int host_ip6_reference(char const *string); SOFIAPUBFUN int host_ip6_reference(char const *string);

View File

@@ -281,7 +281,7 @@ int host_test(void)
TEST_SCAN(scan_host, "127.255.249.000.a,", "127.255.249.000.a,", ","); 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, "0.00.000.000:,", "0.0.0.0", ":,");
TEST_SCAN(scan_host, "127.255.249.000,", "127.255.249.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", TEST_SCAN(scan_host, "[dead:beef:feed:ded:0:1:2:3]:1",
"[dead:beef:feed:ded::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_SCAN(scan_host, "[::127.0.0.1]:1", "[::127.0.0.1]:1", ":1");
@@ -323,10 +323,10 @@ int host_test(void)
/* Invalid IP4 address (extra leading zeros) */ /* Invalid IP4 address (extra leading zeros) */
TEST_1(!host_cmp("127.0.0.1", "127.0.0.01")); TEST_1(!host_cmp("127.0.0.1", "127.0.0.01"));
/* Invalid reference (extra leading zeros) */ /* Invalid reference (extra leading zeros) */
TEST_1(host_cmp("[0ffff:0ffff:0ffff:0ffff:0ffff:0ffff:255.255.255.255]", TEST_1(host_cmp("[0ffff:0ffff:0ffff:0ffff:0ffff:0ffff:255.255.255.255]",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")); "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
#if SU_HAVE_IN6 #if SU_HAVE_IN6
TEST_1(!host_cmp("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]", TEST_1(!host_cmp("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")); "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
TEST_1(!host_cmp("::1", "::001")); TEST_1(!host_cmp("::1", "::001"));
TEST_1(!host_cmp("[::1]", "::1")); TEST_1(!host_cmp("[::1]", "::1"));

View File

@@ -13,7 +13,7 @@
2005-09-08 Kai Vehmanen <kai.vehmanen@nokia.com> 2005-09-08 Kai Vehmanen <kai.vehmanen@nokia.com>
* hide_emails.sh: Fixed bug in hiding addresses of * hide_emails.sh: Fixed bug in hiding addresses of
form foo.bar-bar@something.org. Fixed sf.net form foo.bar-bar@something.org. Fixed sf.net
bug #1277167. bug #1277167.

View File

@@ -55,10 +55,10 @@ USE_PDFLATEX = YES
PDF_HYPERLINKS = YES PDF_HYPERLINKS = YES
COMPACT_LATEX = YES COMPACT_LATEX = YES
PAPER_TYPE = a4wide PAPER_TYPE = a4wide
EXTRA_PACKAGES = EXTRA_PACKAGES =
LATEX_BATCHMODE = YES LATEX_BATCHMODE = YES
FILE_PATTERNS = *.h *.c FILE_PATTERNS = *.h *.c
EXCLUDE_PATTERNS = acconfig.h config.h confdefs.h \ EXCLUDE_PATTERNS = acconfig.h config.h confdefs.h \
test*.h test*.c torture*.c *test.c *torture.c \ test*.h test*.c torture*.c *test.c *torture.c \

View File

@@ -11,7 +11,7 @@ INPUT = @srcdir@/mainpage.docs @srcdir@/docguide.docs @srcdir@/conformanc
GENERATE_TAGFILE = docs.doxytags GENERATE_TAGFILE = docs.doxytags
TAGFILES = TAGFILES =
TAGFILES += su.doxytags=su TAGFILES += su.doxytags=su
TAGFILES += ipt.doxytags=ipt TAGFILES += ipt.doxytags=ipt
TAGFILES += bnf.doxytags=bnf TAGFILES += bnf.doxytags=bnf

View File

@@ -22,7 +22,7 @@ EXTRA_DIST = Doxyfile.aliases Doxyfile.conf \
pictures/autotools.gif \ pictures/autotools.gif \
pictures/autotools.vsd \ pictures/autotools.vsd \
pictures/nta-receiving-message.eps \ pictures/nta-receiving-message.eps \
pictures/nta-receiving-message.gif pictures/nta-receiving-message.gif
BUILT_SOURCES = Doxyfile.rfc BUILT_SOURCES = Doxyfile.rfc

View File

@@ -145,9 +145,9 @@ below.
@ref sip_min_expires "Min-Expires", @ref sip_min_expires "Min-Expires",
@ref sip_mime_version "MIME-Version", @ref sip_mime_version "MIME-Version",
@ref sip_organization "Organization", @ref sip_organization "Organization",
@ref sip_p_asserted_identity "P-Asserted-Identity" @ref sip_p_asserted_identity "P-Asserted-Identity"
(extension in @VERSION_1_12_7), (extension in @VERSION_1_12_7),
@ref sip_p_preferred_identity "P-Preferred-Identity" @ref sip_p_preferred_identity "P-Preferred-Identity"
(extension in @VERSION_1_12_7), (extension in @VERSION_1_12_7),
@ref sip_priority "Priority", @ref sip_priority "Priority",
@ref sip_proxy_authenticate "Proxy-Authenticate", @ref sip_proxy_authenticate "Proxy-Authenticate",
@@ -479,7 +479,7 @@ below.
@RFC3325: Asserted Identity @RFC3325: Asserted Identity
</th> </th>
<td> <td>
Sofia-SIP supports Sofia-SIP supports
@ref sip_p_asserted_identity "P-Asserted-Identity" and @ref sip_p_asserted_identity "P-Asserted-Identity" and
@ref sip_p_preferred_identity "P-Preferred-Identity" headers @ref sip_p_preferred_identity "P-Preferred-Identity" headers
(generating, parsing and syntax checking). Also the non-standard (generating, parsing and syntax checking). Also the non-standard
@@ -952,7 +952,7 @@ below.
(generating, parsing and syntax checking). (generating, parsing and syntax checking).
The implicit subscription is suppressed by @nua, if the @ReferSub: The implicit subscription is suppressed by @nua, if the @ReferSub:
true header is included in the REFER true header is included in the REFER
request (@ref nua_refer "on server side") or request (@ref nua_refer "on server side") or
response (@ref nua_i_refer "on client side"). response (@ref nua_i_refer "on client side").
@@ -972,7 +972,7 @@ below.
<td> <td>
Sofia-SIP provides function sip_response_terminates_dialog() that Sofia-SIP provides function sip_response_terminates_dialog() that
can be used to determine the effect of error response with dialog. can be used to determine the effect of error response with dialog.
The nua UA engine uses sip_response_terminates_dialog(). The nua UA engine uses sip_response_terminates_dialog().
</td> </td>
<td> <td>
@@ -1131,7 +1131,7 @@ below.
<td> <td>
Application must take care of: Application must take care of:
- Audio or video processing - Audio or video processing
- Generating a=rtpmap or a=fmtp lines when needed - Generating a=rtpmap or a=fmtp lines when needed
</td> </td>
</tr> </tr>

View File

@@ -1,33 +1,33 @@
/*! /*!
@page docguide Documentation Guidelines @page docguide Documentation Guidelines
@section doxygen Using Doxygen @section doxygen Using Doxygen
Doxygen is a document generation program, used by many C/C++ projects. Its 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>. home page is at <a href="http://www.doxygen.org">http://www.doxygen.org</a>.
The Sofia documentation is written using Doxygen. The Sofia documentation is written using Doxygen.
Doxygen works by extracting the documentation data both from the actual Doxygen works by extracting the documentation data both from the actual
C/C++ source code and from the specially formatted comments. C/C++ source code and from the specially formatted comments.
The comments can contain some Javadoc-like The comments can contain some Javadoc-like
@ref doxycommands "special commands". @ref doxycommands "special commands".
In general the the style of the comments and documentation should follow the In general the the style of the comments and documentation should follow the
<a href="http://java.sun.com/j2se/javadoc/writingdoccomments/"> <a href="http://java.sun.com/j2se/javadoc/writingdoccomments/">
javadoc style guide</a>. javadoc style guide</a>.
A Doxygen comment must either contain reference about the entity A Doxygen comment must either contain reference about the entity
it is describing, e.g., command it is describing, e.g., command
\@file when describing files: \@file when describing files:
@verbatim @verbatim
/** /**
* @file foo.c * @file foo.c
* *
* Implementation of foo. The foo takes care of grokking xyzzy. * Implementation of foo. The foo takes care of grokking xyzzy.
* *
* @author Jaska Jokunen <jaska.jokunen@company.com> \n * @author Jaska Jokunen <jaska.jokunen@company.com> \n
* *
* @date Created: Wed Oct 20 15:06:51 EEST 2004 jasjoku * @date Created: Wed Oct 20 15:06:51 EEST 2004 jasjoku
*/ */
@endverbatim @endverbatim
@@ -40,7 +40,7 @@ comment. For example, documenting a function happens like this:
/** /**
* Orches a candometer. If orching candometer is not possible, it * Orches a candometer. If orching candometer is not possible, it
* tries to schadule hearping. * tries to schadule hearping.
* *
* @param[in] k pointer to a candometer * @param[in] k pointer to a candometer
* @param[in] level orching level * @param[in] level orching level
* @param[out] return_hearping return value for schaduled hearping * @param[out] return_hearping return value for schaduled hearping
@@ -59,15 +59,15 @@ int orch(cando_t *k, int level, hearping_t *return_hearping)
@subsection doxyfile Doxyfile and Doxyfile.conf @subsection doxyfile Doxyfile and Doxyfile.conf
The doxygen options are specified through a configuration file, The doxygen options are specified through a configuration file,
<i>Doxyfile</i>. As a convention, a module-specific Doxyfile includes <i>Doxyfile</i>. As a convention, a module-specific Doxyfile includes
a common file libsofia-sip-ua/docs/Doxyfile.conf. This makes it possible a common file libsofia-sip-ua/docs/Doxyfile.conf. This makes it possible
to keep the module-specific Doxyfiles as clean as possible: to keep the module-specific Doxyfiles as clean as possible:
@code @code
PROJECT_NAME = "ipt" PROJECT_NAME = "ipt"
OUTPUT_DIRECTORY = ../docs/ipt OUTPUT_DIRECTORY = ../docs/ipt
INPUT = ipt.docs . INPUT = ipt.docs .
@INCLUDE = ../Doxyfile.conf @INCLUDE = ../Doxyfile.conf
@@ -80,7 +80,7 @@ From the file above, you can observe some conventions. The
Doxygen-generated HTML documentation is collected in @b docs Doxygen-generated HTML documentation is collected in @b docs
subdirectory at top level. A separate output directory is created for subdirectory at top level. A separate output directory is created for
each submodule under it. Doxytags for the module are generated in the @e each submodule under it. Doxytags for the module are generated in the @e
doxytags file in the output directory. doxytags file in the output directory.
@subsection module_docs Module documentation in \<module\>.docs @subsection module_docs Module documentation in \<module\>.docs
@@ -105,7 +105,7 @@ Utility library for IP Telephony applications.
@section ipt_overview Overview @section ipt_overview Overview
This module contain some routines useful for IPT applications, like This module contain some routines useful for IPT applications, like
- ... - ...
- ... - ...
*/ */
@@ -115,7 +115,7 @@ This module contain some routines useful for IPT applications, like
In this section we go through the most common Doxygen commands. All In this section we go through the most common Doxygen commands. All
the commands are explained in the manual. the commands are explained in the manual.
The commands include The commands include
- @ref doxystyle "style commands (@@a, @@b, @@c, @@e, @@em, @@p)" - @ref doxystyle "style commands (@@a, @@b, @@c, @@e, @@em, @@p)"
- @ref doxyfuncs "function parameters and return values (@@param, @@return, @@retval)" - @ref doxyfuncs "function parameters and return values (@@param, @@return, @@retval)"
@@ -123,17 +123,17 @@ The commands include
The text style can be changed with @@b @b (bold), @@c @c (code), or The text style can be changed with @@b @b (bold), @@c @c (code), or
@@e @e (italic) commands. Function argument names use style command @@e @e (italic) commands. Function argument names use style command
@@a. @@a.
For example, a sentence "The @b Content-Type header @a ct specifies the @e 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 media-type of the message body, e.g., @c audio/amr would be AMR-encoded
audio." is produced with commands like audio." is produced with commands like
@code @code
The @b Content-Type header @a ct specifies the @e media-type of 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. the message body, e.g., @c audio/amr would be AMR-encoded audio.
@endcode @endcode
The style commands have synonyms, e.g., @@em and @@e mean same, as The style commands have synonyms, e.g., @@em and @@e mean same, as
well as @@c and @@p. well as @@c and @@p.
@subsection doxyfuncs Function Parameters and Return Values - @param, @return, @retval @subsection doxyfuncs Function Parameters and Return Values - @param, @return, @retval
@@ -150,11 +150,11 @@ values, e.g., enumeration or success/failure indication.
@verbatim @verbatim
/**Schadule hearping. /**Schadule hearping.
* *
* The function schadule() schadules a hearping. * The function schadule() schadules a hearping.
* *
* @param[in] h pointer to hearping * @param[in] h pointer to hearping
* *
* @retval 0 hearping was successful * @retval 0 hearping was successful
* @retval -1 an error occurred * @retval -1 an error occurred
*/ */
@@ -170,12 +170,12 @@ An example code fragment can be included using @@code and @@endcode
commands. commands.
@verbatim @verbatim
/**Destroy a hearping. /**Destroy a hearping.
* *
* The function hearping_destroy() deinitializes a hearping and * The function hearping_destroy() deinitializes a hearping and
* reclaims the memory allocated for it. * reclaims the memory allocated for it.
* *
* @param[in,out] h pointer to pointer to hearping * @param[in,out] h pointer to pointer to hearping
* *
* The function clears the pointer to hearping, so it must be called * The function clears the pointer to hearping, so it must be called
* with a pointer to pointer: * with a pointer to pointer:
* @code * @code
@@ -204,7 +204,7 @@ usually at top after the LGPL reference, containing @@file command or alias
When the structure of the documentation does not follow directory or file When the structure of the documentation does not follow directory or file
structure, it is possible to use grouping commands @@defgroup and @@ingroup. structure, it is possible to use grouping commands @@defgroup and @@ingroup.
The command @@defgroup creates a group, and @@ingroup adds an entry to an The command @@defgroup creates a group, and @@ingroup adds an entry to an
group. group.
@subsection doclinking Creating Links @subsection doclinking Creating Links
@@ -215,7 +215,7 @@ 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. variable is prefixed with hash @#, Doxygen creates a link to it.
It is also possible to create links with freely selected link to It is also possible to create links with freely selected link to
documentation entries with @@link and @@endlink commands. documentation entries with @@link and @@endlink commands.
When the link target is a named page, section, or subsection, it is possible When the link target is a named page, section, or subsection, it is possible
to use the @@ref command. to use the @@ref command.

View File

@@ -8,39 +8,39 @@ This document contains automatically generated reference documentation
for Sofia-SIP components. Some introductory material and for Sofia-SIP components. Some introductory material and
pointers to the example code are also included. pointers to the example code are also included.
For a list of module specific pages, see @ref subdirs For a list of module specific pages, see @ref subdirs
"source tree structure" or direct links to submodules:<br> "source tree structure" or direct links to submodules:<br>
<a href="nua/index.html">nua</a> <a href="nua/index.html">nua</a>
<a href="su/index.html">su</a> <a href="su/index.html">su</a>
<a href="features/index.html">features</a> <a href="features/index.html">features</a>
<a href="soa/index.html">soa</a> <a href="soa/index.html">soa</a>
<a href="sdp/index.html">sdp</a> <a href="sdp/index.html">sdp</a>
<a href="nta/index.html">nta</a> <a href="nta/index.html">nta</a>
<a href="tport/index.html">tport</a> <a href="tport/index.html">tport</a>
<a href="sresolv/index.html">sresolv</a> <a href="sresolv/index.html">sresolv</a>
<a href="sip/index.html">sip</a> <a href="sip/index.html">sip</a>
<a href="msg/index.html">msg</a> <a href="msg/index.html">msg</a>
<a href="url/index.html">url</a> <a href="url/index.html">url</a>
<a href="stun/index.html">stun</a> <a href="stun/index.html">stun</a>
<a href="iptsec/index.html">iptsec</a> <a href="iptsec/index.html">iptsec</a>
<a href="nea/index.html">nea</a> <a href="nea/index.html">nea</a>
<a href="nth/index.html">nth</a> <a href="nth/index.html">nth</a>
<a href="http/index.html">http</a> <a href="http/index.html">http</a>
<a href="bnf/index.html">bnf</a> <a href="bnf/index.html">bnf</a>
<a href="ipt/index.html">ipt</a> <a href="ipt/index.html">ipt</a>
@section who Contact Information @section who Contact Information
You can download latest Sofia SIP from the project You can download latest Sofia SIP from the project
<a href="http://sofia-sip.sf.net">home page</a> at <a href="http://sofia-sip.sf.net">home page</a> at
<a href="sf.net">Sourceforge.net</a>. <a href="sf.net">Sourceforge.net</a>.
Please contact us if you have questions regarding this software: Please contact us if you have questions regarding this software:
<ul> <ul>
<li>Pekka Pessi <Pekka.Pessi@nokia.com></li> <li>Pekka Pessi <Pekka.Pessi@nokia.com></li>
<li>Kai Vehmanen <Kai.Vehmanen@nokia.com></li> <li>Kai Vehmanen <Kai.Vehmanen@nokia.com></li>
</ul> </ul>
Or post to the Sofia-SIP mailing list: Or post to the Sofia-SIP mailing list:
@@ -68,7 +68,7 @@ Common runtime library:
SIP Signaling: SIP Signaling:
- <a href="nua/index.html">"nua" - SIP User Agent library</a> - <a href="nua/index.html">"nua" - SIP User Agent library</a>
- <a href="nea/index.html">"nea" - SIP Event API</a> - <a href="nea/index.html">"nea" - SIP Event API</a>
- <a href="iptsec/index.html">"iptsec" - - <a href="iptsec/index.html">"iptsec" -
Digest authentication for HTTP and SIP</a> Digest authentication for HTTP and SIP</a>
- <a href="nta/index.html">"nta" - SIP transaction engine</a> - <a href="nta/index.html">"nta" - SIP transaction engine</a>
- <a href="tport/index.html">"tport" - Message transport</a> - <a href="tport/index.html">"tport" - Message transport</a>
@@ -103,7 +103,7 @@ This document gives general guidelines on generic C style and code
formatting within Sofia-SIP. The guidelines include identifier naming formatting within Sofia-SIP. The guidelines include identifier naming
conventions, indenting convention, and tool usage directions. conventions, indenting convention, and tool usage directions.
Please note that C style is always a matter of taste. Please note that C style is always a matter of taste.
@section naming Naming Conventions @section naming Naming Conventions
@@ -177,7 +177,7 @@ The default indentation can be achieved with GNU indent with options
-saw -nsc -nsob -nss -saw -nsc -nsob -nss
@endcode @endcode
Loops without condition use @c for @c (;;) instead of @c while @c (1). Loops without condition use @c for @c (;;) instead of @c while @c (1).
@code @code
for (;;) { for (;;) {
@@ -220,7 +220,7 @@ separate C files and isolated from the rest of the software with a
wrapper interface. wrapper interface.
SU module handles abstraction to OS specific functionality such as SU module handles abstraction to OS specific functionality such as
memory management, sockets, threads and time functions. memory management, sockets, threads and time functions.
@subsection ansi_99 ANSI C 99 features @subsection ansi_99 ANSI C 99 features
@@ -322,7 +322,7 @@ struct foo {
If compiler decides to pack this structure, this code generates a 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 structure that has @a bar and @a foo in the first seven bits, and then
@a something beginning from the next 32 bit boundary. @a something beginning from the next 32 bit boundary.
One problem arises when using packed bit-fields: on ARM it is 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 generally not possible to access a 32 bit field that does not start from
@@ -348,9 +348,9 @@ binary protocols), don't use them.
@section file_organization File and Directory Structure @section file_organization File and Directory Structure
A Sofia-SIP library module can be defined as a subdirectory under the A Sofia-SIP library module can be defined as a subdirectory under the
libsofia-sip-ua directory hierarchy that contains a file \<modulename\>.docs libsofia-sip-ua directory hierarchy that contains a file \<modulename\>.docs
(where the \<modulename\> of course referes to the actual name of (where the \<modulename\> of course referes to the actual name of
the module). the module).
In case you like to start developing a new module, please 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 contact Sofia-SIP development team so that they can help you to set up
@@ -364,16 +364,16 @@ An overview of the contents of a module directory:
Contains any pictures/images Contains any pictures/images
that are needed by the module documentation. The that are needed by the module documentation. The
file formats to use are GIF (for html pages) and file formats to use are GIF (for html pages) and
EPS (for latex). If some program (e.g. MS Visio) is EPS (for latex). If some program (e.g. MS Visio) is
used to create the pictures, also the original used to create the pictures, also the original
files must be stored here.\n files must be stored here.\n
(Note that old modules may have "images" subdirectory instead of (Note that old modules may have "images" subdirectory instead of
"pictures") "pictures")
- files Makefile.am \n - files Makefile.am \n
See section @ref build "dealing with GNU Autotools" below. See section @ref build "dealing with GNU Autotools" below.
- (optionally) source code file(s) of the module and module tests. - (optionally) source code file(s) of the module and module tests.
The source code file(s) can also be located in subdirectories if necesary. The source code file(s) can also be located in subdirectories if necesary.
@section oo_with_c Writing Object-Oriented Code @section oo_with_c Writing Object-Oriented Code
@@ -423,17 +423,17 @@ header-specific data, like header name.
@subsection oo_derived Inheritance and Derived Objects @subsection oo_derived Inheritance and Derived Objects
Inheritance is a object-oriented practice that has limited use in Sofia. 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 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 derived from #su_home_t, which means that they can use the various
home-based memory management functions from <su_alloc.h>. home-based memory management functions from <su_alloc.h>.
In this sence, inheritance means that a pointer to a derived object can be 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 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: must have the base object at the beginning of its memory area:
@code @code
struct derived struct derived
{ {
struct base base[1]; struct base base[1];
int extra; int extra;
@@ -452,19 +452,19 @@ The third alternative works because base was used as a 1-element array.
@subsection oo_templates Templates @subsection oo_templates Templates
There are a few template types implemented as macros in Sofia libraries. 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 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 to define hash tables types and accessor functions for different object, and
red-black tree, defined in <sofia-sip/rbtree.h>. red-black tree, defined in <sofia-sip/rbtree.h>.
@section memory Memory Management @section memory Memory Management
The home-based memory management is useful when a lot of memory blocks are 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, allocated for given task. The allocations are done via the memory home,
which keeps a reference to each allocated memory block. When the memory 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 home is then freed, it will free all memory blocks to which it has
reference. This simplifies application logic because application code does reference. This simplifies application logic because application code does
not need to keep track of the allocated memory and free every allocated block not need to keep track of the allocated memory and free every allocated block
separately. separately.
See documentation of <sofia-sip/su_alloc.h> and @ref su_alloc "memory managment tutorial" See documentation of <sofia-sip/su_alloc.h> and @ref su_alloc "memory managment tutorial"
@@ -502,8 +502,8 @@ A typical example of use of a memory home is to have a memory home structure
@subsection combining Combining allocations @subsection combining Combining allocations
Another place where home-based memory management makes programmers Another place where home-based memory management makes programmers
life easier is case where a sub-procedure makes multiple memory allocations 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 fails, all the allocations must be released
and, in case the sub-procedure is succesfull, all allocations must be and, in case the sub-procedure is succesfull, all allocations must be
controlled by upper level memory management. controlled by upper level memory management.
@@ -522,7 +522,7 @@ controlled by upper level memory management.
} }
/* destroy temporary memory home (and registered allocations) */ /* destroy temporary memory home (and registered allocations) */
/* Note than in case processing was succesfull the memory */ /* Note than in case processing was succesfull the memory */
/* registrations were already moved to upper level home. */ /* registrations were already moved to upper level home. */
su_home_deinit(temphome); su_home_deinit(temphome);
/* return ok/not-ok */ /* return ok/not-ok */
@@ -542,9 +542,9 @@ Here are some ideas of what you should test:
- valid args - valid args
- not valid args - not valid args
- Aim for 100% line coverage\n - Aim for 100% line coverage\n
(If there is a line of code that you have not tested, you don't know (If there is a line of code that you have not tested, you don't know
if its working.) \n if its working.) \n
For selected part of code you should also aim for For selected part of code you should also aim for
100% branch/path coverage.\n 100% branch/path coverage.\n
But be anyway reasonable with these because in practise complete But be anyway reasonable with these because in practise complete
coverage is next to impossible to achive (so 80% is ok in practise). coverage is next to impossible to achive (so 80% is ok in practise).
@@ -573,13 +573,13 @@ test_foo_LDADD = -L. -lmy
Each test program should either return zero for success or a non-zero 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", 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. @b my_test_foo and @b my_test_bar will be built and then run.
Make will print a Make will print a
summary of how the tests went. As these tests are run from the build 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 system, the tests must be non-interactive (no questions asked) and not
rely on any files that are not in version control system. rely on any files that are not in version control system.
Sofia SIP's top-level makefile contains a recursive check target, so 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 you can use "cd sofia-sip ; make check" to run all the existing tests
with a single command. with a single command.
@@ -594,7 +594,7 @@ A good introduction to these tools is available at
<a href="http://developer.gnome.org/doc/books/WGA/generating-makefiles.html"> <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> developer.gnome.org</a>. <a href="http://sources.redhat.com/autobook">Autobook</a>
provides more detailed documentation for autoconf and automake. provides more detailed documentation for autoconf and automake.
The <a href="http://www.gnu.org/manual/make/">GNU make manual</a> The <a href="http://www.gnu.org/manual/make/">GNU make manual</a>
is also a good source of information. is also a good source of information.
@subsection autogen_sh autogen.sh @subsection autogen_sh autogen.sh
@@ -629,14 +629,14 @@ Contact Sofia-SIP development team, if you need changes to these files.
@subsection aclocal_m4 aclocal.m4 @subsection aclocal_m4 aclocal.m4
The aclocal.m4 contains the definitions of the autoconf macros used in The aclocal.m4 contains the definitions of the autoconf macros used in
@b configure.ac. @b configure.ac.
This file is generated by aclocal command. This file is generated by aclocal command.
@subsection Makefile_am Makefile.am @subsection Makefile_am Makefile.am
Makefile.am is where you define what programs and libraries should Makefile.am is where you define what programs and libraries should
be built, and also what source files are needed to create them. be built, and also what source files are needed to create them.
When you run automake, it creates the file Makefile.in. When you run automake, it creates the file Makefile.in.
@@ -644,12 +644,12 @@ This file is created by the developer of the module.
@subsection configure configure @subsection configure configure
When you run configure script, it performs all the checks defined in 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 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 @b xxx files. All @c @@FOO@@ variables in the source @b *.in files are
replaced with values found during the configuration process. For instance replaced with values found during the configuration process. For instance
the variable @c @@srcdir@@ in @b Makefile.in is replaced in @b Makefile the variable @c @@srcdir@@ in @b Makefile.in is replaced in @b Makefile
with the source directory path (useful when compiling outside the main with the source directory path (useful when compiling outside the main
source tree). source tree).
This file is generated by autoconf command. This file is generated by autoconf command.
@@ -658,14 +658,14 @@ This file is generated by autoconf command.
This script stores the last parameters given to configre command. This script stores the last parameters given to configre command.
If necessary you can rerun the last given configure script (with given If necessary you can rerun the last given configure script (with given
parameters) by using command "./config.status -r" or parameters) by using command "./config.status -r" or
"./config.status --recheck". "./config.status --recheck".
This file is generated by configure script. This file is generated by configure script.
@subsection config_cache config.cache @subsection config_cache config.cache
This file contains results of the various checks that configure script This file contains results of the various checks that configure script
performed. In case the configure script failed, you might try to performed. In case the configure script failed, you might try to
delete this file and run the configure script again. delete this file and run the configure script again.
@@ -673,8 +673,8 @@ This file is generated by configure script.
@subsection Makefile Makefile @subsection Makefile Makefile
The @b Makefile contains the actual rules how to build the target 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 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. is generated from @b Makefile.in when you run @c autoconf command.
Ensure that "make dist" and "make install" targets work. Ensure that "make dist" and "make install" targets work.
@@ -726,7 +726,7 @@ The defined debug output levels are:
- 7 SU_DEBUG_7() - media protocol actions (incoming packets, ...) - 7 SU_DEBUG_7() - media protocol actions (incoming packets, ...)
- 9 SU_DEBUG_9() - entering/exiting functions, very verbatim progress - 9 SU_DEBUG_9() - entering/exiting functions, very verbatim progress
In addition to the macros mentioned above, there is also functions for In addition to the macros mentioned above, there is also functions for
printing logging messages: printing logging messages:
- su_llog(), su_vllog() - su_llog(), su_vllog()
- su_perror(), su_perror2() - su_perror(), su_perror2()

View File

@@ -43,15 +43,15 @@
*/ */
char const * const sofia_sip_name_version = SOFIA_SIP_NAME_VERSION; char const * const sofia_sip_name_version = SOFIA_SIP_NAME_VERSION;
/** The name and version of software package providing S/MIME functionality, /** The name and version of software package providing S/MIME functionality,
* NULL if none. * NULL if none.
*/ */
char const * sofia_sip_has_smime; char const * sofia_sip_has_smime;
/** The name and version of software package providing TLS functionality, /** The name and version of software package providing TLS functionality,
* NULL if none. * NULL if none.
* *
* TLS over TCP is used as transport for SIP messages when using SIPS * TLS over TCP is used as transport for SIP messages when using SIPS
* scheme. Using TLS over TCP with SIP is described in @RFC3261. * scheme. Using TLS over TCP with SIP is described in @RFC3261.
*/ */
@@ -61,16 +61,16 @@ char const * sofia_sip_has_tls = tls_version;
char const * sofia_sip_has_tls; char const * sofia_sip_has_tls;
#endif #endif
/** The name and version of software package providing DTLS functionality, /** The name and version of software package providing DTLS functionality,
* NULL if none. * NULL if none.
* *
* DTLS or TLS over datagram transport (UDP) can be used as transport for * DTLS or TLS over datagram transport (UDP) can be used as transport for
* SIP messages. * SIP messages.
*/ */
char const * sofia_sip_has_dtls; char const * sofia_sip_has_dtls;
/** The name and version of software package providing TLS over SCTP functionality, /** The name and version of software package providing TLS over SCTP functionality,
* NULL if none. * NULL if none.
* *
* TLS over SCTP can be used as transport for SIP messages. * TLS over SCTP can be used as transport for SIP messages.
*/ */
@@ -80,8 +80,8 @@ char const * sofia_sip_has_tls_sctp;
#include <sigcomp.h> #include <sigcomp.h>
#endif #endif
/** The name and version of software package providing SigComp functionality, /** The name and version of software package providing SigComp functionality,
* NULL if none. * NULL if none.
* *
* SigComp can be used to compress SIP messages. * SigComp can be used to compress SIP messages.
*/ */
@@ -91,8 +91,8 @@ char const * sofia_sip_has_sigcomp = sigcomp_package_version;
char const * sofia_sip_has_sigcomp; char const * sofia_sip_has_sigcomp;
#endif #endif
/** The name and version of software package providing STUN functionality, /** The name and version of software package providing STUN functionality,
* NULL if none. * NULL if none.
* *
* STUN is a protocol used to traverse NATs with UDP. * STUN is a protocol used to traverse NATs with UDP.
*/ */
@@ -103,21 +103,21 @@ char const * sofia_sip_has_stun = stun_version;
char const * sofia_sip_has_stun; char const * sofia_sip_has_stun;
#endif #endif
/** The name and version of software package providing TURN functionality, /** The name and version of software package providing TURN functionality,
* NULL if none. * NULL if none.
* *
* TURN is a protocol used to traverse NATs or firewalls with TCP or UDP. * TURN is a protocol used to traverse NATs or firewalls with TCP or UDP.
*/ */
char const * sofia_sip_has_turn; char const * sofia_sip_has_turn;
/** The name and version of software package providing UPnP functionality, /** The name and version of software package providing UPnP functionality,
* NULL if none. * NULL if none.
* *
* UPnP (Universal Plug and Play) can be used to traverse NATs or firewalls. * UPnP (Universal Plug and Play) can be used to traverse NATs or firewalls.
*/ */
char const * sofia_sip_has_upnp; char const * sofia_sip_has_upnp;
/** The name and version of software package providing SCTP functionality, /** The name and version of software package providing SCTP functionality,
* NULL if none. * NULL if none.
* *
* SCTP can be used as transport for SIP messages. The software providing it * SCTP can be used as transport for SIP messages. The software providing it
@@ -126,7 +126,7 @@ char const * sofia_sip_has_upnp;
char const * sofia_sip_has_sctp; char const * sofia_sip_has_sctp;
/* We don't have viable SCTP transport interface */ /* We don't have viable SCTP transport interface */
/** The name and version of software package providing IPv6 functionality, /** The name and version of software package providing IPv6 functionality,
* NULL if none. * NULL if none.
* *
* IPv6 can be used to send SIP messages. * IPv6 can be used to send SIP messages.

View File

@@ -22,8 +22,8 @@ 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 installed @a libsofia-sip-ua.so library. The macro #SOFIA_SIP_NAME_VERSION
contains the name and release of currently available include files. contains the name and release of currently available include files.
The Sofia SIP binary API hides some protocols used under the SIP stack. 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. While the binary API stays the same, the features are not necessarily there.
These features are mainly related to encryption, compression and underlying These features are mainly related to encryption, compression and underlying
transports. transports.

View File

@@ -1,7 +1,7 @@
PROJECT_NAME = "http" PROJECT_NAME = "http"
OUTPUT_DIRECTORY = ../docs/html/http OUTPUT_DIRECTORY = ../docs/html/http
INPUT = @srcdir@/http.docs @srcdir@/sofia-sip sofia-sip @srcdir@ . INPUT = @srcdir@/http.docs @srcdir@/sofia-sip sofia-sip @srcdir@ .
@INCLUDE_PATH = . @srcdir@ @INCLUDE_PATH = . @srcdir@
@INCLUDE = ../docs/Doxyfile.conf @INCLUDE = ../docs/Doxyfile.conf

View File

@@ -29,12 +29,12 @@ 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_parser.h sofia-sip/http_tag_class.h \
sofia-sip/http_status.h sofia-sip/http_hclasses.h sofia-sip/http_status.h sofia-sip/http_hclasses.h
BUILT_H = sofia-sip/http_protos.h sofia-sip/http_tag.h BUILT_H = sofia-sip/http_protos.h sofia-sip/http_tag.h
BUILT_C = http_tag.c http_parser_table.c BUILT_C = http_tag.c http_parser_table.c
BUILT_SOURCES = $(BUILT_H) $(BUILT_C) http_tag_ref.c BUILT_SOURCES = $(BUILT_H) $(BUILT_C) http_tag_ref.c
nobase_include_sofia_HEADERS = $(BUILT_H) $(PUBLIC_H) nobase_include_sofia_HEADERS = $(BUILT_H) $(PUBLIC_H)
libhttp_la_SOURCES = $(INTERNAL_H) \ libhttp_la_SOURCES = $(INTERNAL_H) \
http_parser.c http_header.c \ http_parser.c http_header.c \
@@ -77,7 +77,7 @@ SS_HTTP_H = ${srcdir}/sofia-sip/http.h
${BUILT_H} ${BUILT_C}: ${srcdir}/sofia-sip/http.h ${MSG_PARSER_AWK} ${BUILT_H} ${BUILT_C}: ${srcdir}/sofia-sip/http.h ${MSG_PARSER_AWK}
sofia-sip/http_protos.h: ${srcdir}/sofia-sip/http_protos.h.in sofia-sip/http_protos.h: ${srcdir}/sofia-sip/http_protos.h.in
@-mkdir sofia-sip 2>/dev/null || true @-mkdir sofia-sip 2>/dev/null || true
${AWK_HTTP_AWK} PR=$@ TEMPLATE=${srcdir}/sofia-sip/http_protos.h.in ${SS_HTTP_H} ${AWK_HTTP_AWK} PR=$@ TEMPLATE=${srcdir}/sofia-sip/http_protos.h.in ${SS_HTTP_H}

View File

@@ -26,13 +26,13 @@
* - @c http_X_t is the structure used to store parsed header, * - @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_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_p() tests if header object is instance of header X,
* - @c http_X_make() is a macro that creates a header X object by * - @c http_X_make() is a macro that creates a header X object by
decoding given string, decoding given string,
* - @c http_X_dup() duplicates (deeply copies) the header X (macro), * - @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 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 * - @c #msg_hclass_t http_X_class[] contains the @em header @em class
* for header X. * for header X.
* *
* In addition to this interface, the parser provider interface is * In addition to this interface, the parser provider interface is
* documented in the <a href="../sip/group__sip__parser.html">SIP Parser module</a>. * 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 * The parser provider interface makes it possible to extend HTTP parser with

View File

@@ -197,7 +197,7 @@ issize_t http_status_d(su_home_t *home, http_header_t *h, char *s, isize_t slen)
if (msg_firstline_d(s, &status, &phrase) < 0 || if (msg_firstline_d(s, &status, &phrase) < 0 ||
http_version_d(&s, &st->st_version) < 0 || *s || http_version_d(&s, &st->st_version) < 0 || *s ||
msg_uint32_d(&status, &code) == -1 || msg_uint32_d(&status, &code) == -1 ||
status[0]) status[0])
return -1; return -1;
@@ -341,7 +341,7 @@ HTTP_HEADER_CLASS_LIST(allow, "Allow", list);
#define http_authentication_info_dup_one msg_list_dup_one #define http_authentication_info_dup_one msg_list_dup_one
msg_hclass_t http_authentication_info_class[] = msg_hclass_t http_authentication_info_class[] =
HTTP_HEADER_CLASS(authentication_info, "Authentication-Info", HTTP_HEADER_CLASS(authentication_info, "Authentication-Info",
ai_params, list, authentication_info); ai_params, list, authentication_info);
/* ====================================================================== */ /* ====================================================================== */
@@ -427,7 +427,7 @@ HTTP_HEADER_CLASS_LIST(connection, "Connection", list_critical);
/**@ingroup http_content_range /**@ingroup http_content_range
* @typedef typedef struct http_content_range_s http_content_range_t; * @typedef typedef struct http_content_range_s http_content_range_t;
* *
* The structure #http_content_range_t contains representation of * The structure #http_content_range_t contains representation of
* @b Content-Range header. * @b Content-Range header.
* *
* The #http_content_range_t is defined as follows: * The #http_content_range_t is defined as follows:
@@ -652,7 +652,7 @@ msg_hclass_t http_expires_class[] =
HTTP_HEADER_CLASS(expires, "Expires", d_common, single, default); HTTP_HEADER_CLASS(expires, "Expires", d_common, single, default);
/* ====================================================================== */ /* ====================================================================== */
/**@HTTP_HEADER http_from From header. /**@HTTP_HEADER http_from From header.
* *
* @code * @code
* From = "From" ":" mailbox * From = "From" ":" mailbox
@@ -773,7 +773,7 @@ HTTP_HEADER_CLASS_LIST(if_match, "If-Match", list);
/**@ingroup http_if_modified_since /**@ingroup http_if_modified_since
* @typedef typedef struct http_if_modified_since_s http_if_modified_since_t; * @typedef typedef struct http_if_modified_since_s http_if_modified_since_t;
* *
* The structure #http_if_modified_since_t contains representation of * The structure #http_if_modified_since_t contains representation of
* @b If-Modified-Since header. * @b If-Modified-Since header.
* *
* The #http_if_modified_since_t is defined as follows: * The #http_if_modified_since_t is defined as follows:
@@ -790,7 +790,7 @@ HTTP_HEADER_CLASS_LIST(if_match, "If-Match", list);
#define http_if_modified_since_e http_date_e #define http_if_modified_since_e http_date_e
msg_hclass_t http_if_modified_since_class[] = msg_hclass_t http_if_modified_since_class[] =
HTTP_HEADER_CLASS(if_modified_since, "If-Modified-Since", HTTP_HEADER_CLASS(if_modified_since, "If-Modified-Since",
d_common, single, default); d_common, single, default);
/* ====================================================================== */ /* ====================================================================== */
@@ -802,7 +802,7 @@ msg_hclass_t http_if_none_match_class[] =
HTTP_HEADER_CLASS_LIST(if_none_match, "If-None-Match", list); HTTP_HEADER_CLASS_LIST(if_none_match, "If-None-Match", list);
/* ====================================================================== */ /* ====================================================================== */
/**@HTTP_HEADER http_if_range If-Range header. /**@HTTP_HEADER http_if_range If-Range header.
* *
* The @b If-Range header is used when a client has a partial copy of an * The @b If-Range header is used when a client has a partial copy of an
* entity in its cache, and wishes to have an up-to-date copy of the entire * entity in its cache, and wishes to have an up-to-date copy of the entire
@@ -813,7 +813,7 @@ HTTP_HEADER_CLASS_LIST(if_none_match, "If-None-Match", list);
* @code * @code
* If-Range = "If-Range" ":" ( entity-tag / HTTP-date ) * If-Range = "If-Range" ":" ( entity-tag / HTTP-date )
* @endcode * @endcode
*/ */
/** Parse If-Range header */ /** Parse If-Range header */
issize_t http_if_range_d(su_home_t *home, http_header_t *h, char *s, isize_t slen) issize_t http_if_range_d(su_home_t *home, http_header_t *h, char *s, isize_t slen)
@@ -892,7 +892,7 @@ HTTP_HEADER_CLASS(if_range, "If-Range", ifr_common, single, if_range);
/**@ingroup http_if_unmodified_since /**@ingroup http_if_unmodified_since
* @typedef typedef http_date_t http_if_unmodified_since_t; * @typedef typedef http_date_t http_if_unmodified_since_t;
* *
* The structure #http_if_unmodified_since_t contains representation of * The structure #http_if_unmodified_since_t contains representation of
* @b If-Unmodified-Since header. * @b If-Unmodified-Since header.
* *
* The #http_if_unmodified_since_t is defined as follows: * The #http_if_unmodified_since_t is defined as follows:
@@ -909,7 +909,7 @@ HTTP_HEADER_CLASS(if_range, "If-Range", ifr_common, single, if_range);
#define http_if_unmodified_since_e http_date_e #define http_if_unmodified_since_e http_date_e
msg_hclass_t http_if_unmodified_since_class[] = msg_hclass_t http_if_unmodified_since_class[] =
HTTP_HEADER_CLASS(if_unmodified_since, "If-Unmodified-Since", HTTP_HEADER_CLASS(if_unmodified_since, "If-Unmodified-Since",
d_common, single, default); d_common, single, default);

View File

@@ -22,7 +22,7 @@
* *
*/ */
/**@CFILE http_extra.c /**@CFILE http_extra.c
* *
* Extra HTTP headers * Extra HTTP headers
* *
@@ -162,7 +162,7 @@ static issize_t cookie_scanner(char *s)
} }
else { else {
s += strcspn(s, ",;" LWS); s += strcspn(s, ",;" LWS);
if (s == v) if (s == v)
return -1; return -1;
} }
@@ -352,7 +352,7 @@ static issize_t set_cookie_scanner(char *s)
/* Special cases from Netscape spec */ /* Special cases from Netscape spec */
if (LOOKING_AT(s, "expires=")) { if (LOOKING_AT(s, "expires=")) {
msg_time_t value; msg_time_t value;
msg_date_d((char const **)&rest, &value); msg_date_d((char const **)&rest, &value);
} else if (LOOKING_AT(s, "path=/")) { } else if (LOOKING_AT(s, "path=/")) {
for (;;) { for (;;) {
@@ -366,8 +366,8 @@ static issize_t set_cookie_scanner(char *s)
} }
#undef LOOKING_AT #undef LOOKING_AT
if (IS_LWS(*rest)) { if (IS_LWS(*rest)) {
*rest++ = '\0'; skip_lws(&rest); *rest++ = '\0'; skip_lws(&rest);
} }
return rest - s; return rest - s;

View File

@@ -88,7 +88,7 @@ int http_request_complete(msg_t *msg)
msg_fragment_clear(http->http_content_length->l_common); msg_fragment_clear(http->http_content_length->l_common);
} }
} }
if (!http->http_separator) if (!http->http_separator)
http->http_separator = http_separator_create(home); http->http_separator = http_separator_create(home);
@@ -118,13 +118,13 @@ int http_strip_hostport(url_t *url)
/** Add a Content-Length and separator to a message */ /** Add a Content-Length and separator to a message */
int http_message_complete(msg_t *msg, http_t *http) int http_message_complete(msg_t *msg, http_t *http)
{ {
#if 1 #if 1
if (!http->http_content_length) { if (!http->http_content_length) {
http_content_length_t *l; http_content_length_t *l;
http_payload_t *pl; http_payload_t *pl;
size_t len = 0; size_t len = 0;
for (pl = http->http_payload; pl; pl = pl->pl_next) for (pl = http->http_payload; pl; pl = pl->pl_next)
len += pl->pl_len; len += pl->pl_len;
@@ -148,8 +148,8 @@ int http_message_complete(msg_t *msg, http_t *http)
} }
/** Add headers from the request to the response message. */ /** Add headers from the request to the response message. */
int http_complete_response(msg_t *msg, int http_complete_response(msg_t *msg,
int status, char const *phrase, int status, char const *phrase,
http_t const *request) http_t const *request)
{ {
su_home_t *home = msg_home(msg); su_home_t *home = msg_home(msg);
@@ -210,7 +210,7 @@ int http_header_field_e(char b[], int bsiz, http_header_t const *h, int flags)
return h->sh_class->hc_print(b, bsiz, h, flags); return h->sh_class->hc_print(b, bsiz, h, flags);
} }
http_header_t *http_header_format(su_home_t *home, http_header_t *http_header_format(su_home_t *home,
msg_hclass_t *hc, msg_hclass_t *hc,
char const *fmt, char const *fmt,
...) ...)

View File

@@ -75,7 +75,7 @@ issize_t http_extract_chunk(msg_t *, http_t *, char b[], isize_t bsiz, int eos);
#define CRLF_TEST(s) \ #define CRLF_TEST(s) \
(((s)[0]) == '\r' ? (((s)[1]) == '\n') + 1 : ((s)[0])=='\n') (((s)[0]) == '\r' ? (((s)[1]) == '\n') + 1 : ((s)[0])=='\n')
/** Extract the HTTP message body, including separator line. /** Extract the HTTP message body, including separator line.
* *
* @retval -1 error * @retval -1 error
* @retval 0 cannot proceed * @retval 0 cannot proceed
@@ -98,7 +98,7 @@ issize_t http_extract_body(msg_t *msg, http_t *http, char b[], isize_t bsiz, int
if (!eos && (bsiz == 0 || (bsiz == 1 && b[0] == '\r'))) if (!eos && (bsiz == 0 || (bsiz == 1 && b[0] == '\r')))
return 0; return 0;
m = CRLF_TEST(b); m = CRLF_TEST(b);
assert(m > 0 || eos); /* We should be looking at an empty line */ assert(m > 0 || eos); /* We should be looking at an empty line */
@@ -143,7 +143,7 @@ issize_t http_extract_body(msg_t *msg, http_t *http, char b[], isize_t bsiz, int
*/ */
http->http_transfer_encoding->k_items && http->http_transfer_encoding->k_items &&
http->http_transfer_encoding->k_items[0] && http->http_transfer_encoding->k_items[0] &&
strcasecmp(http->http_transfer_encoding->k_items[0], strcasecmp(http->http_transfer_encoding->k_items[0],
"identity") != 0) { "identity") != 0) {
http->http_flags |= MSG_FLG_CHUNKS; http->http_flags |= MSG_FLG_CHUNKS;
@@ -162,16 +162,16 @@ issize_t http_extract_body(msg_t *msg, http_t *http, char b[], isize_t bsiz, int
body_len = http->http_content_length->l_length; body_len = http->http_content_length->l_length;
/* We cannot parse multipart/byteranges ... */ /* We cannot parse multipart/byteranges ... */
else if (http->http_content_type && http->http_content_type->c_type && else if (http->http_content_type && http->http_content_type->c_type &&
strcasecmp(http->http_content_type->c_type, "multipart/byteranges") strcasecmp(http->http_content_type->c_type, "multipart/byteranges")
== 0) == 0)
return -1; return -1;
else if (MSG_IS_MAILBOX(flags)) /* message fragments */ else if (MSG_IS_MAILBOX(flags)) /* message fragments */
body_len = 0; body_len = 0;
else if (http->http_request) else if (http->http_request)
body_len = 0; body_len = 0;
else if (eos) else if (eos)
body_len = bsiz; body_len = bsiz;
else else
return 0; /* XXX */ return 0; /* XXX */
if (body_len == 0) { if (body_len == 0) {
@@ -198,7 +198,7 @@ issize_t http_extract_body(msg_t *msg, http_t *http, char b[], isize_t bsiz, int
return m; return m;
} }
/** Extract a chunk. /** Extract a chunk.
* *
* @retval -1 error * @retval -1 error
* @retval 0 cannot proceed * @retval 0 cannot proceed
@@ -210,7 +210,7 @@ issize_t http_extract_chunk(msg_t *msg, http_t *http, char b[], isize_t bsiz, in
unsigned crlf, chunk_len; unsigned crlf, chunk_len;
char *b0 = b, *s; char *b0 = b, *s;
union { union {
msg_header_t *header; msg_header_t *header;
msg_payload_t *chunk; msg_payload_t *chunk;
} h = { NULL }; } h = { NULL };
size_t bsiz0 = bsiz; size_t bsiz0 = bsiz;
@@ -234,15 +234,15 @@ issize_t http_extract_chunk(msg_t *msg, http_t *http, char b[], isize_t bsiz, in
assert(crlf < bsiz); assert(crlf < bsiz);
/* Skip crlf */ /* Skip crlf */
b += crlf; bsiz -= crlf; b += crlf; bsiz -= crlf;
} }
/* Now, looking at the chunk header */ /* Now, looking at the chunk header */
n = strcspn(b, CRLF); n = strcspn(b, CRLF);
if (!eos && n == bsiz) if (!eos && n == bsiz)
return 0; return 0;
crlf = CRLF_TEST(b + n); crlf = CRLF_TEST(b + n);
if (n == 0) { if (n == 0) {
if (crlf == bsiz && eos) { if (crlf == bsiz && eos) {
msg_mark_as_complete(msg, MSG_FLG_COMPLETE | MSG_FLG_FRAGS); msg_mark_as_complete(msg, MSG_FLG_COMPLETE | MSG_FLG_FRAGS);
@@ -267,7 +267,7 @@ issize_t http_extract_chunk(msg_t *msg, http_t *http, char b[], isize_t bsiz, in
crlf = bsiz > 0 ? CRLF_TEST(b) : 0; crlf = bsiz > 0 ? CRLF_TEST(b) : 0;
if ((eos && bsiz == 0) || crlf == 2 || if ((eos && bsiz == 0) || crlf == 2 ||
(crlf == 1 && (bsiz > 1 || b[0] == '\n'))) { (crlf == 1 && (bsiz > 1 || b[0] == '\n'))) {
/* Shortcut - We got empty trailers */ /* Shortcut - We got empty trailers */
b += crlf; b += crlf;
@@ -285,7 +285,7 @@ issize_t http_extract_chunk(msg_t *msg, http_t *http, char b[], isize_t bsiz, in
b += n + crlf, bsiz -= n + crlf; b += n + crlf, bsiz -= n + crlf;
/* Extract chunk */ /* Extract chunk */
chunk = msg_extract_payload(msg, http, chunk = msg_extract_payload(msg, http,
&h.header, chunk_len + (b - b0), &h.header, chunk_len + (b - b0),
b0, bsiz0, eos); b0, bsiz0, eos);
@@ -294,7 +294,7 @@ issize_t http_extract_chunk(msg_t *msg, http_t *http, char b[], isize_t bsiz, in
h.chunk->pl_data += (b - b0); h.chunk->pl_data += (b - b0);
h.chunk->pl_len -= (b - b0); h.chunk->pl_len -= (b - b0);
} }
return chunk; return chunk;
} }
} }
@@ -312,12 +312,12 @@ int http_version_d(char **ss, char const **ver)
char const *result; char const *result;
int const version_size = sizeof(http_version_1_1) - 1; int const version_size = sizeof(http_version_1_1) - 1;
if (strncasecmp(s, http_version_1_1, version_size) == 0 && if (strncasecmp(s, http_version_1_1, version_size) == 0 &&
!IS_TOKEN(s[version_size])) { !IS_TOKEN(s[version_size])) {
result = http_version_1_1; result = http_version_1_1;
s += version_size; s += version_size;
} }
else if (strncasecmp(s, http_version_1_0, version_size) == 0 && else if (strncasecmp(s, http_version_1_0, version_size) == 0 &&
!IS_TOKEN(s[version_size])) { !IS_TOKEN(s[version_size])) {
result = http_version_1_0; result = http_version_1_0;
s += version_size; s += version_size;
@@ -348,7 +348,7 @@ int http_version_d(char **ss, char const **ver)
memmove(s + l1 + 1, s + n - l2, l2); memmove(s + l1 + 1, s + n - l2, l2);
s[l1 + 1 + l2] = 0; s[l1 + 1 + l2] = 0;
/* Compare again with compacted version */ /* Compare again with compacted version */
if (strcasecmp(s, http_version_1_1) == 0) if (strcasecmp(s, http_version_1_1) == 0)
result = http_version_1_1; result = http_version_1_1;
else if (strcasecmp(s, http_version_1_0) == 0) else if (strcasecmp(s, http_version_1_0) == 0)
@@ -359,10 +359,10 @@ int http_version_d(char **ss, char const **ver)
} }
while (IS_LWS(*s)) *s++ = '\0'; while (IS_LWS(*s)) *s++ = '\0';
*ss = s; *ss = s;
if (ver) if (ver)
*ver = result; *ver = result;
return 0; return 0;
@@ -454,7 +454,7 @@ http_method_t http_method_d(char **ss, char const **nname)
#define MATCH(s, m) (strncasecmp(s, m, n = sizeof(m) - 1) == 0) #define MATCH(s, m) (strncasecmp(s, m, n = sizeof(m) - 1) == 0)
if (c >= 'a' && c <= 'z') if (c >= 'a' && c <= 'z')
c += 'A' - 'a'; c += 'A' - 'a';
switch (c) { switch (c) {
@@ -463,7 +463,7 @@ http_method_t http_method_d(char **ss, char const **nname)
case 'G': if (MATCH(s, "GET")) code = http_method_get; break; case 'G': if (MATCH(s, "GET")) code = http_method_get; break;
case 'H': if (MATCH(s, "HEAD")) code = http_method_head; break; case 'H': if (MATCH(s, "HEAD")) code = http_method_head; break;
case 'O': if (MATCH(s, "OPTIONS")) code = http_method_options; break; case 'O': if (MATCH(s, "OPTIONS")) code = http_method_options; break;
case 'P': if (MATCH(s, "POST")) code = http_method_post; case 'P': if (MATCH(s, "POST")) code = http_method_post;
else else
if (MATCH(s, "PUT")) code = http_method_put; break; if (MATCH(s, "PUT")) code = http_method_put; break;
case 'T': if (MATCH(s, "TRACE")) code = http_method_trace; break; case 'T': if (MATCH(s, "TRACE")) code = http_method_trace; break;
@@ -510,7 +510,7 @@ http_method_t http_method_code(char const *name)
* query. For each key, a query element (in the form name=value) is searched * query. For each key, a query element (in the form name=value) is searched
* from the query string. If a query element has a beginning matching with * from the query string. If a query element has a beginning matching with
* the key, a copy of the rest of the element is returned in corresponding * the key, a copy of the rest of the element is returned in corresponding
* return_value argument. * return_value argument.
* *
* @note The @a query string will be modified. * @note The @a query string will be modified.
* *
@@ -538,15 +538,15 @@ issize_t http_query_parse(char *query,
valuelen = namelen + strcspn(q + namelen, "&"); valuelen = namelen + strcspn(q + namelen, "&");
q_next = q + valuelen; q_next = q + valuelen;
if (*q_next) if (*q_next)
*q_next++ = '\0'; *q_next++ = '\0';
value = q + namelen; value = q + namelen;
has_value = (*value) != '\0'; /* is the part in form of name=value? */ has_value = (*value) != '\0'; /* is the part in form of name=value? */
if (has_value) if (has_value)
*value++ = '\0'; *value++ = '\0';
name = url_unescape(q, q); name = url_unescape(q, q);
if (has_value) { if (has_value) {
namelen = strlen(name); namelen = strlen(name);
@@ -570,4 +570,4 @@ issize_t http_query_parse(char *query,
} }
return N; return N;
} }

View File

@@ -31,7 +31,7 @@
*/ */
/**@internal /**@internal
* @CFILE http_parser_table.c * @CFILE http_parser_table.c
* @brief HTTP parser table * @brief HTTP parser table
* *
* #AUTO# * #AUTO#

View File

@@ -79,7 +79,7 @@ char const
char const *http_status_phrase(int status) char const *http_status_phrase(int status)
{ {
if (status < 100 || status > 699) if (status < 100 || status > 699)
return NULL; return NULL;
switch (status) { switch (status) {

View File

@@ -1,4 +1,4 @@
/**@HTTP /**@HTTP
* @IFILE http_tag.c.in * @IFILE http_tag.c.in
* *
* Template for <http_tag.c>. * Template for <http_tag.c>.
@@ -35,7 +35,7 @@
* This file is autogenerated from <http_tag.c.in>. * This file is autogenerated from <http_tag.c.in>.
* *
* #AUTO# * #AUTO#
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
*/ */
@@ -58,7 +58,7 @@ tag_typedef_t httptag_any = NSTAG_TYPEDEF(*);
tag_typedef_t httptag_http = HTTPMSGTAG_TYPEDEF(http); tag_typedef_t httptag_http = HTTPMSGTAG_TYPEDEF(http);
tag_typedef_t httptag_version = STRTAG_TYPEDEF(version); tag_typedef_t httptag_version = STRTAG_TYPEDEF(version);
tag_typedef_t httptag_header = tag_typedef_t httptag_header =
{{ TAG_NAMESPACE, "header", httphdrtag_class, 0 }}; {{ TAG_NAMESPACE, "header", httphdrtag_class, 0 }};
tag_typedef_t httptag_header_str = STRTAG_TYPEDEF(header_str); tag_typedef_t httptag_header_str = STRTAG_TYPEDEF(header_str);

View File

@@ -49,7 +49,7 @@
#include <sofia-sip/http_tag_class.h> #include <sofia-sip/http_tag_class.h>
#include <sofia-sip/su_tagarg.h> #include <sofia-sip/su_tagarg.h>
tag_class_t httphdrtag_class[1] = tag_class_t httphdrtag_class[1] =
{{ {{
sizeof(httphdrtag_class), sizeof(httphdrtag_class),
/* tc_next */ NULL, /* tc_next */ NULL,
@@ -65,7 +65,7 @@ tag_class_t httphdrtag_class[1] =
/* tc_scan */ msghdrtag_scan, /* tc_scan */ msghdrtag_scan,
}}; }};
tag_class_t httpstrtag_class[1] = tag_class_t httpstrtag_class[1] =
{{ {{
sizeof(httpstrtag_class), sizeof(httpstrtag_class),
/* tc_next */ NULL, /* tc_next */ NULL,
@@ -81,7 +81,7 @@ tag_class_t httpstrtag_class[1] =
/* tc_scan */ msghdrtag_scan, /* tc_scan */ msghdrtag_scan,
}}; }};
tag_class_t httpmsgtag_class[1] = tag_class_t httpmsgtag_class[1] =
{{ {{
sizeof(httpmsgtag_class), sizeof(httpmsgtag_class),
/* tc_next */ NULL, /* tc_next */ NULL,
@@ -100,7 +100,7 @@ tag_class_t httpmsgtag_class[1] =
/** Filter a HTTP header structure. */ /** Filter a HTTP header structure. */
tagi_t *httptag_filter(tagi_t *dst, tagi_t *httptag_filter(tagi_t *dst,
tagi_t const f[], tagi_t const f[],
tagi_t const *src, tagi_t const *src,
void **bb) void **bb)
{ {
tagi_t stub[2] = {{ NULL }}; tagi_t stub[2] = {{ NULL }};
@@ -152,7 +152,7 @@ tagi_t *httptag_filter(tagi_t *dst,
} }
} }
/** Duplicate headers from taglist and add them to the HTTP message. /** Duplicate headers from taglist and add them to the HTTP message.
* *
* Return the number of headers added to the HTTP message. * Return the number of headers added to the HTTP message.
*/ */
@@ -209,8 +209,8 @@ int http_add_tl(msg_t *msg, http_t *http,
else if (tag == httptag_header_str) { else if (tag == httptag_header_str) {
if (msg_header_add_str(msg, http, (char const *)value) < 0) if (msg_header_add_str(msg, http, (char const *)value) < 0)
break; break;
} }
else else
continue; continue;
retval++; retval++;
@@ -218,7 +218,7 @@ int http_add_tl(msg_t *msg, http_t *http,
ta_end(ta); ta_end(ta);
if (t) if (t)
return -1; return -1;
return retval; return retval;

View File

@@ -26,10 +26,10 @@
/** Defined when <sofia-sip/http.h> has been included. */ /** Defined when <sofia-sip/http.h> has been included. */
#define HTTP_H #define HTTP_H
/**@file sofia-sip/http.h /**@file sofia-sip/http.h
* *
* HTTP message, methods, headers. * HTTP message, methods, headers.
* *
* @sa <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> * @sa <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com>. * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -50,7 +50,7 @@
SOFIA_BEGIN_DECLS SOFIA_BEGIN_DECLS
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* 1) Constants * 1) Constants
*/ */
#define HTTP_NONE ((http_header_t *)MSG_HEADER_NONE) #define HTTP_NONE ((http_header_t *)MSG_HEADER_NONE)
@@ -161,9 +161,9 @@ typedef struct http_cookie_s http_cookie_t;
typedef msg_error_t http_error_t; typedef msg_error_t http_error_t;
/** Unknown header. */ /** Unknown header. */
typedef msg_generic_t http_unknown_t; typedef msg_generic_t http_unknown_t;
/** Separator line between headers and message contents */ /** Separator line between headers and message contents */
typedef msg_separator_t http_separator_t; typedef msg_separator_t http_separator_t;
/** Entity-body */ /** Entity-body */
typedef msg_payload_t http_payload_t; typedef msg_payload_t http_payload_t;
/** Time in seconds since 01-Jan-1900. */ /** Time in seconds since 01-Jan-1900. */
typedef unsigned long http_time_t; typedef unsigned long http_time_t;
@@ -327,7 +327,7 @@ struct http_s {
unsigned http_size; /**< Size of this structure */ unsigned http_size; /**< Size of this structure */
int http_flags; /**< Flags */ int http_flags; /**< Flags */
http_error_t *http_error; /**< Erroneous headers */ http_error_t *http_error; /**< Erroneous headers */
http_request_t *http_request; /**< Request line */ http_request_t *http_request; /**< Request line */
http_status_t *http_status; /**< Status line */ http_status_t *http_status; /**< Status line */
@@ -389,19 +389,19 @@ struct http_s {
/* === Headers end here */ /* === Headers end here */
http_header_t *http_unknown; /**< Unknown headers. */ http_header_t *http_unknown; /**< Unknown headers. */
http_separator_t *http_separator; http_separator_t *http_separator;
/**< Separator between message and payload */ /**< Separator between message and payload */
http_payload_t *http_payload; /**< Message entity-body */ http_payload_t *http_payload; /**< Message entity-body */
}; };
/**Union representing any HTTP header. /**Union representing any HTTP header.
* *
* Each different header is an array of size 1. * Each different header is an array of size 1.
* *
* @deprecated * @deprecated
*/ */
union http_header_u { union http_header_u {
msg_common_t sh_common[1]; msg_common_t sh_common[1];
struct { struct {
msg_common_t shn_common; msg_common_t shn_common;
http_header_t *shn_next; http_header_t *shn_next;

View File

@@ -28,9 +28,9 @@
/**@file sofia-sip/http_hclasses.h /**@file sofia-sip/http_hclasses.h
* @brief HTTP header classes. * @brief HTTP header classes.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
*/ */
#ifndef MSG_TYPES_H #ifndef MSG_TYPES_H

View File

@@ -26,7 +26,7 @@
/** Defined when <sofia-sip/http_header.h> has been included.*/ /** Defined when <sofia-sip/http_header.h> has been included.*/
#define HTTP_HEADER_H #define HTTP_HEADER_H
/**@file sofia-sip/http_header.h /**@file sofia-sip/http_header.h
* *
* HTTP library prototypes. * HTTP library prototypes.
* *
@@ -85,13 +85,13 @@ SOFIAPUBVAR char const http_version_0_9[];
/** HTTP 1.0 */ /** HTTP 1.0 */
SOFIAPUBVAR char const http_version_1_0[]; SOFIAPUBVAR char const http_version_1_0[];
/** HTTP 1.1 version. */ /** HTTP 1.1 version. */
SOFIAPUBVAR char const http_version_1_1[]; SOFIAPUBVAR char const http_version_1_1[];
#define HTTP_VERSION_CURRENT http_version_1_1 #define HTTP_VERSION_CURRENT http_version_1_1
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* 3) Prototypes * 3) Prototypes
*/ */
/** HTTP parser description. */ /** HTTP parser description. */
@@ -123,7 +123,7 @@ SOFIAPUBFUN int http_strip_hostport(url_t *url);
/** Add required headers to the response message */ /** Add required headers to the response message */
SOFIAPUBFUN int http_complete_response(msg_t *msg, SOFIAPUBFUN int http_complete_response(msg_t *msg,
int status, char const *phrase, int status, char const *phrase,
http_t const *request); http_t const *request);
/** Return string corresponding to the method. */ /** Return string corresponding to the method. */
@@ -139,9 +139,9 @@ SOFIAPUBFUN int http_header_insert(msg_t *msg, http_t *http, http_header_t *h);
SOFIAPUBFUN int http_header_remove(msg_t *msg, http_t *http, http_header_t *h); SOFIAPUBFUN int http_header_remove(msg_t *msg, http_t *http, http_header_t *h);
SOFIAPUBFUN char const *http_header_name(http_header_t const *h, int compact); SOFIAPUBFUN char const *http_header_name(http_header_t const *h, int compact);
SOFIAPUBFUN void *http_header_data(http_header_t *h); SOFIAPUBFUN void *http_header_data(http_header_t *h);
SOFIAPUBFUN http_content_length_t *http_content_length_create(su_home_t *home, SOFIAPUBFUN http_content_length_t *http_content_length_create(su_home_t *home,
uint32_t n); uint32_t n);
SOFIAPUBFUN http_payload_t *http_payload_create(su_home_t *home, SOFIAPUBFUN http_payload_t *http_payload_create(su_home_t *home,
void const *data, usize_t len); void const *data, usize_t len);
SOFIAPUBFUN http_separator_t *http_separator_create(su_home_t *home); SOFIAPUBFUN http_separator_t *http_separator_create(su_home_t *home);
#endif #endif
@@ -164,7 +164,7 @@ SOFIAPUBFUN http_status_t *http_status_create(su_home_t *home,
char const *version); char const *version);
/** Create an @b Host header object. */ /** Create an @b Host header object. */
SOFIAPUBFUN http_host_t *http_host_create(su_home_t *home, SOFIAPUBFUN http_host_t *http_host_create(su_home_t *home,
char const *host, char const *host,
char const *port); char const *port);
@@ -184,7 +184,7 @@ SOFIAPUBFUN issize_t http_query_parse(char *query,
...); ...);
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* 4) Inlined functions * 4) Inlined functions
*/ */
#if SU_HAVE_INLINE #if SU_HAVE_INLINE
@@ -213,13 +213,13 @@ http_t *http_object(msg_t *msg)
* @param http HTTP message structure to which header is added * @param http HTTP message structure to which header is added
* @param h list of header(s) to be added * @param h list of header(s) to be added
*/ */
su_inline su_inline
int http_header_insert(msg_t *msg, http_t *http, http_header_t *h) int http_header_insert(msg_t *msg, http_t *http, http_header_t *h)
{ {
return msg_header_insert(msg, (msg_pub_t *)http, (msg_header_t *)h); return msg_header_insert(msg, (msg_pub_t *)http, (msg_header_t *)h);
} }
/** Remove a header from a HTTP message. */ /** Remove a header from a HTTP message. */
su_inline su_inline
int http_header_remove(msg_t *msg, http_t *http, http_header_t *h) int http_header_remove(msg_t *msg, http_t *http, http_header_t *h)
{ {
@@ -243,19 +243,19 @@ void *http_header_data(http_header_t *h)
return h && h != HTTP_NONE ? h->sh_class->hc_size + (char *)h : NULL; return h && h != HTTP_NONE ? h->sh_class->hc_size + (char *)h : NULL;
} }
su_inline su_inline
http_content_length_t *http_content_length_create(su_home_t *home, uint32_t n) http_content_length_t *http_content_length_create(su_home_t *home, uint32_t n)
{ {
return msg_content_length_create(home, n); return msg_content_length_create(home, n);
} }
su_inline su_inline
http_payload_t *http_payload_create(su_home_t *home, void const *data, isize_t len) http_payload_t *http_payload_create(su_home_t *home, void const *data, isize_t len)
{ {
return msg_payload_create(home, data, len); return msg_payload_create(home, data, len);
} }
su_inline su_inline
http_separator_t *http_separator_create(su_home_t *home) http_separator_t *http_separator_create(su_home_t *home)
{ {
return msg_separator_create(home); return msg_separator_create(home);

View File

@@ -24,7 +24,7 @@
#ifndef HTTP_PARSER_H #ifndef HTTP_PARSER_H
/**Defined when <sofia-sip/http_parser.h> has been included.*/ /**Defined when <sofia-sip/http_parser.h> has been included.*/
#define HTTP_PARSER_H #define HTTP_PARSER_H
/**@file sofia-sip/http_parser.h /**@file sofia-sip/http_parser.h
* @brief Typedefs and prototypes used by HTTP parser. * @brief Typedefs and prototypes used by HTTP parser.
* *
@@ -102,7 +102,7 @@ SOFIAPUBFUN char const *http_method_name(http_method_t method,
char const *name); char const *name);
/** Extract HTTP message body */ /** Extract HTTP message body */
SOFIAPUBFUN issize_t http_extract_body(msg_t *, http_t *, SOFIAPUBFUN issize_t http_extract_body(msg_t *, http_t *,
char b[], isize_t bsiz, int eos); char b[], isize_t bsiz, int eos);
SOFIA_END_DECLS SOFIA_END_DECLS

View File

@@ -32,12 +32,12 @@
/** Defined when <sofia-sip/http_protos.h> has been included. */ /** Defined when <sofia-sip/http_protos.h> has been included. */
#define HTTP_PROTOS_H #define HTTP_PROTOS_H
/**@file sofia-sip/http_protos.h /**@file sofia-sip/http_protos.h
* *
* Macros for each HTTP header. * Macros for each HTTP header.
* *
* #AUTO# * #AUTO#
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
*/ */
@@ -61,18 +61,18 @@ SOFIA_BEGIN_DECLS
/**@addtogroup http_#xxxxxx#*/ /** @{ */ /**@addtogroup http_#xxxxxx#*/ /** @{ */
enum { enum {
/** Hash of #xxxxxxx_xxxxxxx#. @internal*/ /** Hash of #xxxxxxx_xxxxxxx#. @internal*/
http_#xxxxxx#_hash = #hash# http_#xxxxxx#_hash = #hash#
}; };
/**Header class for HTTP #xxxxxxx_xxxxxxx#. /**Header class for HTTP #xxxxxxx_xxxxxxx#.
* *
* The header class http_#xxxxxx#_class defines how a HTTP * The header class http_#xxxxxx#_class defines how a HTTP
* #xxxxxxx_xxxxxxx# is parsed and printed. It also * #xxxxxxx_xxxxxxx# is parsed and printed. It also
* contains methods used by HTTP parser and other functions * contains methods used by HTTP parser and other functions
* to manipulate the http_#xxxxxx#_t header structure. * to manipulate the http_#xxxxxx#_t header structure.
* *
*/ */
SOFIAPUBVAR msg_hclass_t http_#xxxxxx#_class[]; SOFIAPUBVAR msg_hclass_t http_#xxxxxx#_class[];
@@ -85,28 +85,28 @@ SOFIAPUBFUN msg_parse_f http_#xxxxxx#_d;
SOFIAPUBFUN msg_print_f http_#xxxxxx#_e; SOFIAPUBFUN msg_print_f http_#xxxxxx#_e;
/**Initializer for structure http_#xxxxxx#_t. /**Initializer for structure http_#xxxxxx#_t.
* *
* A static http_#xxxxxx#_t structure must be initialized * A static http_#xxxxxx#_t structure must be initialized
* with the HTTP_#XXXXXX#_INIT() macro. For instance, * with the HTTP_#XXXXXX#_INIT() macro. For instance,
* @code * @code
* *
* http_#xxxxxx#_t http_#xxxxxx# = HTTP_#XXXXXX#_INIT; * http_#xxxxxx#_t http_#xxxxxx# = HTTP_#XXXXXX#_INIT;
* *
* @endcode * @endcode
* @HI * @HI
*/ */
#define HTTP_#XXXXXX#_INIT() HTTP_HDR_INIT(#xxxxxx#) #define HTTP_#XXXXXX#_INIT() HTTP_HDR_INIT(#xxxxxx#)
/**Initialize a structure http_#xxxxxx#_t. /**Initialize a structure http_#xxxxxx#_t.
* *
* An http_#xxxxxx#_t structure can be initialized with the * An http_#xxxxxx#_t structure can be initialized with the
* http_#xxxxxx#_init() function/macro. For instance, * http_#xxxxxx#_init() function/macro. For instance,
* @code * @code
* *
* http_#xxxxxx#_t http_#xxxxxx#; * http_#xxxxxx#_t http_#xxxxxx#;
* *
* http_#xxxxxx#_init(&http_#xxxxxx#); * http_#xxxxxx#_init(&http_#xxxxxx#);
* *
* @endcode * @endcode
* @HI * @HI
*/ */
@@ -121,20 +121,20 @@ su_inline http_#xxxxxx#_t *http_#xxxxxx#_init(http_#xxxxxx#_t x[1])
#endif #endif
/**Test if header object is instance of http_#xxxxxx#_t. /**Test if header object is instance of http_#xxxxxx#_t.
* *
* The function http_is_#xxxxxx#() returns true (nonzero) if * The function http_is_#xxxxxx#() returns true (nonzero) if
* the header class is an instance of #xxxxxxx_xxxxxxx# * the header class is an instance of #xxxxxxx_xxxxxxx#
* object and false (zero) otherwise. * object and false (zero) otherwise.
* *
* @param header pointer to the header structure to be tested * @param header pointer to the header structure to be tested
* *
* @return * @return
* The function http_is_x#xxxxxx#() returns true (nonzero) if * The function http_is_x#xxxxxx#() returns true (nonzero) if
* the header object is an instance of header #xxxxxx# and * the header object is an instance of header #xxxxxx# and
* false (zero) otherwise. * false (zero) otherwise.
*/ */
#if SU_HAVE_INLINE #if SU_HAVE_INLINE
su_inline su_inline
int http_is_#xxxxxx#(http_header_t const *header) int http_is_#xxxxxx#(http_header_t const *header)
{ {
return header && header->sh_class->hc_hash == http_#xxxxxx#_hash; return header && header->sh_class->hc_hash == http_#xxxxxx#_hash;
@@ -145,27 +145,27 @@ int http_is_#xxxxxx#(http_header_t const *header)
#endif #endif
/**Duplicate (deep copy) @c http_#xxxxxx#_t. /**Duplicate (deep copy) @c http_#xxxxxx#_t.
* *
* The function http_#xxxxxx#_dup() duplicates a header * The function http_#xxxxxx#_dup() duplicates a header
* structure @a hdr. If the header structure @a hdr * structure @a hdr. If the header structure @a hdr
* contains a reference (@c hdr->x_next) to a list of * contains a reference (@c hdr->x_next) to a list of
* headers, all the headers in the list are duplicated, too. * headers, all the headers in the list are duplicated, too.
* *
* @param home memory home used to allocate new structure * @param home memory home used to allocate new structure
* @param hdr header structure to be duplicated * @param hdr header structure to be duplicated
* *
* When duplicating, all parameter lists and non-constant * When duplicating, all parameter lists and non-constant
* strings attached to the header are copied, too. The * strings attached to the header are copied, too. The
* function uses given memory @a home to allocate all the * function uses given memory @a home to allocate all the
* memory areas used to copy the header. * memory areas used to copy the header.
* *
* @par Example * @par Example
* @code * @code
* *
* #xxxxxx# = http_#xxxxxx#_dup(home, http->http_#xxxxxx#); * #xxxxxx# = http_#xxxxxx#_dup(home, http->http_#xxxxxx#);
* *
* @endcode * @endcode
* *
* @return * @return
* The function http_#xxxxxx#_dup() returns a pointer to the * The function http_#xxxxxx#_dup() returns a pointer to the
* newly duplicated http_#xxxxxx#_t header structure, or NULL * newly duplicated http_#xxxxxx#_t header structure, or NULL
@@ -174,34 +174,34 @@ int http_is_#xxxxxx#(http_header_t const *header)
#if SU_HAVE_INLINE #if SU_HAVE_INLINE
su_inline su_inline
#endif #endif
http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home, http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home,
http_#xxxxxx#_t const *hdr) http_#xxxxxx#_t const *hdr)
__attribute__((__malloc__)); __attribute__((__malloc__));
/**Copy a http_#xxxxxx#_t header structure. /**Copy a http_#xxxxxx#_t header structure.
* *
* The function http_#xxxxxx#_copy() copies a header structure @a * The function http_#xxxxxx#_copy() copies a header structure @a
* hdr. If the header structure @a hdr contains a reference (@c * hdr. If the header structure @a hdr contains a reference (@c
* hdr->h_next) to a list of headers, all the headers in that * hdr->h_next) to a list of headers, all the headers in that
* list are copied, too. The function uses given memory @a home * list are copied, too. The function uses given memory @a home
* to allocate all the memory areas used to copy the header * to allocate all the memory areas used to copy the header
* structure @a hdr. * structure @a hdr.
* *
* @param home memory home used to allocate new structure * @param home memory home used to allocate new structure
* @param hdr pointer to the header structure to be duplicated * @param hdr pointer to the header structure to be duplicated
* *
* When copying, only the header structure and parameter lists * When copying, only the header structure and parameter lists
* attached to it are duplicated. The new header structure * attached to it are duplicated. The new header structure
* retains all the references to the strings within the old @a * retains all the references to the strings within the old @a
* header, including the encoding of the old header, if present. * header, including the encoding of the old header, if present.
* *
* @par Example * @par Example
* @code * @code
* *
* #xxxxxx# = http_#xxxxxx#_copy(home, http->http_#xxxxxx#); * #xxxxxx# = http_#xxxxxx#_copy(home, http->http_#xxxxxx#);
* *
* @endcode * @endcode
* *
* @return * @return
* The function http_#xxxxxx#_copy() returns a pointer to * The function http_#xxxxxx#_copy() returns a pointer to
* newly copied header structure, or NULL upon an error. * newly copied header structure, or NULL upon an error.
@@ -209,23 +209,23 @@ http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home,
#if SU_HAVE_INLINE #if SU_HAVE_INLINE
su_inline su_inline
#endif #endif
http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home, http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home,
http_#xxxxxx#_t const *hdr) http_#xxxxxx#_t const *hdr)
__attribute__((__malloc__)); __attribute__((__malloc__));
/**Make a header structure http_#xxxxxx#_t. /**Make a header structure http_#xxxxxx#_t.
* *
* The function http_#xxxxxx#_make() makes a new * The function http_#xxxxxx#_make() makes a new
* http_#xxxxxx#_t header structure. It allocates a new * http_#xxxxxx#_t header structure. It allocates a new
* header structure, and decodes the string @a s as the * header structure, and decodes the string @a s as the
* value of the structure. * value of the structure.
* *
* @param home memory home used to allocate new header structure. * @param home memory home used to allocate new header structure.
* @param s string to be decoded as value of the new header structure * @param s string to be decoded as value of the new header structure
* *
* @note This function is usually implemented as a macro calling * @note This function is usually implemented as a macro calling
* http_header_make(). * http_header_make().
* *
* @return * @return
* The function http_#xxxxxx#_make() returns a pointer to * The function http_#xxxxxx#_make() returns a pointer to
* newly maked http_#xxxxxx#_t header structure, or NULL upon * newly maked http_#xxxxxx#_t header structure, or NULL upon
@@ -238,25 +238,25 @@ http_#xxxxxx#_t *http_#xxxxxx#_make(su_home_t *home, char const *s)
__attribute__((__malloc__)); __attribute__((__malloc__));
/**Make a #xxxxxxx_xxxxxxx# from formatting result. /**Make a #xxxxxxx_xxxxxxx# from formatting result.
* *
* The function http_#xxxxxx#_format() makes a new * The function http_#xxxxxx#_format() makes a new
* #xxxxxxx_xxxxxxx# object using formatting result as its * #xxxxxxx_xxxxxxx# object using formatting result as its
* value. The function first prints the arguments according to * value. The function first prints the arguments according to
* the format @a fmt specified. Then it allocates a new header * the format @a fmt specified. Then it allocates a new header
* structure, and uses the formatting result as the header * structure, and uses the formatting result as the header
* value. * value.
* *
* @param home memory home used to allocate new header structure. * @param home memory home used to allocate new header structure.
* @param fmt string used as a printf()-style format * @param fmt string used as a printf()-style format
* @param ... argument list for format * @param ... argument list for format
* *
* @note This function is usually implemented as a macro calling * @note This function is usually implemented as a macro calling
* msg_header_format(). * msg_header_format().
* *
* @return * @return
* The function http_#xxxxxx#_format() returns a pointer to newly * The function http_#xxxxxx#_format() returns a pointer to newly
* makes header structure, or NULL upon an error. * makes header structure, or NULL upon an error.
* *
* @HIDE * @HIDE
*/ */
#if SU_HAVE_INLINE #if SU_HAVE_INLINE
@@ -273,29 +273,29 @@ http_#xxxxxx#_t *http_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
{ {
http_header_t *h; http_header_t *h;
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
h = http_header_vformat(home, http_#xxxxxx#_class, fmt, ap); h = http_header_vformat(home, http_#xxxxxx#_class, fmt, ap);
va_end(ap); va_end(ap);
return (http_#xxxxxx#_t *)h; return (http_#xxxxxx#_t *)h;
} }
su_inline su_inline
http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home, http_#xxxxxx#_t const *o) http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home, http_#xxxxxx#_t const *o)
{ {
return (http_#xxxxxx#_t *) return (http_#xxxxxx#_t *)
msg_header_dup_as(home, http_#xxxxxx#_class, (msg_header_t const *)o); msg_header_dup_as(home, http_#xxxxxx#_class, (msg_header_t const *)o);
} }
su_inline su_inline
http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home, http_#xxxxxx#_t const *o) http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home, http_#xxxxxx#_t const *o)
{ {
return (http_#xxxxxx#_t *) return (http_#xxxxxx#_t *)
msg_header_copy_as(home, http_#xxxxxx#_class, (msg_header_t const *)o); msg_header_copy_as(home, http_#xxxxxx#_class, (msg_header_t const *)o);
} }
su_inline su_inline
http_#xxxxxx#_t *http_#xxxxxx#_make(su_home_t *home, char const *s) http_#xxxxxx#_t *http_#xxxxxx#_make(su_home_t *home, char const *s)
{ {
return (http_#xxxxxx#_t *)http_header_make(home, http_#xxxxxx#_class, s); return (http_#xxxxxx#_t *)http_header_make(home, http_#xxxxxx#_class, s);

View File

@@ -22,10 +22,10 @@
* *
*/ */
#ifndef HTTP_STATUS_H #ifndef HTTP_STATUS_H
#define HTTP_STATUS_H #define HTTP_STATUS_H
/**@file sofia-sip/http_status.h /**@file sofia-sip/http_status.h
* *
* HTTP status codes. * HTTP status codes.
* *

View File

@@ -105,7 +105,7 @@ SOFIAPUBVAR tag_typedef_t httptag_http_ref;
#if SU_INLINE_TAG_CAST #if SU_INLINE_TAG_CAST
su_inline su_inline
tag_value_t httptag_http_v(http_t const *v) { return (tag_value_t)v; } tag_value_t httptag_http_v(http_t const *v) { return (tag_value_t)v; }
su_inline su_inline
tag_value_t httptag_http_vr(http_t const **vp) { return (tag_value_t)vp; } tag_value_t httptag_http_vr(http_t const **vp) { return (tag_value_t)vp; }
#else #else
#define httptag_http_v(v) (tag_value_t)(v) #define httptag_http_v(v) (tag_value_t)(v)
@@ -131,8 +131,8 @@ extern tag_typedef_t httptag_version_ref;
/**Tag list item for header string. /**Tag list item for header string.
* *
* The HTTPTAG_HEADER() macro is used to include a tag item containing an * The HTTPTAG_HEADER() macro is used to include a tag item containing an
* unknown HTTP header in the tag list, e.g., * unknown HTTP header in the tag list, e.g.,
* @code * @code
* http_header_t *hdr; * http_header_t *hdr;
* *
* HTTPTAG_HEADER(hdr). * HTTPTAG_HEADER(hdr).
@@ -199,7 +199,7 @@ SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#;
* *
* Tag list item for string with #xxxxxxx_xxxxxxx# value. * Tag list item for string with #xxxxxxx_xxxxxxx# value.
* *
* The HTTPTAG_#XXXXXX#_STR() macro is used to include a tag item with a * The HTTPTAG_#XXXXXX#_STR() macro is used to include a tag item with a
* string containing value of a http_#xxxxxx#_t header in a tag list. * string containing value of a http_#xxxxxx#_t header in a tag list.
* *
* @param s pointer to a string containing http_#xxxxxx#_t value, or NULL. * @param s pointer to a string containing http_#xxxxxx#_t value, or NULL.

View File

@@ -24,7 +24,7 @@
#ifndef HTTP_TAG_CLASS_H #ifndef HTTP_TAG_CLASS_H
/**Defined when http_tag_class.h have been included*/ /**Defined when http_tag_class.h have been included*/
#define HTTP_TAG_CLASS_H #define HTTP_TAG_CLASS_H
/**@file sofia-sip/http_tag_class.h /**@file sofia-sip/http_tag_class.h
* @brief Tag classes for HTTP headers. * @brief Tag classes for HTTP headers.
@@ -62,9 +62,9 @@ SOFIA_BEGIN_DECLS
{{ TAG_NAMESPACE, #t, httpmsgtag_class, \ {{ TAG_NAMESPACE, #t, httpmsgtag_class, \
(tag_value_t)HTTP_PROTOCOL_TAG }} (tag_value_t)HTTP_PROTOCOL_TAG }}
/**@internal Filter HTTP header tag items. */ /**@internal Filter HTTP header tag items. */
SOFIAPUBFUN tagi_t *httptag_filter(tagi_t *dst, tagi_t const f[], SOFIAPUBFUN tagi_t *httptag_filter(tagi_t *dst, tagi_t const f[],
tagi_t const *src, tagi_t const *src,
void **bb); void **bb);
SOFIA_END_DECLS SOFIA_END_DECLS

View File

@@ -189,7 +189,7 @@ msg_t *read_message_byte_by_byte(char const buffer[])
for (i = 0; i < n;) { for (i = 0; i < n;) {
/* This prevent msg_recv_iovec() from allocating extra slack */ /* This prevent msg_recv_iovec() from allocating extra slack */
int msg_buf_exact(msg_t *, int); int msg_buf_exact(msg_t *, int);
msg_buf_exact(msg, 10 + 1); msg_buf_exact(msg, 10 + 1);
if (msg_recv_iovec(msg, iovec, msg_n_fragments, 10, 0) < 0) { if (msg_recv_iovec(msg, iovec, msg_n_fragments, 10, 0) < 0) {
perror("msg_recv_iovec"); perror("msg_recv_iovec");
@@ -1008,7 +1008,7 @@ static int http_header_test(void)
"CUSTOMER=WILE_E_COYOTE; " "CUSTOMER=WILE_E_COYOTE; "
"path=/; " "path=/; "
"expires=Wednesday, 09-Nov-99 23:12:40 GMT"); "expires=Wednesday, 09-Nov-99 23:12:40 GMT");
TEST_1(sc); TEST_1(sc);
TEST_1(sc->sc_params); TEST_1(sc->sc_params);
TEST_S(sc->sc_name, "CUSTOMER=WILE_E_COYOTE"); TEST_S(sc->sc_name, "CUSTOMER=WILE_E_COYOTE");

View File

@@ -36,7 +36,7 @@
#include <string.h> #include <string.h>
#include "sofia-sip/base64.h" #include "sofia-sip/base64.h"
static unsigned char const code[] = static unsigned char const code[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
#define B64NOP 128 #define B64NOP 128
@@ -48,22 +48,22 @@ static unsigned char const code[] =
* stores the result in the buffer @a buf of @a bsiz bytes. * stores the result in the buffer @a buf of @a bsiz bytes.
* *
* If the @a buf is NULL, the function just returns the length of decoded * If the @a buf is NULL, the function just returns the length of decoded
* data. In any case, no decoded data is stored in @a buf beyond @a bsiz. * data. In any case, no decoded data is stored in @a buf beyond @a bsiz.
* The function always returns the full length of decodable data. * The function always returns the full length of decodable data.
* *
* @param buf Buffer to store decoded data * @param buf Buffer to store decoded data
* @param bsiz Size of @a buf * @param bsiz Size of @a buf
* @param b64s Base64-encoded string. * @param b64s Base64-encoded string.
* *
* @return Length of data that can be decoded in bytes. * @return Length of data that can be decoded in bytes.
* *
* @sa <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>, * @sa <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>,
* <i>"Multipurpose Internet Mail Extensions (MIME) Part One: * <i>"Multipurpose Internet Mail Extensions (MIME) Part One:
* Format of Internet Message Bodies"</i>, * Format of Internet Message Bodies"</i>,
* N. Freed, N. Borenstein, November 1996. * N. Freed, N. Borenstein, November 1996.
* *
* @par Example * @par Example
* The following example code decodes a string of BASE64 data into a * The following example code decodes a string of BASE64 data into a
* memory area allocated from heap: * memory area allocated from heap:
* @code * @code
* int decoder(char const *encoded, void **return_decoded) * int decoder(char const *encoded, void **return_decoded)
@@ -76,7 +76,7 @@ static unsigned char const code[] =
* } * }
* @endcode * @endcode
*/ */
isize_t base64_d(char buf[], isize_t bsiz, char const *b64s) isize_t base64_d(char buf[], isize_t bsiz, char const *b64s)
{ {
static unsigned char decode[256] = ""; static unsigned char decode[256] = "";
unsigned char const *s = (unsigned char const *)b64s; unsigned char const *s = (unsigned char const *)b64s;
@@ -90,7 +90,7 @@ isize_t base64_d(char buf[], isize_t bsiz, char const *b64s)
if (decode['\0'] != B64EOF) { if (decode['\0'] != B64EOF) {
/* Prepare decoding table */ /* Prepare decoding table */
for (i = 1; i < 256; i++) for (i = 1; i < 256; i++)
decode[i] = B64NOP; decode[i] = B64NOP;
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
decode[code[i]] = (unsigned char)i; decode[code[i]] = (unsigned char)i;
@@ -104,17 +104,17 @@ isize_t base64_d(char buf[], isize_t bsiz, char const *b64s)
if (c != B64NOP) if (c != B64NOP)
len++; len++;
} }
total_len = len = len * 3 / 4; total_len = len = len * 3 / 4;
if (buf == NULL || bsiz == 0) if (buf == NULL || bsiz == 0)
return total_len; return total_len;
if (len > bsiz) if (len > bsiz)
len = bsiz; len = bsiz;
for (i = 0, s = (unsigned char const *)b64s; i < len; ) { for (i = 0, s = (unsigned char const *)b64s; i < len; ) {
while ((b1 = decode[*s++]) == B64NOP) while ((b1 = decode[*s++]) == B64NOP)
; ;
if (b1 != B64EOF) if (b1 != B64EOF)
@@ -126,7 +126,7 @@ isize_t base64_d(char buf[], isize_t bsiz, char const *b64s)
if (b3 != B64EOF) if (b3 != B64EOF)
while ((b4 = decode[*s++]) == B64NOP) while ((b4 = decode[*s++]) == B64NOP)
; ;
if (((b1 | b2 | b3 | b4) & (B64NOP|B64EOF)) == 0) { if (((b1 | b2 | b3 | b4) & (B64NOP|B64EOF)) == 0) {
/* Normal case, 4 B64 chars to 3 data bytes */ /* Normal case, 4 B64 chars to 3 data bytes */
w = (b1 << 18) | (b2 << 12) | (b3 << 6) | b4; w = (b1 << 18) | (b2 << 12) | (b3 << 6) | b4;
@@ -163,8 +163,8 @@ isize_t base64_d(char buf[], isize_t bsiz, char const *b64s)
} }
/**Encode data with BASE64. /**Encode data with BASE64.
* *
* The function base64_e() encodes @a dsiz bytes of @a data into @a buf. * The function base64_e() encodes @a dsiz bytes of @a data into @a buf.
* *
* @note The function base64_e() uses at most @a bsiz bytes from @a buf. * @note The function base64_e() uses at most @a bsiz bytes from @a buf.
* *
@@ -183,13 +183,13 @@ isize_t base64_d(char buf[], isize_t bsiz, char const *b64s)
* @return The function base64_e() return length of encoded string, * @return The function base64_e() return length of encoded string,
* excluding the final NUL. * excluding the final NUL.
* *
* @sa <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>, * @sa <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>,
* <i>"Multipurpose Internet Mail Extensions (MIME) Part One: * <i>"Multipurpose Internet Mail Extensions (MIME) Part One:
* Format of Internet Message Bodies"</i>, * Format of Internet Message Bodies"</i>,
* N. Freed, N. Borenstein, November 1996. * N. Freed, N. Borenstein, November 1996.
* *
*/ */
isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz) isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz)
{ {
unsigned char *s = (unsigned char *)buf; unsigned char *s = (unsigned char *)buf;
unsigned char *b = (unsigned char *)data; unsigned char *b = (unsigned char *)data;
@@ -200,7 +200,7 @@ isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz)
if (bsize == 0) if (bsize == 0)
s = NULL; s = NULL;
for (i = 0, n = 0; i < dsize; i += 3, n += 4) { for (i = 0, n = 0; i < dsize; i += 3, n += 4) {
w = (b[i] << 16) | (b[i+1] << 8) | b[i+2]; w = (b[i] << 16) | (b[i+1] << 8) | b[i+2];
@@ -211,9 +211,9 @@ isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz)
s[n + 2] = code[(w >> 6) & 63]; s[n + 2] = code[(w >> 6) & 63];
s[n + 3] = code[(w) & 63]; s[n + 3] = code[(w) & 63];
} else { } else {
if (n + 1 < bsize) if (n + 1 < bsize)
s[n + 0] = code[(w >> 18) & 63]; s[n + 0] = code[(w >> 18) & 63];
if (n + 2 < bsize) if (n + 2 < bsize)
s[n + 1] = code[(w >> 12) & 63]; s[n + 1] = code[(w >> 12) & 63];
if (n + 3 < bsize) if (n + 3 < bsize)
s[n + 2] = code[(w >> 6) & 63]; s[n + 2] = code[(w >> 6) & 63];
@@ -221,8 +221,8 @@ isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz)
s = NULL; s = NULL;
} }
} }
} }
if (slack) { if (slack) {
if (s) { if (s) {
if (slack == 2) if (slack == 2)
@@ -230,7 +230,7 @@ isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz)
else else
w = (b[i] << 16); w = (b[i] << 16);
if (n + 1 < bsize) if (n + 1 < bsize)
s[n + 0] = code[(w >> 18) & 63]; s[n + 0] = code[(w >> 18) & 63];
if (n + 2 < bsize) if (n + 2 < bsize)
s[n + 1] = code[(w >> 12) & 63]; s[n + 1] = code[(w >> 12) & 63];

View File

@@ -1,7 +1,7 @@
/* -*- c -*- */ /* -*- c -*- */
/**@MODULEPAGE "ipt" - Utility Module /**@MODULEPAGE "ipt" - Utility Module
* *
* @section ipt_meta Module Meta Information * @section ipt_meta Module Meta Information
* *
* Utility library for IP Telephony applications. * Utility library for IP Telephony applications.
@@ -14,7 +14,7 @@
* *
* @section ipt_overview Overview * @section ipt_overview Overview
* *
* This module contain some routines useful for IPT applications, like * This module contain some routines useful for IPT applications, like
* - <sofia-sip/base64.h> BASE64 encoding/decoding, and * - <sofia-sip/base64.h> BASE64 encoding/decoding, and
* - <sofia-sip/token64.h> encoding/decoding binary as SIP/HTTP token. * - <sofia-sip/token64.h> encoding/decoding binary as SIP/HTTP token.
*/ */

View File

@@ -37,40 +37,40 @@ void rc4_init(const void *vseed, isize_t seed_len, rc4_t *state) {
const rc4_u8 *seed = (const rc4_u8 *)vseed; const rc4_u8 *seed = (const rc4_u8 *)vseed;
rc4_u8 *array = state->rc4_array; rc4_u8 *array = state->rc4_array;
state->rc4_i = 0; state->rc4_i = 0;
state->rc4_j = 0; state->rc4_j = 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
array[i] = (rc4_u8) i; array[i] = (rc4_u8) i;
for (i = 0, j = 0, k = 0; for (i = 0, j = 0, k = 0;
i < 256; i < 256;
i++, k++, k >= seed_len ? k = 0 : 0) { i++, k++, k >= seed_len ? k = 0 : 0) {
rc4_u8 a = array[i]; rc4_u8 a = array[i];
rc4_u8 b = array[j += a + seed[k]]; rc4_u8 b = array[j += a + seed[k]];
array[i] = b; array[i] = b;
array[j] = a; array[j] = a;
} }
} }
void rc4(void *buffer, isize_t len, rc4_t *state) { void rc4(void *buffer, isize_t len, rc4_t *state) {
rc4_u8 *buf = (rc4_u8 *)buffer; rc4_u8 *buf = (rc4_u8 *)buffer;
rc4_u8 *array = state->rc4_array; rc4_u8 *array = state->rc4_array;
rc4_u8 i = state->rc4_i; rc4_u8 i = state->rc4_i;
rc4_u8 j = state->rc4_j; rc4_u8 j = state->rc4_j;
while (len-- > 0) { while (len-- > 0) {
rc4_u8 a = array[++i]; rc4_u8 a = array[++i];
rc4_u8 b = array[j += a]; rc4_u8 b = array[j += a];
array[i] = b; array[i] = b;
array[j] = a; array[j] = a;
*buf++ ^= array[(a + b) & 255]; *buf++ ^= array[(a + b) & 255];
} }
state->rc4_i = i; state->rc4_i = i;
state->rc4_j = j; state->rc4_j = j;
} }
@@ -90,114 +90,114 @@ rc4_u8 output_2[] = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a, };
rc4_u8 key_3[] = { 0xef, 0x01, 0x23, 0x45, }; rc4_u8 key_3[] = { 0xef, 0x01, 0x23, 0x45, };
rc4_u8 input_3[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; rc4_u8 input_3[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
rc4_u8 output_3[] = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61, }; rc4_u8 output_3[] = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61, };
rc4_u8 key_4[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, }; rc4_u8 key_4[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, };
rc4_u8 input_4[] = { rc4_u8 input_4[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, }; 0x01, };
rc4_u8 output_4[] = { rc4_u8 output_4[] = {
0x75, 0x95, 0xc3, 0xe6, 0x11, 0x4a, 0x09, 0x78, 0x0c, 0x4a, 0xd4, 0x75, 0x95, 0xc3, 0xe6, 0x11, 0x4a, 0x09, 0x78, 0x0c, 0x4a, 0xd4,
0x52, 0x33, 0x8e, 0x1f, 0xfd, 0x9a, 0x1b, 0xe9, 0x49, 0x8f, 0x52, 0x33, 0x8e, 0x1f, 0xfd, 0x9a, 0x1b, 0xe9, 0x49, 0x8f,
0x81, 0x3d, 0x76, 0x53, 0x34, 0x49, 0xb6, 0x77, 0x8d, 0xca, 0x81, 0x3d, 0x76, 0x53, 0x34, 0x49, 0xb6, 0x77, 0x8d, 0xca,
0xd8, 0xc7, 0x8a, 0x8d, 0x2b, 0xa9, 0xac, 0x66, 0x08, 0x5d, 0xd8, 0xc7, 0x8a, 0x8d, 0x2b, 0xa9, 0xac, 0x66, 0x08, 0x5d,
0x0e, 0x53, 0xd5, 0x9c, 0x26, 0xc2, 0xd1, 0xc4, 0x90, 0xc1, 0x0e, 0x53, 0xd5, 0x9c, 0x26, 0xc2, 0xd1, 0xc4, 0x90, 0xc1,
0xeb, 0xbe, 0x0c, 0xe6, 0x6d, 0x1b, 0x6b, 0x1b, 0x13, 0xb6, 0xeb, 0xbe, 0x0c, 0xe6, 0x6d, 0x1b, 0x6b, 0x1b, 0x13, 0xb6,
0xb9, 0x19, 0xb8, 0x47, 0xc2, 0x5a, 0x91, 0x44, 0x7a, 0x95, 0xb9, 0x19, 0xb8, 0x47, 0xc2, 0x5a, 0x91, 0x44, 0x7a, 0x95,
0xe7, 0x5e, 0x4e, 0xf1, 0x67, 0x79, 0xcd, 0xe8, 0xbf, 0x0a, 0xe7, 0x5e, 0x4e, 0xf1, 0x67, 0x79, 0xcd, 0xe8, 0xbf, 0x0a,
0x95, 0x85, 0x0e, 0x32, 0xaf, 0x96, 0x89, 0x44, 0x4f, 0xd3, 0x95, 0x85, 0x0e, 0x32, 0xaf, 0x96, 0x89, 0x44, 0x4f, 0xd3,
0x77, 0x10, 0x8f, 0x98, 0xfd, 0xcb, 0xd4, 0xe7, 0x26, 0x56, 0x77, 0x10, 0x8f, 0x98, 0xfd, 0xcb, 0xd4, 0xe7, 0x26, 0x56,
0x75, 0x00, 0x99, 0x0b, 0xcc, 0x7e, 0x0c, 0xa3, 0xc4, 0xaa, 0x75, 0x00, 0x99, 0x0b, 0xcc, 0x7e, 0x0c, 0xa3, 0xc4, 0xaa,
0xa3, 0x04, 0xa3, 0x87, 0xd2, 0x0f, 0x3b, 0x8f, 0xbb, 0xcd, 0xa3, 0x04, 0xa3, 0x87, 0xd2, 0x0f, 0x3b, 0x8f, 0xbb, 0xcd,
0x42, 0xa1, 0xbd, 0x31, 0x1d, 0x7a, 0x43, 0x03, 0xdd, 0xa5, 0x42, 0xa1, 0xbd, 0x31, 0x1d, 0x7a, 0x43, 0x03, 0xdd, 0xa5,
0xab, 0x07, 0x88, 0x96, 0xae, 0x80, 0xc1, 0x8b, 0x0a, 0xf6, 0xab, 0x07, 0x88, 0x96, 0xae, 0x80, 0xc1, 0x8b, 0x0a, 0xf6,
0x6d, 0xff, 0x31, 0x96, 0x16, 0xeb, 0x78, 0x4e, 0x49, 0x5a, 0x6d, 0xff, 0x31, 0x96, 0x16, 0xeb, 0x78, 0x4e, 0x49, 0x5a,
0xd2, 0xce, 0x90, 0xd7, 0xf7, 0x72, 0xa8, 0x17, 0x47, 0xb6, 0xd2, 0xce, 0x90, 0xd7, 0xf7, 0x72, 0xa8, 0x17, 0x47, 0xb6,
0x5f, 0x62, 0x09, 0x3b, 0x1e, 0x0d, 0xb9, 0xe5, 0xba, 0x53, 0x5f, 0x62, 0x09, 0x3b, 0x1e, 0x0d, 0xb9, 0xe5, 0xba, 0x53,
0x2f, 0xaf, 0xec, 0x47, 0x50, 0x83, 0x23, 0xe6, 0x71, 0x32, 0x2f, 0xaf, 0xec, 0x47, 0x50, 0x83, 0x23, 0xe6, 0x71, 0x32,
0x7d, 0xf9, 0x44, 0x44, 0x32, 0xcb, 0x73, 0x67, 0xce, 0xc8, 0x7d, 0xf9, 0x44, 0x44, 0x32, 0xcb, 0x73, 0x67, 0xce, 0xc8,
0x2f, 0x5d, 0x44, 0xc0, 0xd0, 0x0b, 0x67, 0xd6, 0x50, 0xa0, 0x2f, 0x5d, 0x44, 0xc0, 0xd0, 0x0b, 0x67, 0xd6, 0x50, 0xa0,
0x75, 0xcd, 0x4b, 0x70, 0xde, 0xdd, 0x77, 0xeb, 0x9b, 0x10, 0x75, 0xcd, 0x4b, 0x70, 0xde, 0xdd, 0x77, 0xeb, 0x9b, 0x10,
0x23, 0x1b, 0x6b, 0x5b, 0x74, 0x13, 0x47, 0x39, 0x6d, 0x62, 0x23, 0x1b, 0x6b, 0x5b, 0x74, 0x13, 0x47, 0x39, 0x6d, 0x62,
0x89, 0x74, 0x21, 0xd4, 0x3d, 0xf9, 0xb4, 0x2e, 0x44, 0x6e, 0x89, 0x74, 0x21, 0xd4, 0x3d, 0xf9, 0xb4, 0x2e, 0x44, 0x6e,
0x35, 0x8e, 0x9c, 0x11, 0xa9, 0xb2, 0x18, 0x4e, 0xcb, 0xef, 0x35, 0x8e, 0x9c, 0x11, 0xa9, 0xb2, 0x18, 0x4e, 0xcb, 0xef,
0x0c, 0xd8, 0xe7, 0xa8, 0x77, 0xef, 0x96, 0x8f, 0x13, 0x90, 0x0c, 0xd8, 0xe7, 0xa8, 0x77, 0xef, 0x96, 0x8f, 0x13, 0x90,
0xec, 0x9b, 0x3d, 0x35, 0xa5, 0x58, 0x5c, 0xb0, 0x09, 0x29, 0xec, 0x9b, 0x3d, 0x35, 0xa5, 0x58, 0x5c, 0xb0, 0x09, 0x29,
0x0e, 0x2f, 0xcd, 0xe7, 0xb5, 0xec, 0x66, 0xd9, 0x08, 0x4b, 0x0e, 0x2f, 0xcd, 0xe7, 0xb5, 0xec, 0x66, 0xd9, 0x08, 0x4b,
0xe4, 0x40, 0x55, 0xa6, 0x19, 0xd9, 0xdd, 0x7f, 0xc3, 0x16, 0xe4, 0x40, 0x55, 0xa6, 0x19, 0xd9, 0xdd, 0x7f, 0xc3, 0x16,
0x6f, 0x94, 0x87, 0xf7, 0xcb, 0x27, 0x29, 0x12, 0x42, 0x64, 0x6f, 0x94, 0x87, 0xf7, 0xcb, 0x27, 0x29, 0x12, 0x42, 0x64,
0x45, 0x99, 0x85, 0x14, 0xc1, 0x5d, 0x53, 0xa1, 0x8c, 0x86, 0x45, 0x99, 0x85, 0x14, 0xc1, 0x5d, 0x53, 0xa1, 0x8c, 0x86,
0x4c, 0xe3, 0xa2, 0xb7, 0x55, 0x57, 0x93, 0x98, 0x81, 0x26, 0x4c, 0xe3, 0xa2, 0xb7, 0x55, 0x57, 0x93, 0x98, 0x81, 0x26,
0x52, 0x0e, 0xac, 0xf2, 0xe3, 0x06, 0x6e, 0x23, 0x0c, 0x91, 0x52, 0x0e, 0xac, 0xf2, 0xe3, 0x06, 0x6e, 0x23, 0x0c, 0x91,
0xbe, 0xe4, 0xdd, 0x53, 0x04, 0xf5, 0xfd, 0x04, 0x05, 0xb3, 0xbe, 0xe4, 0xdd, 0x53, 0x04, 0xf5, 0xfd, 0x04, 0x05, 0xb3,
0x5b, 0xd9, 0x9c, 0x73, 0x13, 0x5d, 0x3d, 0x9b, 0xc3, 0x35, 0x5b, 0xd9, 0x9c, 0x73, 0x13, 0x5d, 0x3d, 0x9b, 0xc3, 0x35,
0xee, 0x04, 0x9e, 0xf6, 0x9b, 0x38, 0x67, 0xbf, 0x2d, 0x7b, 0xee, 0x04, 0x9e, 0xf6, 0x9b, 0x38, 0x67, 0xbf, 0x2d, 0x7b,
0xd1, 0xea, 0xa5, 0x95, 0xd8, 0xbf, 0xc0, 0x06, 0x6f, 0xf8, 0xd1, 0xea, 0xa5, 0x95, 0xd8, 0xbf, 0xc0, 0x06, 0x6f, 0xf8,
0xd3, 0x15, 0x09, 0xeb, 0x0c, 0x6c, 0xaa, 0x00, 0x6c, 0x80, 0xd3, 0x15, 0x09, 0xeb, 0x0c, 0x6c, 0xaa, 0x00, 0x6c, 0x80,
0x7a, 0x62, 0x3e, 0xf8, 0x4c, 0x3d, 0x33, 0xc1, 0x95, 0xd2, 0x7a, 0x62, 0x3e, 0xf8, 0x4c, 0x3d, 0x33, 0xc1, 0x95, 0xd2,
0x3e, 0xe3, 0x20, 0xc4, 0x0d, 0xe0, 0x55, 0x81, 0x57, 0xc8, 0x3e, 0xe3, 0x20, 0xc4, 0x0d, 0xe0, 0x55, 0x81, 0x57, 0xc8,
0x22, 0xd4, 0xb8, 0xc5, 0x69, 0xd8, 0x49, 0xae, 0xd5, 0x9d, 0x22, 0xd4, 0xb8, 0xc5, 0x69, 0xd8, 0x49, 0xae, 0xd5, 0x9d,
0x4e, 0x0f, 0xd7, 0xf3, 0x79, 0x58, 0x6b, 0x4b, 0x7f, 0xf6, 0x4e, 0x0f, 0xd7, 0xf3, 0x79, 0x58, 0x6b, 0x4b, 0x7f, 0xf6,
0x84, 0xed, 0x6a, 0x18, 0x9f, 0x74, 0x86, 0xd4, 0x9b, 0x9c, 0x84, 0xed, 0x6a, 0x18, 0x9f, 0x74, 0x86, 0xd4, 0x9b, 0x9c,
0x4b, 0xad, 0x9b, 0xa2, 0x4b, 0x96, 0xab, 0xf9, 0x24, 0x37, 0x4b, 0xad, 0x9b, 0xa2, 0x4b, 0x96, 0xab, 0xf9, 0x24, 0x37,
0x2c, 0x8a, 0x8f, 0xff, 0xb1, 0x0d, 0x55, 0x35, 0x49, 0x00, 0x2c, 0x8a, 0x8f, 0xff, 0xb1, 0x0d, 0x55, 0x35, 0x49, 0x00,
0xa7, 0x7a, 0x3d, 0xb5, 0xf2, 0x05, 0xe1, 0xb9, 0x9f, 0xcd, 0xa7, 0x7a, 0x3d, 0xb5, 0xf2, 0x05, 0xe1, 0xb9, 0x9f, 0xcd,
0x86, 0x60, 0x86, 0x3a, 0x15, 0x9a, 0xd4, 0xab, 0xe4, 0x0f, 0x86, 0x60, 0x86, 0x3a, 0x15, 0x9a, 0xd4, 0xab, 0xe4, 0x0f,
0xa4, 0x89, 0x34, 0x16, 0x3d, 0xdd, 0xe5, 0x42, 0xa6, 0x58, 0xa4, 0x89, 0x34, 0x16, 0x3d, 0xdd, 0xe5, 0x42, 0xa6, 0x58,
0x55, 0x40, 0xfd, 0x68, 0x3c, 0xbf, 0xd8, 0xc0, 0x0f, 0x12, 0x55, 0x40, 0xfd, 0x68, 0x3c, 0xbf, 0xd8, 0xc0, 0x0f, 0x12,
0x12, 0x9a, 0x28, 0x4d, 0xea, 0xcc, 0x4c, 0xde, 0xfe, 0x58, 0x12, 0x9a, 0x28, 0x4d, 0xea, 0xcc, 0x4c, 0xde, 0xfe, 0x58,
0xbe, 0x71, 0x37, 0x54, 0x1c, 0x04, 0x71, 0x26, 0xc8, 0xd4, 0xbe, 0x71, 0x37, 0x54, 0x1c, 0x04, 0x71, 0x26, 0xc8, 0xd4,
0x9e, 0x27, 0x55, 0xab, 0x18, 0x1a, 0xb7, 0xe9, 0x40, 0xb0, 0x9e, 0x27, 0x55, 0xab, 0x18, 0x1a, 0xb7, 0xe9, 0x40, 0xb0,
0xc0, }; 0xc0, };
#include <stdio.h> #include <stdio.h>
@@ -210,7 +210,7 @@ void printout(const char *title, rc4_u8 *data, int len) {
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
printf("0x%02x ", data[i]); printf("0x%02x ", data[i]);
} }
putchar('\n'); putchar('\n');
} }

View File

@@ -34,10 +34,10 @@
* [A-Za-z0-9+/=]. Base64 is defined as part of MIME mail format, but it is * [A-Za-z0-9+/=]. Base64 is defined as part of MIME mail format, but it is
* used widely by other text-based protocols as well. * used widely by other text-based protocols as well.
* *
* @sa <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>, * @sa <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>,
* <i>"Multipurpose Internet Mail Extensions (MIME) Part One: * <i>"Multipurpose Internet Mail Extensions (MIME) Part One:
* Format of Internet Message Bodies"</i>, * Format of Internet Message Bodies"</i>,
* N. Freed, N. Borenstein, * N. Freed, N. Borenstein,
* November 1996. * November 1996.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>

View File

@@ -28,9 +28,9 @@
/**@file sofia-sip/rc4.h /**@file sofia-sip/rc4.h
* @brief Arcfour random number generator. * @brief Arcfour random number generator.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Sun Jun 9 14:32:58 1996 ppessi * @date Created: Sun Jun 9 14:32:58 1996 ppessi
*/ */
@@ -45,21 +45,21 @@ extern "C" {
/** Byte. */ /** Byte. */
typedef uint8_t rc4_u8; typedef uint8_t rc4_u8;
/** RC4 context. /** RC4 context.
* *
* The RC4 context is accessed and modified through rc4_init() and rc4() * The RC4 context is accessed and modified through rc4_init() and rc4()
* functions only. * functions only.
*/ */
typedef struct { typedef struct {
uint8_t rc4_i; uint8_t rc4_i;
uint8_t rc4_j; uint8_t rc4_j;
uint8_t rc4_array[256]; uint8_t rc4_array[256];
} rc4_t; } rc4_t;
/** Key RC4 context. */ /** Key RC4 context. */
SOFIAPUBFUN void rc4_init(const void *seed, isize_t seed_len, rc4_t *state); SOFIAPUBFUN void rc4_init(const void *seed, isize_t seed_len, rc4_t *state);
/** Generate RC4 stream. */ /** Generate RC4 stream. */
SOFIAPUBFUN void rc4(void *buffer, isize_t len, rc4_t *state); SOFIAPUBFUN void rc4(void *buffer, isize_t len, rc4_t *state);
#if defined(__cplusplus) #if defined(__cplusplus)

View File

@@ -24,7 +24,7 @@
#ifndef UNIQUEID_H #ifndef UNIQUEID_H
/** Defined when <sofia-sip/uniqueid.h> has been included. */ /** Defined when <sofia-sip/uniqueid.h> has been included. */
#define UNIQUEID_H #define UNIQUEID_H
/**@file sofia-sip/uniqueid.h /**@file sofia-sip/uniqueid.h
* *
@@ -38,7 +38,7 @@
*/ */
/* Compatibility functionality */ /* Compatibility functionality */
#define guid_t su_guid_t #define guid_t su_guid_t
#define guid_generate su_guid_generate #define guid_generate su_guid_generate
#define guid_sprintf su_guid_sprintf #define guid_sprintf su_guid_sprintf
#define guid_strlen su_guid_strlen #define guid_strlen su_guid_strlen

View File

@@ -32,7 +32,7 @@
* *
* @date Created: Tue Apr 21 15:32:38 1998 pessi * @date Created: Tue Apr 21 15:32:38 1998 pessi
* @sa <a href="ftp://ftp.ietf.org/rfc/rfc2279.txt">RFC 2279</a>, * @sa <a href="ftp://ftp.ietf.org/rfc/rfc2279.txt">RFC 2279</a>,
* <i>"UTF-8, a transformation format of ISO 10646"</i>, * <i>"UTF-8, a transformation format of ISO 10646"</i>,
* F. Yergeau. January 1998. * F. Yergeau. January 1998.
* *
@@ -83,7 +83,7 @@ int ucs4cmp(ucs4 const *s1, ucs4 const *s2);
int ucs4ncmp(ucs4 const *s1, ucs4 const *s2, size_t n); int ucs4ncmp(ucs4 const *s1, ucs4 const *s2, size_t n);
/* /*
* IS_UCS4_n tests whether UCS4 character should be represented * IS_UCS4_n tests whether UCS4 character should be represented
* with 'n' byte utf8 string * with 'n' byte utf8 string
*/ */
#define IS_UCS4_1(x) ((ucs4)(x) <= 0x7fu) #define IS_UCS4_1(x) ((ucs4)(x) <= 0x7fu)
@@ -172,7 +172,7 @@ int ucs4ncmp(ucs4 const *s1, ucs4 const *s2, size_t n);
(s)[3]=((c>>12)&63)|128,\ (s)[3]=((c>>12)&63)|128,\
(s)[4]=((c>>6)&63)|128,\ (s)[4]=((c>>6)&63)|128,\
(s)[5]=((c)&63)|128) (s)[5]=((c)&63)|128)
SOFIA_END_DECLS SOFIA_END_DECLS
#endif /* UTF8_H */ #endif /* UTF8_H */

View File

@@ -22,13 +22,13 @@
* *
*/ */
/**@internal @file token64.c /**@internal @file token64.c
* *
* Token encoding. * Token encoding.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Wed Apr 3 10:45:47 2002 ppessi * @date Created: Wed Apr 3 10:45:47 2002 ppessi
*/ */
#include "config.h" #include "config.h"
@@ -39,10 +39,10 @@
#include "sofia-sip/token64.h" #include "sofia-sip/token64.h"
static const char code[65] = static const char code[65] =
"0123456789-abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; "0123456789-abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/** Encode data as a SIP/HTTP token. /** Encode data as a SIP/HTTP token.
* *
* @note * @note
* A token is case-independent, so this is really not a good idea. * A token is case-independent, so this is really not a good idea.
@@ -74,7 +74,7 @@ isize_t token64_e(char b[], isize_t bsiz, void const *data, isize_t dlen)
for (i = 0; i < dlen; i += 3, s += 4) { for (i = 0; i < dlen; i += 3, s += 4) {
unsigned char h0 = h[i], h1 = h[i + 1], h2 = h[i + 2]; unsigned char h0 = h[i], h1 = h[i + 1], h2 = h[i + 2];
s[0] = code[h0 >> 2]; s[0] = code[h0 >> 2];
s[1] = code[((h0 << 4)|(h1 >> 4)) & 63]; s[1] = code[((h0 << 4)|(h1 >> 4)) & 63];
s[2] = code[((h1 << 4)|(h2 >> 6)) & 63]; s[2] = code[((h1 << 4)|(h2 >> 6)) & 63];

View File

@@ -36,7 +36,7 @@
#include "utf8internal.h" #include "utf8internal.h"
/* /*
* Decode utf8 string into ucs2 string, * Decode utf8 string into ucs2 string,
* return number of ucs2 characters decoded * return number of ucs2 characters decoded
*/ */
size_t ucs2decode(ucs2 *dst, size_t dst_size, const utf8 *s) size_t ucs2decode(ucs2 *dst, size_t dst_size, const utf8 *s)
@@ -70,9 +70,9 @@ size_t ucs2decode(ucs2 *dst, size_t dst_size, const utf8 *s)
* Encode ucs2 string into utf8 string, * Encode ucs2 string into utf8 string,
* return number of utf8 bytes encoded including final zero * return number of utf8 bytes encoded including final zero
* *
* 'quote' may contain an optional quoting table containing * 'quote' may contain an optional quoting table containing
* non-zero for all ASCII characters to quote * non-zero for all ASCII characters to quote
* *
*/ */
size_t ucs2encode(utf8 *dst, const ucs2 *s, size_t n, const char quote[128]) size_t ucs2encode(utf8 *dst, const ucs2 *s, size_t n, const char quote[128])
{ {
@@ -131,7 +131,7 @@ size_t ucs2enclen(const ucs2 *s, size_t n, const char quote[128])
{ {
size_t len = 1; size_t len = 1;
ucs2 c; ucs2 c;
while (n-- > 0) { while (n-- > 0) {
c = *s++; c = *s++;
if (c < 0x80u) if (c < 0x80u)
@@ -157,7 +157,7 @@ size_t ucs2len(ucs2 const *s)
{ {
size_t len = 0; size_t len = 0;
if (s) while (*s++) if (s) while (*s++)
len++; len++;
return len; return len;
@@ -170,7 +170,7 @@ int ucs2cmp(ucs2 const *s1, ucs2 const *s2)
{ {
int retval = s1 - s2; int retval = s1 - s2;
if (s1 && s2) if (s1 && s2)
while ((retval = (*s1 - *s2)) && (*s1++) && (*s2++)) while ((retval = (*s1 - *s2)) && (*s1++) && (*s2++))
; ;
@@ -184,7 +184,7 @@ int ucs2ncmp(ucs2 const *s1, ucs2 const *s2, size_t n)
{ {
int retval = 0; int retval = 0;
if (s1 && s2) if (s1 && s2)
while (n-- > 0 && (retval = (*s1 - *s2)) && (*s1++) && (*s2++)) while (n-- > 0 && (retval = (*s1 - *s2)) && (*s1++) && (*s2++))
; ;

View File

@@ -35,7 +35,7 @@
#include "utf8internal.h" #include "utf8internal.h"
/* /*
* Decode utf8 string into ucs4 string, * Decode utf8 string into ucs4 string,
* return number of ucs4 characters decoded * return number of ucs4 characters decoded
*/ */
size_t ucs4decode(ucs4 *dst, size_t dst_size, const utf8 *s) size_t ucs4decode(ucs4 *dst, size_t dst_size, const utf8 *s)
@@ -75,9 +75,9 @@ size_t ucs4decode(ucs4 *dst, size_t dst_size, const utf8 *s)
* Encode ucs4 string into utf8 string, * Encode ucs4 string into utf8 string,
* return number of utf8 bytes encoded including final zero * return number of utf8 bytes encoded including final zero
* *
* 'quote' may contain an optional quoting table containing * 'quote' may contain an optional quoting table containing
* non-zero for all ASCII characters to quote * non-zero for all ASCII characters to quote
* *
*/ */
size_t ucs4encode(utf8 *dst, const ucs4 *s, size_t n, const char quote[128]) size_t ucs4encode(utf8 *dst, const ucs4 *s, size_t n, const char quote[128])
{ {
@@ -151,7 +151,7 @@ size_t ucs4enclen(const ucs4 *s, size_t n, const char quote[128])
{ {
size_t len = 1; size_t len = 1;
ucs4 c; ucs4 c;
while (n-- > 0) { while (n-- > 0) {
c = *s++; c = *s++;
if (c < 0x80u) if (c < 0x80u)
@@ -183,7 +183,7 @@ size_t ucs4len(ucs4 const *s)
{ {
size_t len = 0; size_t len = 0;
if (s) while (*s++) if (s) while (*s++)
len++; len++;
return len; return len;
@@ -203,7 +203,7 @@ int ucs4cmp(ucs4 const *s1, ucs4 const *s2)
} }
/* /*
* Compare UCS4 string prefix * Compare UCS4 string prefix
*/ */
int ucs4ncmp(ucs4 const *s1, ucs4 const *s2, size_t n) int ucs4ncmp(ucs4 const *s1, ucs4 const *s2, size_t n)
{ {

View File

@@ -22,7 +22,7 @@
* *
*/ */
/**@CFILE utf8.c /**@CFILE utf8.c
* *
* utf8 string handling. * utf8 string handling.
* *

View File

@@ -23,9 +23,9 @@
*/ */
#ifndef UTF8INTERNAL_H #ifndef UTF8INTERNAL_H
#define UTF8INTERNAL_H #define UTF8INTERNAL_H
/**@IFILE utf8internal.h /**@IFILE utf8internal.h
* UTF-8 macros. * UTF-8 macros.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>

View File

@@ -38,27 +38,27 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
static ucs4 ucs4test0[] = { static ucs4 ucs4test0[] = {
0x41u, 0xC1u, 0x841u, 0x10041u, 0x200041u, 0x4000041u, 0 0x41u, 0xC1u, 0x841u, 0x10041u, 0x200041u, 0x4000041u, 0
}; };
static utf8 ucs4test1[] = static utf8 ucs4test1[] =
"A" "A"
"\303\201" "\303\201"
"\340\241\201" "\340\241\201"
"\360\220\201\201" "\360\220\201\201"
"\370\210\200\201\201" "\370\210\200\201\201"
"\374\204\200\200\201\201"; "\374\204\200\200\201\201";
static ucs2 ucs2test0[] = { static ucs2 ucs2test0[] = {
0x41u, 0xC1u, 0x841u, 0 0x41u, 0xC1u, 0x841u, 0
}; };
static utf8 ucs2test1[] = static utf8 ucs2test1[] =
"A" "A"
"\303\201" "\303\201"
"\340\241\201"; "\340\241\201";
ucs4 ucs4s[1024] = { 0 }; ucs4 ucs4s[1024] = { 0 };
ucs2 ucs2s[1024] = { 0 }; ucs2 ucs2s[1024] = { 0 };
utf8 utf8s[1024] = { 0 }; utf8 utf8s[1024] = { 0 };
size_t len; size_t len;
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
else puts("OK"); else puts("OK");
/* UCS2 */ /* UCS2 */
puts("testing ucs2len(ucs2test0)"); puts("testing ucs2len(ucs2test0)");
len = ucs2len(ucs2test0); len = ucs2len(ucs2test0);

View File

@@ -1,7 +1,7 @@
PROJECT_NAME = "iptsec" PROJECT_NAME = "iptsec"
OUTPUT_DIRECTORY = ../docs/html/iptsec OUTPUT_DIRECTORY = ../docs/html/iptsec
INPUT = @srcdir@/iptsec.docs @srcdir@/sofia-sip @srcdir@ . INPUT = @srcdir@/iptsec.docs @srcdir@/sofia-sip @srcdir@ .
@INCLUDE_PATH = . @srcdir@ @INCLUDE_PATH = . @srcdir@
@INCLUDE = ../docs/Doxyfile.conf @INCLUDE = ../docs/Doxyfile.conf

View File

@@ -57,14 +57,14 @@
#include <assert.h> #include <assert.h>
static auth_client_t *ca_create(su_home_t *home, static auth_client_t *ca_create(su_home_t *home,
char const *scheme, char const *scheme,
char const *realm); char const *realm);
static void ca_destroy(su_home_t *home, auth_client_t *ca); static void ca_destroy(su_home_t *home, auth_client_t *ca);
static int ca_challenge(auth_client_t *ca, static int ca_challenge(auth_client_t *ca,
msg_auth_t const *auth, msg_auth_t const *auth,
msg_hclass_t *credential_class, msg_hclass_t *credential_class,
char const *scheme, char const *scheme,
char const *realm); char const *realm);
@@ -73,9 +73,9 @@ static int ca_info(auth_client_t *ca,
msg_auth_info_t const *ai, msg_auth_info_t const *ai,
msg_hclass_t *credential_class); msg_hclass_t *credential_class);
static int ca_credentials(auth_client_t *ca, static int ca_credentials(auth_client_t *ca,
char const *scheme, char const *scheme,
char const *realm, char const *realm,
char const *user, char const *user,
char const *pass); char const *pass);
@@ -85,19 +85,19 @@ static int ca_clear_credentials(auth_client_t *ca);
/** Initialize authenticators. /** Initialize authenticators.
* *
* The function auc_challenge() merges the challenge @a ch to the list of * The function auc_challenge() merges the challenge @a ch to the list of
* authenticators @a auc_list. * authenticators @a auc_list.
* *
* @param[in,out] auc_list list of authenticators to be updated * @param[in,out] auc_list list of authenticators to be updated
* @param[in,out] home memory home used for allocating authenticators * @param[in,out] home memory home used for allocating authenticators
* @param[in] ch challenge to be processed * @param[in] ch challenge to be processed
* @param[in] crcl credential class * @param[in] crcl credential class
* *
* @retval 1 when challenge was updated * @retval 1 when challenge was updated
* @retval 0 when there was no new challenges * @retval 0 when there was no new challenges
* @retval -1 upon an error * @retval -1 upon an error
*/ */
int auc_challenge(auth_client_t **auc_list, int auc_challenge(auth_client_t **auc_list,
su_home_t *home, su_home_t *home,
msg_auth_t const *ch, msg_auth_t const *ch,
msg_hclass_t *crcl) msg_hclass_t *crcl)
{ {
@@ -139,7 +139,7 @@ int auc_challenge(auth_client_t **auc_list,
return retval; return retval;
} }
/** Update authentication client. /** Update authentication client.
* *
* @retval -1 upon an error * @retval -1 upon an error
* @retval 0 when challenge did not match * @retval 0 when challenge did not match
@@ -147,10 +147,10 @@ int auc_challenge(auth_client_t **auc_list,
* @retval 2 when challenge did match and updated client * @retval 2 when challenge did match and updated client
*/ */
static static
int ca_challenge(auth_client_t *ca, int ca_challenge(auth_client_t *ca,
msg_auth_t const *ch, msg_auth_t const *ch,
msg_hclass_t *credential_class, msg_hclass_t *credential_class,
char const *scheme, char const *scheme,
char const *realm) char const *realm)
{ {
int stale = 0; int stale = 0;
@@ -165,7 +165,7 @@ int ca_challenge(auth_client_t *ca,
if (strcmp(ca->ca_realm, realm)) if (strcmp(ca->ca_realm, realm))
return 0; return 0;
if (ca->ca_credential_class && if (ca->ca_credential_class &&
ca->ca_credential_class != credential_class) ca->ca_credential_class != credential_class)
return 0; return 0;
@@ -205,7 +205,7 @@ int ca_challenge(auth_client_t *ca,
* processed. * processed.
* *
* @bug * @bug
* In principle, SIP allows more than one challenge for a single request. * In principle, SIP allows more than one challenge for a single request.
* For example, there can be multiple proxies that each challenge the * For example, there can be multiple proxies that each challenge the
* client. The result of storing authentication info can be quite unexpected * client. The result of storing authentication info can be quite unexpected
* if there are more than one authenticator with the given type (specified * if there are more than one authenticator with the given type (specified
@@ -238,7 +238,7 @@ int auc_info(auth_client_t **auc_list,
return retval; return retval;
} }
/** Update authentication client with authentication info. /** Update authentication client with authentication info.
* *
* @retval -1 upon an error * @retval -1 upon an error
* @retval 0 when challenge did not match * @retval 0 when challenge did not match
@@ -246,7 +246,7 @@ int auc_info(auth_client_t **auc_list,
* @retval 2 when challenge did match and updated client * @retval 2 when challenge did match and updated client
*/ */
static static
int ca_info(auth_client_t *ca, int ca_info(auth_client_t *ca,
msg_auth_info_t const *info, msg_auth_info_t const *info,
msg_hclass_t *credential_class) msg_hclass_t *credential_class)
{ {
@@ -262,7 +262,7 @@ int ca_info(auth_client_t *ca,
return 0; return 0;
if (!ca->ca_auc if (!ca->ca_auc
|| (size_t)ca->ca_auc->auc_plugin_size <= || (size_t)ca->ca_auc->auc_plugin_size <=
offsetof(auth_client_plugin_t, auc_info) offsetof(auth_client_plugin_t, auc_info)
|| !ca->ca_auc->auc_info) || !ca->ca_auc->auc_info)
return 0; return 0;
@@ -283,14 +283,14 @@ int ca_info(auth_client_t *ca,
* *
* @todo The authentication data format sucks. * @todo The authentication data format sucks.
* *
* @param[in,out] auc_list list of authenticators * @param[in,out] auc_list list of authenticators
* @param[in,out] home memory home used for allocations * @param[in,out] home memory home used for allocations
* @param[in] data colon-separated authentication data * @param[in] data colon-separated authentication data
* *
* @retval 0 when successful * @retval 0 when successful
* @retval -1 upon an error * @retval -1 upon an error
*/ */
int auc_credentials(auth_client_t **auc_list, su_home_t *home, int auc_credentials(auth_client_t **auc_list, su_home_t *home,
char const *data) char const *data)
{ {
int retval = 0, match; int retval = 0, match;
@@ -317,7 +317,7 @@ int auc_credentials(auth_client_t **auc_list, su_home_t *home,
retval = -1; retval = -1;
break; break;
} }
if (match) if (match)
retval++; retval++;
} }
} }
@@ -330,25 +330,25 @@ int auc_credentials(auth_client_t **auc_list, su_home_t *home,
/**Feed authentication data to the authenticator. /**Feed authentication data to the authenticator.
* *
* The function auc_credentials() is used to provide the authenticators in * The function auc_credentials() is used to provide the authenticators in
* with authentication tuple (scheme, realm, user name, secret). * with authentication tuple (scheme, realm, user name, secret).
* *
* scheme:"realm":user:pass * scheme:"realm":user:pass
* *
* @todo The authentication data format sucks. * @todo The authentication data format sucks.
* *
* @param[in,out] auc_list list of authenticators * @param[in,out] auc_list list of authenticators
* @param[in] scheme scheme to use (NULL, if any) * @param[in] scheme scheme to use (NULL, if any)
* @param[in] realm realm to use (NULL, if any) * @param[in] realm realm to use (NULL, if any)
* @param[in] user username * @param[in] user username
* @param[in] pass password * @param[in] pass password
* *
* @retval number of updated clients * @retval number of updated clients
* @retval 0 when no client was updated * @retval 0 when no client was updated
* @retval -1 upon an error * @retval -1 upon an error
*/ */
int auc_all_credentials(auth_client_t **auc_list, int auc_all_credentials(auth_client_t **auc_list,
char const *scheme, char const *scheme,
char const *realm, char const *realm,
char const *user, char const *user,
char const *pass) char const *pass)
{ {
@@ -363,7 +363,7 @@ int auc_all_credentials(auth_client_t **auc_list,
match = ca_credentials(*auc_list, scheme, realm, user, pass); match = ca_credentials(*auc_list, scheme, realm, user, pass);
if (match < 0) if (match < 0)
return -1; return -1;
if (match) if (match)
retval++; retval++;
} }
} }
@@ -371,9 +371,9 @@ int auc_all_credentials(auth_client_t **auc_list,
return retval; return retval;
} }
int ca_credentials(auth_client_t *ca, int ca_credentials(auth_client_t *ca,
char const *scheme, char const *scheme,
char const *realm, char const *realm,
char const *user, char const *user,
char const *pass) char const *pass)
{ {
@@ -465,21 +465,21 @@ int auc_copy_credentials(auth_client_t **dst,
return retval; return retval;
} }
/**Clear authentication data from the authenticator. /**Clear authentication data from the authenticator.
* *
* The function auc_clear_credentials() is used to remove the credentials * The function auc_clear_credentials() is used to remove the credentials
* from the authenticators. * from the authenticators.
* *
* @param[in,out] auc_list list of authenticators * @param[in,out] auc_list list of authenticators
* @param[in] scheme scheme (if non-null, remove only matching credentials) * @param[in] scheme scheme (if non-null, remove only matching credentials)
* @param[in] realm realm (if non-null, remove only matching credentials) * @param[in] realm realm (if non-null, remove only matching credentials)
* *
* @retval 0 when successful * @retval 0 when successful
* @retval -1 upon an error * @retval -1 upon an error
*/ */
int auc_clear_credentials(auth_client_t **auc_list, int auc_clear_credentials(auth_client_t **auc_list,
char const *scheme, char const *scheme,
char const *realm) char const *realm)
{ {
@@ -502,7 +502,7 @@ int auc_clear_credentials(auth_client_t **auc_list,
retval = -1; retval = -1;
break; break;
} }
if (match) if (match)
retval++; retval++;
} }
@@ -523,7 +523,7 @@ int ca_clear_credentials(auth_client_t *ca)
} }
/** Check if we have all required credentials. /** Check if we have all required credentials.
* *
* @retval 1 when authorization can proceed * @retval 1 when authorization can proceed
* @retval 0 when there is not enough credentials * @retval 0 when there is not enough credentials
* *
@@ -553,20 +553,20 @@ int auc_has_authorization(auth_client_t **auc_list)
* headers to a request. The authentication headers will contain the * headers to a request. The authentication headers will contain the
* credentials generated by the list of authenticators. * credentials generated by the list of authenticators.
* *
* @param[in,out] auc_list list of authenticators * @param[in,out] auc_list list of authenticators
* @param[out] msg message to be authenticated * @param[out] msg message to be authenticated
* @param[out] pub headers of the message * @param[out] pub headers of the message
* @param[in] method request method * @param[in] method request method
* @param[in] url request URI * @param[in] url request URI
* @param[in] body message body (NULL if empty) * @param[in] body message body (NULL if empty)
* *
* @retval 1 when successful * @retval 1 when successful
* @retval 0 when there is not enough credentials * @retval 0 when there is not enough credentials
* @retval -1 upon an error * @retval -1 upon an error
*/ */
int auc_authorization(auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub, int auc_authorization(auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body) msg_payload_t const *body)
{ {
auth_client_t *ca; auth_client_t *ca;
@@ -616,21 +616,21 @@ int auc_authorization(auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub,
* authentication headers for a request. The list of authentication headers * authentication headers for a request. The list of authentication headers
* will contain the credentials generated by the list of authenticators. * will contain the credentials generated by the list of authenticators.
* *
* @param[in] auc_list list of authenticators * @param[in] auc_list list of authenticators
* @param[in] home memory home used to allocate headers * @param[in] home memory home used to allocate headers
* @param[in] method request method * @param[in] method request method
* @param[in] url request URI * @param[in] url request URI
* @param[in] body message body (NULL if empty) * @param[in] body message body (NULL if empty)
* @param[out] return_headers authorization headers return value * @param[out] return_headers authorization headers return value
* *
* @retval 1 when successful * @retval 1 when successful
* @retval 0 when there is not enough credentials * @retval 0 when there is not enough credentials
* @retval -1 upon an error * @retval -1 upon an error
*/ */
int auc_authorization_headers(auth_client_t **auc_list, int auc_authorization_headers(auth_client_t **auc_list,
su_home_t *home, su_home_t *home,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **return_headers) msg_header_t **return_headers)
{ {
@@ -666,13 +666,13 @@ int auc_authorization_headers(auth_client_t **auc_list,
static int auc_basic_authorization(auth_client_t *ca, static int auc_basic_authorization(auth_client_t *ca,
su_home_t *h, su_home_t *h,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **); msg_header_t **);
static const auth_client_plugin_t ca_basic_plugin = static const auth_client_plugin_t ca_basic_plugin =
{ {
/* auc_plugin_size: */ sizeof ca_basic_plugin, /* auc_plugin_size: */ sizeof ca_basic_plugin,
/* auc_size: */ sizeof (auth_client_t), /* auc_size: */ sizeof (auth_client_t),
/* auc_name: */ "Basic", /* auc_name: */ "Basic",
@@ -694,15 +694,15 @@ static const auth_client_plugin_t ca_basic_plugin =
* @param hc header class for the header to be created * @param hc header class for the header to be created
* @param user user name * @param user user name
* @param pass password * @param pass password
* *
* @return * @return
* The function auc_basic_authorization() returns a pointer to newly created * The function auc_basic_authorization() returns a pointer to newly created
* authorization header, or NULL upon an error. * authorization header, or NULL upon an error.
*/ */
int auc_basic_authorization(auth_client_t *ca, int auc_basic_authorization(auth_client_t *ca,
su_home_t *home, su_home_t *home,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **return_headers) msg_header_t **return_headers)
{ {
@@ -742,7 +742,7 @@ int auc_basic_authorization(auth_client_t *ca,
userpass[ulen] = ':'; userpass[ulen] = ':';
memcpy(userpass + ulen + 1, pass, plen); memcpy(userpass + ulen + 1, pass, plen);
userpass[uplen] = '\0'; userpass[uplen] = '\0';
base64_e(base64, b64len + 1, userpass, uplen); base64_e(base64, b64len + 1, userpass, uplen);
base64[b64len] = '\0'; base64[b64len] = '\0';
@@ -767,22 +767,22 @@ typedef struct auth_digest_client_s
auth_challenge_t cda_ac[1]; auth_challenge_t cda_ac[1];
} auth_digest_client_t; } auth_digest_client_t;
static int auc_digest_challenge(auth_client_t *ca, static int auc_digest_challenge(auth_client_t *ca,
msg_auth_t const *ch); msg_auth_t const *ch);
static int auc_digest_authorization(auth_client_t *ca, static int auc_digest_authorization(auth_client_t *ca,
su_home_t *h, su_home_t *h,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **); msg_header_t **);
static int auc_digest_info(auth_client_t *ca, static int auc_digest_info(auth_client_t *ca,
msg_auth_info_t const *info); msg_auth_info_t const *info);
static const auth_client_plugin_t ca_digest_plugin = static const auth_client_plugin_t ca_digest_plugin =
{ {
/* auc_plugin_size: */ sizeof ca_digest_plugin, /* auc_plugin_size: */ sizeof ca_digest_plugin,
/* auc_size: */ sizeof (auth_digest_client_t), /* auc_size: */ sizeof (auth_digest_client_t),
/* auc_name: */ "Digest", /* auc_name: */ "Digest",
/* auc_challenge: */ auc_digest_challenge, /* auc_challenge: */ auc_digest_challenge,
/* auc_authorize: */ auc_digest_authorization, /* auc_authorize: */ auc_digest_authorization,
/* auc_info: */ auc_digest_info, /* auc_info: */ auc_digest_info,
@@ -866,15 +866,15 @@ static int auc_digest_info(auth_client_t *ca,
* sip_authorization_class or sip_proxy_authorization_class, as well as * sip_authorization_class or sip_proxy_authorization_class, as well as
* http_authorization_class or http_proxy_authorization_class. * http_authorization_class or http_proxy_authorization_class.
* *
* @retval 1 when authorization headers has been created * @retval 1 when authorization headers has been created
* @retval 0 when there is no credentials * @retval 0 when there is no credentials
* @retval -1 upon an error * @retval -1 upon an error
*/ */
static static
int auc_digest_authorization(auth_client_t *ca, int auc_digest_authorization(auth_client_t *ca,
su_home_t *home, su_home_t *home,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **return_headers) msg_header_t **return_headers)
{ {
@@ -923,7 +923,7 @@ int auc_digest_authorization(auth_client_t *ca,
auth_digest_sessionkey(ar, sessionkey, pass); auth_digest_sessionkey(ar, sessionkey, pass);
auth_digest_response(ar, response, sessionkey, method, data, dlen); auth_digest_response(ar, response, sessionkey, method, data, dlen);
h = msg_header_format(home, hc, h = msg_header_format(home, hc,
"Digest " "Digest "
"username=\"%s\", " "username=\"%s\", "
"realm=\"%s\", " "realm=\"%s\", "
@@ -935,21 +935,21 @@ int auc_digest_authorization(auth_client_t *ca,
"response=\"%s\"" "response=\"%s\""
"%s%s" "%s%s"
"%s%s", "%s%s",
ar->ar_username, ar->ar_username,
ar->ar_realm, ar->ar_realm,
ar->ar_nonce, ar->ar_nonce,
cnonce ? "\", cnonce=\"" : "", cnonce ? "\", cnonce=\"" : "",
cnonce ? cnonce : "", cnonce ? cnonce : "",
ar->ar_opaque ? "\", opaque=\"" : "", ar->ar_opaque ? "\", opaque=\"" : "",
ar->ar_opaque ? ar->ar_opaque : "", ar->ar_opaque ? ar->ar_opaque : "",
ar->ar_algorithm ? "\", algorithm=" : "", ar->ar_algorithm ? "\", algorithm=" : "",
ar->ar_algorithm ? ar->ar_algorithm : "", ar->ar_algorithm ? ar->ar_algorithm : "",
ar->ar_uri, ar->ar_uri,
response, response,
ar->ar_auth || ar->ar_auth_int ? ", qop=" : "", ar->ar_auth || ar->ar_auth_int ? ", qop=" : "",
ar->ar_auth_int ? "auth-int" : ar->ar_auth_int ? "auth-int" :
(ar->ar_auth ? "auth" : ""), (ar->ar_auth ? "auth" : ""),
cnonce ? ", nc=" : "", cnonce ? ", nc=" : "",
cnonce ? ncount : ""); cnonce ? ncount : "");
su_free(home, uri); su_free(home, uri);
@@ -965,7 +965,7 @@ int auc_digest_authorization(auth_client_t *ca,
#define MAX_AUC 20 #define MAX_AUC 20
static auth_client_plugin_t const *ca_plugins[MAX_AUC] = static auth_client_plugin_t const *ca_plugins[MAX_AUC] =
{ {
&ca_digest_plugin, &ca_basic_plugin, NULL &ca_digest_plugin, &ca_basic_plugin, NULL
}; };
@@ -984,7 +984,7 @@ int auc_register_plugin(auth_client_plugin_t const *plugin)
return errno = EINVAL, -1; return errno = EINVAL, -1;
for (i = 0; i < MAX_AUC; i++) { for (i = 0; i < MAX_AUC; i++) {
if (ca_plugins[i] == NULL || if (ca_plugins[i] == NULL ||
strcmp(plugin->auc_name, ca_plugins[i]->auc_name) == 0) { strcmp(plugin->auc_name, ca_plugins[i]->auc_name) == 0) {
ca_plugins[i] = plugin; ca_plugins[i] = plugin;
return 0; return 0;
@@ -1051,10 +1051,10 @@ void ca_destroy(su_home_t *home, auth_client_t *ca)
* headers to a SIP request. The authentication headers will contain the * headers to a SIP request. The authentication headers will contain the
* credentials generated by the list of authenticators. * credentials generated by the list of authenticators.
* *
* @param[in,out] auc_list list of authenticators * @param[in,out] auc_list list of authenticators
* @param[in,out] msg message to be authenticated * @param[in,out] msg message to be authenticated
* @param[in,out] sip sip headers of the message * @param[in,out] sip sip headers of the message
* *
* @retval 1 when successful * @retval 1 when successful
* @retval 0 when there is not enough credentials * @retval 0 when there is not enough credentials
* @retval -1 upon an error * @retval -1 upon an error
@@ -1066,14 +1066,14 @@ int auc_authorize(auth_client_t **auc_list, msg_t *msg, sip_t *sip)
if (!rq) if (!rq)
return 0; return 0;
return auc_authorization(auc_list, msg, (msg_pub_t *)sip, return auc_authorization(auc_list, msg, (msg_pub_t *)sip,
rq->rq_method_name, rq->rq_method_name,
/* /*
RFC 3261 defines the protection domain based RFC 3261 defines the protection domain based
only on realm, so we do not bother get a only on realm, so we do not bother get a
correct URI to auth module. correct URI to auth module.
*/ */
rq->rq_url, rq->rq_url,
sip->sip_payload); sip->sip_payload);
} }
#endif #endif

View File

@@ -63,20 +63,20 @@ typedef struct auth_ntlm_client_s
auth_challenge_t ntlm_ac[1]; auth_challenge_t ntlm_ac[1];
} auth_ntlm_client_t; } auth_ntlm_client_t;
static int auc_ntlm_challenge(auth_client_t *ca, static int auc_ntlm_challenge(auth_client_t *ca,
msg_auth_t const *ch); msg_auth_t const *ch);
static int auc_ntlm_authorization(auth_client_t *ca, static int auc_ntlm_authorization(auth_client_t *ca,
su_home_t *h, su_home_t *h,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **); msg_header_t **);
auth_client_plugin_t const _ntlm_client_plugin = auth_client_plugin_t const _ntlm_client_plugin =
{ {
sizeof ca_ntlm_plugin, sizeof ca_ntlm_plugin,
sizeof (auth_ntlm_client_t), sizeof (auth_ntlm_client_t),
"NTLM", "NTLM",
auc_ntlm_challenge, auc_ntlm_challenge,
auc_ntlm_authorization auc_ntlm_authorization
}; };
@@ -142,7 +142,7 @@ static int auc_ntlm_challenge(auth_client_t *ca, msg_auth_t const *ch)
* @param pass password * @param pass password
* @param ac challenge structure * @param ac challenge structure
* @param cnonce client nonce * @param cnonce client nonce
* @param nc client nonce count * @param nc client nonce count
* @param method request method * @param method request method
* @param uri request uri * @param uri request uri
* @param data message body * @param data message body
@@ -152,10 +152,10 @@ static int auc_ntlm_challenge(auth_client_t *ca, msg_auth_t const *ch)
* Returns a pointer to newly created authorization header, or NULL upon an * Returns a pointer to newly created authorization header, or NULL upon an
* error. * error.
*/ */
int auc_ntlm_authorization(auth_client_t *ca, int auc_ntlm_authorization(auth_client_t *ca,
su_home_t *home, su_home_t *home,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **return_headers) msg_header_t **return_headers)
{ {
@@ -201,7 +201,7 @@ int auc_ntlm_authorization(auth_client_t *ca,
auth_ntlm_sessionkey(ar, sessionkey, pass); auth_ntlm_sessionkey(ar, sessionkey, pass);
auth_ntlm_response(ar, response, sessionkey, method, data, dlen); auth_ntlm_response(ar, response, sessionkey, method, data, dlen);
h = msg_header_format(home, hc, h = msg_header_format(home, hc,
"NTLM " "NTLM "
"username=\"%s\", " "username=\"%s\", "
"realm=\"%s\", " "realm=\"%s\", "
@@ -213,21 +213,21 @@ int auc_ntlm_authorization(auth_client_t *ca,
"response=\"%s\"" "response=\"%s\""
"%s%s" "%s%s"
"%s%s", "%s%s",
ar->ar_username, ar->ar_username,
ar->ar_realm, ar->ar_realm,
ar->ar_nonce, ar->ar_nonce,
cnonce ? "\", cnonce=\"" : "", cnonce ? "\", cnonce=\"" : "",
cnonce ? cnonce : "", cnonce ? cnonce : "",
ar->ar_opaque ? "\", opaque=\"" : "", ar->ar_opaque ? "\", opaque=\"" : "",
ar->ar_opaque ? ar->ar_opaque : "", ar->ar_opaque ? ar->ar_opaque : "",
ar->ar_algorithm ? "\", algorithm=" : "", ar->ar_algorithm ? "\", algorithm=" : "",
ar->ar_algorithm ? ar->ar_algorithm : "", ar->ar_algorithm ? ar->ar_algorithm : "",
ar->ar_uri, ar->ar_uri,
response, response,
ar->ar_auth || ar->ar_auth_int ? ", qop=" : "", ar->ar_auth || ar->ar_auth_int ? ", qop=" : "",
ar->ar_auth_int ? "auth-int" : ar->ar_auth_int ? "auth-int" :
(ar->ar_auth ? "auth" : ""), (ar->ar_auth ? "auth" : ""),
cnonce ? ", nc=" : "", cnonce ? ", nc=" : "",
cnonce ? ncount : ""); cnonce ? ncount : "");
su_free(home, uri); su_free(home, uri);

View File

@@ -54,7 +54,7 @@ su_inline int has_token(char const *qstring, char const *token);
* The function auth_get_params() searches for the authentication parameters * The function auth_get_params() searches for the authentication parameters
* in @a params. The parameter list @a params is seached for each parameter * in @a params. The parameter list @a params is seached for each parameter
* given in in vararg section, and if it is found, its value is assigned to * given in in vararg section, and if it is found, its value is assigned to
* the given address. * the given address.
* *
* @note The field name should contain the equal ("=") sign. * @note The field name should contain the equal ("=") sign.
* *

View File

@@ -59,7 +59,7 @@
* found, or -1 upon an error. * found, or -1 upon an error.
*/ */
issize_t auth_digest_challenge_get(su_home_t *home, issize_t auth_digest_challenge_get(su_home_t *home,
auth_challenge_t *ac0, auth_challenge_t *ac0,
char const * const params[]) char const * const params[])
{ {
ssize_t n; ssize_t n;
@@ -70,7 +70,7 @@ issize_t auth_digest_challenge_get(su_home_t *home,
ac->ac_size = sizeof(ac); ac->ac_size = sizeof(ac);
assert(ac0); assert(ac0);
assert(ac0->ac_size >= (int) sizeof(*ac)); assert(ac0->ac_size >= (int) sizeof(*ac));
if (ac0 == NULL || params == NULL) if (ac0 == NULL || params == NULL)
@@ -103,7 +103,7 @@ issize_t auth_digest_challenge_get(su_home_t *home,
auth_struct_copy(ac0, ac, sizeof(ac)); auth_struct_copy(ac0, ac, sizeof(ac));
SU_DEBUG_5(("%s(): got "MOD_ZD"\n", "auth_digest_challenge_get", n)); SU_DEBUG_5(("%s(): got "MOD_ZD"\n", "auth_digest_challenge_get", n));
return n; return n;
} }
@@ -136,7 +136,7 @@ void auth_digest_challenge_free_params(su_home_t *home, auth_challenge_t *ac)
* found, or -1 upon an error. * found, or -1 upon an error.
*/ */
issize_t auth_digest_response_get(su_home_t *home, issize_t auth_digest_response_get(su_home_t *home,
auth_response_t *ar0, auth_response_t *ar0,
char const *const params[]) char const *const params[])
{ {
ssize_t n; ssize_t n;
@@ -189,7 +189,7 @@ static void unquote_update(su_md5_t md5[1], char const *quoted)
if (!quoted) if (!quoted)
/*xyzzy*/; /*xyzzy*/;
else if (quoted[0] == '"') { else if (quoted[0] == '"') {
char const *q; char const *q;
size_t n; size_t n;
for (q = quoted + 1; *q; q += n + 2) { for (q = quoted + 1; *q; q += n + 2) {
@@ -204,9 +204,9 @@ static void unquote_update(su_md5_t md5[1], char const *quoted)
su_md5_strupdate(md5, quoted); su_md5_strupdate(md5, quoted);
} }
/** Generate A1 hash for digest authentication. /** Generate A1 hash for digest authentication.
*/ */
int auth_digest_a1(auth_response_t *ar, int auth_digest_a1(auth_response_t *ar,
auth_hexmd5_t ha1, auth_hexmd5_t ha1,
char const *secret) char const *secret)
{ {
@@ -222,13 +222,13 @@ int auth_digest_a1(auth_response_t *ar,
su_md5_hexdigest(md5, ha1); su_md5_hexdigest(md5, ha1);
SU_DEBUG_5(("auth_digest_a1() has A1 = MD5(%s:%s:%s) = %s\n", SU_DEBUG_5(("auth_digest_a1() has A1 = MD5(%s:%s:%s) = %s\n",
ar->ar_username, ar->ar_realm, secret, ha1)); ar->ar_username, ar->ar_realm, secret, ha1));
return 0; return 0;
} }
int auth_digest_a1sess(auth_response_t *ar, int auth_digest_a1sess(auth_response_t *ar,
auth_hexmd5_t ha1sess, auth_hexmd5_t ha1sess,
char const *ha1) char const *ha1)
{ {
@@ -243,15 +243,15 @@ int auth_digest_a1sess(auth_response_t *ar,
su_md5_hexdigest(md5, ha1sess); su_md5_hexdigest(md5, ha1sess);
SU_DEBUG_5(("auth_sessionkey has A1' = MD5(%s:%s:%s) = %s\n", SU_DEBUG_5(("auth_sessionkey has A1' = MD5(%s:%s:%s) = %s\n",
ha1, ar->ar_nonce, ar->ar_cnonce, ha1sess)); ha1, ar->ar_nonce, ar->ar_cnonce, ha1sess));
return 0; return 0;
} }
/** Generate MD5 session key for digest authentication. /** Generate MD5 session key for digest authentication.
*/ */
int auth_digest_sessionkey(auth_response_t *ar, int auth_digest_sessionkey(auth_response_t *ar,
auth_hexmd5_t ha1, auth_hexmd5_t ha1,
char const *secret) char const *secret)
{ {
@@ -263,7 +263,7 @@ int auth_digest_sessionkey(auth_response_t *ar,
return -1; return -1;
if (ar->ar_md5sess) { if (ar->ar_md5sess) {
auth_hexmd5_t base_ha1; auth_hexmd5_t base_ha1;
auth_digest_a1(ar, base_ha1, secret); auth_digest_a1(ar, base_ha1, secret);
auth_digest_a1sess(ar, ha1, base_ha1); auth_digest_a1sess(ar, ha1, base_ha1);
} else { } else {
@@ -273,12 +273,12 @@ int auth_digest_sessionkey(auth_response_t *ar,
return 0; return 0;
} }
/** Generate response for digest authentication. /** Generate response for digest authentication.
* *
*/ */
int auth_digest_response(auth_response_t *ar, int auth_digest_response(auth_response_t *ar,
auth_hexmd5_t response, auth_hexmd5_t response,
auth_hexmd5_t const ha1, auth_hexmd5_t const ha1,
char const *method_name, char const *method_name,
void const *data, isize_t dlen) void const *data, isize_t dlen)
{ {
@@ -314,7 +314,7 @@ int auth_digest_response(auth_response_t *ar,
} }
su_md5_hexdigest(md5, HA2); su_md5_hexdigest(md5, HA2);
SU_DEBUG_5(("A2 = MD5(%s:%s%s%s)\n", method_name, ar->ar_uri, SU_DEBUG_5(("A2 = MD5(%s:%s%s%s)\n", method_name, ar->ar_uri,
ar->ar_auth_int ? ":" : "", ar->ar_auth_int ? Hentity : "")); ar->ar_auth_int ? ":" : "", ar->ar_auth_int ? Hentity : ""));
/* Calculate response */ /* Calculate response */
@@ -333,17 +333,17 @@ int auth_digest_response(auth_response_t *ar,
} }
su_md5_update(md5, ":", 1); su_md5_update(md5, ":", 1);
su_md5_update(md5, HA2, 32); su_md5_update(md5, HA2, 32);
su_md5_hexdigest(md5, response); su_md5_hexdigest(md5, response);
SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n", SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n",
response, ha1, ar->ar_nonce, response, ha1, ar->ar_nonce,
ar->ar_auth || ar->ar_auth_int ? ":" : "", ar->ar_auth || ar->ar_auth_int ? ":" : "",
ar->ar_auth || ar->ar_auth_int ? ar->ar_nc : "", ar->ar_auth || ar->ar_auth_int ? ar->ar_nc : "",
ar->ar_auth || ar->ar_auth_int ? ":" : "", ar->ar_auth || ar->ar_auth_int ? ":" : "",
ar->ar_auth || ar->ar_auth_int ? ar->ar_cnonce : "", ar->ar_auth || ar->ar_auth_int ? ar->ar_cnonce : "",
ar->ar_auth || ar->ar_auth_int ? ":" : "", ar->ar_auth || ar->ar_auth_int ? ":" : "",
ar->ar_auth || ar->ar_auth_int ? ar->ar_qop : "", ar->ar_auth || ar->ar_auth_int ? ar->ar_qop : "",
HA2, HA2,
ar->ar_qop ? ar->ar_qop : "NONE")); ar->ar_qop ? ar->ar_qop : "NONE"));

View File

@@ -80,7 +80,7 @@ static void auth_call_scheme_destructor(void *);
static void auth_md5_hmac_key(auth_mod_t *am); static void auth_md5_hmac_key(auth_mod_t *am);
HTABLE_PROTOS_WITH(auth_htable, aht, auth_passwd_t, usize_t, unsigned); HTABLE_PROTOS_WITH(auth_htable, aht, auth_passwd_t, usize_t, unsigned);
HTABLE_BODIES_WITH(auth_htable, aht, auth_passwd_t, APW_HASH, HTABLE_BODIES_WITH(auth_htable, aht, auth_passwd_t, APW_HASH,
usize_t, unsigned); usize_t, unsigned);
/**Allocate an authentication module instance. /**Allocate an authentication module instance.

View File

@@ -25,7 +25,7 @@
/**@internal /**@internal
* @file auth_module_http.c * @file auth_module_http.c
* @brief Authenticate HTTP request * @brief Authenticate HTTP request
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Jari Urpalainen <Jari.Urpalainen@nokia.com> * @author Jari Urpalainen <Jari.Urpalainen@nokia.com>
* *
@@ -43,10 +43,10 @@
#include <sofia-sip/auth_module.h> #include <sofia-sip/auth_module.h>
static auth_challenger_t http_server_challenger[] = static auth_challenger_t http_server_challenger[] =
{{ HTTP_401_UNAUTHORIZED, http_www_authenticate_class }}; {{ HTTP_401_UNAUTHORIZED, http_www_authenticate_class }};
static auth_challenger_t http_proxy_challenger[] = static auth_challenger_t http_proxy_challenger[] =
{{ HTTP_407_PROXY_AUTH, http_proxy_authenticate_class }}; {{ HTTP_407_PROXY_AUTH, http_proxy_authenticate_class }};
const char *auth_mod_check_http(auth_mod_t *am, const char *auth_mod_check_http(auth_mod_t *am,
@@ -54,22 +54,22 @@ const char *auth_mod_check_http(auth_mod_t *am,
http_t const *http, http_t const *http,
auth_kind_t proxy) auth_kind_t proxy)
{ {
msg_auth_t *credentials = msg_auth_t *credentials =
proxy ? http->http_proxy_authorization : http->http_authorization; proxy ? http->http_proxy_authorization : http->http_authorization;
auth_challenger_t const *challenger = auth_challenger_t const *challenger =
proxy ? http_proxy_challenger : http_server_challenger; proxy ? http_proxy_challenger : http_server_challenger;
if (http->http_request) { if (http->http_request) {
if (!as->as_method) if (!as->as_method)
as->as_method = http->http_request->rq_method_name; as->as_method = http->http_request->rq_method_name;
#if 0 #if 0
if (!as->as_uri) if (!as->as_uri)
as->as_uri = http->http_request->rq_url; as->as_uri = http->http_request->rq_url;
#endif #endif
} }
if (http->http_payload && !as->as_body) if (http->http_payload && !as->as_body)
as->as_body = http->http_payload->pl_data, as->as_body = http->http_payload->pl_data,
as->as_bodylen = http->http_payload->pl_len; as->as_bodylen = http->http_payload->pl_len;
/* Call real authentication method */ /* Call real authentication method */

View File

@@ -25,7 +25,7 @@
/**@internal /**@internal
* @file auth_module_sip.c * @file auth_module_sip.c
* @brief Authenticate SIP request * @brief Authenticate SIP request
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Jari Urpalainen <Jari.Urpalainen@nokia.com> * @author Jari Urpalainen <Jari.Urpalainen@nokia.com>
* *
@@ -45,19 +45,19 @@
#include <sofia-sip/auth_module.h> #include <sofia-sip/auth_module.h>
static auth_challenger_t sip_server_challenger[] = static auth_challenger_t sip_server_challenger[] =
{{ SIP_401_UNAUTHORIZED, sip_www_authenticate_class, {{ SIP_401_UNAUTHORIZED, sip_www_authenticate_class,
sip_authentication_info_class sip_authentication_info_class
}}; }};
static auth_challenger_t sip_proxy_challenger[] = static auth_challenger_t sip_proxy_challenger[] =
{{ SIP_407_PROXY_AUTH_REQUIRED, sip_proxy_authenticate_class }}; {{ SIP_407_PROXY_AUTH_REQUIRED, sip_proxy_authenticate_class }};
/** Authenticate an incoming SIP request. /** Authenticate an incoming SIP request.
* *
* The function auth_mod_check() completes the @a as structure and calls the * The function auth_mod_check() completes the @a as structure and calls the
* scheme-specific authentication method performing the actual * scheme-specific authentication method performing the actual
* authentication. * authentication.
* *
* A successful authentication is indicated by setting @a as->as_status to * A successful authentication is indicated by setting @a as->as_status to
* 0. The authentication module sets @a as->as_match as the matching * 0. The authentication module sets @a as->as_match as the matching
@@ -86,7 +86,7 @@ void auth_mod_check(auth_mod_t *am,
as->as_method = sip->sip_request->rq_method_name; as->as_method = sip->sip_request->rq_method_name;
if (sip->sip_payload) if (sip->sip_payload)
as->as_body = sip->sip_payload->pl_data, as->as_body = sip->sip_payload->pl_data,
as->as_bodylen = sip->sip_payload->pl_len; as->as_bodylen = sip->sip_payload->pl_len;
auth_mod_method(am, as, credentials, challenger); auth_mod_method(am, as, credentials, challenger);

View File

@@ -58,7 +58,7 @@ su_inline int has_token(char const *qstring, char const *token);
* found, or -1 upon an error. * found, or -1 upon an error.
*/ */
issize_t auth_ntlm_challenge_get(su_home_t *home, issize_t auth_ntlm_challenge_get(su_home_t *home,
auth_challenge_t *ac0, auth_challenge_t *ac0,
char const * const params[]) char const * const params[])
{ {
ssize_t n; ssize_t n;
@@ -68,7 +68,7 @@ issize_t auth_ntlm_challenge_get(su_home_t *home,
ac->ac_size = sizeof(ac); ac->ac_size = sizeof(ac);
assert(ac0); assert(ac0);
assert(ac0->ac_size >= sizeof(*ac)); assert(ac0->ac_size >= sizeof(*ac));
if (ac0 == NULL || params == NULL) if (ac0 == NULL || params == NULL)
@@ -103,7 +103,7 @@ issize_t auth_ntlm_challenge_get(su_home_t *home,
auth_struct_copy(ac0, ac, sizeof(ac)); auth_struct_copy(ac0, ac, sizeof(ac));
SU_DEBUG_5(("%s(): got %d\n", "auth_ntlm_challenge_get", n)); SU_DEBUG_5(("%s(): got %d\n", "auth_ntlm_challenge_get", n));
return n; return n;
} }
@@ -119,7 +119,7 @@ issize_t auth_ntlm_challenge_get(su_home_t *home,
* found, or -1 upon an error. * found, or -1 upon an error.
*/ */
issize_t auth_ntlm_response_get(su_home_t *home, issize_t auth_ntlm_response_get(su_home_t *home,
auth_response_t *ar0, auth_response_t *ar0,
char const *const params[]) char const *const params[])
{ {
ssize_t n; ssize_t n;
@@ -169,9 +169,9 @@ issize_t auth_ntlm_response_get(su_home_t *home,
#if 0 #if 0
/** Generate A1 hash for digest authentication. /** Generate A1 hash for digest authentication.
*/ */
int auth_digest_a1(auth_response_t *ar, int auth_digest_a1(auth_response_t *ar,
auth_hexmd5_t ha1, auth_hexmd5_t ha1,
char const *secret) char const *secret)
{ {
@@ -187,13 +187,13 @@ int auth_digest_a1(auth_response_t *ar,
su_md5_hexdigest(md5, ha1); su_md5_hexdigest(md5, ha1);
SU_DEBUG_5(("auth_digest_a1() has A1 = MD5(%s:%s:%s) = %s\n", SU_DEBUG_5(("auth_digest_a1() has A1 = MD5(%s:%s:%s) = %s\n",
ar->ar_username, ar->ar_realm, secret, ha1)); ar->ar_username, ar->ar_realm, secret, ha1));
return 0; return 0;
} }
int auth_digest_a1sess(auth_response_t *ar, int auth_digest_a1sess(auth_response_t *ar,
auth_hexmd5_t ha1sess, auth_hexmd5_t ha1sess,
char const *ha1) char const *ha1)
{ {
@@ -208,15 +208,15 @@ int auth_digest_a1sess(auth_response_t *ar,
su_md5_hexdigest(md5, ha1sess); su_md5_hexdigest(md5, ha1sess);
SU_DEBUG_5(("auth_sessionkey has A1' = MD5(%s:%s:%s) = %s\n", SU_DEBUG_5(("auth_sessionkey has A1' = MD5(%s:%s:%s) = %s\n",
ha1, ar->ar_nonce, ar->ar_cnonce, ha1sess)); ha1, ar->ar_nonce, ar->ar_cnonce, ha1sess));
return 0; return 0;
} }
/** Generate MD5 session key for digest authentication. /** Generate MD5 session key for digest authentication.
*/ */
int auth_digest_sessionkey(auth_response_t *ar, int auth_digest_sessionkey(auth_response_t *ar,
auth_hexmd5_t ha1, auth_hexmd5_t ha1,
char const *secret) char const *secret)
{ {
@@ -228,7 +228,7 @@ int auth_digest_sessionkey(auth_response_t *ar,
return -1; return -1;
if (ar->ar_md5sess) { if (ar->ar_md5sess) {
auth_hexmd5_t base_ha1; auth_hexmd5_t base_ha1;
auth_digest_a1(ar, base_ha1, secret); auth_digest_a1(ar, base_ha1, secret);
auth_digest_a1sess(ar, ha1, base_ha1); auth_digest_a1sess(ar, ha1, base_ha1);
} else { } else {
@@ -243,12 +243,12 @@ int auth_digest_sessionkey(auth_response_t *ar,
#if 0 #if 0
/** Generate response for digest authentication. /** Generate response for digest authentication.
* *
*/ */
int auth_digest_response(auth_response_t *ar, int auth_digest_response(auth_response_t *ar,
auth_hexmd5_t response, auth_hexmd5_t response,
auth_hexmd5_t const ha1, auth_hexmd5_t const ha1,
char const *method_name, char const *method_name,
void const *data, issize_t dlen) void const *data, issize_t dlen)
{ {
@@ -284,7 +284,7 @@ int auth_digest_response(auth_response_t *ar,
} }
su_md5_hexdigest(md5, HA2); su_md5_hexdigest(md5, HA2);
SU_DEBUG_5(("A2 = MD5(%s:%s%s%s)\n", method_name, ar->ar_uri, SU_DEBUG_5(("A2 = MD5(%s:%s%s%s)\n", method_name, ar->ar_uri,
ar->ar_auth_int ? ":" : "", ar->ar_auth_int ? Hentity : "")); ar->ar_auth_int ? ":" : "", ar->ar_auth_int ? Hentity : ""));
/* Calculate response */ /* Calculate response */
@@ -303,17 +303,17 @@ int auth_digest_response(auth_response_t *ar,
} }
su_md5_update(md5, ":", 1); su_md5_update(md5, ":", 1);
su_md5_update(md5, HA2, 32); su_md5_update(md5, HA2, 32);
su_md5_hexdigest(md5, response); su_md5_hexdigest(md5, response);
SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n", SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n",
response, ha1, ar->ar_nonce, response, ha1, ar->ar_nonce,
ar->ar_auth || ar->ar_auth_int ? ":" : "", ar->ar_auth || ar->ar_auth_int ? ":" : "",
ar->ar_auth || ar->ar_auth_int ? ar->ar_nc : "", ar->ar_auth || ar->ar_auth_int ? ar->ar_nc : "",
ar->ar_auth || ar->ar_auth_int ? ":" : "", ar->ar_auth || ar->ar_auth_int ? ":" : "",
ar->ar_auth || ar->ar_auth_int ? ar->ar_cnonce : "", ar->ar_auth || ar->ar_auth_int ? ar->ar_cnonce : "",
ar->ar_auth || ar->ar_auth_int ? ":" : "", ar->ar_auth || ar->ar_auth_int ? ":" : "",
ar->ar_auth || ar->ar_auth_int ? ar->ar_qop : "", ar->ar_auth || ar->ar_auth_int ? ar->ar_qop : "",
HA2, HA2,
ar->ar_qop ? ar->ar_qop : "NONE")); ar->ar_qop ? ar->ar_qop : "NONE"));

View File

@@ -25,9 +25,9 @@
/**@internal /**@internal
* @file auth_plugin.c * @file auth_plugin.c
* @brief Plugin interface for authentication verification modules. * @brief Plugin interface for authentication verification modules.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Tue Apr 27 15:23:31 2004 ppessi * @date Created: Tue Apr 27 15:23:31 2004 ppessi
*/ */
@@ -69,7 +69,7 @@ static auth_scheme_t *schemes[N] = {
auth_scheme_delayed auth_scheme_delayed
}; };
/** Register an authentication plugin. /** Register an authentication plugin.
* *
* @retval 0 when successful * @retval 0 when successful
* @retval -1 upon an error * @retval -1 upon an error
@@ -82,17 +82,17 @@ int auth_mod_register_plugin(auth_scheme_t *asch)
if (i == N) if (i == N)
return -1; return -1;
} }
schemes[i] = asch; schemes[i] = asch;
return 0; return 0;
} }
/**Create an authentication plugin module. /**Create an authentication plugin module.
* *
* The function auth_mod_create() creates a module used to authenticate the * The function auth_mod_create() creates a module used to authenticate the
* requests. * requests.
* *
* @param root pointer to a su_root_t object * @param root pointer to a su_root_t object
* @param tag,value,... tagged argument list * @param tag,value,... tagged argument list
* *
@@ -123,7 +123,7 @@ auth_mod_t *auth_mod_create(su_root_t *root,
size_t len; size_t len;
base = strrchr(method, '+'); base = strrchr(method, '+');
if (base) if (base)
len = base++ - method; len = base++ - method;
else else
len = strlen(method); len = strlen(method);
@@ -132,7 +132,7 @@ auth_mod_t *auth_mod_create(su_root_t *root,
; ;
else if (strcasecmp(base, "Basic") == 0) else if (strcasecmp(base, "Basic") == 0)
bscheme = auth_scheme_basic; bscheme = auth_scheme_basic;
else if (strcasecmp(base, "Digest") == 0) else if (strcasecmp(base, "Digest") == 0)
bscheme = auth_scheme_digest; bscheme = auth_scheme_digest;
if (base == NULL || bscheme) { if (base == NULL || bscheme) {
@@ -152,6 +152,6 @@ auth_mod_t *auth_mod_create(su_root_t *root,
} }
ta_end(ta); ta_end(ta);
return am; return am;
} }

View File

@@ -24,7 +24,7 @@
/**@CFILE auth_plugin_delayed.c /**@CFILE auth_plugin_delayed.c
* *
* @brief Plugin for delayed authentication. * @brief Plugin for delayed authentication.
* *
* This authentication plugin provides authentication operation that is * This authentication plugin provides authentication operation that is
* intentionally delayed. It serves as an example of server-side * intentionally delayed. It serves as an example of server-side
@@ -61,7 +61,7 @@ static char const __func__[] = "auth_plugin_delayed";
#include "sofia-sip/auth_module.h" #include "sofia-sip/auth_module.h"
#include "sofia-sip/auth_plugin.h" #include "sofia-sip/auth_plugin.h"
struct auth_plugin_t struct auth_plugin_t
{ {
su_root_t *ap_root; su_root_t *ap_root;
auth_scheme_t *ap_base; auth_scheme_t *ap_base;
@@ -81,7 +81,7 @@ static void delayed_auth_method(auth_mod_t *am,
msg_auth_t *auth, msg_auth_t *auth,
auth_challenger_t const *ach); auth_challenger_t const *ach);
static void delayed_auth_challenge(auth_mod_t *am, static void delayed_auth_challenge(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach); auth_challenger_t const *ach);
@@ -89,12 +89,12 @@ static void delayed_auth_cancel(auth_mod_t *am, auth_status_t *as);
static void delayed_auth_destroy(auth_mod_t *am); static void delayed_auth_destroy(auth_mod_t *am);
auth_scheme_t auth_scheme_delayed[1] = auth_scheme_t auth_scheme_delayed[1] =
{{ {{
"Delayed", "Delayed",
sizeof (struct { auth_mod_t mod[1]; auth_plugin_t plug[1]; }), sizeof (struct { auth_mod_t mod[1]; auth_plugin_t plug[1]; }),
delayed_auth_init, delayed_auth_init,
delayed_auth_method, delayed_auth_method,
delayed_auth_challenge, delayed_auth_challenge,
delayed_auth_cancel, delayed_auth_cancel,
delayed_auth_destroy delayed_auth_destroy
@@ -118,13 +118,13 @@ static int delayed_auth_init(auth_mod_t *am,
retval = 0; retval = 0;
} }
ta_end(ta); ta_end(ta);
return retval; return retval;
} }
struct auth_splugin_t struct auth_splugin_t
{ {
void const *asp_cookie; void const *asp_cookie;
auth_splugin_t *asp_next; auth_splugin_t *asp_next;
@@ -152,7 +152,7 @@ static void delayed_auth_method(auth_mod_t *am,
su_msg_r mamc = SU_MSG_R_INIT; su_msg_r mamc = SU_MSG_R_INIT;
auth_splugin_t *asp; auth_splugin_t *asp;
if (su_msg_create(mamc, if (su_msg_create(mamc,
su_root_task(ap->ap_root), su_root_task(ap->ap_root),
su_root_task(ap->ap_root), su_root_task(ap->ap_root),
delayed_auth_method_recv, delayed_auth_method_recv,
@@ -202,7 +202,7 @@ static void delayed_auth_method_recv(su_root_magic_t *rm,
asp->asp_as->as_callback(asp->asp_as->as_magic, asp->asp_as); asp->asp_as->as_callback(asp->asp_as->as_magic, asp->asp_as);
} }
static void delayed_auth_challenge(auth_mod_t *am, static void delayed_auth_challenge(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach) auth_challenger_t const *ach)
{ {
@@ -217,7 +217,7 @@ static void delayed_auth_cancel(auth_mod_t *am, auth_status_t *as)
auth_plugin_t *ap = AUTH_PLUGIN(am); auth_plugin_t *ap = AUTH_PLUGIN(am);
(void)ap; /* xyzzy */ (void)ap; /* xyzzy */
if (as->as_plugin && as->as_plugin->asp_cookie == delayed_asp_cookie) if (as->as_plugin && as->as_plugin->asp_cookie == delayed_asp_cookie)
as->as_plugin->asp_canceled = 1; as->as_plugin->asp_canceled = 1;

View File

@@ -24,7 +24,7 @@
/**@CFILE auth_plugin_ntlm.c /**@CFILE auth_plugin_ntlm.c
* *
* @brief Plugin for delayed authentication. * @brief Plugin for delayed authentication.
* *
* This authentication plugin provides authentication operation that is * This authentication plugin provides authentication operation that is
* intentionally delayed. It serves as an example of server-side * intentionally delayed. It serves as an example of server-side
@@ -100,14 +100,14 @@ static int auth_init_ntlm(auth_mod_t *am,
if (auth_init_default(am, NULL, root, ta_tags(ta)) != -1) { if (auth_init_default(am, NULL, root, ta_tags(ta)) != -1) {
retval = 0; retval = 0;
} }
ta_end(ta); ta_end(ta);
return retval; return retval;
} }
/** Authenticate a request with @b NTLM authentication scheme. /** Authenticate a request with @b NTLM authentication scheme.
* *
* This function reads user database before authentication, if needed. * This function reads user database before authentication, if needed.
*/ */
@@ -123,7 +123,7 @@ void auth_method_ntlm_x(auth_mod_t *am,
} }
} }
/** Authenticate a request with @b Ntlm authentication scheme. /** Authenticate a request with @b Ntlm authentication scheme.
*/ */
void auth_method_ntlm(auth_mod_t *am, void auth_method_ntlm(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
@@ -144,7 +144,7 @@ void auth_method_ntlm(auth_mod_t *am,
as->as_status = 0, as->as_phrase = NULL; as->as_status = 0, as->as_phrase = NULL;
as->as_match = (msg_header_t *)au; as->as_match = (msg_header_t *)au;
return; return;
} }
if (au) { if (au) {
auth_response_t ar[1] = {{ sizeof(ar) }}; auth_response_t ar[1] = {{ sizeof(ar) }};
@@ -161,7 +161,7 @@ void auth_method_ntlm(auth_mod_t *am,
/** Find a NTLM credential header with matching realm and opaque. */ /** Find a NTLM credential header with matching realm and opaque. */
msg_auth_t *auth_ntlm_credentials(msg_auth_t *auth, msg_auth_t *auth_ntlm_credentials(msg_auth_t *auth,
char const *realm, char const *realm,
char const *opaque, char const *opaque,
char const *gssapidata, char const *gssapidata,
@@ -216,19 +216,19 @@ void auth_check_ntlm(auth_mod_t *am,
#define PA "Authorization missing " #define PA "Authorization missing "
if ((!ar->ar_username && (phrase = PA "username")) || if ((!ar->ar_username && (phrase = PA "username")) ||
(!ar->ar_nonce && (phrase = PA "nonce")) || (!ar->ar_nonce && (phrase = PA "nonce")) ||
(!ar->ar_uri && (phrase = PA "URI")) || (!ar->ar_uri && (phrase = PA "URI")) ||
(!ar->ar_response && (phrase = PA "response")) || (!ar->ar_response && (phrase = PA "response")) ||
/* (!ar->ar_opaque && (phrase = PA "opaque")) || */ /* (!ar->ar_opaque && (phrase = PA "opaque")) || */
/* Check for qop */ /* Check for qop */
(ar->ar_qop && (ar->ar_qop &&
((ar->ar_auth && ((ar->ar_auth &&
strcasecmp(ar->ar_qop, "auth") && strcasecmp(ar->ar_qop, "auth") &&
strcasecmp(ar->ar_qop, "\"auth\"")) || strcasecmp(ar->ar_qop, "\"auth\"")) ||
(ar->ar_auth_int && (ar->ar_auth_int &&
strcasecmp(ar->ar_qop, "auth-int") && strcasecmp(ar->ar_qop, "auth-int") &&
strcasecmp(ar->ar_qop, "\"auth-int\""))) strcasecmp(ar->ar_qop, "\"auth-int\"")))
&& (phrase = PA "has invalid qop"))) { && (phrase = PA "has invalid qop"))) {
assert(phrase); assert(phrase);
SU_DEBUG_5(("auth_method_ntlm: 400 %s\n", phrase)); SU_DEBUG_5(("auth_method_ntlm: 400 %s\n", phrase));
@@ -239,10 +239,10 @@ void auth_check_ntlm(auth_mod_t *am,
/* XXX - replace */ /* XXX - replace */
#if 0 #if 0
if (as->as_nonce_issued == 0 /* Already validated nonce */ && if (as->as_nonce_issued == 0 /* Already validated nonce */ &&
auth_validate_ntlm_nonce(am, as, ar, now) < 0) { auth_validate_ntlm_nonce(am, as, ar, now) < 0) {
#else #else
if (as->as_nonce_issued == 0 /* Already validated nonce */ && if (as->as_nonce_issued == 0 /* Already validated nonce */ &&
auth_validate_digest_nonce(am, as, ar, now) < 0) { auth_validate_digest_nonce(am, as, ar, now) < 0) {
#endif #endif
as->as_blacklist = am->am_blacklist; as->as_blacklist = am->am_blacklist;
@@ -262,9 +262,9 @@ void auth_check_ntlm(auth_mod_t *am,
a1 = apw->apw_hash; a1 = apw->apw_hash;
else if (apw && apw->apw_pass) else if (apw && apw->apw_pass)
auth_ntlm_a1(ar, a1buf, apw->apw_pass), a1 = a1buf; auth_ntlm_a1(ar, a1buf, apw->apw_pass), a1 = a1buf;
else else
auth_ntlm_a1(ar, a1buf, "xyzzy"), a1 = a1buf, apw = NULL; auth_ntlm_a1(ar, a1buf, "xyzzy"), a1 = a1buf, apw = NULL;
if (ar->ar_md5sess) if (ar->ar_md5sess)
auth_ntlm_a1sess(ar, a1buf, a1), a1 = a1buf; auth_ntlm_a1sess(ar, a1buf, a1), a1 = a1buf;
#else #else
@@ -272,19 +272,19 @@ void auth_check_ntlm(auth_mod_t *am,
a1 = apw->apw_hash; a1 = apw->apw_hash;
else if (apw && apw->apw_pass) else if (apw && apw->apw_pass)
auth_digest_a1(ar, a1buf, apw->apw_pass), a1 = a1buf; auth_digest_a1(ar, a1buf, apw->apw_pass), a1 = a1buf;
else else
auth_digest_a1(ar, a1buf, "xyzzy"), a1 = a1buf, apw = NULL; auth_digest_a1(ar, a1buf, "xyzzy"), a1 = a1buf, apw = NULL;
if (ar->ar_md5sess) if (ar->ar_md5sess)
auth_digest_a1sess(ar, a1buf, a1), a1 = a1buf; auth_digest_a1sess(ar, a1buf, a1), a1 = a1buf;
#endif #endif
/* XXX - replace with auth_ntlm_response */ /* XXX - replace with auth_ntlm_response */
#if 0 #if 0
auth_ntlm_response(ar, response, a1, auth_ntlm_response(ar, response, a1,
as->as_method, as->as_body, as->as_bodylen); as->as_method, as->as_body, as->as_bodylen);
#else #else
auth_digest_response(ar, response, a1, auth_digest_response(ar, response, a1,
as->as_method, as->as_body, as->as_bodylen); as->as_method, as->as_body, as->as_bodylen);
#endif #endif
@@ -321,7 +321,7 @@ void auth_check_ntlm(auth_mod_t *am,
} }
/** Construct a challenge header for @b Ntlm authentication scheme. */ /** Construct a challenge header for @b Ntlm authentication scheme. */
void auth_challenge_ntlm(auth_mod_t *am, void auth_challenge_ntlm(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach) auth_challenger_t const *ach)
{ {
@@ -337,8 +337,8 @@ void auth_challenge_ntlm(auth_mod_t *am,
u = as->as_uri; u = as->as_uri;
d = as->as_pdomain; d = as->as_pdomain;
as->as_response = as->as_response =
msg_header_format(as->as_home, ach->ach_header, msg_header_format(as->as_home, ach->ach_header,
"Ntlm" "Ntlm"
" realm=\"%s\"," " realm=\"%s\","
"%s%s%s" "%s%s%s"
@@ -346,12 +346,12 @@ void auth_challenge_ntlm(auth_mod_t *am,
" nonce=\"%s\"," " nonce=\"%s\","
"%s%s%s" "%s%s%s"
"%s" /* stale */ "%s" /* stale */
" algorithm=%s" " algorithm=%s"
"%s%s%s", "%s%s%s",
as->as_realm, as->as_realm,
u ? " uri=\"" : "", u ? u : "", u ? "\"," : "", u ? " uri=\"" : "", u ? u : "", u ? "\"," : "",
d ? " domain=\"" : "", d ? d : "", d ? "\"," : "", d ? " domain=\"" : "", d ? d : "", d ? "\"," : "",
nonce, nonce,
am->am_opaque ? " opaque=\"" : "", am->am_opaque ? " opaque=\"" : "",
am->am_opaque ? am->am_opaque : "", am->am_opaque ? am->am_opaque : "",
am->am_opaque ? "\"," : "", am->am_opaque ? "\"," : "",
@@ -368,7 +368,7 @@ void auth_challenge_ntlm(auth_mod_t *am,
} }
/** Construct a info header for @b Ntlm authentication scheme. */ /** Construct a info header for @b Ntlm authentication scheme. */
void auth_info_ntlm(auth_mod_t *am, void auth_info_ntlm(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach) auth_challenger_t const *ach)
{ {
@@ -385,7 +385,7 @@ void auth_info_ntlm(auth_mod_t *am,
auth_generate_digest_nonce(am, nonce, sizeof nonce, 1, msg_now()); auth_generate_digest_nonce(am, nonce, sizeof nonce, 1, msg_now());
#endif #endif
as->as_info = as->as_info =
msg_header_format(as->as_home, ach->ach_info, "nextnonce=\"%s\"", nonce); msg_header_format(as->as_home, ach->ach_info, "nextnonce=\"%s\"", nonce);
} }
} }

View File

@@ -40,14 +40,14 @@
#include <sofia-sip/url_tag_class.h> #include <sofia-sip/url_tag_class.h>
/**@def AUTHTAG_ANY() /**@def AUTHTAG_ANY()
* *
* Filter tag matching any AUTHTAG_*(). * Filter tag matching any AUTHTAG_*().
*/ */
tag_typedef_t authtag_any = NSTAG_TYPEDEF(*); tag_typedef_t authtag_any = NSTAG_TYPEDEF(*);
/**@def AUTHTAG_MODULE() /**@def AUTHTAG_MODULE()
* *
* Pointer to an authentication server module (auth_mod_t). * Pointer to an authentication server module (auth_mod_t).
* *
* The tag item AUTHTAG_MODULE() contains pointer to an authentication server * The tag item AUTHTAG_MODULE() contains pointer to an authentication server
* module. It is used to pass an already initialized authentication module * module. It is used to pass an already initialized authentication module
@@ -58,11 +58,11 @@ tag_typedef_t authtag_module = PTRTAG_TYPEDEF(module);
/**@def AUTHTAG_METHOD() /**@def AUTHTAG_METHOD()
* *
* Name of the authentication scheme. * Name of the authentication scheme.
* *
* The tag AUTHTAG_METHOD() specifies the authentication module and scheme * The tag AUTHTAG_METHOD() specifies the authentication module and scheme
* to be used by the auth_module. The name can specify a basic * to be used by the auth_module. The name can specify a basic
* authentication module, like "Digest" or "Basic", or an plugin module, * authentication module, like "Digest" or "Basic", or an plugin module,
* like "SGMF+Digest". * like "SGMF+Digest".
* *
* @sa See <sofia-sip/auth_plugin.h> for plugin interface. * @sa See <sofia-sip/auth_plugin.h> for plugin interface.
*/ */
@@ -87,7 +87,7 @@ tag_typedef_t authtag_realm = STRTAG_TYPEDEF(realm);
* *
* Opaque data used by authentication server. * Opaque data used by authentication server.
* *
* The tag authtag_opaque is used to pass opaque data to the @b auth_module. * The tag authtag_opaque is used to pass opaque data to the @b auth_module.
* The opaque data will be included in all the challenges (however, the data * The opaque data will be included in all the challenges (however, the data
* is prefixed with a "." and other opaque data used by the algorithms. * is prefixed with a "." and other opaque data used by the algorithms.
* *
@@ -115,7 +115,7 @@ tag_typedef_t authtag_db = STRTAG_TYPEDEF(db);
/**@def AUTHTAG_QOP() /**@def AUTHTAG_QOP()
* *
* Quality-of-protection used by Digest authentication. * Quality-of-protection used by Digest authentication.
* *
* The tag AUTHTAG_QOP() specifies the qop scheme to be used by the * The tag AUTHTAG_QOP() specifies the qop scheme to be used by the
* digest authentication. * digest authentication.
*/ */
@@ -124,7 +124,7 @@ tag_typedef_t authtag_qop = STRTAG_TYPEDEF(qop);
/**@def AUTHTAG_ALGORITHM() /**@def AUTHTAG_ALGORITHM()
* *
* Authentication algorithm used by Digest authentication. * Authentication algorithm used by Digest authentication.
* *
* The tag AUTHTAG_ALGORITHM() specifies the qop scheme to be used by the * The tag AUTHTAG_ALGORITHM() specifies the qop scheme to be used by the
* digest authentication. * digest authentication.
*/ */
@@ -133,7 +133,7 @@ tag_typedef_t authtag_algorithm = STRTAG_TYPEDEF(algorithm);
/**@def AUTHTAG_EXPIRES() /**@def AUTHTAG_EXPIRES()
* *
* Nonce expiration time for Digest authentication. * Nonce expiration time for Digest authentication.
* *
* The tag AUTHTAG_EXPIRES() specifies the time in seconds that a nonce is * The tag AUTHTAG_EXPIRES() specifies the time in seconds that a nonce is
* considered valid. If 0, the nonce lifetime unbounded. The default time is * considered valid. If 0, the nonce lifetime unbounded. The default time is
* 3600 seconds. * 3600 seconds.
@@ -143,7 +143,7 @@ tag_typedef_t authtag_expires = UINTTAG_TYPEDEF(expires);
/**@def AUTHTAG_NEXT_EXPIRES() /**@def AUTHTAG_NEXT_EXPIRES()
* *
* Next nonce expiration time for Digest authentication. * Next nonce expiration time for Digest authentication.
* *
* The tag AUTHTAG_NEXT_EXPIRES() specifies the time in seconds that a * The tag AUTHTAG_NEXT_EXPIRES() specifies the time in seconds that a
* nextnonce sent in Authentication-Info header is considered valid. If 0, * nextnonce sent in Authentication-Info header is considered valid. If 0,
* the nonce lifetime is unbounded. The default time is 3600 seconds. * the nonce lifetime is unbounded. The default time is 3600 seconds.
@@ -153,9 +153,9 @@ tag_typedef_t authtag_next_expires = UINTTAG_TYPEDEF(next_expires);
/**@def AUTHTAG_MAX_NCOUNT() /**@def AUTHTAG_MAX_NCOUNT()
* *
* Max nonce count value. * Max nonce count value.
* *
* The tag AUTHTAG_MAX_NCOUNT() specifies the maximum number of times a * The tag AUTHTAG_MAX_NCOUNT() specifies the maximum number of times a
* nonce should be used. * nonce should be used.
* *
* @todo Count actual usages and don't trust "nc" parameter only. * @todo Count actual usages and don't trust "nc" parameter only.
*/ */
@@ -164,7 +164,7 @@ tag_typedef_t authtag_max_ncount = UINTTAG_TYPEDEF(max_ncount);
/**@def AUTHTAG_BLACKLIST() /**@def AUTHTAG_BLACKLIST()
* *
* Blacklist time. * Blacklist time.
* *
* The tag AUTHTAG_BLACKLIST() specifies the time the server delays its * The tag AUTHTAG_BLACKLIST() specifies the time the server delays its
* response if it is given bad credentials or malformed nonce. The default * response if it is given bad credentials or malformed nonce. The default
* time is 5 seconds. * time is 5 seconds.
@@ -176,7 +176,7 @@ tag_typedef_t authtag_blacklist = UINTTAG_TYPEDEF(blacklist);
/**@def AUTHTAG_FORBIDDEN() /**@def AUTHTAG_FORBIDDEN()
* *
* Respond with 403 Forbidden. * Respond with 403 Forbidden.
* *
* When given a true argument, the tag AUTHTAG_FORBIDDEN() specifies that the * When given a true argument, the tag AUTHTAG_FORBIDDEN() specifies that the
* server responds with 403 Forbidden (instead of 401/407) when it receives * server responds with 403 Forbidden (instead of 401/407) when it receives
* bad credentials. * bad credentials.
@@ -208,8 +208,8 @@ tag_typedef_t authtag_fake = BOOLTAG_TYPEDEF(fake);
/**@def AUTHTAG_REMOTE() /**@def AUTHTAG_REMOTE()
* *
* Remote authenticator URL. * Remote authenticator URL.
* *
* The tag AUTHTAG_REMOTE() is used to specify URL for remote authenticator. * The tag AUTHTAG_REMOTE() is used to specify URL for remote authenticator.
* The meaning of the URL is specific to the authentication module. The * The meaning of the URL is specific to the authentication module. The
* authentication module is selected by AUTHTAG_METHOD(). * authentication module is selected by AUTHTAG_METHOD().
*/ */
@@ -217,15 +217,15 @@ tag_typedef_t authtag_remote = URLTAG_TYPEDEF(remote);
/**@def AUTHTAG_ALLOW() /**@def AUTHTAG_ALLOW()
* *
* Comma-separated list of methods that are not challenged. * Comma-separated list of methods that are not challenged.
* *
* The tag AUTHTAG_ALLOW() takes its argument a string containing a * The tag AUTHTAG_ALLOW() takes its argument a string containing a
* comma-separated list of methods, for example, * comma-separated list of methods, for example,
* @code * @code
* AUTHTAG_ALLOW("ACK, BYE, CANCEL"). * AUTHTAG_ALLOW("ACK, BYE, CANCEL").
* @endcode * @endcode
* *
* The specified methods are not challenged by the authentication module. * The specified methods are not challenged by the authentication module.
* For example, this may include SIP ACK method or SIP methods only used * For example, this may include SIP ACK method or SIP methods only used
* within an already established dialog. * within an already established dialog.
*/ */
@@ -234,7 +234,7 @@ tag_typedef_t authtag_allow = STRTAG_TYPEDEF(allow);
/**@def AUTHTAG_MASTER_KEY() /**@def AUTHTAG_MASTER_KEY()
* *
* Private master key for the authentication module. * Private master key for the authentication module.
* *
* The tag AUTHTAG_MASTER_KEY() specifies a private master key that can be * The tag AUTHTAG_MASTER_KEY() specifies a private master key that can be
* used by the authentication module for various purposes (for instance, * used by the authentication module for various purposes (for instance,
* validating that nonces are really generated by it). * validating that nonces are really generated by it).
@@ -244,7 +244,7 @@ tag_typedef_t authtag_master_key = STRTAG_TYPEDEF(master_key);
/**@def AUTHTAG_CACHE_USERS() /**@def AUTHTAG_CACHE_USERS()
* *
* Time to cache user data. * Time to cache user data.
* *
* The tag AUTHTAG_CACHE_USERS() specifies how many seconds the user data is * The tag AUTHTAG_CACHE_USERS() specifies how many seconds the user data is
* cached locally. Default value is typically 30 minutes. * cached locally. Default value is typically 30 minutes.
*/ */
@@ -253,7 +253,7 @@ tag_typedef_t authtag_cache_users = UINTTAG_TYPEDEF(cache_users);
/**@def AUTHTAG_CACHE_ERRORS() /**@def AUTHTAG_CACHE_ERRORS()
* *
* Time to cache errors. * Time to cache errors.
* *
* The tag AUTHTAG_CACHE_ERRORS() specifies the lifetime in seconds for * The tag AUTHTAG_CACHE_ERRORS() specifies the lifetime in seconds for
* errors in the local authentication data cache. Note that the errors * errors in the local authentication data cache. Note that the errors
* generated locally (e.g., because of connectivity problem with * generated locally (e.g., because of connectivity problem with

View File

@@ -5,10 +5,10 @@
* @section iptsec_meta Module Meta Information * @section iptsec_meta Module Meta Information
* *
* The iptsec module currently provides interfaces to HTTP * The iptsec module currently provides interfaces to HTTP
* Basic and Digest authentication, used by HTTP and SIP protocol elements. * Basic and Digest authentication, used by HTTP and SIP protocol elements.
* There are both * There are both
* @ref auth_client "client-side" and * @ref auth_client "client-side" and
* @ref auth_module "server-side" * @ref auth_module "server-side"
* (authentication verification) functionality available. * (authentication verification) functionality available.
* *
* @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com> * @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -25,13 +25,13 @@
* operation is simple enough: * operation is simple enough:
* -# server initializes an #auth_status_t structure with information from * -# server initializes an #auth_status_t structure with information from
* the request * the request
* -# server calls auth_mod_method() * -# server calls auth_mod_method()
* -# server checks the status from auth_status_t structure, sends an error * -# server checks the status from auth_status_t structure, sends an error
* response to the client if authentication fails * response to the client if authentication fails
* -# server proceeds serving the authenticated request. * -# server proceeds serving the authenticated request.
* *
* If the operation is asynchronous, only a preliminary result is stored in * If the operation is asynchronous, only a preliminary result is stored in
* the auth_status_t structure when the call to auth_mod_method() returns. * the auth_status_t structure when the call to auth_mod_method() returns.
* In that case, the application can assign a callback function to the * In that case, the application can assign a callback function to the
* structure. The callback function is invoked when the authentication * structure. The callback function is invoked when the authentication
* operation is completed. An asynchronous authentication operation can be * operation is completed. An asynchronous authentication operation can be
@@ -62,7 +62,7 @@
* -# store the challenge to a list with auc_challenge() * -# store the challenge to a list with auc_challenge()
* -# prompt user and feed credentials (username and password) to the list * -# prompt user and feed credentials (username and password) to the list
* with auc_credentials() or auc_all_credentials() * with auc_credentials() or auc_all_credentials()
* -# authorize a request (add credential headers to it) with * -# authorize a request (add credential headers to it) with
* auc_authorization() and resend the request * auc_authorization() and resend the request
* *
* If there are several username/password pairs for multiple authentication * If there are several username/password pairs for multiple authentication

View File

@@ -24,9 +24,9 @@
/**@internal @file iptsec_debug.c /**@internal @file iptsec_debug.c
* @brief Debug log for IPTSEC module. * @brief Debug log for IPTSEC module.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Thu Dec 19 15:55:30 2002 ppessi * @date Created: Thu Dec 19 15:55:30 2002 ppessi
*/ */
@@ -51,7 +51,7 @@
* *
* The IPTSEC_DEBUG environment variable is used to determine the debug * The IPTSEC_DEBUG environment variable is used to determine the debug
* logging level for @iptsec module. The default level is 3. * logging level for @iptsec module. The default level is 3.
* *
* @sa <sofia-sip/su_debug.h>, #iptsec_log, #SOFIA_DEBUG * @sa <sofia-sip/su_debug.h>, #iptsec_log, #SOFIA_DEBUG
*/ */
extern IPTSEC_DEBUG; extern IPTSEC_DEBUG;
@@ -62,7 +62,7 @@ extern IPTSEC_DEBUG;
#endif #endif
/** Common log for client and server components. /** Common log for client and server components.
* *
* The iptsec_log is the log object used by @iptsec module. The level of * The iptsec_log is the log object used by @iptsec module. The level of
* #iptsec_log is set using #IPTSEC_DEBUG environment variable. * #iptsec_log is set using #IPTSEC_DEBUG environment variable.
*/ */

View File

@@ -29,9 +29,9 @@
/**@internal /**@internal
* @file iptsec_debug.h * @file iptsec_debug.h
* @brief Debug log for IPTSEC module. * @brief Debug log for IPTSEC module.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Thu Dec 19 15:56:35 2002 ppessi * @date Created: Thu Dec 19 15:56:35 2002 ppessi
*/ */

View File

@@ -24,7 +24,7 @@
#ifndef AUTH_CLIENT_H #ifndef AUTH_CLIENT_H
/** Defined when <sofia-sip/auth_client.h> has been included. */ /** Defined when <sofia-sip/auth_client.h> has been included. */
#define AUTH_CLIENT_H #define AUTH_CLIENT_H
/**@file sofia-sip/auth_client.h /**@file sofia-sip/auth_client.h
* *
@@ -49,7 +49,7 @@ SOFIA_BEGIN_DECLS
typedef struct auth_client_s auth_client_t; typedef struct auth_client_s auth_client_t;
SOFIAPUBFUN SOFIAPUBFUN
int auc_challenge(auth_client_t **auc, su_home_t *home, int auc_challenge(auth_client_t **auc, su_home_t *home,
msg_auth_t const *auth, msg_auth_t const *auth,
msg_hclass_t *crcl); msg_hclass_t *crcl);
@@ -62,14 +62,14 @@ int auc_info(auth_client_t **auc_list,
msg_hclass_t *credential_class); msg_hclass_t *credential_class);
SOFIAPUBFUN SOFIAPUBFUN
int auc_all_credentials(auth_client_t **auc_list, int auc_all_credentials(auth_client_t **auc_list,
char const *scheme, char const *scheme,
char const *realm, char const *realm,
char const *user, char const *user,
char const *pass); char const *pass);
SOFIAPUBFUN SOFIAPUBFUN
int auc_clear_credentials(auth_client_t **auc_list, int auc_clear_credentials(auth_client_t **auc_list,
char const *scheme, char const *scheme,
char const *realm); char const *realm);
@@ -81,15 +81,15 @@ int auc_has_authorization(auth_client_t **auc_list);
SOFIAPUBFUN SOFIAPUBFUN
int auc_authorization(auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub, int auc_authorization(auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body); msg_payload_t const *body);
SOFIAPUBFUN SOFIAPUBFUN
int auc_authorization_headers(auth_client_t **auc_list, int auc_authorization_headers(auth_client_t **auc_list,
su_home_t *home, su_home_t *home,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **return_headers); msg_header_t **return_headers);
@@ -105,4 +105,4 @@ int auc_register_plugin(auth_client_plugin_t const *plugin);
SOFIA_END_DECLS SOFIA_END_DECLS
#endif #endif

View File

@@ -24,17 +24,17 @@
#ifndef AUTH_CLIENT_PLUGIN_H #ifndef AUTH_CLIENT_PLUGIN_H
/** Defined when <sofia-sip/auth_client_plugin.h> has been included. */ /** Defined when <sofia-sip/auth_client_plugin.h> has been included. */
#define AUTH_CLIENT_PLUGIN_H #define AUTH_CLIENT_PLUGIN_H
/**@file sofia-sip/auth_client_plugin.h /**@file sofia-sip/auth_client_plugin.h
* @brief Client-side plugin interface for authentication * @brief Client-side plugin interface for authentication
* *
* @note For extensions in 1.12.6 or later, * @note For extensions in 1.12.6 or later,
* you have to define SOFIA_EXTEND_AUTH_CLIENT to 1 * you have to define SOFIA_EXTEND_AUTH_CLIENT to 1
* before including this file. * before including this file.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Fri May 19 16:18:21 EEST 2006 * @date Created: Fri May 19 16:18:21 EEST 2006
*/ */
@@ -74,16 +74,16 @@ struct auth_client_plugin
int auc_size; /* Size of the client structure */ int auc_size; /* Size of the client structure */
char const *auc_name; /* Name of the autentication scheme */ char const *auc_name; /* Name of the autentication scheme */
/** Store challenge */ /** Store challenge */
int (*auc_challenge)(auth_client_t *ca, int (*auc_challenge)(auth_client_t *ca,
msg_auth_t const *ch); msg_auth_t const *ch);
/** Authorize request. */ /** Authorize request. */
int (*auc_authorize)(auth_client_t *ca, int (*auc_authorize)(auth_client_t *ca,
su_home_t *h, su_home_t *h,
char const *method, char const *method,
url_t const *url, url_t const *url,
msg_payload_t const *body, msg_payload_t const *body,
msg_header_t **return_headers); msg_header_t **return_headers);

View File

@@ -26,7 +26,7 @@
/** Defined when <sofia-sip/auth_common.h> has been included. */ /** Defined when <sofia-sip/auth_common.h> has been included. */
#define AUTH_COMMON_H #define AUTH_COMMON_H
/**@file sofia-sip/auth_common.h /**@file sofia-sip/auth_common.h
* *
* Functions common for client/server. * Functions common for client/server.
* *
@@ -43,7 +43,7 @@ SOFIA_BEGIN_DECLS
SOFIAPUBFUN issize_t auth_get_params(su_home_t *home, SOFIAPUBFUN issize_t auth_get_params(su_home_t *home,
char const * const params[], ... char const * const params[], ...
/* char const * name, /* char const * name,
char const **return_value */); char const **return_value */);
SOFIAPUBFUN int auth_struct_copy(void *dst, void const *src, isize_t s_size); SOFIAPUBFUN int auth_struct_copy(void *dst, void const *src, isize_t s_size);

View File

@@ -26,14 +26,14 @@
/** Defined when <sofia-sip/auth_digest.h> has been included. */ /** Defined when <sofia-sip/auth_digest.h> has been included. */
#define AUTH_DIGEST_H #define AUTH_DIGEST_H
/**@file sofia-sip/auth_digest.h /**@file sofia-sip/auth_digest.h
* Datatypes and functions for Digest authentication. * Datatypes and functions for Digest authentication.
* *
* The structures and functions here follow the RFC 2617. * The structures and functions here follow the RFC 2617.
* *
* @sa @RFC2617, * @sa @RFC2617,
* <i>"HTTP Authentication: Basic and Digest Access Authentication"</i>, * <i>"HTTP Authentication: Basic and Digest Access Authentication"</i>,
* J. Franks et al, * J. Franks et al,
* June 1999. * June 1999.
* *
* @sa @RFC3261 section 22 * @sa @RFC3261 section 22
@@ -96,7 +96,7 @@ typedef struct {
* *
* @code * @code
* credentials = "Digest" digest-response * credentials = "Digest" digest-response
* digest-response = 1#( username | realm | nonce | digest-uri | * digest-response = 1#( username | realm | nonce | digest-uri |
* response | [ algorithm ] | [cnonce] | [opaque] | * response | [ algorithm ] | [cnonce] | [opaque] |
* [message-qop] | [nonce-count] | [auth-param] ) * [message-qop] | [nonce-count] | [auth-param] )
* username = "username" "=" username-value * username = "username" "=" username-value

View File

@@ -24,9 +24,9 @@
#ifndef AUTH_MODULE_H #ifndef AUTH_MODULE_H
/** Defined when <sofia-sip/auth_module.h> has been included. */ /** Defined when <sofia-sip/auth_module.h> has been included. */
#define AUTH_MODULE_H #define AUTH_MODULE_H
/**@file sofia-sip/auth_module.h /**@file sofia-sip/auth_module.h
* @brief Authentication verification interface. * @brief Authentication verification interface.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com>. * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -56,7 +56,7 @@ typedef struct auth_mod_t auth_mod_t;
/** Authentication operation. */ /** Authentication operation. */
typedef struct auth_status_t auth_status_t; typedef struct auth_status_t auth_status_t;
#ifdef AUTH_MAGIC_T #ifdef AUTH_MAGIC_T
typedef AUTH_MAGIC_T auth_magic_t; typedef AUTH_MAGIC_T auth_magic_t;
#else #else
typedef void auth_magic_t; typedef void auth_magic_t;
@@ -81,10 +81,10 @@ typedef void auth_callback_t(auth_magic_t *, auth_status_t *);
* authentication operation and all the related data. The application * authentication operation and all the related data. The application
* verifying the authentication fills the auth_status_t structure, then * verifying the authentication fills the auth_status_t structure, then
* calls auth_mod_method() (or auth_mod_challenge()). The operation result * calls auth_mod_method() (or auth_mod_challenge()). The operation result
* is stored in the structure. * is stored in the structure.
* *
* If the operation is asynchronous, only a preliminary result is stored in * If the operation is asynchronous, only a preliminary result is stored in
* the auth_status_t structure when the call to auth_mod_method() returns. * the auth_status_t structure when the call to auth_mod_method() returns.
* In that case, the application @b must assign a callback function to the * In that case, the application @b must assign a callback function to the
* structure. The callback function is invoked when the authentication * structure. The callback function is invoked when the authentication
* operation is completed. * operation is completed.
@@ -105,7 +105,7 @@ struct auth_status_t
url_t const *as_user_uri; /* Return user's identity [in/out] */ url_t const *as_user_uri; /* Return user's identity [in/out] */
char const *as_ident; /**< Identities [out] */ char const *as_ident; /**< Identities [out] */
unsigned as_profile; /**< User profile (group) [out] */ unsigned as_profile; /**< User profile (group) [out] */
su_addrinfo_t *as_source; /**< Source address [in] */ su_addrinfo_t *as_source; /**< Source address [in] */
char const *as_realm; /**< Authentication realm [in] */ char const *as_realm; /**< Authentication realm [in] */
@@ -136,7 +136,7 @@ struct auth_status_t
/** @} */ /** @} */
/** Pointer to extended state, used exclusively by plugin modules. */ /** Pointer to extended state, used exclusively by plugin modules. */
auth_splugin_t *as_plugin; auth_splugin_t *as_plugin;
}; };
/** Authentication challenge. /** Authentication challenge.
@@ -146,7 +146,7 @@ struct auth_status_t
* with 401 response code and phrase along with header class for * with 401 response code and phrase along with header class for
* @b WWW-Authenticate header in the @a ach structure. * @b WWW-Authenticate header in the @a ach structure.
*/ */
typedef struct auth_challenger typedef struct auth_challenger
{ {
int ach_status; /**< Response status for challenge response */ int ach_status; /**< Response status for challenge response */
char const *ach_phrase; /**< Response phrase for challenge response */ char const *ach_phrase; /**< Response phrase for challenge response */

View File

@@ -24,20 +24,20 @@
#ifndef AUTH_NTLM_H #ifndef AUTH_NTLM_H
/** Defined when <sofia-sip/auth_ntlm.h> has been included. */ /** Defined when <sofia-sip/auth_ntlm.h> has been included. */
#define AUTH_NTLM_H #define AUTH_NTLM_H
/**@file sofia-sip/auth_ntlm.h /**@file sofia-sip/auth_ntlm.h
* Datatypes and functions for Ntlm authentication. * Datatypes and functions for Ntlm authentication.
* *
* The structures and functions here follow the RFC 2617. * The structures and functions here follow the RFC 2617.
* *
* @sa * @sa
* <a href="ftp://ftp.ietf.org/rfc/rfc2617.txt">RFC 2617</a>, * <a href="ftp://ftp.ietf.org/rfc/rfc2617.txt">RFC 2617</a>,
* <i>"HTTP Authentication: Basic and Ntlm Access Authentication"</i>, * <i>"HTTP Authentication: Basic and Ntlm Access Authentication"</i>,
* J. Franks et al, * J. Franks et al,
* June 1999. * June 1999.
* *
* @sa Section 19 from * @sa Section 19 from
* <a href="ftp://ftp.ietf.org/internet-drafts/draft-ietf-sip-rfc2543bis-04.txt>draft-ietf-sip-rfc2543bis-04</a>. * <a href="ftp://ftp.ietf.org/internet-drafts/draft-ietf-sip-rfc2543bis-04.txt>draft-ietf-sip-rfc2543bis-04</a>.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -55,33 +55,33 @@
SOFIA_BEGIN_DECLS SOFIA_BEGIN_DECLS
issize_t auth_ntlm_challenge_get(su_home_t *, auth_challenge_t *, issize_t auth_ntlm_challenge_get(su_home_t *, auth_challenge_t *,
char const * const params[]); char const * const params[]);
issize_t auth_ntlm_response_get(su_home_t *, auth_response_t *, issize_t auth_ntlm_response_get(su_home_t *, auth_response_t *,
char const * const params[]); char const * const params[]);
int auth_ntlm_a1(auth_response_t *ar, int auth_ntlm_a1(auth_response_t *ar,
auth_hexmd5_t ha1, auth_hexmd5_t ha1,
char const *secret); char const *secret);
int auth_ntlm_a1sess(auth_response_t *ar, int auth_ntlm_a1sess(auth_response_t *ar,
auth_hexmd5_t ha1sess, auth_hexmd5_t ha1sess,
char const *ha1); char const *ha1);
int auth_ntlm_sessionkey(auth_response_t *, auth_hexmd5_t ha1, int auth_ntlm_sessionkey(auth_response_t *, auth_hexmd5_t ha1,
char const *secret); char const *secret);
int auth_ntlm_response(auth_response_t *, auth_hexmd5_t response, int auth_ntlm_response(auth_response_t *, auth_hexmd5_t response,
auth_hexmd5_t const ha1, auth_hexmd5_t const ha1,
char const *method_name, void const *data, issize_t dlen); char const *method_name, void const *data, issize_t dlen);
/** NTLM scheme */ /** NTLM scheme */
msg_auth_t *auth_ntlm_credentials(msg_auth_t *auth, msg_auth_t *auth_ntlm_credentials(msg_auth_t *auth,
char const *realm, char const *realm,
char const *opaque, char const *opaque,
char const *gssapidata, char const *gssapidata,
char const *targetname); char const *targetname);
void auth_challenge_ntlm(auth_mod_t *am, void auth_challenge_ntlm(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach); auth_challenger_t const *ach);
@@ -97,18 +97,18 @@ void auth_check_ntlm(auth_mod_t *am,
auth_response_t *ar, auth_response_t *ar,
auth_challenger_t const *ach); auth_challenger_t const *ach);
int auth_generate_ntlm_nonce(auth_mod_t *am, int auth_generate_ntlm_nonce(auth_mod_t *am,
char buffer[], char buffer[],
size_t buffer_len, size_t buffer_len,
int nextnonce, int nextnonce,
msg_time_t now); msg_time_t now);
int auth_validate_ntlm_nonce(auth_mod_t *am, int auth_validate_ntlm_nonce(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_response_t *ar, auth_response_t *ar,
msg_time_t now); msg_time_t now);
void auth_info_ntlm(auth_mod_t *am, void auth_info_ntlm(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach); auth_challenger_t const *ach);

View File

@@ -24,13 +24,13 @@
#ifndef AUTH_PLUGIN_H #ifndef AUTH_PLUGIN_H
/** Defined when <sofia-sip/auth_plugin.h> has been included. */ /** Defined when <sofia-sip/auth_plugin.h> has been included. */
#define AUTH_PLUGIN_H #define AUTH_PLUGIN_H
/**@file sofia-sip/auth_plugin.h /**@file sofia-sip/auth_plugin.h
* @brief Plugin interface for authentication verification modules. * @brief Plugin interface for authentication verification modules.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* *
* @date Created: Tue Apr 27 15:22:07 2004 ppessi * @date Created: Tue Apr 27 15:22:07 2004 ppessi
*/ */
@@ -77,20 +77,20 @@ struct auth_scheme
tag_type_t tag, tag_value_t value, ...); tag_type_t tag, tag_value_t value, ...);
/** Check authentication. Invoked by auth_mod_method(). */ /** Check authentication. Invoked by auth_mod_method(). */
void (*asch_check)(auth_mod_t *am, void (*asch_check)(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
msg_auth_t *auth, msg_auth_t *auth,
auth_challenger_t const *ch); auth_challenger_t const *ch);
/** Create a challenge. Invoked by auth_mod_challenge(). */ /** Create a challenge. Invoked by auth_mod_challenge(). */
void (*asch_challenge)(auth_mod_t *am, void (*asch_challenge)(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ch); auth_challenger_t const *ch);
/** Cancel an asynchronous authentication request. /** Cancel an asynchronous authentication request.
* Invoked by auth_mod_cancel(). * Invoked by auth_mod_cancel().
*/ */
void (*asch_cancel)(auth_mod_t *am, void (*asch_cancel)(auth_mod_t *am,
auth_status_t *as); auth_status_t *as);
/** Reclaim resources an authentication module. /** Reclaim resources an authentication module.
@@ -161,7 +161,7 @@ struct auth_mod_t
unsigned am_count; /**< Nonce counter */ unsigned am_count; /**< Nonce counter */
uint8_t am_master_key[16]; /**< Private master key */ uint8_t am_master_key[16]; /**< Private master key */
su_md5_t am_hmac_ipad; /**< MD5 with inner pad */ su_md5_t am_hmac_ipad; /**< MD5 with inner pad */
su_md5_t am_hmac_opad; /**< MD5 with outer pad */ su_md5_t am_hmac_opad; /**< MD5 with outer pad */
@@ -182,11 +182,11 @@ SOFIAPUBFUN int auth_readdb_if_needed(auth_mod_t *am);
SOFIAPUBFUN int auth_readdb(auth_mod_t *am); SOFIAPUBFUN int auth_readdb(auth_mod_t *am);
SOFIAPUBFUN msg_auth_t *auth_mod_credentials(msg_auth_t *auth, SOFIAPUBFUN msg_auth_t *auth_mod_credentials(msg_auth_t *auth,
char const *scheme, char const *scheme,
char const *realm); char const *realm);
SOFIAPUBFUN auth_mod_t *auth_mod_alloc(auth_scheme_t *scheme, SOFIAPUBFUN auth_mod_t *auth_mod_alloc(auth_scheme_t *scheme,
tag_type_t, tag_value_t, ...); tag_type_t, tag_value_t, ...);
#define AUTH_PLUGIN(am) (auth_plugin_t *)((am) + 1) #define AUTH_PLUGIN(am) (auth_plugin_t *)((am) + 1)
@@ -211,13 +211,13 @@ void auth_method_basic(auth_mod_t *am,
auth_challenger_t const *ach); auth_challenger_t const *ach);
SOFIAPUBFUN SOFIAPUBFUN
void auth_challenge_basic(auth_mod_t *am, void auth_challenge_basic(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach); auth_challenger_t const *ach);
/** Digest scheme */ /** Digest scheme */
SOFIAPUBFUN SOFIAPUBFUN
msg_auth_t *auth_digest_credentials(msg_auth_t *auth, msg_auth_t *auth_digest_credentials(msg_auth_t *auth,
char const *realm, char const *realm,
char const *opaque); char const *opaque);
@@ -228,7 +228,7 @@ void auth_method_digest(auth_mod_t *am,
auth_challenger_t const *ach); auth_challenger_t const *ach);
SOFIAPUBFUN SOFIAPUBFUN
void auth_info_digest(auth_mod_t *am, void auth_info_digest(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach); auth_challenger_t const *ach);
@@ -239,19 +239,19 @@ void auth_check_digest(auth_mod_t *am,
auth_challenger_t const *ach); auth_challenger_t const *ach);
SOFIAPUBFUN SOFIAPUBFUN
void auth_challenge_digest(auth_mod_t *am, void auth_challenge_digest(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_challenger_t const *ach); auth_challenger_t const *ach);
SOFIAPUBFUN SOFIAPUBFUN
isize_t auth_generate_digest_nonce(auth_mod_t *am, isize_t auth_generate_digest_nonce(auth_mod_t *am,
char buffer[], char buffer[],
size_t buffer_len, size_t buffer_len,
int nextnonce, int nextnonce,
msg_time_t now); msg_time_t now);
SOFIAPUBFUN SOFIAPUBFUN
int auth_validate_digest_nonce(auth_mod_t *am, int auth_validate_digest_nonce(auth_mod_t *am,
auth_status_t *as, auth_status_t *as,
auth_response_t *ar, auth_response_t *ar,
msg_time_t now); msg_time_t now);
@@ -260,7 +260,7 @@ SOFIAPUBFUN int auth_allow_check(auth_mod_t *am, auth_status_t *as);
/** Init md5 for MD5-based HMAC */ /** Init md5 for MD5-based HMAC */
SOFIAPUBFUN void auth_md5_hmac_init(auth_mod_t *am, su_md5_t *md5); SOFIAPUBFUN void auth_md5_hmac_init(auth_mod_t *am, su_md5_t *md5);
SOFIAPUBFUN void auth_md5_hmac_digest(auth_mod_t *am, su_md5_t *md5, SOFIAPUBFUN void auth_md5_hmac_digest(auth_mod_t *am, su_md5_t *md5,
void *hmac, size_t size); void *hmac, size_t size);
SOFIA_END_DECLS SOFIA_END_DECLS

View File

@@ -77,7 +77,7 @@
int tstflags; int tstflags;
char *argv0; char *argv0;
#define TSTFLAGS tstflags #define TSTFLAGS tstflags
#include <sofia-sip/tstdef.h> #include <sofia-sip/tstdef.h>
@@ -105,14 +105,14 @@ int test_digest()
"algorithm=MD5, " "algorithm=MD5, "
"qop=\"auth\""; "qop=\"auth\"";
char response[] = char response[] =
"DIGEST USERNAME=\"digest\", " "DIGEST USERNAME=\"digest\", "
"REALM=\"garage.sr.ntc.nokia.com\", " "REALM=\"garage.sr.ntc.nokia.com\", "
"NONCE=\"MjAwMS0wMS0yMSAxNTowODo1OA==\", " "NONCE=\"MjAwMS0wMS0yMSAxNTowODo1OA==\", "
"RESPONSE=\"d9d7f1ae99a013cb05f319f0f678251d\", " "RESPONSE=\"d9d7f1ae99a013cb05f319f0f678251d\", "
"URI=\"sip:garage.sr.ntc.nokia.com\""; "URI=\"sip:garage.sr.ntc.nokia.com\"";
char rfc2617[] = char rfc2617[] =
"Digest username=\"Mufasa\", " "Digest username=\"Mufasa\", "
"realm=\"testrealm@host.com\", " "realm=\"testrealm@host.com\", "
"nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
@@ -122,7 +122,7 @@ int test_digest()
"algorithm=\"md5\", " "algorithm=\"md5\", "
"uri=\"/dir/index.html\""; "uri=\"/dir/index.html\"";
char indigo[] = char indigo[] =
"Digest username=\"user1\", " "Digest username=\"user1\", "
"realm=\"nokia-proxy\", " "realm=\"nokia-proxy\", "
"nonce=\"0YXwH29PCT4lEz8+YJipQg==\", " "nonce=\"0YXwH29PCT4lEz8+YJipQg==\", "
@@ -134,7 +134,7 @@ int test_digest()
"qop=auth, " "qop=auth, "
"nc=000000002"; "nc=000000002";
char proxy_authenticate[] = char proxy_authenticate[] =
"Digest realm=\"IndigoSw\", " "Digest realm=\"IndigoSw\", "
"domain=\"indigosw.com aol.com\", " "domain=\"indigosw.com aol.com\", "
"nonce=\"V2VkIEF1ZyAxNSAxNzoxNzozNyBCU1QgMjAwMVtCQDE3OWU4Yg==\", " "nonce=\"V2VkIEF1ZyAxNSAxNzoxNzozNyBCU1QgMjAwMVtCQDE3OWU4Yg==\", "
@@ -172,12 +172,12 @@ int test_digest()
TEST_SIZE(auth_digest_response_get(home, ar, au->au_params), 10); TEST_SIZE(auth_digest_response_get(home, ar, au->au_params), 10);
TEST0(auth_digest_sessionkey(ar, sessionkey, "Circle Of Life") == 0); TEST0(auth_digest_sessionkey(ar, sessionkey, "Circle Of Life") == 0);
if (tstflags & tst_verbatim) if (tstflags & tst_verbatim)
printf("%s: sessionkey=\"%s\"\n", name, sessionkey); printf("%s: sessionkey=\"%s\"\n", name, sessionkey);
TEST0(strcmp(sessionkey, "939e7578ed9e3c518a452acee763bce9") == 0); TEST0(strcmp(sessionkey, "939e7578ed9e3c518a452acee763bce9") == 0);
TEST0(auth_digest_response(ar, hresponse, sessionkey, "GET", NULL, 0) == 0); TEST0(auth_digest_response(ar, hresponse, sessionkey, "GET", NULL, 0) == 0);
if (tstflags & tst_verbatim) if (tstflags & tst_verbatim)
printf("%s: hresponse=\"%s\"\n", name, hresponse); printf("%s: hresponse=\"%s\"\n", name, hresponse);
TEST0(strcmp(hresponse, "6629fae49393a05397450978507c4ef1") == 0); TEST0(strcmp(hresponse, "6629fae49393a05397450978507c4ef1") == 0);
@@ -195,11 +195,11 @@ int test_digest()
TEST_1(ac->ac_auth_int); TEST_1(ac->ac_auth_int);
{ {
char challenge[] = char challenge[] =
"Digest realm=\"opera.ntc.nokia.com\", " "Digest realm=\"opera.ntc.nokia.com\", "
"nonce=\"InyiWI+qIdvDKkO2jFK7mg==\""; "nonce=\"InyiWI+qIdvDKkO2jFK7mg==\"";
char credentials[] = char credentials[] =
"Digest username=\"samuel.privat.saturday@opera.ntc.nokia.com\", " "Digest username=\"samuel.privat.saturday@opera.ntc.nokia.com\", "
"realm=\"opera.ntc.nokia.com\", nonce=\"InyiWI+qIdvDKkO2jFK7mg==\", " "realm=\"opera.ntc.nokia.com\", nonce=\"InyiWI+qIdvDKkO2jFK7mg==\", "
"algorithm=MD5, uri=\"sip:opera.ntc.nokia.com\", " "algorithm=MD5, uri=\"sip:opera.ntc.nokia.com\", "
@@ -247,12 +247,12 @@ Authorization: Digest username="Mufasa",
opaque="5ccc069c403ebaf9f0171e9517f40e41" opaque="5ccc069c403ebaf9f0171e9517f40e41"
*/ */
char challenge[] = char challenge[] =
"Digest realm=\"testrealm@host.com\", " "Digest realm=\"testrealm@host.com\", "
"nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
"opaque=\"5ccc069c403ebaf9f0171e9517f40e41\""; "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
char rfc2069_cred[] = char rfc2069_cred[] =
"Digest username=\"Mufasa\", " "Digest username=\"Mufasa\", "
"realm=\"testrealm@host.com\", " "realm=\"testrealm@host.com\", "
"nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
@@ -278,10 +278,10 @@ Authorization: Digest username="Mufasa",
} }
{ {
char worldcom_chal[] = char worldcom_chal[] =
"Digest realm=\"WCOM\", nonce=\"ce2292f3f748fbe239bda9e852e8b986\""; "Digest realm=\"WCOM\", nonce=\"ce2292f3f748fbe239bda9e852e8b986\"";
char worldcom_cred[] = char worldcom_cred[] =
"Digest realm=\"WCOM\", username=\"jari\", " "Digest realm=\"WCOM\", username=\"jari\", "
"nonce=\"ce2292f3f748fbe239bda9e852e8b986\", " "nonce=\"ce2292f3f748fbe239bda9e852e8b986\", "
"response=\"ea692d202019d41a75c70df4b2401e2f\", " "response=\"ea692d202019d41a75c70df4b2401e2f\", "
@@ -304,12 +304,12 @@ Authorization: Digest username="Mufasa",
} }
{ {
char etri_chal[] = char etri_chal[] =
"Digest realm=\"nokia-proxy\", domain=\"sip:194.2.188.133\", " "Digest realm=\"nokia-proxy\", domain=\"sip:194.2.188.133\", "
"nonce=\"wB7JBwIb/XhtgfGp1VuPoQ==\", opaque=\"wkJxwA==\", " "nonce=\"wB7JBwIb/XhtgfGp1VuPoQ==\", opaque=\"wkJxwA==\", "
", algorithm=MD5, qop=\"auth\""; ", algorithm=MD5, qop=\"auth\"";
char etri_cred[] = char etri_cred[] =
"Digest username=\"myhuh\", realm=\"nokia-proxy\", " "Digest username=\"myhuh\", realm=\"nokia-proxy\", "
"nonce=\"wB7JBwIb/XhtgfGp1VuPoQ==\", uri=\"sip:194.2.188.133\", " "nonce=\"wB7JBwIb/XhtgfGp1VuPoQ==\", uri=\"sip:194.2.188.133\", "
"response=\"32960a62bdc202171ca5a294dc229a6d\", " "response=\"32960a62bdc202171ca5a294dc229a6d\", "
@@ -317,13 +317,13 @@ Authorization: Digest username="Mufasa",
memset(ac, 0, sizeof(ac)); ac->ac_size = sizeof(ac); memset(ac, 0, sizeof(ac)); ac->ac_size = sizeof(ac);
memset(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar); memset(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar);
TEST0(pa = sip_proxy_authenticate_make(home, etri_chal)); TEST0(pa = sip_proxy_authenticate_make(home, etri_chal));
TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 8); TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 8);
TEST0(pz = sip_proxy_authorization_make(home, etri_cred)); TEST0(pz = sip_proxy_authorization_make(home, etri_cred));
TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 6 /* 8 */); TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 6 /* 8 */);
ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL; ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
TEST(auth_digest_sessionkey(ar, sessionkey, "myhuh"), 0); TEST(auth_digest_sessionkey(ar, sessionkey, "myhuh"), 0);
@@ -332,7 +332,7 @@ Authorization: Digest username="Mufasa",
} }
{ {
char chal[] = char chal[] =
"Digest realm=\"nokia-proxy\", domain=\"sip:10.21.32.63\", " "Digest realm=\"nokia-proxy\", domain=\"sip:10.21.32.63\", "
"nonce=\"GjbLsrozHC6Lx95C57vGlw==\", opaque=\"HN22wQ==\", algorithm=MD5"; "nonce=\"GjbLsrozHC6Lx95C57vGlw==\", opaque=\"HN22wQ==\", algorithm=MD5";
@@ -344,13 +344,13 @@ Authorization: Digest username="Mufasa",
memset(ac, 0, sizeof(ac)); ac->ac_size = sizeof(ac); memset(ac, 0, sizeof(ac)); ac->ac_size = sizeof(ac);
memset(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar); memset(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar);
TEST0(pa = sip_proxy_authenticate_make(home, chal)); TEST0(pa = sip_proxy_authenticate_make(home, chal));
TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 6); TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 6);
TEST0(pz = sip_proxy_authorization_make(home, cred)); TEST0(pz = sip_proxy_authorization_make(home, cred));
TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 8); TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 8);
ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL; ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
TEST(auth_digest_sessionkey(ar, sessionkey, "test1"), 0); TEST(auth_digest_sessionkey(ar, sessionkey, "test1"), 0);
@@ -359,18 +359,18 @@ Authorization: Digest username="Mufasa",
} }
{ {
char challenge[] = char challenge[] =
"Digest realm=\"nokia-proxy\", domain=\"sip:194.2.188.133\", " "Digest realm=\"nokia-proxy\", domain=\"sip:194.2.188.133\", "
"nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", opaque=\"+GNywA==\", " "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", opaque=\"+GNywA==\", "
"algorithm=MD5, qop=\"auth-int\""; "algorithm=MD5, qop=\"auth-int\"";
char credentials[] = char credentials[] =
"Digest username=\"test\", realm=\"nokia-proxy\", " "Digest username=\"test\", realm=\"nokia-proxy\", "
"nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", " "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", "
"cnonce=\"11RkhFg9EdaIRD36w0EMVA==\", opaque=\"+GNywA==\", " "cnonce=\"11RkhFg9EdaIRD36w0EMVA==\", opaque=\"+GNywA==\", "
"uri=\"sip:3000@194.2.188.133\", algorithm=MD5, " "uri=\"sip:3000@194.2.188.133\", algorithm=MD5, "
"response=\"26e8b9aaacfca2d68770fab1ec04e2c7\", " "response=\"26e8b9aaacfca2d68770fab1ec04e2c7\", "
"qop=auth-int, nc=00000001"; "qop=auth-int, nc=00000001";
char data[] = char data[] =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
"<presence>\n" "<presence>\n"
"<presentity uri=\"sip:3000@194.2.188.133\"/>\n" "<presentity uri=\"sip:3000@194.2.188.133\"/>\n"
@@ -389,23 +389,23 @@ Authorization: Digest username="Mufasa",
memset(ac, 0, sizeof(ac)); ac->ac_size = sizeof(ac); memset(ac, 0, sizeof(ac)); ac->ac_size = sizeof(ac);
memset(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar); memset(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar);
TEST0(pa = sip_proxy_authenticate_make(home, challenge)); TEST0(pa = sip_proxy_authenticate_make(home, challenge));
TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 8); TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 8);
TEST0(pz = sip_proxy_authorization_make(home, credentials)); TEST0(pz = sip_proxy_authorization_make(home, credentials));
TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 12); TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 12);
ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL; ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
TEST0(!auth_digest_sessionkey(ar, sessionkey, "test")); TEST0(!auth_digest_sessionkey(ar, sessionkey, "test"));
TEST0(!auth_digest_response(ar, hresponse, sessionkey, "REGISTER", TEST0(!auth_digest_response(ar, hresponse, sessionkey, "REGISTER",
data, strlen(data))); data, strlen(data)));
TEST_S(hresponse, "26e8b9aaacfca2d68770fab1ec04e2c7"); TEST_S(hresponse, "26e8b9aaacfca2d68770fab1ec04e2c7");
} }
su_home_deinit(home); su_home_deinit(home);
END(); END();
} }
@@ -418,7 +418,7 @@ msg_t *read_message(int flags, char const buffer[])
msg_iovec_t iovec[2]; msg_iovec_t iovec[2];
n = strlen(buffer); n = strlen(buffer);
if (n == 0) if (n == 0)
return NULL; return NULL;
msg = msg_create(sip_default_mclass(), flags); msg = msg_create(sip_default_mclass(), flags);
@@ -447,10 +447,10 @@ void test_callback(su_root_t *root, auth_status_t *as)
su_root_break(root); su_root_break(root);
} }
static static
void init_as(auth_status_t *as) void init_as(auth_status_t *as)
{ {
memset(as, 0, sizeof *as); memset(as, 0, sizeof *as);
as->as_home->suh_size = (sizeof *as); as->as_home->suh_size = (sizeof *as);
su_home_init(as->as_home); su_home_init(as->as_home);
as->as_method = "REGISTER"; as->as_method = "REGISTER";
@@ -458,14 +458,14 @@ void init_as(auth_status_t *as)
as->as_phrase = "Infernal Error"; as->as_phrase = "Infernal Error";
} }
static static
void deinit_as(auth_status_t *as) void deinit_as(auth_status_t *as)
{ {
su_home_deinit(as->as_home); su_home_deinit(as->as_home);
memset(as, 0, sizeof *as); memset(as, 0, sizeof *as);
} }
static static
void reinit_as(auth_status_t *as) void reinit_as(auth_status_t *as)
{ {
deinit_as(as); init_as(as); deinit_as(as); init_as(as);
@@ -475,9 +475,9 @@ void reinit_as(auth_status_t *as)
int test_digest_client() int test_digest_client()
{ {
BEGIN(); BEGIN();
{ {
char challenge[] = char challenge[] =
PROTOCOL " 401 Unauthorized\r\n" PROTOCOL " 401 Unauthorized\r\n"
"Call-ID:0e3dc2b2-dcc6-1226-26ac-258b5ce429ab\r\n" "Call-ID:0e3dc2b2-dcc6-1226-26ac-258b5ce429ab\r\n"
"CSeq:32439043 REGISTER\r\n" "CSeq:32439043 REGISTER\r\n"
@@ -488,8 +488,8 @@ int test_digest_client()
"Content-Length:0\r\n" "Content-Length:0\r\n"
"Security-Server:digest\r\n" "Security-Server:digest\r\n"
"r\n"; "r\n";
char request[] = char request[] =
"REGISTER sip:ims3.so.noklab.net " PROTOCOL "\r\n" "REGISTER sip:ims3.so.noklab.net " PROTOCOL "\r\n"
"Via: SIP/2.0/UDP 10.21.36.70:23800;rport;branch=z9hG4bKRE18GFwa3AS\r\n" "Via: SIP/2.0/UDP 10.21.36.70:23800;rport;branch=z9hG4bKRE18GFwa3AS\r\n"
"Max-Forwards: 80\r\n" "Max-Forwards: 80\r\n"
@@ -515,13 +515,13 @@ int test_digest_client()
auth_mod_t *am; auth_mod_t *am;
auth_status_t as[1]; auth_status_t as[1];
sip_www_authenticate_t *au; sip_www_authenticate_t *au;
auth_challenger_t ach[1] = auth_challenger_t ach[1] =
{{ 401, "Authorization required", {{ 401, "Authorization required",
sip_www_authenticate_class, sip_www_authenticate_class,
sip_authentication_info_class sip_authentication_info_class
}}; }};
auth_challenger_t pach[1] = auth_challenger_t pach[1] =
{{ 407, "Proxy Authorization required", {{ 407, "Proxy Authorization required",
sip_proxy_authenticate_class, sip_proxy_authenticate_class,
sip_proxy_authentication_info_class sip_proxy_authentication_info_class
}}; }};
@@ -530,29 +530,29 @@ int test_digest_client()
TEST_1(m1 = read_message(MSG_DO_EXTRACT_COPY, challenge)); TEST_1(m1 = read_message(MSG_DO_EXTRACT_COPY, challenge));
TEST_1(sip = sip_object(m1)); TEST_1(sip = sip_object(m1));
TEST_1(aucs == NULL); TEST_1(aucs == NULL);
TEST(auc_challenge(&aucs, home, sip->sip_www_authenticate, TEST(auc_challenge(&aucs, home, sip->sip_www_authenticate,
sip_authorization_class), 1); sip_authorization_class), 1);
TEST_1(aucs != NULL); TEST_1(aucs != NULL);
msg_destroy(m1); msg_destroy(m1);
TEST(auc_all_credentials(&aucs, "DIGEST", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "DIGEST", "\"ims3.so.noklab.net\"",
"surf3.private@ims3.so.noklab.net", "1234"), 1); "surf3.private@ims3.so.noklab.net", "1234"), 1);
TEST_1(m2 = read_message(MSG_DO_EXTRACT_COPY, request)); TEST_1(m2 = read_message(MSG_DO_EXTRACT_COPY, request));
TEST_1(sip = sip_object(m2)); TEST_1(sip = sip_object(m2));
TEST_P(sip->sip_authorization, NULL); TEST_P(sip->sip_authorization, NULL);
TEST_1(rq = sip->sip_request); TEST_1(rq = sip->sip_request);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
rq->rq_url, sip->sip_payload), 1); rq->rq_url, sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
TEST_S(msg_params_find(sip->sip_authorization->au_params, TEST_S(msg_params_find(sip->sip_authorization->au_params,
"response="), "response="),
"\"860f5ecc9990772e16937750ced9594d\""); "\"860f5ecc9990772e16937750ced9594d\"");
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
TEST_S(msg_params_find(sip->sip_authorization->au_params, TEST_S(msg_params_find(sip->sip_authorization->au_params,
@@ -571,7 +571,7 @@ int test_digest_client()
TEST_1(root = su_root_create(NULL)); TEST_1(root = su_root_create(NULL));
TEST_1(am = auth_mod_create(NULL, TEST_1(am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM("ims3.so.noklab.net"), AUTHTAG_REALM("ims3.so.noklab.net"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
@@ -582,7 +582,7 @@ int test_digest_client()
auth_mod_check_client(am, as, sip->sip_authorization, ach); auth_mod_check_client(am, as, sip->sip_authorization, ach);
TEST(as->as_status, 401); TEST(as->as_status, 401);
TEST_1(au = sip_authorization_make(home, TEST_1(au = sip_authorization_make(home,
"Digest username=\"user1\", " "Digest username=\"user1\", "
"nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", " "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", "
"opaque=\"+GNywA==\", " "opaque=\"+GNywA==\", "
@@ -602,7 +602,7 @@ int test_digest_client()
char const *uri = au->au_params[3]; char const *uri = au->au_params[3];
char const *response = au->au_params[4]; char const *response = au->au_params[4];
char const *realm = au->au_params[5]; char const *realm = au->au_params[5];
TEST_S(username, "username=\"user1\""); TEST_S(username, "username=\"user1\"");
TEST_S(nonce, "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\""); TEST_S(nonce, "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\"");
TEST_S(opaque, "opaque=\"+GNywA==\""); TEST_S(opaque, "opaque=\"+GNywA==\"");
@@ -653,24 +653,24 @@ int test_digest_client()
as->as_response = (msg_header_t *) as->as_response = (msg_header_t *)
sip_www_authenticate_make(as->as_home, "Unknown realm=\"huu haa\""); sip_www_authenticate_make(as->as_home, "Unknown realm=\"huu haa\"");
TEST_1(as->as_response); TEST_1(as->as_response);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
aucs = NULL; aucs = NULL;
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); auth_mod_check_client(am, as, NULL, ach);
TEST(as->as_status, 401); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
reinit_as(as); reinit_as(as);
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -683,7 +683,7 @@ int test_digest_client()
auth_mod_destroy(am); auth_mod_destroy(am);
aucs = NULL; aucs = NULL;
TEST_1(am = auth_mod_create(NULL, TEST_1(am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM("ims3.so.noklab.net"), AUTHTAG_REALM("ims3.so.noklab.net"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
@@ -713,11 +713,11 @@ int test_digest_client()
reinit_as(as); reinit_as(as);
} }
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -750,12 +750,12 @@ int test_digest_client()
TEST(msg_params_remove((msg_param_t *)au->au_params, "opaque"), 1); TEST(msg_params_remove((msg_param_t *)au->au_params, "opaque"), 1);
TEST(auc_challenge(&aucs, home, au, sip_authorization_class), 1); TEST(auc_challenge(&aucs, home, au, sip_authorization_class), 1);
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -774,7 +774,7 @@ int test_digest_client()
{ {
msg_auth_t *au; msg_auth_t *au;
TEST_1(am = auth_mod_create(NULL, TEST_1(am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
AUTHTAG_ALGORITHM("MD5-sess"), AUTHTAG_ALGORITHM("MD5-sess"),
@@ -790,12 +790,12 @@ int test_digest_client()
au = (void *)msg_header_dup(home, as->as_response); TEST_1(au); au = (void *)msg_header_dup(home, as->as_response); TEST_1(au);
TEST(auc_challenge(&aucs, home, au, sip_authorization_class), 1); TEST(auc_challenge(&aucs, home, au, sip_authorization_class), 1);
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -812,7 +812,7 @@ int test_digest_client()
{ {
char const *nonce1, *nextnonce, *nonce2; char const *nonce1, *nextnonce, *nonce2;
TEST_1(am = auth_mod_create(NULL, TEST_1(am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM("ims3.so.noklab.net"), AUTHTAG_REALM("ims3.so.noklab.net"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
@@ -823,21 +823,21 @@ int test_digest_client()
if NEXT_EXPIRES in nonzero */ if NEXT_EXPIRES in nonzero */
AUTHTAG_NEXT_EXPIRES(900), AUTHTAG_NEXT_EXPIRES(900),
TAG_END())); TAG_END()));
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401); auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
TEST_1(nonce1 = msg_header_find_param(sip->sip_authorization->au_common, "nonce")); TEST_1(nonce1 = msg_header_find_param(sip->sip_authorization->au_common, "nonce"));
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, sip->sip_authorization, ach); auth_mod_check_client(am, as, sip->sip_authorization, ach);
TEST(as->as_status, 0); TEST(as->as_status, 0);
@@ -850,8 +850,8 @@ int test_digest_client()
TEST(auc_info(&aucs, (msg_auth_info_t const *)as->as_info, sip_authorization_class), 1); TEST(auc_info(&aucs, (msg_auth_info_t const *)as->as_info, sip_authorization_class), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
TEST_1(nonce2 = msg_header_find_param(sip->sip_authorization->au_common, "nonce")); TEST_1(nonce2 = msg_header_find_param(sip->sip_authorization->au_common, "nonce"));
@@ -867,7 +867,7 @@ int test_digest_client()
auth_mod_destroy(am); aucs = NULL; auth_mod_destroy(am); aucs = NULL;
} }
TEST_1(am = auth_mod_create(NULL, TEST_1(am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM("ims3.so.noklab.net"), AUTHTAG_REALM("ims3.so.noklab.net"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
@@ -878,13 +878,13 @@ int test_digest_client()
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401); auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -893,7 +893,7 @@ int test_digest_client()
TEST(as->as_status, 0); TEST(as->as_status, 0);
auth_mod_destroy(am); aucs = NULL; auth_mod_destroy(am); aucs = NULL;
TEST_1(am = auth_mod_create(NULL, TEST_1(am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM("ims3.so.noklab.net"), AUTHTAG_REALM("ims3.so.noklab.net"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
@@ -907,13 +907,13 @@ int test_digest_client()
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401); auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -924,7 +924,7 @@ int test_digest_client()
au = (void*)msg_header_copy(msg_home(m2), (void*)sip->sip_authorization); au = (void*)msg_header_copy(msg_home(m2), (void*)sip->sip_authorization);
/* Test with invalid qop (bug #2329) */ /* Test with invalid qop (bug #2329) */
msg_params_replace(msg_home(m2), (void *)&au->au_params, msg_params_replace(msg_home(m2), (void *)&au->au_params,
"qop=\"auth,auth-int\""); "qop=\"auth,auth-int\"");
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, au, ach); auth_mod_check_client(am, as, au, ach);
@@ -949,11 +949,11 @@ int test_digest_client()
TEST_1(au = (void *)as->as_response); TEST_1(au->au_params); TEST_1(au = (void *)as->as_response); TEST_1(au->au_params);
TEST_S(msg_params_find(au->au_params, "stale="), "true"); TEST_S(msg_params_find(au->au_params, "stale="), "true");
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="), TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="),
@@ -965,8 +965,8 @@ int test_digest_client()
/* Test nonce count check */ /* Test nonce count check */
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="), TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="),
@@ -983,15 +983,15 @@ int test_digest_client()
/* Test anonymous operation */ /* Test anonymous operation */
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401); auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
reinit_as(as); reinit_as(as);
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"anonymous", ""), 1); "anonymous", ""), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -1000,20 +1000,20 @@ int test_digest_client()
auth_mod_destroy(am); aucs = NULL; auth_mod_destroy(am); aucs = NULL;
/* Test empty realm */ /* Test empty realm */
TEST_1(am = auth_mod_create(root, TEST_1(am = auth_mod_create(root,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM(""), AUTHTAG_REALM(""),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
TAG_END())); TAG_END()));
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401); auth_mod_check_client(am, as, NULL, ach); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
reinit_as(as); reinit_as(as);
TEST(auc_all_credentials(&aucs, "Digest", "\"\"", "user1", "secret"), 1); TEST(auc_all_credentials(&aucs, "Digest", "\"\"", "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -1021,15 +1021,15 @@ int test_digest_client()
auth_mod_check_client(am, as, sip->sip_authorization, ach); auth_mod_check_client(am, as, sip->sip_authorization, ach);
TEST(as->as_status, 0); TEST(as->as_status, 0);
aucs = NULL; aucs = NULL;
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, pach); TEST(as->as_status, 407); auth_mod_check_client(am, as, NULL, pach); TEST(as->as_status, 407);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_proxy_authorization_class), 1); sip_proxy_authorization_class), 1);
reinit_as(as); reinit_as(as);
TEST(auc_credentials(&aucs, as->as_home, "Digest:\"\":user1:secret"), 1); TEST(auc_credentials(&aucs, as->as_home, "Digest:\"\":user1:secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_proxy_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_proxy_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_proxy_authorization); TEST_1(sip->sip_proxy_authorization);
@@ -1040,25 +1040,25 @@ int test_digest_client()
auth_mod_destroy(am); aucs = NULL; auth_mod_destroy(am); aucs = NULL;
/* Test Basic authentication scheme */ /* Test Basic authentication scheme */
TEST_1(am = auth_mod_create(root, TEST_1(am = auth_mod_create(root,
AUTHTAG_METHOD("Basic"), AUTHTAG_METHOD("Basic"),
AUTHTAG_REALM("ims3.so.noklab.net"), AUTHTAG_REALM("ims3.so.noklab.net"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
TAG_END())); TAG_END()));
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); auth_mod_check_client(am, as, NULL, ach);
TEST(as->as_status, 401); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1);
reinit_as(as);
TEST(auc_all_credentials(&aucs, "Basic", "\"ims3.so.noklab.net\"", TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1);
reinit_as(as);
TEST(auc_all_credentials(&aucs, "Basic", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -1067,20 +1067,20 @@ int test_digest_client()
aucs = NULL; aucs = NULL;
reinit_as(as); reinit_as(as);
auth_mod_check_client(am, as, NULL, ach); auth_mod_check_client(am, as, NULL, ach);
TEST(as->as_status, 401); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1);
reinit_as(as);
TEST(auc_all_credentials(&aucs, "Basic", "\"ims3.so.noklab.net\"", TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
"very-long-user-name-that-surely-exceeds-the-static-buffer", sip_authorization_class), 1);
reinit_as(as);
TEST(auc_all_credentials(&aucs, "Basic", "\"ims3.so.noklab.net\"",
"very-long-user-name-that-surely-exceeds-the-static-buffer",
"at-least-when-used-with-the-even-longer-password"), 1); "at-least-when-used-with-the-even-longer-password"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -1091,7 +1091,7 @@ int test_digest_client()
/* Test asynchronous operation */ /* Test asynchronous operation */
aucs = NULL; aucs = NULL;
TEST_1(am = auth_mod_create(root, TEST_1(am = auth_mod_create(root,
AUTHTAG_METHOD("Delayed+Digest"), AUTHTAG_METHOD("Delayed+Digest"),
AUTHTAG_REALM("ims3.so.noklab.net"), AUTHTAG_REALM("ims3.so.noklab.net"),
AUTHTAG_DB(testpasswd), AUTHTAG_DB(testpasswd),
@@ -1107,19 +1107,19 @@ int test_digest_client()
TEST(as->as_status, 100); TEST(as->as_status, 100);
su_root_run(root); su_root_run(root);
TEST(as->as_status, 401); TEST(as->as_status, 401);
TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response,
sip_authorization_class), 1); sip_authorization_class), 1);
reinit_as(as); reinit_as(as);
as->as_callback = test_callback; as->as_callback = test_callback;
as->as_magic = root; as->as_magic = root;
TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
"user1", "secret"), 1); "user1", "secret"), 1);
msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization); msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
(url_t *)"sip:surf3@ims3.so.noklab.net", (url_t *)"sip:surf3@ims3.so.noklab.net",
sip->sip_payload), 1); sip->sip_payload), 1);
TEST_1(sip->sip_authorization); TEST_1(sip->sip_authorization);
@@ -1188,7 +1188,7 @@ int test_module_io()
TEST(close(tmpfd), 0); TEST(close(tmpfd), 0);
/* Test file reading operation */ /* Test file reading operation */
am = auth_mod_create(NULL, am = auth_mod_create(NULL,
AUTHTAG_METHOD("Digest"), AUTHTAG_METHOD("Digest"),
AUTHTAG_REALM("realm"), AUTHTAG_REALM("realm"),
AUTHTAG_DB(tmppasswd), AUTHTAG_DB(tmppasswd),
@@ -1201,7 +1201,7 @@ int test_module_io()
apw = auth_mod_getpass(am, "user2", NULL); TEST_1(apw); apw = auth_mod_getpass(am, "user2", NULL); TEST_1(apw);
TEST_S(apw->apw_hash, "4cbc2aff0b5b2b33675c0731c0db1c14"); TEST_S(apw->apw_hash, "4cbc2aff0b5b2b33675c0731c0db1c14");
apw2 = apw; apw2 = apw;
*am0 = *am; *am0 = *am;
@@ -1312,7 +1312,7 @@ int main(int argc, char *argv[])
if (rest == NULL || *rest) if (rest == NULL || *rest)
usage(1); usage(1);
su_log_set_level(iptsec_log, level); su_log_set_level(iptsec_log, level);
} else { } else {
usage(1); usage(1);

View File

@@ -6,7 +6,7 @@
* Renamed msg_test.c as test_msg.c. * Renamed msg_test.c as test_msg.c.
* Renamed msg_test_class.[hc] as test_class.[hc], * Renamed msg_test_class.[hc] as test_class.[hc],
msg_test_protos.h(.in) as test_protos.h(.in), msg_test_protos.h(.in) as test_protos.h(.in),
msg_test_table.c(.in) as test_table.c(.in). msg_test_table.c(.in) as test_table.c(.in).
@@ -40,14 +40,14 @@
* msg_parser.c: Using header-specific flags to classify parsing * msg_parser.c: Using header-specific flags to classify parsing
errors with msg_extract_errors(). errors with msg_extract_errors().
Added support for apndlist headers. Added support for apndlist headers.
* msg_header.h: Added support for apndlist headers. * msg_header.h: Added support for apndlist headers.
* msg_mime.c: Various Accept* headers are now apndlist meaning * msg_mime.c: Various Accept* headers are now apndlist meaning
that they are printed on single line by default. that they are printed on single line by default.
2005-07-18 Kai Vehmanen <kai.vehmanen@nokia.com> 2005-07-18 Kai Vehmanen <kai.vehmanen@nokia.com>
* Initial import of the module to Sofia-SIP tree. * Initial import of the module to Sofia-SIP tree.

View File

@@ -33,7 +33,7 @@ PUBLIC_H = sofia-sip/msg.h sofia-sip/msg_header.h \
INTERNAL_H = msg_internal.h test_class.h INTERNAL_H = msg_internal.h test_class.h
nobase_include_sofia_HEADERS = \ nobase_include_sofia_HEADERS = \
$(GENERATED_H) $(PUBLIC_H) $(GENERATED_H) $(PUBLIC_H)
GENERATED_HC = $(GENERATED_H) msg_mime_table.c test_table.c test_protos.h GENERATED_HC = $(GENERATED_H) msg_mime_table.c test_table.c test_protos.h
@@ -55,7 +55,7 @@ LDADD = libtest_msg.a libmsg.la \
../bnf/libbnf.la \ ../bnf/libbnf.la \
../url/liburl.la \ ../url/liburl.la \
../ipt/libipt.la \ ../ipt/libipt.la \
../su/libsu.la ../su/libsu.la
test_msg_LDFLAGS = -static test_msg_LDFLAGS = -static

View File

@@ -95,7 +95,7 @@ msg_t *msg_create(msg_mclass_t const *mc, int flags)
* destroyed. * destroyed.
* *
* @param msg message of which a reference is created * @param msg message of which a reference is created
* *
* @return * @return
* A pointer to a message. * A pointer to a message.
*/ */
@@ -137,7 +137,7 @@ void msg_set_parent(msg_t *kid, msg_t *dad)
* @relatesalso msg_s * @relatesalso msg_s
* *
* @param ref pointer to msg object * @param ref pointer to msg object
* *
* @deprecated Use msg_destroy() instead. * @deprecated Use msg_destroy() instead.
*/ */
void msg_ref_destroy(msg_t *ref) void msg_ref_destroy(msg_t *ref)
@@ -154,7 +154,7 @@ void msg_ref_destroy(msg_t *ref)
void msg_destroy(msg_t *msg) void msg_destroy(msg_t *msg)
{ {
msg_t *parent; msg_t *parent;
for (; msg; msg = parent) { for (; msg; msg = parent) {
int refs; int refs;
su_home_mutex_lock(msg->m_home); su_home_mutex_lock(msg->m_home);
@@ -174,9 +174,9 @@ void msg_destroy(msg_t *msg)
/**Retrieve public message structure. /**Retrieve public message structure.
* *
* Get a pointer to the public message structure. * Get a pointer to the public message structure.
* *
* @param msg pointer to msg object * @param msg pointer to msg object
* *
* @returns * @returns
* A pointer to the public message structure, or NULL if none. * A pointer to the public message structure, or NULL if none.
*/ */
@@ -194,10 +194,10 @@ msg_pub_t *msg_object(msg_t const *msg)
* *
* Get a pointer to the public message structure of the * Get a pointer to the public message structure of the
* given protocol. * given protocol.
* *
* @param msg pointer to msg object * @param msg pointer to msg object
* @param tag tag of public message structure * @param tag tag of public message structure
* *
* @returns * @returns
* A pointer to the public message structure, or NULL if there is none or * A pointer to the public message structure, or NULL if there is none or
* the message is not for desired protocol. * the message is not for desired protocol.
@@ -216,9 +216,9 @@ msg_pub_t *msg_public(msg_t const *msg, void *tag)
* *
* Get a pointer to the message class object * Get a pointer to the message class object
* (factory object for the message). * (factory object for the message).
* *
* @param msg pointer to msg object * @param msg pointer to msg object
* *
* @returns * @returns
* A pointer to the message class, or NULL if none. * A pointer to the message class, or NULL if none.
*/ */
@@ -239,7 +239,7 @@ msg_mclass_t const *msg_mclass(msg_t const *msg)
* Zero the address and addressinfo structures associated with the message. * Zero the address and addressinfo structures associated with the message.
* *
* @sa msg_addrinfo(), msg_set_address(), msg_get_address(), msg_addr_copy(). * @sa msg_addrinfo(), msg_set_address(), msg_get_address(), msg_addr_copy().
*/ */
void msg_addr_zero(msg_t *msg) void msg_addr_zero(msg_t *msg)
{ {
memset(&msg->m_addr, 0, sizeof(&msg->m_addr)); memset(&msg->m_addr, 0, sizeof(&msg->m_addr));
@@ -249,7 +249,7 @@ void msg_addr_zero(msg_t *msg)
msg->m_addrinfo.ai_addr = &msg->m_addr->su_sa; msg->m_addrinfo.ai_addr = &msg->m_addr->su_sa;
} }
/** Get pointer to socket address structure. /** Get pointer to socket address structure.
* *
* @relatesalso msg_s * @relatesalso msg_s
* *
@@ -269,7 +269,7 @@ su_sockaddr_t *msg_addr(msg_t *msg)
* *
* @param msg pointer to msg object * @param msg pointer to msg object
* @param su pointer to socket address structure * @param su pointer to socket address structure
* @param return_len return parameter value for length * @param return_len return parameter value for length
* of socket address structure * of socket address structure
* *
* @sa msg_addrinfo(), msg_set_address(), msg_addr_zero(), msg_addr_copy(). * @sa msg_addrinfo(), msg_set_address(), msg_addr_zero(), msg_addr_copy().
@@ -287,13 +287,13 @@ int msg_get_address(msg_t *msg, su_sockaddr_t *su, socklen_t *return_len)
return -1; return -1;
} }
/** Set message address. /** Set message address.
* *
* @relatesalso msg_s * @relatesalso msg_s
* *
* Copy the supplied socket address to the socket address structure * Copy the supplied socket address to the socket address structure
* associated with the message. * associated with the message.
* *
* @param msg pointer to msg object * @param msg pointer to msg object
* @param su pointer to socket address structure * @param su pointer to socket address structure
* @param sulen length of socket address structure * @param sulen length of socket address structure
@@ -337,7 +337,7 @@ su_addrinfo_t *msg_addrinfo(msg_t *msg)
* Copy the addrinfo and socket address structures from @a src to the @a dst * Copy the addrinfo and socket address structures from @a src to the @a dst
* message object. * message object.
* *
* @param dst pointer to destination message object * @param dst pointer to destination message object
* @param src pointer to source message object * @param src pointer to source message object
* *
* @sa msg_addrinfo(), msg_get_address(), msg_set_address(), msg_addr_zero(). * @sa msg_addrinfo(), msg_get_address(), msg_set_address(), msg_addr_zero().
@@ -347,10 +347,10 @@ void msg_addr_copy(msg_t *dst, msg_t const *src)
dst->m_addrinfo = src->m_addrinfo; dst->m_addrinfo = src->m_addrinfo;
dst->m_addrinfo.ai_next = NULL; dst->m_addrinfo.ai_next = NULL;
dst->m_addrinfo.ai_canonname = NULL; dst->m_addrinfo.ai_canonname = NULL;
memcpy(dst->m_addrinfo.ai_addr = &dst->m_addr->su_sa, memcpy(dst->m_addrinfo.ai_addr = &dst->m_addr->su_sa,
src->m_addr, src->m_addrinfo.ai_addrlen); src->m_addr, src->m_addrinfo.ai_addrlen);
if (dst->m_addrinfo.ai_addrlen < sizeof(dst->m_addr)) if (dst->m_addrinfo.ai_addrlen < sizeof(dst->m_addr))
memset((char *)dst->m_addr + dst->m_addrinfo.ai_addrlen, 0, memset((char *)dst->m_addr + dst->m_addrinfo.ai_addrlen, 0,
sizeof(dst->m_addr) - dst->m_addrinfo.ai_addrlen); sizeof(dst->m_addr) - dst->m_addrinfo.ai_addrlen);
} }
@@ -361,9 +361,9 @@ void msg_addr_copy(msg_t *dst, msg_t const *src)
* *
* If the message parser fails to parse certain headers in the message, it * If the message parser fails to parse certain headers in the message, it
* sets the corresponding extract error flags. The flags corresponding to * sets the corresponding extract error flags. The flags corresponding to
* each header are stored in the message parser (msg_mclass_t) structure. * each header are stored in the message parser (msg_mclass_t) structure.
* They are set when the header is added to the parser table. * They are set when the header is added to the parser table.
* *
* The SIP flags are defined in <sofia-sip/sip_headers.h>. For well-known * The SIP flags are defined in <sofia-sip/sip_headers.h>. For well-known
* SIP headers, the flags for each header are listed in a separate text file * SIP headers, the flags for each header are listed in a separate text file
* (sip_bad_mask) read by msg_parser.awk. * (sip_bad_mask) read by msg_parser.awk.

View File

@@ -38,9 +38,9 @@ contains description of the functionality required when an existing parser
is extended by a new header or a parser is created for a completely new is extended by a new header or a parser is created for a completely new
protocol. It is possible to add new headers to the parser or extend the protocol. It is possible to add new headers to the parser or extend the
definition of existing ones. The header files used for constructing these definition of existing ones. The header files used for constructing these
parsers are as follows: parsers are as follows:
- <sofia-sip/msg_parser.h> parsing functions, macros - <sofia-sip/msg_parser.h> parsing functions, macros
- <sofia-sip/msg_mclass.h> message factory object definition - <sofia-sip/msg_mclass.h> message factory object definition
- <sofia-sip/msg_mclass_hash.h> hashing of header names - <sofia-sip/msg_mclass_hash.h> hashing of header names
@section msg_overview Parsers, Messages and Headers @section msg_overview Parsers, Messages and Headers
@@ -54,7 +54,7 @@ The C structure corresponding to each header is defined either in a
protocol-specific header files include <sofia-sip/sip.h>, <sofia-sip/http.h>, and protocol-specific header files include <sofia-sip/sip.h>, <sofia-sip/http.h>, and
<sofia-sip/msg_mime.h>. For each header, there is defined a @em header @em class <sofia-sip/msg_mime.h>. For each header, there is defined a @em header @em class
structure, some standard functions, and tags for including them in tag structure, some standard functions, and tags for including them in tag
lists. lists.
As a convention, all the identifiers for SIP headers start with prefix @c As a convention, all the identifiers for SIP headers start with prefix @c
sip and all the macros with @c SIP. Same thing holds for HTTP, too: it sip and all the macros with @c SIP. Same thing holds for HTTP, too: it
@@ -73,18 +73,18 @@ For header @e X of protocol @e NS, there are types, functions, macros and
header class as follows: header class as follows:
- @c ns_X_t is the structure used to store parsed header, - @c ns_X_t is the structure used to store parsed header,
- @c ns_hclass_t @c ns_X_class[] contains the @em header @em class - @c ns_hclass_t @c ns_X_class[] contains the @em header @em class
for header X, for header X,
- @c NS_X_INIT() initializes a static instance of @c ns_X_t, - @c NS_X_INIT() initializes a static instance of @c ns_X_t,
- @c ns_X_init() initializes a dynamic instance of @c ns_X_t, - @c ns_X_init() initializes a dynamic instance of @c ns_X_t,
- @c ns_is_X() tests if header object is instance of header X, - @c ns_is_X() tests if header object is instance of header X,
- @c ns_X_make() creates a header X object by decoding given string, - @c ns_X_make() creates a header X object by decoding given string,
- @c ns_X_format() creates a header X object by decoding given - @c ns_X_format() creates a header X object by decoding given
@c printf() list, @c printf() list,
- @c ns_X_dup() duplicates (deeply copies) the header X, - @c ns_X_dup() duplicates (deeply copies) the header X,
- @c ns_X_copy() copies the header X, - @c ns_X_copy() copies the header X,
- @c NSTAG_X() is used include instance of @c ns_X_t in a tag list, and - @c NSTAG_X() is used include instance of @c ns_X_t in a tag list, and
- @c NSTAG_X_STR() is used to include string containing value header - @c NSTAG_X_STR() is used to include string containing value header
in a tag list. in a tag list.
The declarations of header tags and the prototypes for these functions can The declarations of header tags and the prototypes for these functions can
@@ -111,7 +111,7 @@ header. As there is no low-layer framing between the RFC822-style messages,
the parser considers any received data, be it a UDP datagram or a TCP the parser considers any received data, be it a UDP datagram or a TCP
stream, as a @em byte @em stream. The protocol-specific parsers controls how stream, as a @em byte @em stream. The protocol-specific parsers controls how
a byte stream is split into separate messages or if it consists of a single a byte stream is split into separate messages or if it consists of a single
message only. message only.
The parser engine works by separating stream into fragments, then passing The parser engine works by separating stream into fragments, then passing
the fragment to a suitable parser. A fragment is a piece of message that is the fragment to a suitable parser. A fragment is a piece of message that is
@@ -120,7 +120,7 @@ between headers and message body, the message body. (In case of HTTP, the
message body can consists of multiple fragments known as chunks.) message body can consists of multiple fragments known as chunks.)
The parser starts by separating the first line (e.g., request or status The parser starts by separating the first line (e.g., request or status
line) from the byte stream, then passing the line to the suitable parser. line) from the byte stream, then passing the line to the suitable parser.
After first line comes the message headers. The parser continues parsing After first line comes the message headers. The parser continues parsing
process by extracting headers, each on their own line, from the stream and process by extracting headers, each on their own line, from the stream and
passing contents of each header to its parser. The message structure is passing contents of each header to its parser. The message structure is
@@ -195,7 +195,7 @@ typedef struct msg_accept_s
char const *ac_subtype; //< Points after first slash in type char const *ac_subtype; //< Points after first slash in type
msg_param_t const *ac_params; //< List of parameters msg_param_t const *ac_params; //< List of parameters
msg_param_t ac_q; //< Value of q parameter msg_param_t ac_q; //< Value of q parameter
} }
msg_accept_t; msg_accept_t;
@endcode @endcode
@@ -205,8 +205,8 @@ list of @e accept-params (together with media-specific-parameters) is put in
the @c ac_params array. If there is a @e q parameter present, a pointer to the @c ac_params array. If there is a @e q parameter present, a pointer to
the @c qvalue is assigned to @c ac_q field. the @c qvalue is assigned to @c ac_q field.
In the beginning of the header structure there are two boilerplate members. In the beginning of the header structure there are two boilerplate members.
The @c ac_common[1] contains information common to all message fragments. The @c ac_common[1] contains information common to all message fragments.
The @c ac_next is a pointer to next header field with the same name, in case The @c ac_next is a pointer to next header field with the same name, in case
a message contains multiple @b Accept headers or multiple comma-separated a message contains multiple @b Accept headers or multiple comma-separated
header fields are located in a single line. header fields are located in a single line.
@@ -217,7 +217,7 @@ It is not enough to represent a message as a list of headers following each
other. The programmer also needs a convenient way to access certain headers other. The programmer also needs a convenient way to access certain headers
at the message level, for example, accessing directly the @b Accept header at the message level, for example, accessing directly the @b Accept header
instead of going through all headers and examining their name. The instead of going through all headers and examining their name. The
structured view to the message is provided via a message-specific C struct. structured view to the message is provided via a message-specific C struct.
In general, its type is msg_pub_t (it provides public view to message). The In general, its type is msg_pub_t (it provides public view to message). The
protocol-specific type is #sip_t, #http_t or #msg_multipart_t for protocol-specific type is #sip_t, #http_t or #msg_multipart_t for
SIP, HTTP and MIME, respectively. SIP, HTTP and MIME, respectively.
@@ -283,7 +283,7 @@ CSeq: 2
The figure below shows the layout of the BYE message above after parsing: The figure below shows the layout of the BYE message above after parsing:
@image html sip-parser2.gif BYE message and its representation in C @image html sip-parser2.gif BYE message and its representation in C
@image latex sip-parser2.eps BYE message and its representation in C @image latex sip-parser2.eps BYE message and its representation in C
The leftmost box represents the message of type #msg_t. Next box from The leftmost box represents the message of type #msg_t. Next box from
@@ -446,7 +446,7 @@ encountered.
/**@typedef typedef struct msg_s msg_t; /**@typedef typedef struct msg_s msg_t;
* *
* Message object. * Message object.
* *
* The @a msg_t is the type of a message object used by Sofia signaling * The @a msg_t is the type of a message object used by Sofia signaling
* protocols and parsers. Its contents are not directly accessible. * protocols and parsers. Its contents are not directly accessible.
@@ -454,7 +454,7 @@ encountered.
/**@typedef typedef struct msg_common_s msg_common_t; /**@typedef typedef struct msg_common_s msg_common_t;
* *
* Common part of header. * Common part of header.
* *
* The @a msg_common_t is the base type of a message headers used by * The @a msg_common_t is the base type of a message headers used by
* protocol parsers. Instead of #msg_common_t, most interfaces use * protocol parsers. Instead of #msg_common_t, most interfaces use

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