]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
merge whitespace fixes from sofia-sip tree
authorMichael Jerris <mike@jerris.com>
Tue, 16 Dec 2008 18:05:22 +0000 (18:05 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 16 Dec 2008 18:05:22 +0000 (18:05 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10802 d0543943-73ff-0310-b7d9-9358b9ac24b2

489 files changed:
libs/sofia-sip/AUTHORS
libs/sofia-sip/COPYING
libs/sofia-sip/COPYRIGHTS
libs/sofia-sip/ChangeLog
libs/sofia-sip/ChangeLog.ext-trees
libs/sofia-sip/Makefile.am
libs/sofia-sip/README
libs/sofia-sip/README.developers
libs/sofia-sip/RELEASE
libs/sofia-sip/RELEASE.template
libs/sofia-sip/TODO
libs/sofia-sip/autogen.sh
libs/sofia-sip/configure.ac
libs/sofia-sip/docs/build_system.txt
libs/sofia-sip/docs/devel_platform_notes.txt
libs/sofia-sip/docs/release_management.txt
libs/sofia-sip/libsofia-sip-ua-glib/Makefile.am
libs/sofia-sip/libsofia-sip-ua-glib/su-glib/sofia-sip/su_glib.h
libs/sofia-sip/libsofia-sip-ua-glib/su-glib/sofia-sip/su_source.h
libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_glib.docs
libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c
libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source_test.c
libs/sofia-sip/libsofia-sip-ua-glib/su-glib/torture_su_glib_timer.c
libs/sofia-sip/libsofia-sip-ua/ChangeLog
libs/sofia-sip/libsofia-sip-ua/Makefile.am
libs/sofia-sip/libsofia-sip-ua/bnf/bnf.c
libs/sofia-sip/libsofia-sip-ua/bnf/bnf.docs
libs/sofia-sip/libsofia-sip-ua/bnf/sofia-sip/bnf.h
libs/sofia-sip/libsofia-sip-ua/bnf/sofia-sip/hostdomain.h
libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c
libs/sofia-sip/libsofia-sip-ua/docs/ChangeLog
libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.conf
libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/docs/Makefile.am
libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs
libs/sofia-sip/libsofia-sip-ua/docs/docguide.docs
libs/sofia-sip/libsofia-sip-ua/docs/mainpage.docs
libs/sofia-sip/libsofia-sip-ua/features/features.c
libs/sofia-sip/libsofia-sip-ua/features/features.docs
libs/sofia-sip/libsofia-sip-ua/http/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/http/Makefile.am
libs/sofia-sip/libsofia-sip-ua/http/http.docs
libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
libs/sofia-sip/libsofia-sip-ua/http/http_extra.c
libs/sofia-sip/libsofia-sip-ua/http/http_header.c
libs/sofia-sip/libsofia-sip-ua/http/http_parser.c
libs/sofia-sip/libsofia-sip-ua/http/http_parser_table.c.in
libs/sofia-sip/libsofia-sip-ua/http/http_status.c
libs/sofia-sip/libsofia-sip-ua/http/http_tag.c.in
libs/sofia-sip/libsofia-sip-ua/http/http_tag_class.c
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http.h
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_hclasses.h
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_header.h
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_parser.h
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_protos.h.in
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_status.h
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in
libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag_class.h
libs/sofia-sip/libsofia-sip-ua/http/test_http.c
libs/sofia-sip/libsofia-sip-ua/ipt/base64.c
libs/sofia-sip/libsofia-sip-ua/ipt/ipt.docs
libs/sofia-sip/libsofia-sip-ua/ipt/rc4.c
libs/sofia-sip/libsofia-sip-ua/ipt/sofia-sip/base64.h
libs/sofia-sip/libsofia-sip-ua/ipt/sofia-sip/rc4.h
libs/sofia-sip/libsofia-sip-ua/ipt/sofia-sip/uniqueid.h
libs/sofia-sip/libsofia-sip-ua/ipt/sofia-sip/utf8.h
libs/sofia-sip/libsofia-sip-ua/ipt/token64.c
libs/sofia-sip/libsofia-sip-ua/ipt/ucs2.c
libs/sofia-sip/libsofia-sip-ua/ipt/ucs4.c
libs/sofia-sip/libsofia-sip-ua/ipt/utf8.c
libs/sofia-sip/libsofia-sip-ua/ipt/utf8internal.h
libs/sofia-sip/libsofia-sip-ua/ipt/utf8test.c
libs/sofia-sip/libsofia-sip-ua/iptsec/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_digest.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module_http.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module_sip.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_delayed.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c
libs/sofia-sip/libsofia-sip-ua/iptsec/auth_tag.c
libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec.docs
libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec_debug.c
libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec_debug.h
libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client.h
libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h
libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_common.h
libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h
libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h
libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_ntlm.h
libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_plugin.h
libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c
libs/sofia-sip/libsofia-sip-ua/msg/ChangeLog
libs/sofia-sip/libsofia-sip-ua/msg/Makefile.am
libs/sofia-sip/libsofia-sip-ua/msg/msg.c
libs/sofia-sip/libsofia-sip-ua/msg/msg.docs
libs/sofia-sip/libsofia-sip-ua/msg/msg_auth.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_generic.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_header_copy.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_header_make.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h
libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_mime_table.c.in
libs/sofia-sip/libsofia-sip-ua/msg/msg_name_hash.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.awk
libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c
libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_addr.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_buffer.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_date.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mclass.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mclass_hash.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_parser.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_tag_class.h
libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_types.h
libs/sofia-sip/libsofia-sip-ua/msg/test_class.c
libs/sofia-sip/libsofia-sip-ua/msg/test_class.h
libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c
libs/sofia-sip/libsofia-sip-ua/msg/test_protos.h.in
libs/sofia-sip/libsofia-sip-ua/msg/test_table.c.in
libs/sofia-sip/libsofia-sip-ua/nea/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/nea/Makefile.am
libs/sofia-sip/libsofia-sip-ua/nea/nea.c
libs/sofia-sip/libsofia-sip-ua/nea/nea.docs
libs/sofia-sip/libsofia-sip-ua/nea/nea_debug.c
libs/sofia-sip/libsofia-sip-ua/nea/nea_event.c
libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c
libs/sofia-sip/libsofia-sip-ua/nea/sofia-sip/nea.h
libs/sofia-sip/libsofia-sip-ua/nta/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/nta/Makefile.am
libs/sofia-sip/libsofia-sip-ua/nta/invite.msc
libs/sofia-sip/libsofia-sip-ua/nta/nta.c
libs/sofia-sip/libsofia-sip-ua/nta/nta.docs
libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c
libs/sofia-sip/libsofia-sip-ua/nta/portbind.c
libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta
libs/sofia-sip/libsofia-sip-ua/nta/sl_read_payload.c
libs/sofia-sip/libsofia-sip-ua/nta/sl_utils.docs
libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c
libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c
libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta.h
libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_stateless.h
libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tport.h
libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h
libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c
libs/sofia-sip/libsofia-sip-ua/nth/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/nth/http-client.c
libs/sofia-sip/libsofia-sip-ua/nth/nth.docs
libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c
libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c
libs/sofia-sip/libsofia-sip-ua/nth/nth_tag.c
libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth.h
libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h
libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
libs/sofia-sip/libsofia-sip-ua/nua/ChangeLog
libs/sofia-sip/libsofia-sip-ua/nua/nua.c
libs/sofia-sip/libsofia-sip-ua/nua/nua.docs
libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_types.h
libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
libs/sofia-sip/libsofia-sip-ua/nua/outbound.h
libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua.h
libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
libs/sofia-sip/libsofia-sip-ua/sdp/ChangeLog
libs/sofia-sip/libsofia-sip-ua/sdp/errata
libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp
libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c
libs/sofia-sip/libsofia-sip-ua/sdp/sdp.docs
libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c
libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
libs/sofia-sip/libsofia-sip-ua/sdp/sdp_tag.c
libs/sofia-sip/libsofia-sip-ua/sdp/sofia-sip/sdp.h
libs/sofia-sip/libsofia-sip-ua/sdp/sofia-sip/sdp_tag.h
libs/sofia-sip/libsofia-sip-ua/sdp/test_sdp.c
libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c
libs/sofia-sip/libsofia-sip-ua/sip/ADD-A-HEADER
libs/sofia-sip/libsofia-sip-ua/sip/ChangeLog
libs/sofia-sip/libsofia-sip-ua/sip/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/sip/GRAMMAR
libs/sofia-sip/libsofia-sip-ua/sip/run-tests
libs/sofia-sip/libsofia-sip-ua/sip/run_test_sip_msg
libs/sofia-sip/libsofia-sip-ua/sip/sip.docs
libs/sofia-sip/libsofia-sip-ua/sip/sip.doxyaliases
libs/sofia-sip/libsofia-sip-ua/sip/sip_bad_mask
libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_extra_headers.txt
libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_header.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_mime.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.docs
libs/sofia-sip/libsofia-sip-ua/sip/sip_parser_table.c.in
libs/sofia-sip/libsofia-sip-ua/sip/sip_prack.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_status.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_tag.c.in
libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_time.c
libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_hclasses.h.in
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_status.h
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag_class.h
libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_util.h
libs/sofia-sip/libsofia-sip-ua/sip/test_date.c
libs/sofia-sip/libsofia-sip-ua/sip/test_sip_msg.c
libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
libs/sofia-sip/libsofia-sip-ua/sip/validator.c
libs/sofia-sip/libsofia-sip-ua/soa/ChangeLog
libs/sofia-sip/libsofia-sip-ua/soa/Doxyfile.in
libs/sofia-sip/libsofia-sip-ua/soa/Makefile.am
libs/sofia-sip/libsofia-sip-ua/soa/soa.c
libs/sofia-sip/libsofia-sip-ua/soa/soa.docs
libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c
libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa.h
libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h
libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c
libs/sofia-sip/libsofia-sip-ua/sresolv/127.zone
libs/sofia-sip/libsofia-sip-ua/sresolv/194.2.188
libs/sofia-sip/libsofia-sip-ua/sresolv/3.f.f.e.1.2.0.0.3.0.1.2.c.0.0.0
libs/sofia-sip/libsofia-sip-ua/sresolv/3.f.f.e.1.2.0.0.3.0.1.2.c.0.0.0.arpa
libs/sofia-sip/libsofia-sip-ua/sresolv/Makefile.am
libs/sofia-sip/libsofia-sip-ua/sresolv/example.com
libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c
libs/sofia-sip/libsofia-sip-ua/sresolv/root.zone
libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_async.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_cache.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_config.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-sip/sresolv.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c
libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c
libs/sofia-sip/libsofia-sip-ua/sresolv/sresolv.c
libs/sofia-sip/libsofia-sip-ua/sresolv/sresolv.docs
libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c
libs/sofia-sip/libsofia-sip-ua/sresolv/torture_sresolv.c
libs/sofia-sip/libsofia-sip-ua/stun/ChangeLog
libs/sofia-sip/libsofia-sip-ua/stun/lookup_stun_server.c
libs/sofia-sip/libsofia-sip-ua/stun/sofia-sip/stun.h
libs/sofia-sip/libsofia-sip-ua/stun/sofia-sip/stun_common.h
libs/sofia-sip/libsofia-sip-ua/stun/stun.c
libs/sofia-sip/libsofia-sip-ua/stun/stun_common.c
libs/sofia-sip/libsofia-sip-ua/stun/stun_dns.c
libs/sofia-sip/libsofia-sip-ua/stun/stun_internal.h
libs/sofia-sip/libsofia-sip-ua/stun/stun_mini.c
libs/sofia-sip/libsofia-sip-ua/stun/stun_tag.c
libs/sofia-sip/libsofia-sip-ua/stun/stunc.c
libs/sofia-sip/libsofia-sip-ua/su/ChangeLog
libs/sofia-sip/libsofia-sip-ua/su/Makefile.am
libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c
libs/sofia-sip/libsofia-sip-ua/su/foo.c
libs/sofia-sip/libsofia-sip-ua/su/getopt.c
libs/sofia-sip/libsofia-sip-ua/su/localinfo.c
libs/sofia-sip/libsofia-sip-ua/su/memccpy.c
libs/sofia-sip/libsofia-sip-ua/su/memcspn.c
libs/sofia-sip/libsofia-sip-ua/su/memmem.c
libs/sofia-sip/libsofia-sip-ua/su/memspn.c
libs/sofia-sip/libsofia-sip-ua/su/poll.c
libs/sofia-sip/libsofia-sip-ua/su/smoothsort.c
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/heap.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable2.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/rbtree.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_addrinfo.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc_stat.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_bm.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_debug.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_localinfo.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_log.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_md5.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_os_nw.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_osx_runloop.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_strlst.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_class.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_inline.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tagarg.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_time.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_types.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_uniqueid.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_vector.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/tstdef.h
libs/sofia-sip/libsofia-sip-ua/su/strcasestr.c
libs/sofia-sip/libsofia-sip-ua/su/strtoull.c
libs/sofia-sip/libsofia-sip-ua/su/su.c
libs/sofia-sip/libsofia-sip-ua/su/su.docs
libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c
libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
libs/sofia-sip/libsofia-sip-ua/su/su_alloc_lock.c
libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_bm.c
libs/sofia-sip/libsofia-sip-ua/su/su_default_log.c
libs/sofia-sip/libsofia-sip-ua/su/su_devpoll_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_epoll_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_errno.c
libs/sofia-sip/libsofia-sip-ua/su/su_global_log.c
libs/sofia-sip/libsofia-sip-ua/su/su_kqueue_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
libs/sofia-sip/libsofia-sip-ua/su/su_log.c
libs/sofia-sip/libsofia-sip-ua/su/su_md5.c
libs/sofia-sip/libsofia-sip-ua/su/su_module_debug.h
libs/sofia-sip/libsofia-sip-ua/su/su_open_c_localinfo.cpp
libs/sofia-sip/libsofia-sip-ua/su/su_os_nw.c
libs/sofia-sip/libsofia-sip-ua/su/su_osx_runloop.c
libs/sofia-sip/libsofia-sip-ua/su/su_perf.c
libs/sofia-sip/libsofia-sip-ua/su/su_poll_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_port.h
libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c
libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_root.c
libs/sofia-sip/libsofia-sip-ua/su/su_select_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_socket_port.c
libs/sofia-sip/libsofia-sip-ua/su/su_sprintf.c
libs/sofia-sip/libsofia-sip-ua/su/su_strdup.c
libs/sofia-sip/libsofia-sip-ua/su/su_strlst.c
libs/sofia-sip/libsofia-sip-ua/su/su_tag.c
libs/sofia-sip/libsofia-sip-ua/su/su_tag_io.c
libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c
libs/sofia-sip/libsofia-sip-ua/su/su_time.c
libs/sofia-sip/libsofia-sip-ua/su/su_time0.c
libs/sofia-sip/libsofia-sip-ua/su/su_timer.c
libs/sofia-sip/libsofia-sip-ua/su/su_uniqueid.c
libs/sofia-sip/libsofia-sip-ua/su/su_vector.c
libs/sofia-sip/libsofia-sip-ua/su/su_wait.c
libs/sofia-sip/libsofia-sip-ua/su/su_win32_port.c
libs/sofia-sip/libsofia-sip-ua/su/tag_dll.awk
libs/sofia-sip/libsofia-sip-ua/su/test_htable.c
libs/sofia-sip/libsofia-sip-ua/su/test_htable2.c
libs/sofia-sip/libsofia-sip-ua/su/test_memmem.c
libs/sofia-sip/libsofia-sip-ua/su/test_poll.c
libs/sofia-sip/libsofia-sip-ua/su/test_su.c
libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c
libs/sofia-sip/libsofia-sip-ua/su/torture_heap.c
libs/sofia-sip/libsofia-sip-ua/su/torture_rbtree.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_bm.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_port.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_tag.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_time.c
libs/sofia-sip/libsofia-sip-ua/su/torture_su_timer.c
libs/sofia-sip/libsofia-sip-ua/tport/ChangeLog
libs/sofia-sip/libsofia-sip-ua/tport/Makefile.am
libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h
libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_plugins.h
libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c
libs/sofia-sip/libsofia-sip-ua/tport/tls_test_client.c
libs/sofia-sip/libsofia-sip-ua/tport/tls_test_server.c
libs/sofia-sip/libsofia-sip-ua/tport/tport.c
libs/sofia-sip/libsofia-sip-ua/tport/tport.docs
libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h
libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_stun.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_threadpool.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_connect.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_sctp.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c
libs/sofia-sip/libsofia-sip-ua/url/sofia-sip/url.h
libs/sofia-sip/libsofia-sip-ua/url/sofia-sip/url_tag.h
libs/sofia-sip/libsofia-sip-ua/url/sofia-sip/url_tag_class.h
libs/sofia-sip/libsofia-sip-ua/url/torture_url.c
libs/sofia-sip/libsofia-sip-ua/url/url.c
libs/sofia-sip/libsofia-sip-ua/url/url.docs
libs/sofia-sip/libsofia-sip-ua/url/url_tag.c
libs/sofia-sip/libsofia-sip-ua/url/urlmap.c
libs/sofia-sip/libsofia-sip-ua/url/urlmap.h
libs/sofia-sip/m4/sac-coverage.m4
libs/sofia-sip/m4/sac-general.m4
libs/sofia-sip/m4/sac-openssl.m4
libs/sofia-sip/m4/sac-su2.m4
libs/sofia-sip/m4/sac-tport.m4
libs/sofia-sip/open_c/build_sources.cmd
libs/sofia-sip/open_c/version.awk
libs/sofia-sip/packages/ChangeLog
libs/sofia-sip/packages/Makefile.am
libs/sofia-sip/packages/sofia-sip.spec.in
libs/sofia-sip/rules/lcov.am
libs/sofia-sip/rules/recursive.am
libs/sofia-sip/rules/valcheck.am
libs/sofia-sip/scripts/coverage
libs/sofia-sip/scripts/fix-include-sofia-sip
libs/sofia-sip/scripts/hide_emails.sh
libs/sofia-sip/scripts/lcov-report
libs/sofia-sip/scripts/rpmbuild-snaphot
libs/sofia-sip/scripts/uncovered
libs/sofia-sip/tests/check_sofia.c
libs/sofia-sip/tests/test_100rel.c
libs/sofia-sip/tests/test_basic_call.c
libs/sofia-sip/tests/test_call_hold.c
libs/sofia-sip/tests/test_call_reject.c
libs/sofia-sip/tests/test_cancel_bye.c
libs/sofia-sip/tests/test_extension.c
libs/sofia-sip/tests/test_init.c
libs/sofia-sip/tests/test_nat.c
libs/sofia-sip/tests/test_nat.h
libs/sofia-sip/tests/test_nua.c
libs/sofia-sip/tests/test_nua.h
libs/sofia-sip/tests/test_nua_api.c
libs/sofia-sip/tests/test_nua_params.c
libs/sofia-sip/tests/test_offer_answer.c
libs/sofia-sip/tests/test_ops.c
libs/sofia-sip/tests/test_proxy.c
libs/sofia-sip/tests/test_proxy.h
libs/sofia-sip/tests/test_refer.c
libs/sofia-sip/tests/test_register.c
libs/sofia-sip/tests/test_session_timer.c
libs/sofia-sip/tests/test_simple.c
libs/sofia-sip/tests/test_sip_events.c
libs/sofia-sip/utils/ChangeLog
libs/sofia-sip/utils/Doxyfile.in
libs/sofia-sip/utils/apps_utils.h
libs/sofia-sip/utils/sip-date.c
libs/sofia-sip/utils/sip-dig.c
libs/sofia-sip/utils/sip-options.c
libs/sofia-sip/utils/utils.docs
libs/sofia-sip/win32/ChangeLog
libs/sofia-sip/win32/README.txt
libs/sofia-sip/win32/build_sources.cmd
libs/sofia-sip/win32/config.h.in
libs/sofia-sip/win32/libsofia-sip-ua/sofia-sip-ua.def
libs/sofia-sip/win32/sofia-sip/su_configure.h
libs/sofia-sip/win32/version.awk

index cc18cae9d74de401486a5c230e4dd4d6e7cab126..b7df46c294adba4403d42f730feb748ac9319517 100644 (file)
@@ -31,7 +31,6 @@ Urpalainen, Jari <first.surname@nokia.com>
 Whittaker, Colin <colinw -at occamnetworks -dot com>
 Zabaluev, Mikhail <first.surname@nokia.com>
 
-Note: for details on who did what, see the version control 
+Note: for details on who did what, see the version control
       system change history, and release notes for past releases at
       http://sofia-sip.sourceforge.net/relnotes/
\ No newline at end of file
index 1f7c8cc6538984425ed7ce51b5f431b6b52e6101..148d531ce4cb50c801bec118bb37cbbe1608c3a4 100644 (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
 writing it).  Whether that is true depends on what the Library does
 and what the program that uses the Library does.
-  
+
   1. You may copy and distribute verbatim copies of the Library's
 complete source code as you receive it, in any medium, provided that
 you conspicuously and appropriately publish on each copy an
index 09a1d2f70e36388efdba770fa2cfbcac35f1beb8..f82e57e89d00e45048d1dee8e76c296a84e8a64b 100644 (file)
@@ -1,6 +1,6 @@
 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).
 
 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
 distributed with the following copyright notice:
 
-           This module contains code made available by IBM 
-           Corporation on an AS IS basis.  Any one receiving the 
-           module is considered to be licensed under IBM copyrights 
-           to use the IBM-provided source code in any way he or she 
-           deems fit, including copying it, compiling it, modifying 
-           it, and redistributing it, with or without 
-           modifications.  No license under any IBM patents or 
-           patent applications is to be implied from this copyright 
-           license. 
+           This module contains code made available by IBM
+           Corporation on an AS IS basis.  Any one receiving the
+           module is considered to be licensed under IBM copyrights
+           to use the IBM-provided source code in any way he or she
+           deems fit, including copying it, compiling it, modifying
+           it, and redistributing it, with or without
+           modifications.  No license under any IBM patents or
+           patent applications is to be implied from this copyright
+           license.
 
-           A user of the module should understand that IBM cannot 
-           provide technical support for the module and will not be 
-           responsible for any consequences of use of the program. 
+           A user of the module should understand that IBM cannot
+           provide technical support for the module and will not be
+           responsible for any consequences of use of the program.
 
-           Any notices, including this one, are not to be removed 
-           from the module without the prior written consent of 
-           IBM. 
+           Any notices, including this one, are not to be removed
+           from the module without the prior written consent of
+           IBM.
 
 ----------------------------------------------------------------------------
 
@@ -149,7 +149,7 @@ Copyright (c) 1994 Sun Microsystems, Inc.
 
 The following license.terms for information on usage and redistribution
 of this individual file, and for a DISCLAIMER OF ALL WARRANTIES.
+
 This software is copyrighted by the Regents of the University of
 California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
 Corporation and other parties.  The following terms apply to all files
@@ -181,7 +181,7 @@ MODIFICATIONS.
 
 GOVERNMENT USE: If you are acquiring this software on behalf of the
 U.S. government, the Government shall have only "Restricted Rights"
-in the software and related documentation as defined in the Federal 
+in the software and related documentation as defined in the Federal
 Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
 are acquiring the software on behalf of the Department of Defense, the
 software shall be classified as "Commercial Computer Software" and the
@@ -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
 authors grant the U.S. Government and others acting in its behalf
 permission to use and distribute the software in accordance with the
-terms specified in this license. 
+terms specified in this license.
 
 ----------------------------------------------------------------------------
 
index 53b11fac71fe5e1da104b58d751ba0a4a60706bd..56190603ff99ce8b285d333c83563f5887b50e80 100644 (file)
@@ -2,11 +2,11 @@
 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:
 
-- per subdirectory ChangeLog files 
-    - all non-trivial changes to files (unless documented  
+- per subdirectory ChangeLog files
+    - all non-trivial changes to files (unless documented
       elsewhere)
 - version control system changelogs
     - darcs and CVS tree repositories (see README.developers
index 26df6891e414ffc4fb7f6dde5fce20cb3f4fecec..6931926f322932f10c5ccb77d4e94fa2ce3e58c2 100644 (file)
 
   * Fixed binding problems in nua and nta.c.
   Returning more appropriate error code from tport_tbind(), too.
-  This patch fixes tracked bugs 
-  #1485624 (nua not binding to 5060), 
-  #1485625 (nua_create() fails if STUN init fails) and 
+  This patch fixes tracked bugs
+  #1485624 (nua not binding to 5060),
+  #1485625 (nua_create() fails if STUN init fails) and
   #1485632 (ncorrect error message for nua bind error).
   Nua now also binds both to NUTAG_URL and NUTAG_SIPS_URL() URIs, nua_create()
   fails if binding either of them fails.
 
   * Fixed msg_addrlen() usage.
-  
+
   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
-  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
   msg_addrlen() return value to (socklen_t *) will break on (high-endian)
   64-bit platforms. svsp.
   - win32/tests/test_nua/test_nat_tags.cpp
 
   * Now building libsofia_sip_ua.dll on win32.
-  
+
   We define both IN_LIBSOFIA_SIP_UA and IN_LIBSOFIA_SRES in
   libsofia_sip_ua.dsp.
-  
+
   Because of DLL linkage, we compile tags typedefs as C++
   (see win32/tests/test_nua/test_nat_tags.cpp).
-  
+
   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
-  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.
-  
+
   Using multithreaded DLL runtime for all projects.
-  
+
   * Added SOFIAPUBFUN/SOFIAPUBVAR to stun module, too.
 
   * Added test_nat_tags.c to nua module.
   * Added SRESPUBFUN and sres_config.h to sresolv module.
 
   * Updated headers.
-  
+
   Added sofia-sip/ prefix to documentation entries referring to include files.
-  
+
   Added SOFIAPUBFUN and SOFIAPUBVAR to files that missed them.
-  
+
   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 <sofia-sip/http_parser.h>.
 
   * Removed utf8 and unicode-related stuff from library.
-  
+
   Source files are still included in source tar.
 
   * Reordered #includes in sip module.
 
   * Fixed includes in outbound.[hc].
 
-  * Added Doxyfiles to libsofia-sip-ua-glib. 
-  
-  Note that the files are not actually commented. 
+  * Added Doxyfiles to libsofia-sip-ua-glib.
+
+  Note that the files are not actually commented.
 
   * nua, soa: Adding Warnings to the response if appropriate.
 
   * nua_register.c: use nua-generated contact for refresh interval calculation.
   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
   resolver objects.
-  
+
   Trying harder to avoid re-parsing resolv.conf and checking for
   updated servers.
-  
+
   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.
 
 2006-05-08  kai.vehmanen@nokia.com
   * test_sresolv.v: added more tests for A6 record parsing.
 
   * sres.c, sres_cache.c: records are now allocated in a single chunk.
-  
+
   Bug hunted down by Thomas Rosenblatt: strings and domains belonging to
   record were allocated from resolver home, not from cache home.
-  
+
   * Fixed problem with config without search domains in sresolv/sres.c.
 
   * Added information for COPYRIGHTS file to README.developers.
   * Added sofia-sip/auth_ntlm.h auth_ntlm.c to dist in iptsec module.
 
   * Added license to Makefiles (kv)
-    
+
   Added copyright lines and reference to LGPL license to the Makefile.am and
   configure.ac files.
 
   * Added libsofia-sip-ua-glib/ChangeLog to darcs (kv)
 
   * Added win32 registry name server discovery (kv)
-  
+
   Based on a patch from Dimitri E. Prado.
   Decreased update interval to 180secs (SRES_UPDATE_INTERVAL_SECS).
 
        const *, too.
 
        * Added SOFIAPUBFUN to auth_struct_copy(), too.
-       
+
   * iptsec module (by Martti Mela):
 
        * ntlm support now compiles, not working.
   * iptsec module:
 
        * Updated headers in iptsec module.
-       Added SOFIAPUBFUN and SOFIAPUBVAR where needed. 
+       Added SOFIAPUBFUN and SOFIAPUBVAR where needed.
        Removed auc_with_uicc().
 
        * Fixed memory management problems in iptsec module.
        freed.
        Now we are actually running the tests in test_auth_digest.c, too.
        The problem was reported and patch submitted by Colin Whittaker.
-  
+
   * sresolv module:
 
        * Updated sresolv API.
 
     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
 
 
 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).
 
   * NDEBUG oops. (pp)
     M ./libsofia-sip-ua/nua/nua_tag.c -2
     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.
 
     M ./libsofia-sip-ua/nua/nua.docs -1 +1
     M ./libsofia-sip-ua/nua/nua_register.c -7 +11
 
   * Removed obsoleted nua events. (pp)
-  
+
   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_media_event, nua_i_announce, nua_i_describe, nua_i_get_parameter,
   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_get_parameter, and nua_r_set_parameter.
-  
+
   Removed nua functions nua_announce(), nua_describe(), nua_get_media_param(),
   nua_get_parameter(), nua_media_describe(), nua_media_event(),
   nua_media_setup(), nua_options2(), nua_pause(), nua_play(), nua_record(),
     A ./libsofia-sip-ua/tport/tport_type_connect.c
 
   * 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/test_tport.c -13 +11
     M ./libsofia-sip-ua/nta/nta.c -3 +9
 
   * Using SOFIAPUBFUN in msg_header.h. Avoiding use of msg_param_t where possible. (pp)
-      
+
   API CHANGE:
   Allowing NULL as message public pointer (using default) in calls to
   msg_serialize(), msg_header_add(), msg_header_prepend(),
   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().
 
     M ./libsofia-sip-ua/msg/msg_parser.c -155 +182
   * nua_dialog_store_peer_info() now optionally removes peer info. (pp)
   If the SIP message given to nua_dialog_store_peer_info() is redirection
   response, reset peer info.
-  
+
 
     M ./libsofia-sip-ua/nua/nua_dialog.c +14
 
 2006-03-16  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
   Synchronizing CVS with darcs.
-       
+
   * Fixed lib-sofia-sip-ua-glib Makefile.ams.
   Tried to sanitize glib-less compilation.
 
   * Using alarm() with su_test.c.
 
   * 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.
 
   * Fixed problems in test_nua on win32.
     M ./libsofia-sip-ua/nua/nua_stack.c -1 +1
 
 2006-03-13  Martti Mela  <martti.mela@nokia.com>
-       
+
   * win32 defs, compiles and installs in mingw environment
 
 2006-03-09  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-  * Synchronized darcs and CVS. 
-       
+  * Synchronized darcs and CVS.
+
   * Added missing su_source_test.c file.
 
     A ./libsofia-sip-ua-glib/su-glib/su_source_test.c
 
 2006-03-01  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
-  * Synchronized darcs and CVS. 
-       
+  * Synchronized darcs and CVS.
+
   * Added utils/Doxyfile
 
     A ./utils/Doxyfile
 2006-02-15  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
   * Release 1.11.6.
-       
+
   * Fixed problems in doxygen documentation and dist.
 
   * Updated PRACK and nta_outgoing_prack().
   <sofia-sip/su.h>.
 
   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 
-  add both ${sofiadir} and ${sofiadir}/sofia-sip into your include path, 
+  with the fix-include-sofia-sip sed script found in scripts/ directory, or
+  add both ${sofiadir} and ${sofiadir}/sofia-sip into your include path,
   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
 
   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.
-       
+
   * Improved 100rel handling in nua.
   Added test_100rel to test_nua.c.
 
 
   * Improving getaddrinfo replacements.
   Testing functions getaddrinfo()/freeaddrinfo(), getnameinfo() and
-  gai_strerror() separately. 
+  gai_strerror() separately.
   There is no gai_strerror() in windows, I think.
 
 2006-02-03  Pekka Pessi  <Pekka.Pessi@nokia.com>
     M ./libsofia-sip-ua/nea/nea_server.c -1 +1
 
   * Added functions for scanning domain names and IP addresses.
-  Added span_ip4_address()/scan_ip4_address(), 
-        span_ip6_address()/scan_ip6_address(), 
+  Added span_ip4_address()/scan_ip4_address(),
+        span_ip6_address()/scan_ip6_address(),
         span_ip6_reference()/scan_ip6_reference(),
-        span_ip_address()/scan_ip_address(), 
+        span_ip_address()/scan_ip_address(),
         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.h -2 +18
 2006-01-03  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
   Syncinc darcs and CVS.
-       
+
   * Added more tests for call hold.
 
   * Using msg_header_replace_param() in nua_stack.c.
 
   * Removed msg_bnf.h
 
-  * Added NTATAG_TCP_RPORT(). 
+  * Added NTATAG_TCP_RPORT().
   Do not use rport with TCP by default.
 
   * Added test for comp=sigcomp.
 
   * Documented TP_AI_ flags.
   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.
 
   * Added TPTAG_FRESH() and a test for it.
 
   * 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
 
     M ./libsofia-sip-ua/sip/torture_sip.c -13 +137
 
   * 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().
 
     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.h -2 +3
-   
+
 2005-12-02  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
    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 comments.
-  Using SU_HAVE_ flags. 
+  Using SU_HAVE_ flags.
   Added support for SCTP in getaddrinfo() replacement.
 
     M ./libsofia-sip-ua/su/su_addrinfo.c -10 +38
-       
+
   * Declaring sockaddr_storage in su.h if it is not provided in environment.
 
     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>
 
   Syncing darcs with CVS.
-       
+
   * Silenced warning in su_addrinfo.c.
 
     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
 
-  * Rewrote uas_check_session_content(). 
+  * Rewrote uas_check_session_content().
   Returning empty Accept-Encoding header in 415/406 responses.
 
     M ./libsofia-sip-ua/nua/nua_stack.c -21 +41
 
   * 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.
-  
+
   This fixes the race condition in nua_terminate() (where terminating NOTIFY
   was is never sent).
 
@@ -3203,7 +3203,7 @@ Tue Dec 20 19:51:57 EET 2005  Pekka.Pessi@nokia.com
     M ./RELEASE -3 +16
 
   * 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.
 
     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
 
   * 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.
   Correct status code is relayed to application, too.
   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/features/Doxyfile -1 +1
-       
+
        M ./libsofia-sip-ua/nea/Doxyfile -1 +1
 
   * 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>
 
        * nua.h: added event nua_i_subscription
-       
+
        * nua_commmon.c: added event nua_i_subscription
-       
+
        * 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
@@ -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>
 
-       * 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>
 
@@ -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
 
   * Added funtions for rtp payload type management.
-  
+
   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
   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
 
   * Fixed tport.c on Win32 port.
-  Added a separate "connecting" phase. 
-  Checking EWOULDBLOCK in addition to EAGAIN. 
+  Added a separate "connecting" phase.
+  Checking EWOULDBLOCK in addition to EAGAIN.
   Fixed TP_AI_CLOSE and TP_AI_SHUTDOWN flags.
   Improved logging.
 
@@ -3757,7 +3757,7 @@ Tue Dec 20 19:51:57 EET 2005  Pekka.Pessi@nokia.com
   * Cleaned up nta module interfaces.
   Use uint32_t instead of sip_u32_t.
   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().
   Removed nta_incoming_getresponse(), nta_leg_stateful().
   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
 
-  * Cleaned up sip types. 
+  * Cleaned up sip types.
   Not using special typedefs sip_u32_t or sip_u16_t.
 
     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.
 
 2005-11-04  Pekka Pessi  <Pekka.Pessi@nokia.com>
-       
+
   * Removed annoying Last modified from msg 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
 
-  * Added nua_unpublish(). 
+  * Added nua_unpublish().
   Some cosmetic changes, too.
 
     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.
   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
   takes time.
 
     M ./libsofia-sip-ua/nta/nta.c -43 +42
     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().
 
     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.
 
-  * Using DIST_SUBDIRS when including dist-only dirs 
+  * Using DIST_SUBDIRS when including dist-only dirs
 
     M ./Makefile.am -1 +2
     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>
 
        * Importing darcs-to-cvs-2005-10-03.
-       
+
   * Removed old .def files.
 
     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>
 
        * Importing darcs-to-cvs-2005-09-29.
-               
+
 2005-09-28  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
        * 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>
 
        * darcs changes:
-       
+
        Fri Sep 23 18:58:29 EEST 2005  Pekka.Pessi@nokia.com
          * 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
 
        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
 
@@ -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
        or newer.
 
-       * autogen.sh: Fixed interop problem with older automake 
+       * autogen.sh: Fixed interop problem with older automake
        versions.
 
        * configure.ac: Do not compile STUN if OpenSSL is not
index 6bdceebc9cbdf8b880483bbe4a743fc8f1288905..84fe9528a4dc5329ed34bc3f4a2e64add320e045 100644 (file)
@@ -21,12 +21,12 @@ PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 
 EXTRA_DIST =   AUTHORS COPYING COPYRIGHTS ChangeLog.ext-trees \
-               README README.developers RELEASE TODO 
+               README README.developers RELEASE TODO
 
 ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST +=  m4/sac-general.m4 m4/sac-coverage.m4 \
-               m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4 
+               m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4
 
 EXTRA_DIST +=   docs/build_system.txt \
                docs/devel_platform_notes.txt \
index e560df5ed288865614ec2a223dc43d724e2c0e22..a503fb23a9f4af8b62efeb27f0e5bdcd794f1da8 100644 (file)
@@ -5,12 +5,12 @@ README / Sofia-SIP - RFC3261 compliant SIP User-Agent library
 Introduction
 ------------
 
-Sofia-SIP is an open-source SIP User-Agent library, compliant 
-with the IETF RFC3261 specification. It can be used as 
-a building block for SIP client software for uses such as VoIP, 
-IM, and many other real-time and person-to-person communication 
-services. The primary target platform for Sofia-SIP is 
-GNU/Linux. Sofia-SIP is based on a SIP stack developed at 
+Sofia-SIP is an open-source SIP User-Agent library, compliant
+with the IETF RFC3261 specification. It can be used as
+a building block for SIP client software for uses such as VoIP,
+IM, and many other real-time and person-to-person communication
+services. The primary target platform for Sofia-SIP is
+GNU/Linux. Sofia-SIP is based on a SIP stack developed at
 the Nokia Research Center. Sofia-SIP is licensed under the LGPL.
 
 
@@ -42,9 +42,9 @@ the "sofia-sip/utils" directory:
 
 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
-  local network interfaces 
+  local network interfaces
 
 References
 ----------
index ac121846a5f8dcdda4c8f2fde293b9535d9ae00f..611c7bc2f82a818e41a1eca10d73a6585bfb2781 100644 (file)
@@ -6,8 +6,8 @@ Introduction
 ============
 
 This file is a collection of practices and rules for Sofia-SIP
-development. If you have questions, or would like to make 
-changes, raise the issue on sofia-sip-devel (see 
+development. If you have questions, or would like to make
+changes, raise the issue on sofia-sip-devel (see
 http://lists.sourceforge.net/lists/listinfo/sofia-sip-devel ).
 
 
@@ -15,17 +15,17 @@ Important files for developers
 ==============================
 
 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
        per source file copyright statements.
 
 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
-       a few files with different, but LGPL compatible, licensing 
+       a few files with different, but LGPL compatible, licensing
        terms.
-       
-README.developers 
+
+README.developers
        This file.
 
 TODO
@@ -33,11 +33,11 @@ TODO
 
 <dir>/ChangeLog files
        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.
 
 
-Version numbering 
+Version numbering
 =================
 
 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.YEAR.MONTH.DAY, where minor is odd
 
-For all releases, the version should be changed in configure.ac 
-and committed to Darcs/CVS before making the release package. The person 
+For all releases, the version should be changed in configure.ac
+and committed to Darcs/CVS before making the release package. The person
 doing the release is responsible for updating the version number.
 
 Library interface versions
@@ -64,14 +64,14 @@ Sofia-SIP libraries utilize libtool interface versioning. See
 
 The interface versions are set in top-level 'configure.ac' file.
 Additionally, the SONAME version (CURRENT-AGE) is set in the
-same place. These version numbers are available for use as autoconf 
-variables (see the library 'Makefile.am' files and 
+same place. These version numbers are available for use as autoconf
+variables (see the library 'Makefile.am' files and
 'packages/sofia-sip.spec.in').
 
 All changes to the library versions should be marked to the
 appropriate library 'ChangeLog' file. The library version should
-be changed at the same time as the first interface change is 
-committed since the previous release. The interface version is 
+be changed at the same time as the first interface change is
+committed since the previous release. The interface version is
 frozen (should be marked to the 'ChangeLog' file) at the time
 the next release is tagged (in other words, intra-release changes
 need not be tracked with libtool versions).
@@ -95,7 +95,7 @@ Tagging releases and snapshots
     - CVS tree (only used to track major releases) at:
       http://sourceforge.net/cvs/?group_id=143636
 - tags: rel-sofia-sip-x_y_z
-    - stable and development releases (matches release 
+    - stable and development releases (matches release
       version sofia-sip-x.y.z)
 - tags: snapshot_rel_YEARMMDD
     - snapshot releases at
@@ -113,13 +113,13 @@ Sending patches
 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.
 
 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
 wait for comments. There are no strict approval rules so use of
 common sense is recommended. ;)
index 611367c1e3da69de18546abe360cb05b0b62fb30..da6bf2f0eac1802e2c86be975f812f63adaf49b8 100644 (file)
@@ -17,17 +17,17 @@ API/ABI changes and versioning
 
 <see previous release notes at
  http://sofia-sip.sourceforge.net/relnotes/ for examples ;
- - should include all changes to public headers, and 
-   other important information to developers; 
+ - should include all changes to public headers, and
+   other important information to developers;
  - and should be updated _continuously_! />
 
 **template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
 
 libsofia-sip-ua:
 - **template**: Added foobar() function (sofia-sip/foobar.h).
-- This release is ABI/API compatible with applications linked against 
-  any 1.12.x release. However, applications built against this release won't 
-  work against an older library. The ABI has been tested with the nua module 
+- This release is ABI/API compatible with applications linked against
+  any 1.12.x release. However, applications built against this release won't
+  work against an older library. The ABI has been tested with the nua module
   unit test (test_nua) built against original 1.12.0 release.
 
 libsofia-sip-ua-glib:
@@ -41,12 +41,12 @@ Contributors to this release
 <list of people who contributed to _this_ release
  - update as people's patches are added, or when you commit stuff
  - current development team members (see AUTHORS) may be omitted,
-   or listed at the end of the contribur list (depending on the scope 
+   or listed at the end of the contribur list (depending on the scope
    of the work done since the last release)
  - name of the contributor should be enough (email addresses in AUTHORS),
    plus a _brief_ description of what was contributed
  - roughly sorted by number of patches accepted
-/> 
+/>
 
 - **template**: First Surname (patch to nua/soa/msg)
 
@@ -59,7 +59,7 @@ Notes on new features
  - new/changed/removed functionality
  - links to further documentation
  - section may be omitted for minor releases
-/> 
+/>
 
 Bugs fixed in this release
 --------------------------
index 611367c1e3da69de18546abe360cb05b0b62fb30..da6bf2f0eac1802e2c86be975f812f63adaf49b8 100644 (file)
@@ -17,17 +17,17 @@ API/ABI changes and versioning
 
 <see previous release notes at
  http://sofia-sip.sourceforge.net/relnotes/ for examples ;
- - should include all changes to public headers, and 
-   other important information to developers; 
+ - should include all changes to public headers, and
+   other important information to developers;
  - and should be updated _continuously_! />
 
 **template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
 
 libsofia-sip-ua:
 - **template**: Added foobar() function (sofia-sip/foobar.h).
-- This release is ABI/API compatible with applications linked against 
-  any 1.12.x release. However, applications built against this release won't 
-  work against an older library. The ABI has been tested with the nua module 
+- This release is ABI/API compatible with applications linked against
+  any 1.12.x release. However, applications built against this release won't
+  work against an older library. The ABI has been tested with the nua module
   unit test (test_nua) built against original 1.12.0 release.
 
 libsofia-sip-ua-glib:
@@ -41,12 +41,12 @@ Contributors to this release
 <list of people who contributed to _this_ release
  - update as people's patches are added, or when you commit stuff
  - current development team members (see AUTHORS) may be omitted,
-   or listed at the end of the contribur list (depending on the scope 
+   or listed at the end of the contribur list (depending on the scope
    of the work done since the last release)
  - name of the contributor should be enough (email addresses in AUTHORS),
    plus a _brief_ description of what was contributed
  - roughly sorted by number of patches accepted
-/> 
+/>
 
 - **template**: First Surname (patch to nua/soa/msg)
 
@@ -59,7 +59,7 @@ Notes on new features
  - new/changed/removed functionality
  - links to further documentation
  - section may be omitted for minor releases
-/> 
+/>
 
 Bugs fixed in this release
 --------------------------
index 0cd2bdaa780ed9acc0fb6e696b2c243a1476df18..970f6733e20f1fc59f4d0fd69d3dfd55b70aa701 100644 (file)
@@ -8,11 +8,11 @@ Release roadmap
 ---------------
 
 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_set_hparams()/nua_get_hparams() [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
           for each handle; NUTAG_IDENTITY
     - doxygen documentation updates [DONE]
index e460abb66230cf5d1e7ff3810627f82aac395c84..e8fcf2c6a8d1679193e3c14e797055cb9346c452 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh 
+#!/bin/sh
 
 set -x
 AUTOMAKE=${AUTOMAKE:-automake-1.9} ACLOCAL=${ACLOCAL:-aclocal-1.9}
index 4fbc60a3f7a9792cf5476f705394fa736bad54ba..438ace6eae205c47af935407f73e5d092e893cf2 100644 (file)
@@ -2,7 +2,7 @@ dnl Copyright (C) 2005-2006 Nokia Corporation
 dnl Contact: Pekka Pessi <pekka.pessi@nokia.com>
 dnl Licensed under LGPL. See file COPYING.
 
-dnl 
+dnl
 dnl ref: http://www.gnu.org/software/autoconf/manual/autoconf.info.gz
 dnl
 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_AGE, [0])
 AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_SOVER, [3]) # CUR-AGE
-                                           
+
 # dnl calls AC_CANONICAL_ macros that are required by AM_INIT_AUTOMAKE
 SAC_CANONICAL_SYSTEM_CACHE_CHECK
 
@@ -56,7 +56,7 @@ AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
 
 AC_ARG_WITH(doxygen,
 [  --with-doxygen[[=CMD]]    use doxygen command CMD [[doxygen]]],[
-case $enable_doxygen in 
+case $enable_doxygen in
 yes ) doxygen=doxygen ;;
 no ) doxygen=echo ;;
 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
   AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
   AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
-else 
+else
   dnl Cross fingers
   AC_MSG_WARN("printf cannot handle size_t, using long instead")
   AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
   AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
-fi 
+fi
 
 fi
 
@@ -327,7 +327,7 @@ libsofia-sip-ua/sip/Makefile
 libsofia-sip-ua/soa/Doxyfile
 libsofia-sip-ua/soa/Makefile
 libsofia-sip-ua/sresolv/Doxyfile
-libsofia-sip-ua/sresolv/Makefile 
+libsofia-sip-ua/sresolv/Makefile
 libsofia-sip-ua/stun/Doxyfile
 libsofia-sip-ua/stun/Makefile
 libsofia-sip-ua/su/Doxyfile
index ae9db277149a36b585778d5259458c3b831e4a0d..6e746a146b2dd06bfdd92c6b1c3887581c9cda42 100644 (file)
@@ -73,8 +73,8 @@ Code-tree layout
 ================
 
 Most of the code resides in the libsofia-sip-ua directory.
-The main library, libsofia-sip-ua.so, is created by 
-collecting object files (for example bnf/bnf_objs.o) from 
+The main library, libsofia-sip-ua.so, is created by
+collecting object files (for example bnf/bnf_objs.o) from
 individual modules.
 
 There are some portability issues with the way the
@@ -89,13 +89,13 @@ See sofia-sip/docs/release_management.txt
 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
 "doxygen" for generating the HTML reference documentation.
-The pages will be created to libsofia-sip-ua/docs 
-subdirectory. 
+The pages will be created to libsofia-sip-ua/docs
+subdirectory.
 
 This special target is primarily meant for use by
 the Sofia-SIP website admins, but can be used by anyone
index 9d7cc4f1aff3f2fb40d4fc0e0ab400a48c619c18..c24366dd7828bc1615c56d91e2e7467b5e6dd4d1 100644 (file)
@@ -14,16 +14,16 @@ be at least 1.7. You can avoid running autoreconf explicitly if you use
 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,
 by omitting certain interfaces from the resulting library and installed
 header files.
 
 Options such as '--disable-size-compat' modify the library
-ABI by changing the types used in public library function 
+ABI by changing the types used in public library function
 signatures.
 
-Generic POSIX (GNU/Linux, BSD, ...) 
+Generic POSIX (GNU/Linux, BSD, ...)
 -----------------------------------
 
 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.
 
 
-Mac OS X 
+Mac OS X
 --------
 
 TBD
 
-Win32 / Mingw 
+Win32 / Mingw
 -------------
 
-TBD 
+TBD
 
-Win32 / Cygwin 
+Win32 / Cygwin
 --------------
 
 TBD
index 3d9e99afe3d6d668b5976254b4c3822f0fef588e..333d9481727c3d98869204ee11da91efe39bc2f7 100644 (file)
@@ -27,8 +27,8 @@ The release notes should contain the following sections:
     - maintained in sofia-sip/RELEASE
     - see diff between cvs/darcs between previous and
       this version
-    - written in freshmeat.net "Changes:" style 
-- notes on API/ABI interface changes 
+    - written in freshmeat.net "Changes:" style
+- notes on API/ABI interface changes
     - maintained in sofia-sip/RELEASE
     - all changes in public interfaces, plus other
       notes that developers should be aware of
@@ -41,7 +41,7 @@ The release notes should contain the following sections:
 See the RELEASE.template file for a full list of release note
 sections.
 
-Making the release tarball 
+Making the release tarball
 ==========================
 
 - 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
   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
-- add explicit link to the release notes to 
+- add explicit link to the release notes to
   sfnet_www/download.html (three most recent releases,
   see guidelines in the html comments)
 - update sfnet_www/index.html to mention the latest
   release
-- commit the change to sf.net website CVS, and run the 
-  sfnet_www/put_online.sh script 
+- commit the change to sf.net website CVS, and run the
+  sfnet_www/put_online.sh script
 
 Uploading the release to sourceforge.net
 ========================================
@@ -104,8 +104,8 @@ After release
 
 - replace the RELEASE file with RELEASE.template, and
   commit it to master source repository (see sofia-sip/README.developers)
-- change version in configure.ac from "X.Y.Z" to 
-  "X.Y.Zdevel" (as it is in many cases unknown what the 
+- change version in configure.ac from "X.Y.Z" to
+  "X.Y.Zdevel" (as it is in many cases unknown what the
   next version will be)
 - make a "tree open for development" commit
 
@@ -122,15 +122,15 @@ tree.
 
 - 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 -
-  for example produced with the "darcs changes --summary" 
+  for example produced with the "darcs changes --summary"
   command).
 
 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).
 - Use the 'icheck' tool (in Debian) to make comparison
   between two released versions.
index 43f707d934e5f02ffe60af6516d25f23d7cfaa58..b2a6f5b9afc4181bdba9c0978119399639c6ddba 100644 (file)
@@ -17,7 +17,7 @@ if HAVE_GLIB
 lib_LTLIBRARIES += libsofia-sip-ua-glib.la
 endif
 
-libsofia_sip_ua_glib_la_SOURCES = 
+libsofia_sip_ua_glib_la_SOURCES =
 libsofia_sip_ua_glib_la_LIBADD = $(GLIB_TARGETS) $(GLIB_LIBS)
 
 # set the libtool version info version:revision:age for libsofia-sip-ua-glib
@@ -42,7 +42,7 @@ doxygen: built-sources
        done
        ${top_srcdir}/scripts/hide_emails.sh docs/html
 
-PHONY = doxygen 
+PHONY = doxygen
 
 include $(top_srcdir)/rules/recursive.am
 
index f6f2448de2b5f5914fafc66f1cc6bbaffac97778..4f7dfea7b141d7dc87bbb156253e1c9a41a1cc67 100644 (file)
@@ -27,7 +27,7 @@
 
 /**
  * @file su_glib.h
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Kai Vehmanen <first.surname@nokia.com>
  */
index 142a8bca43972ea5e10cf76d7fb8202dce11cf9f..5d8fde163c9ca8170cdcfc3348b15ca301b7bf79 100644 (file)
 
 /**
  * @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.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Kai Vehmanen <first.surname@nokia.com>
- *  
+ *
  * @date Created: Thu Mar  4 19:58:50 2004 ppessi
- * 
+ *
  */
 
 #ifndef SU_WAIT_H
index 1cc9f2089282d417534de598887d652cb04951f9..2a1878042f95523e96ec4db1f0b5d320340cdae3 100644 (file)
@@ -4,7 +4,7 @@
 
 @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
 application would have to create a separate thread for running
 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>
 
   /* ... */
-  
+
   GMainLoop *ptr = g_main_loop_new(NULL, FALSE);
   GSource *gsource;
   su_root_t *sofia_event_loop;
   su_timer_t *timer;
 
   /* create a sofia event loop using su-glib function su_glib_root_source_create() */
-  sofia_event_loop = su_glib_root_create(NULL); 
+  sofia_event_loop = su_glib_root_create(NULL);
 
   /* attach the created GSource to glib 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 */
 
   /* run the glib mainloop */
-  g_main_loop_run(ptr);  
-@endcode   
+  g_main_loop_run(ptr);
+@endcode
 
 @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 )
 
 */
index 583b2c77dd915bcc1bc7cf688b581f7b1d4113d7..df326d159747e5076b490f7553fd9291e32fcebf 100644 (file)
 /**
  * @file su_source.c
  * @brief Wrapper for glib GSource.
- *  
- * Refs: 
+ *
+ * Refs:
  *  - http://sofia-sip.sourceforge.net/refdocs/su/group__su__wait.html
  *  - http://developer.gnome.org/doc/API/glib/glib-the-main-event-loop.html
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
- * 
+ *
  * @date Created: Thu Mar  4 15:15:15 2004 ppessi
- * 
+ *
  */
 
 #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_register(su_port_t *self,
-                           su_root_t *root, 
-                           su_wait_t *wait, 
+                           su_root_t *root,
+                           su_wait_t *wait,
                            su_wakeup_f callback,
                            su_wakeup_arg_t *arg,
                            int priority);
 static int su_source_unregister(su_port_t *port,
-                             su_root_t *root, 
-                             su_wait_t *wait,  
-                             su_wakeup_f callback, 
+                             su_root_t *root,
+                             su_wait_t *wait,
+                             su_wakeup_f callback,
                              su_wakeup_arg_t *arg);
 static int su_source_deregister(su_port_t *self, int i);
 static int su_source_unregister_all(su_port_t *self,
                                  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);
 static void su_source_run(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 int su_source_thread(su_port_t *self, enum su_port_thread_op op);
 static int su_source_add_prepoll(su_port_t *port,
-                                su_root_t *root, 
-                                su_prepoll_f *, 
+                                su_root_t *root,
+                                su_prepoll_f *,
                                 su_prepoll_magic_t *);
 static int su_source_remove_prepoll(su_port_t *port,
                                  su_root_t *root);
@@ -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 
+static
 su_port_vtable_t const su_source_port_vtable[1] =
   {{
       /* 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";
 }
 
-/** 
- * 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 {
   su_base_port_t   sup_base[1];
-  
+
   GThread         *sup_tid;
   GStaticMutex     sup_obtained[1];
 
@@ -184,20 +184,20 @@ struct su_source_s {
 
   GSource         *sup_source; /**< Backpointer to source */
   GMainLoop       *sup_main_loop; /**< Reference to mainloop while running */
-  
+
   /* Waits */
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                  */
-  unsigned         sup_n_waits; 
-  unsigned         sup_size_waits; 
+  unsigned         sup_n_waits;
+  unsigned         sup_size_waits;
   unsigned         sup_max_index;
-  unsigned        *sup_indices; 
-  su_wait_t       *sup_waits; 
-  su_wakeup_f     *sup_wait_cbs; 
-  su_wakeup_arg_t**sup_wait_args; 
-  su_root_t      **sup_wait_roots; 
+  unsigned        *sup_indices;
+  su_wait_t       *sup_waits;
+  su_wakeup_f     *sup_wait_cbs;
+  su_wakeup_arg_t**sup_wait_args;
+  su_root_t      **sup_wait_roots;
 };
 
 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);
 }
 
-/** 
- * 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.
  *
- * @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())
  */
 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. */
-static 
+static
 void su_source_finalize(GSource *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);
 
-  PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...", 
+  PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
                   (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);
 
-  PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n", 
+  PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
                   (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.
  *
  * @param self pointer to a port object
- * @param op operation 
+ * @param op operation
  *
  * @ERRORS
  * @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 ------------------------------------- */
 
 /* 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 */
 static
@@ -402,7 +402,7 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
   su_port_t *self = ss->ss_port;
 
   enter;
-  
+
   if (self->sup_base->sup_head) {
     *return_tout = 0;
     return TRUE;
@@ -450,7 +450,7 @@ gboolean su_source_check(GSource *gs)
   return su_source_prepare(gs, &tout);
 }
 
-static 
+static
 gboolean su_source_dispatch(GSource *gs,
                            GSourceFunc callback,
                            gpointer user_data)
@@ -489,8 +489,8 @@ gboolean su_source_dispatch(GSource *gs,
     for (i = 0; i < n; i++) {
       if (waits[i].revents) {
        root = self->sup_wait_roots[i];
-       self->sup_wait_cbs[i](root ? su_root_magic(root) : NULL, 
-                             &waits[i], 
+       self->sup_wait_cbs[i](root ? su_root_magic(root) : NULL,
+                             &waits[i],
                              self->sup_wait_args[i]);
        /* Callback used su_register()/su_unregister() */
        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));
   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));
 }
 
@@ -520,7 +520,7 @@ static void su_source_unlock(su_port_t *self, char const *who)
 {
   g_static_mutex_unlock(self->sup_mutex);
 
-  PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n", 
+  PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
                   (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
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @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.  */
 int su_source_register(su_port_t *self,
-                      su_root_t *root, 
-                      su_wait_t *wait, 
+                      su_root_t *root,
+                      su_wait_t *wait,
                       su_wakeup_f callback,
                       su_wakeup_arg_t *arg,
                       int priority)
@@ -571,7 +571,7 @@ int su_source_register(su_port_t *self,
   unsigned n;
 
   enter;
-  
+
   assert(SU_SOURCE_OWN_THREAD(self));
 
   n = self->sup_n_waits;
@@ -587,7 +587,7 @@ int su_source_register(su_port_t *self,
 
     if (self->sup_size_waits == 0)
       size = SU_WAIT_MIN;
-    else 
+    else
       size = 2 * self->sup_size_waits;
 
     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++)
       g_source_remove_poll(self->sup_source, (GPollFD*)&self->sup_waits[i]);
-      
+
     waits = realloc(self->sup_waits, size * sizeof(*waits));
     if (waits)
       self->sup_waits = waits;
 
     for (i = 0; i < self->sup_n_waits; i++)
       g_source_add_poll(self->sup_source, (GPollFD*)&waits[i]);
-      
+
     wait_cbs = realloc(self->sup_wait_cbs, size * sizeof(*wait_cbs));
     if (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 */
     wait_tasks = realloc(self->sup_wait_roots, size * sizeof(*wait_tasks));
-    if (wait_tasks) 
+    if (wait_tasks)
       self->sup_wait_roots = 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]);
       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_roots[n] = self->sup_wait_roots[n-1];     
+      self->sup_wait_roots[n] = self->sup_wait_roots[n-1];
     }
   }
   else {
@@ -653,13 +653,13 @@ int su_source_register(su_port_t *self,
 
   I = self->sup_max_index;
 
-  for (i = 0; i < I; i++)  
+  for (i = 0; i < I; i++)
     if (self->sup_indices[i] == UINT_MAX)
       break;
     else if (self->sup_indices[i] >= n)
       self->sup_indices[i]++;
 
-  if (i == I) 
+  if (i == I)
     self->sup_max_index++;
 
   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.
- *  
+ *
  *  The function su_source_unregister() unregisters a su_wait_t object. The
  *  wait object, a callback function and a argument are removed from the
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
- * 
+ *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_source_unregister(su_port_t *self,
-                        su_root_t *root, 
-                        su_wait_t *wait,       
+                        su_root_t *root,
+                        su_wait_t *wait,
                         su_wakeup_f callback, /* XXX - ignored */
                         su_wakeup_arg_t *arg)
 {
@@ -700,7 +700,7 @@ int su_source_unregister(su_port_t *self,
   unsigned i, I, j, *indices;
 
   enter;
-  
+
   assert(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 &&
            self->sup_indices[j] > n)
          self->sup_indices[j]--;
-    
+
     for (; n < N; n++) {
       g_source_remove_poll(self->sup_source, (GPollFD*)&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]);
       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_roots[n] = self->sup_wait_roots[n+1];       
+      self->sup_wait_roots[n] = self->sup_wait_roots[n+1];
     }
 
     i += 1;    /* 0 is failure */
@@ -757,14 +757,14 @@ int su_source_unregister(su_port_t *self,
 }
 
 /** 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
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 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];
 
   enter;
-  
+
   assert(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]);
     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_roots[n] = self->sup_wait_roots[n+1];         
+    self->sup_wait_roots[n] = self->sup_wait_roots[n+1];
   }
 
   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
  * associated with given root object destroys all queued timers.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @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)
 {
   unsigned i, j;
@@ -847,15 +847,15 @@ int su_source_unregister_all(su_port_t *self,
   su_root_t      **wait_roots;
 
   enter;
-  
+
   assert(SU_SOURCE_OWN_THREAD(self));
 
   n_waits    = self->sup_n_waits;
-  waits      = self->sup_waits; 
-  wait_cbs   = self->sup_wait_cbs; 
+  waits      = self->sup_waits;
+  wait_cbs   = self->sup_wait_cbs;
   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++) {
     if (wait_roots[i] == root) {
       /* XXX - we should free all resources associated with this */
@@ -872,7 +872,7 @@ int su_source_unregister_all(su_port_t *self,
     }
     j++;
   }
-  
+
   self->sup_n_waits = j;
   self->sup_registers++;
 
@@ -898,7 +898,7 @@ int su_source_eventmask(su_port_t *self, int index, int socket, int events)
   int retval;
 
   enter;
-  
+
   assert(self);
   assert(SU_SOURCE_OWN_THREAD(self));
   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;
   else if (multishot == 0 || multishot == 1)
     return 1;                  /* Always enabled */
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
 
 /** @internal 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
  * from a callback.
- * 
+ *
  * @param self     pointer to root object
  * */
 void su_source_run(su_port_t *self)
@@ -947,7 +947,7 @@ void su_source_run(su_port_t *self)
   GMainLoop *gml;
 
   enter;
-  
+
   gmc = g_source_get_context(self->sup_source);
   if (gmc && g_main_context_acquire(gmc)) {
     gml = g_main_loop_new(gmc, TRUE);
@@ -962,30 +962,30 @@ void su_source_run(su_port_t *self)
 /** @internal
  * The function @c su_source_break() is used to terminate execution of @c
  * su_source_run(). It can be called from a callback function.
- * 
+ *
  * @param self     pointer to port
- * 
+ *
  */
 void su_source_break(su_port_t *self)
 {
   enter;
-  
+
   if (self->sup_main_loop)
     g_main_loop_quit(self->sup_main_loop);
 }
 
 /** @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
- * expired, it invokes the callbacks. 
- * 
+ * expired, it invokes the callbacks.
+ *
  *   This function returns when a callback has been invoked or @c tout
- *   milliseconds is elapsed. 
+ *   milliseconds is elapsed.
  *
  * @param self     pointer to port
  * @param tout     timeout in milliseconds
- * 
+ *
  * @Return
  *   Milliseconds to the next invocation of timer, or @c SU_WAIT_FOREVER if
  *   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;
 
   enter;
-  
+
   gmc = g_source_get_context(self->sup_source);
 
   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,
-                                su_root_t *root, 
-                                su_prepoll_f *prepoll, 
+                                su_root_t *root,
+                                su_prepoll_f *prepoll,
                                 su_prepoll_magic_t *magic)
 {
   /* 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, "\t%d wait objects\n", self->sup_n_waits);
   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
  *   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)
 {
index 559348b6fbe5ac462e1e2f59ec313ec2e3a983a6..e8bda63081c1869b92e181f2948495c970cef944 100644 (file)
@@ -28,7 +28,7 @@
  * @brief Test program for glib and su root event loop integration.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
 
@@ -74,7 +74,7 @@ short opt_verbatim = 0;
 short opt_singlethread = 0;
 GMainLoop *global_gmainloop = NULL;
 
-static su_socket_t udpsocket(void) 
+static su_socket_t udpsocket(void)
 {
   su_socket_t s;
   su_sockaddr_t su = { 0 };
@@ -98,7 +98,7 @@ static su_socket_t udpsocket(void)
 
   if (getsockname(s, &su.su_sa, &sulen) == SOCKET_ERROR) {
     su_perror("udpsocket: getsockname");
-    exit(1); 
+    exit(1);
   }
 
   if (opt_verbatim)
@@ -118,7 +118,7 @@ static char *snow(su_time_t now)
   return buf;
 }
 
-void 
+void
 do_ping(struct pinger *p, su_timer_t *t, void *p0)
 {
   char buf[1024];
@@ -129,7 +129,7 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0)
   p->when = su_now();
 
   snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
-  if (sendto(p->s, buf, strlen(buf), 0, 
+  if (sendto(p->s, buf, strlen(buf), 0,
             &p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) {
     su_perror("do_ping: send");
   }
@@ -189,7 +189,7 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0)
   p->id = 0;
 
   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) {
     su_perror("do_pong: send");
   }
@@ -412,7 +412,7 @@ usage(int exitcode)
 /*
  * 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
  *
  * Create a pinger, executed from timer, scheduling do_ping(),
@@ -428,8 +428,8 @@ int main(int argc, char *argv[])
   su_timer_t *t;
   unsigned long sleeppid = 0;
 
-  struct pinger 
-    pinger = { PINGER, "ping", 1 }, 
+  struct pinger
+    pinger = { PINGER, "ping", 1 },
     ponger = { PONGER, "pong", 1 };
 
   char *argv0 = argv[0];
@@ -437,7 +437,7 @@ int main(int argc, char *argv[])
 #if HAVE_OPEN_C
   dup2(1, 2);
 #endif
-  
+
   while (argv[1]) {
     if (strcmp(argv[1], "-v") == 0) {
       opt_verbatim = 1;
@@ -465,9 +465,9 @@ int main(int argc, char *argv[])
 #if HAVE_OPEN_C
   opt_verbatim = 1;
   opt_singlethread = 1;
-  su_log_soft_set_level(su_log_default, 9);  
+  su_log_soft_set_level(su_log_default, 9);
 #endif
-  
+
 #if HAVE_SIGNAL
   signal(SIGTERM, term);
 #endif
@@ -478,20 +478,20 @@ int main(int argc, char *argv[])
 
   global_gmainloop = g_main_loop_new(NULL, FALSE);
   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 (!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);
-  
+
   su_root_threading(root, 0 && !opt_singlethread);
 
   if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0)
     perror("su_clone_start"), exit(1);
   if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0)
-    perror("su_clone_start"), exit(1); 
+    perror("su_clone_start"), exit(1);
 
   /* Test timer, exiting after 200 milliseconds */
   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_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);
   su_msg_send(start_msg);
 
@@ -511,7 +511,7 @@ int main(int argc, char *argv[])
   su_timer_destroy(t);
 
   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);
   }
   su_root_destroy(root);
@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
   g_main_loop_unref(global_gmainloop), global_gmainloop = NULL;
 
   if (opt_verbatim)
-    printf("%s exiting\n", argv0); 
+    printf("%s exiting\n", argv0);
 
 #ifndef HAVE_WIN32
 #if HAVE_SIGNAL
@@ -531,6 +531,6 @@ int main(int argc, char *argv[])
 #if HAVE_OPEN_C
    sleep(7);
 #endif
-   
+
   return 0;
 }
index 13fb84c20c5bcb4312315774eb2ab8ad0a4e54a7..2d431addfb4f6fff7ec70945f360e1e2f40214c1 100644 (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.
  *
@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
   su_init(); atexit(su_deinit);
 
   tester->root = root = su_glib_root_create(tester);
-  
+
   source = su_root_gsource(tester->root);
   g_source_attach(source, NULL /*g_main_context_default ()*/);
 
index d03b272b9c6713d4d3521e137e6a6601bd36901a..bde1819aaf306baee8cde218b09fcfcede0db8cf 100644 (file)
@@ -9,7 +9,7 @@
 2006-10-12  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * libsofia-sip-ua interface v3 frozen (3:0:3) for the 1.12.3 release
-       
+
 2006-09-26  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * libsofia-sip-ua interface v2 frozen (2:0:2) for the 1.12.2 release
@@ -27,9 +27,9 @@
        * Added urltag_scan().
 
 2006-08-23  Pekka Pessi  <Pekka.Pessi@nokia.com>
-       
+
        * nta.c, nta.h: added nta_leg_make_replaces(), nta_leg_by_replaces().
-       
+
        * nua: event watcher (nua_subscribe, nua_watcher) now tries to re-establish
          subscription if the subscription was terminated with reason "deactivated" or
          "probation". Likewise, if SUBSCRIBE was returned a suitable error response
        * <SUBDIRS>/Doxyfile: Fixed the use of doxytags. Now
        a separate 'doxytags_MODNAME' file is created for each
        module.
-       
+
 2005-11-15  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-       * <SUBDIRS>/Makefile.am: Changed to use the 'include_sofia_HEADERS' 
+       * <SUBDIRS>/Makefile.am: Changed to use the 'include_sofia_HEADERS'
        variable for listing public library headers. The variable
        is defined in the top-level configure.ac.
-       
+
 2005-10-27  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
   * Always including stun library.
@@ -84,7 +84,7 @@
 
 2005-10-14  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
-         * Shell syntax exercise. 
+         * Shell syntax exercise.
 
            M ./autogen.sh -4 +4
 
@@ -94,7 +94,7 @@
 
 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.
 
 2005-09-09  Pekka Pessi  <Pekka.Pessi@nokia.com>
            M ./iptsec/auth_module.c -5 +5
 
        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.
 
            M ./iptsec/auth_digest_test.c -2 +3
            M ./url/url.c -1 +6
 
        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_mclass.c +1
 
        Thu Sep  8 03:11:35 EEST 2005  Pekka.Pessi@nokia.com
          * su_home_new and su_home_unref
-         Added su_home_new() and su_home_unref(). 
-         
+         Added su_home_new() and su_home_unref().
+
          Fixed su_home_mutex_lock() and su_home_mutex_unlock().
-         
+
          Slightly changed semantics of su_home_clone() versus
          su_home_threadsafe().
 
 
        Thu Sep  8 03:07:17 EEST 2005  Pekka.Pessi@nokia.com
          * More liberal sdp parsing for config files.
-         Be more liberal when parsing config files 
+         Be more liberal when parsing config files
          (do not require v=, accept -1 as len argument).
 
            M ./sdp/sdp_parse.c -9 +25
 
            M ./sdp/sdp.h +2
            M ./sdp/sdp_parse.c +10
-       
+
 2005-09-08  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * Makefile.am: Workaround for automake bug related to adding
 
 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>
 
index 2b181af67edb364ee6594787c17bd66c990c053d..c089364b300ee50b76d65542db32f2df48dcfbf3 100644 (file)
@@ -16,13 +16,13 @@ OPT_SUBDIRS_STUN =
 OPT_SUBDIRS_HTTP =
 OPT_SUBDIRS_NTH =
 if HAVE_STUN
-OPT_LIBADD += stun/libstun.la 
+OPT_LIBADD += stun/libstun.la
 OPT_SUBDIRS_STUN += stun
 endif
 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_NTH += nth 
+OPT_SUBDIRS_NTH += nth
 endif
 
 # note: order does matter in the subdir list
@@ -37,7 +37,7 @@ DOXYGEN = doxygen
 
 noinst_LTLIBRARIES = libsofia-sip-ua.la
 
-libsofia_sip_ua_la_SOURCES = 
+libsofia_sip_ua_la_SOURCES =
 libsofia_sip_ua_la_LIBADD =    bnf/libbnf.la \
                                features/libfeatures.la \
                                ipt/libipt.la \
@@ -90,7 +90,7 @@ doxygen: built-sources
          sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \
            docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
          mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
-       done 
+       done
        for d in $(DIST_SUBDIRS); do \
          test -r $$d/Doxyfile \
          && pushd $$d > /dev/null \
@@ -102,7 +102,7 @@ doxygen: built-sources
          sed '2,10s!<name>index</name>!<name>'$$d'_index</name>!' \
            docs/$$d.doxytags > docs/$$d.doxytags.tmp && \
          mv -f docs/$$d.doxytags.tmp docs/$$d.doxytags ; \
-       done 
+       done
        ${top_srcdir}/scripts/hide_emails.sh docs/html
 
 if HAVE_LCOV
index d6199bdeb4d2c146b542d396d17c2fb3c71150aa..e40bbe5e4c028969064250554717db92df943b4d 100644 (file)
@@ -96,10 +96,10 @@ size_t bnf_span_token(char const *s)
 /** Span of a token */
 size_t bnf_span_token4(char const *s)
 {
-  char const *e = s; 
+  char const *e = s;
   while (_bnf_table[(unsigned char)(*e)] & bnf_token)
-    e++; 
-  return e - s; 
+    e++;
+  return e - 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.
  *
- * 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:
- * 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
  * 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.
  *
- * 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)
 {
@@ -724,7 +724,7 @@ int host_ip6_reference(char const *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.
  *
  * 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.
  *
- * 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 ([]).
  */
 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.
  *
- * 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.
  * 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.
  *
- * Uses the definitions of local addresses found in RFC1700 and 
- * RFC4291. 
+ * Uses the definitions of local addresses found in RFC1700 and
+ * RFC4291.
  */
 int host_is_local(char const *host)
 {
@@ -793,10 +793,10 @@ int host_is_local(char const *host)
 
   n = span_domain(host);
 
-  return 
+  return
     n >= 9 /* strlen("localhost") */ &&
     strncasecmp(host, "localhost", 9) == 0 &&
-    (n == 9 || 
+    (n == 9 ||
      ((n == 10 || /* localhost. */
        n == 21 || /* strlen("localhost.localdomain") */
        n == 22) && /* strlen("localhost.localdomain.") */
@@ -866,7 +866,7 @@ static size_t convert_ip_address(char const *s,
     if (canonize) {
       char *tmp = buf;
       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)
       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
  *
- * 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
  * compared as IP4 addresses; that is, ::ffff:127.0.0.1, ::127.0.0.1 and
  * 127.0.0.1 all are all equal.
  *
  * @param a IP address or domain name
  * @param b IP address or domain name
- * 
+ *
  * @retval -1 if a < b
  * @retval 0 if a == b
  * @retval 1 if a > b
index abd1b3ab96ebb9a6efd0fe68c61563c6eb62245e..bbd1536bb6f8f5ebea1515f1cb6a6506430ae9a8 100644 (file)
@@ -10,9 +10,9 @@
  *
  * The interface used for validating hostnames and IP addresses is in
  * <sofia-sip/hostdomain.h>.
- * 
+ *
  * @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @STATUS @SofiaSIP Core library
  *
  * @LICENSE LGPL
index 46661986a604dd6482dbefa44168e10e9e18b834..1c9b191e358cab28a4e81cd43e8e45f0aea42f73 100644 (file)
 #define BNF_H
 
 /**@file sofia-sip/bnf.h
- * 
+ *
  * Parsing macros and prototypes for HTTP-like protocols.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Jun 06 10:59:34 2000 ppessi
  *
  */
@@ -58,7 +58,7 @@ SOFIA_BEGIN_DECLS
 /** Line-ending characters */
 #define CRLF     CR LF
 /** Whitespace */
-#define WS       SP HT 
+#define WS       SP HT
 /** Linear whitespace */
 #define LWS      SP HT CR LF
 /** Lower-case alphabetic characters */
@@ -71,11 +71,11 @@ SOFIA_BEGIN_DECLS
 #define DIGIT   "0123456789"
 /** RTSP safe characters */
 #define SAFE    "$-_." /* RTSP stuff */
-#define ALPHANUM DIGIT ALPHA 
+#define ALPHANUM DIGIT ALPHA
 #define HEX      DIGIT "ABCDEF" "abcdef"
 
 /** SIP token characters.
- * @note $|&^# were token chars in RFC 2543, but no more in RFC 3261. 
+ * @note $|&^# were token chars in RFC 2543, but no more in RFC 3261.
  */
 #define SIP_TOKEN  ALPHANUM "-.!%*_+`'~"
 /** SIP separator characters */
@@ -109,7 +109,7 @@ SOFIA_BEGIN_DECLS
 #define skip_word(ss) (*(ss) += span_word(*(ss)))
 
 /** 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 */
 #define IS_LWS(c)       ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
 /*#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_separator = 32,                          /**< SIP separator */
   /** SIP token, not alphabetic (0123456789-.!%*_+`'~) */
-  bnf_token0 = 64 | bnf_safe,                          
+  bnf_token0 = 64 | bnf_safe,
   bnf_token = bnf_token0 | bnf_alpha,          /**< SIP token */
   bnf_param0 = 128,                            /**< SIP parameter, not token */
   bnf_param = bnf_token | bnf_param0 /**< SIP/HTTP parameter */
@@ -171,7 +171,7 @@ SOFIAPUBVAR unsigned char const _bnf_table[256];
 /** Get number of characters before linear whitespace */
 #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
  */
 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.  */
 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))
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of a token characters.  */
 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)
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of a alphabetic characters.  */
 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)
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of a digits.  */
 su_inline isize_t span_digit(char const *s)
 {
-  char const *e = s; 
+  char const *e = s;
   while (*e >= '0' && *e <= '9')
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of a hex.  */
 su_inline isize_t span_hexdigit(char const *s)
 {
-  char const *e = s; 
+  char const *e = s;
   while (IS_HEX(*e))
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of characters belonging to an RTSP token */
 su_inline isize_t span_alpha_digit_safe(char const *s)
 {
-  char const *e = s; 
+  char const *e = s;
   while (_bnf_table[(unsigned char)(*e)] & (bnf_alpha | bnf_safe))
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of a characters valid in parameters.  */
 su_inline isize_t span_param(char const *s)
 {
-  char const *e = s; 
+  char const *e = s;
   while (IS_PARAM(*e))
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of a SIP word.  */
 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)))
-    e++; 
-  return e - s; 
+    e++;
+  return e - s;
 }
 
 /** Calculate span of a unreserved characters.  */
@@ -290,13 +290,13 @@ su_inline isize_t span_quoted(char const *s)
 /** Reserved in URLs */
 #define URL_RESERVED        ";/?:=+$,"
 
-/** Non-alphanumeric characters without syntactical meaning. */ 
+/** Non-alphanumeric characters without syntactical meaning. */
 #define URL_MARK            "-_.!~*'()"
 
-/** Unreserved characters. */ 
+/** Unreserved characters. */
 #define URL_UNRESERVED ALPHANUM URL_MARK
 
-/** URL hex escape. */ 
+/** URL hex escape. */
 #define URL_ESCAPED    "%"
 #define URL_DELIMS     "<>#%\""
 #define URL_UNWISE     "{}|\\^[]`"
index 02f01c224c54fe61fec35efc28b40e0b2d618d5c..fe9fe95cb05b2bf4d2a404db3a3114931d0ceff3 100644 (file)
 #define SOFIA_SIP_HOSTDOMAIN_H
 
 /**@file sofia-sip/hostdomain.h
- * 
+ *
  * Predicates for handling host names: IP addresses or domain names.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Mar  9 16:15:22 EET 2006 ppessi
  */
 
@@ -51,7 +51,7 @@ SOFIAPUBFUN int host_is_local(char const *string);
 SOFIAPUBFUN int host_has_domain_invalid(char const *string);
 SOFIAPUBFUN int host_cmp(char const *a, char const *b);
 
-/** This is typo. @deprecated Use host_is_ip6_reference() instead. */ 
+/** This is typo. @deprecated Use host_is_ip6_reference() instead. */
 SOFIAPUBFUN int host_ip6_reference(char const *string);
 
 
index 75be3aedda591c8ca42f62143240b11fa409889d..fce3b4cc241726966938aa7ca7c0399423746aaa 100644 (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, "0.00.000.000:,", "0.0.0.0", ":,");
   TEST_SCAN(scan_host, "127.255.249.000,", "127.255.249.0", ",");
-  TEST_SCAN(scan_host, "[dead:beef:feed:ded:0:1:2:3]:1", 
+  TEST_SCAN(scan_host, "[dead:beef:feed:ded:0:1:2:3]:1",
                        "[dead:beef:feed:ded::1:2:3]", ":1");
   TEST_SCAN(scan_host, "[::127.0.0.1]:1", "[::127.0.0.1]:1", ":1");
 
@@ -323,10 +323,10 @@ int host_test(void)
   /* Invalid IP4 address (extra leading zeros) */
   TEST_1(!host_cmp("127.0.0.1", "127.0.0.01"));
   /* Invalid reference (extra leading zeros) */
-  TEST_1(host_cmp("[0ffff:0ffff:0ffff:0ffff:0ffff:0ffff:255.255.255.255]", 
+  TEST_1(host_cmp("[0ffff:0ffff:0ffff:0ffff:0ffff:0ffff:255.255.255.255]",
                  "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
 #if SU_HAVE_IN6
-  TEST_1(!host_cmp("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]", 
+  TEST_1(!host_cmp("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]",
                  "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
   TEST_1(!host_cmp("::1", "::001"));
   TEST_1(!host_cmp("[::1]", "::1"));
index c8d7972b2ad9a867019b8c996ca6efea93666e8c..6c841fe7f36c309b3e90abee9d7ea0693f2a510d 100644 (file)
@@ -13,7 +13,7 @@
 2005-09-08  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * hide_emails.sh: Fixed bug in hiding addresses of
-       form foo.bar-bar@something.org. Fixed sf.net 
+       form foo.bar-bar@something.org. Fixed sf.net
        bug #1277167.
 
 
index 3bb75f27acf5c8b4f526210703ec7948825af3f1..bc4a2423945239123c0558eeb30dd8b302d2705d 100644 (file)
@@ -55,10 +55,10 @@ USE_PDFLATEX         = YES
 PDF_HYPERLINKS       = YES
 COMPACT_LATEX        = YES
 PAPER_TYPE           = a4wide
-EXTRA_PACKAGES       = 
+EXTRA_PACKAGES       =
 LATEX_BATCHMODE      = YES
 
-FILE_PATTERNS        = *.h *.c 
+FILE_PATTERNS        = *.h *.c
 
 EXCLUDE_PATTERNS     = acconfig.h config.h confdefs.h \
                        test*.h test*.c torture*.c *test.c *torture.c \
index eb9b2faefc3aee296e35f43daf643578e6bc2288..225c02a7851e7c9a931960bb56e68f69f0fe5d0a 100644 (file)
@@ -11,7 +11,7 @@ INPUT                      = @srcdir@/mainpage.docs @srcdir@/docguide.docs @srcdir@/conformanc
 
 GENERATE_TAGFILE    = docs.doxytags
 
-TAGFILES            = 
+TAGFILES            =
 TAGFILES            += su.doxytags=su
 TAGFILES            += ipt.doxytags=ipt
 TAGFILES            += bnf.doxytags=bnf
index 37c3fe2221131956f442c85cd89e90190d144e7f..1fced80046ae00ef88029323a4e81b319e55db94 100644 (file)
@@ -22,7 +22,7 @@ EXTRA_DIST =  Doxyfile.aliases Doxyfile.conf \
        pictures/autotools.gif \
        pictures/autotools.vsd \
        pictures/nta-receiving-message.eps \
-       pictures/nta-receiving-message.gif 
+       pictures/nta-receiving-message.gif
 
 BUILT_SOURCES = Doxyfile.rfc
 
index 8d5bdce4326cc7171b2cad331ef2112966eda2e1..0dd8beb11e0a1ca8759301911c2a5e94ac0cabfc 100644 (file)
@@ -145,9 +145,9 @@ below.
        @ref sip_min_expires "Min-Expires",
        @ref sip_mime_version "MIME-Version",
        @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),
-       @ref sip_p_preferred_identity "P-Preferred-Identity" 
+       @ref sip_p_preferred_identity "P-Preferred-Identity"
         (extension in @VERSION_1_12_7),
        @ref sip_priority "Priority",
        @ref sip_proxy_authenticate "Proxy-Authenticate",
@@ -479,7 +479,7 @@ below.
        @RFC3325: Asserted Identity
     </th>
     <td>
-       Sofia-SIP supports 
+       Sofia-SIP supports
        @ref sip_p_asserted_identity "P-Asserted-Identity" and
        @ref sip_p_preferred_identity "P-Preferred-Identity" headers
         (generating, parsing and syntax checking). Also the non-standard
@@ -952,7 +952,7 @@ below.
        (generating, parsing and syntax checking).
 
         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
        response (@ref nua_i_refer "on client side").
 
@@ -972,7 +972,7 @@ below.
     <td>
        Sofia-SIP provides function sip_response_terminates_dialog() that
        can be used to determine the effect of error response with dialog.
-       
+
        The nua UA engine uses sip_response_terminates_dialog().
     </td>
     <td>
@@ -1131,7 +1131,7 @@ below.
     <td>
         Application must take care of:
        - Audio or video processing
-        - Generating a=rtpmap or a=fmtp lines when needed 
+        - Generating a=rtpmap or a=fmtp lines when needed
     </td>
 </tr>
 
index 718132ab54b6f72299a2ba98a9418cb562285251..2b01c66aef3fb8cf84c244316cf7158b145f23d0 100644 (file)
@@ -1,33 +1,33 @@
 /*!
 
 @page docguide Documentation Guidelines
+
 @section doxygen Using Doxygen
 
 Doxygen is a document generation program, used by many C/C++ projects. Its
-home page is at <a href="http://www.doxygen.org">http://www.doxygen.org</a>. 
+home page is at <a href="http://www.doxygen.org">http://www.doxygen.org</a>.
 The Sofia documentation is written using Doxygen.
 
 Doxygen works by extracting the documentation data both from the actual
-C/C++ source code and from the specially formatted comments. 
-The comments can contain some Javadoc-like 
-@ref doxycommands "special commands". 
+C/C++ source code and from the specially formatted comments.
+The comments can contain some Javadoc-like
+@ref doxycommands "special commands".
 
 In general the the style of the comments and documentation should follow the
 <a href="http://java.sun.com/j2se/javadoc/writingdoccomments/">
 javadoc style guide</a>.
 
 A Doxygen comment must either contain reference about the entity
-it is describing, e.g., command 
+it is describing, e.g., command
 \@file when describing files:
 @verbatim
 /**
- * @file foo.c 
- * 
+ * @file foo.c
+ *
  * Implementation of foo. The foo takes care of grokking xyzzy.
- * 
+ *
  * @author Jaska Jokunen <jaska.jokunen@company.com> \n
- * 
+ *
  * @date Created: Wed Oct 20 15:06:51 EEST 2004 jasjoku
  */
 @endverbatim
@@ -40,7 +40,7 @@ comment. For example, documenting a function happens like this:
 /**
  * Orches a candometer. If orching candometer is not possible, it
  * tries to schadule hearping.
- * 
+ *
  * @param[in]  k        pointer to a candometer
  * @param[in]  level    orching level
  * @param[out] return_hearping return value for schaduled hearping
@@ -59,15 +59,15 @@ int orch(cando_t *k, int level, hearping_t *return_hearping)
 @subsection doxyfile Doxyfile and Doxyfile.conf
 
 The doxygen options are specified through a configuration file,
-<i>Doxyfile</i>. As a convention, a module-specific Doxyfile includes 
-a common file libsofia-sip-ua/docs/Doxyfile.conf. This makes it possible 
+<i>Doxyfile</i>. As a convention, a module-specific Doxyfile includes
+a common file libsofia-sip-ua/docs/Doxyfile.conf. This makes it possible
 to keep the module-specific Doxyfiles as clean as possible:
 
 @code
 PROJECT_NAME         = "ipt"
 OUTPUT_DIRECTORY     = ../docs/ipt
 
-INPUT               = ipt.docs . 
+INPUT               = ipt.docs .
 
 @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
 subdirectory at top level. A separate output directory is created for
 each submodule under it. Doxytags for the module are generated in the @e
-doxytags file in the output directory. 
+doxytags file in the output directory.
 
 @subsection module_docs Module documentation in \<module\>.docs
 
@@ -105,7 +105,7 @@ Utility library for IP Telephony applications.
 
 @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
 the commands are explained in the manual.
-The commands include 
+The commands include
 - @ref doxystyle "style commands (@@a, @@b, @@c, @@e, @@em, @@p)"
 - @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
 @@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
 media-type of the message body, e.g., @c audio/amr would be AMR-encoded
 audio." is produced with commands like
 @code
-The @b Content-Type header @a ct specifies the @e media-type of 
+The @b Content-Type header @a ct specifies the @e media-type of
 the message body, e.g., @c audio/amr would be AMR-encoded audio.
-@endcode 
+@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.
 
 @subsection doxyfuncs Function Parameters and Return Values - @param, @return, @retval
@@ -150,11 +150,11 @@ values, e.g., enumeration or success/failure indication.
 
 @verbatim
 /**Schadule hearping.
- * 
+ *
  * The function schadule() schadules a hearping.
- * 
+ *
  * @param[in] h pointer to hearping
- * 
+ *
  * @retval 0  hearping was successful
  * @retval -1 an error occurred
  */
@@ -170,12 +170,12 @@ An example code fragment can be included using @@code and @@endcode
 commands.
 @verbatim
 /**Destroy a hearping.
- * 
+ *
  * The function hearping_destroy() deinitializes a hearping and
- * reclaims the memory allocated for it. 
- * 
+ * reclaims the memory allocated for it.
+ *
  * @param[in,out] h pointer to pointer to hearping
- * 
+ *
  * The function clears the pointer to hearping, so it must be called
  * with a pointer to pointer:
  * @code
@@ -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
 structure, it is possible to use grouping commands @@defgroup and @@ingroup.
 The command @@defgroup creates a group, and @@ingroup adds an entry to an
-group. 
+group.
 
 @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.
 
 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
 to use the @@ref command.
index b7eb26492dec0c259eba6e191a0857846f66255d..d00ecc381eeac3a5451d8dcd21990eb47dc4742f 100644 (file)
@@ -8,39 +8,39 @@ This document contains automatically generated reference documentation
 for Sofia-SIP components. Some introductory material and
 pointers to the example code are also included.
 
-For a list of module specific pages, see @ref subdirs 
+For a list of module specific pages, see @ref subdirs
 "source tree structure" or direct links to submodules:<br>
-<a href="nua/index.html">nua</a> 
-<a href="su/index.html">su</a> 
-<a href="features/index.html">features</a> 
-<a href="soa/index.html">soa</a> 
-<a href="sdp/index.html">sdp</a> 
-<a href="nta/index.html">nta</a> 
-<a href="tport/index.html">tport</a> 
-<a href="sresolv/index.html">sresolv</a> 
-<a href="sip/index.html">sip</a> 
-<a href="msg/index.html">msg</a> 
-<a href="url/index.html">url</a> 
-<a href="stun/index.html">stun</a> 
-<a href="iptsec/index.html">iptsec</a> 
-<a href="nea/index.html">nea</a> 
-<a href="nth/index.html">nth</a> 
-<a href="http/index.html">http</a> 
-<a href="bnf/index.html">bnf</a> 
-<a href="ipt/index.html">ipt</a> 
+<a href="nua/index.html">nua</a>
+<a href="su/index.html">su</a>
+<a href="features/index.html">features</a>
+<a href="soa/index.html">soa</a>
+<a href="sdp/index.html">sdp</a>
+<a href="nta/index.html">nta</a>
+<a href="tport/index.html">tport</a>
+<a href="sresolv/index.html">sresolv</a>
+<a href="sip/index.html">sip</a>
+<a href="msg/index.html">msg</a>
+<a href="url/index.html">url</a>
+<a href="stun/index.html">stun</a>
+<a href="iptsec/index.html">iptsec</a>
+<a href="nea/index.html">nea</a>
+<a href="nth/index.html">nth</a>
+<a href="http/index.html">http</a>
+<a href="bnf/index.html">bnf</a>
+<a href="ipt/index.html">ipt</a>
 
 @section who Contact Information
 
-You can download latest Sofia SIP from the project 
-<a href="http://sofia-sip.sf.net">home page</a> at 
+You can download latest Sofia SIP from the project
+<a href="http://sofia-sip.sf.net">home page</a> at
 <a href="sf.net">Sourceforge.net</a>.
 
 Please contact us if you have questions regarding this software:
 
-<ul> 
+<ul>
 <li>Pekka Pessi <Pekka.Pessi@nokia.com></li>
 <li>Kai Vehmanen <Kai.Vehmanen@nokia.com></li>
-</ul> 
+</ul>
 
 Or post to the Sofia-SIP mailing list:
 
@@ -68,7 +68,7 @@ Common runtime library:
 SIP Signaling:
  - <a href="nua/index.html">"nua" - SIP User Agent library</a>
  - <a href="nea/index.html">"nea" - SIP Event API</a>
- - <a href="iptsec/index.html">"iptsec" - 
+ - <a href="iptsec/index.html">"iptsec" -
     Digest authentication for HTTP and SIP</a>
  - <a href="nta/index.html">"nta" - SIP transaction engine</a>
  - <a href="tport/index.html">"tport" - Message transport</a>
@@ -103,7 +103,7 @@ This document gives general guidelines on generic C style and code
 formatting within Sofia-SIP. The guidelines include identifier naming
 conventions, indenting convention, and tool usage directions.
 
-Please note that C style is always a matter of taste. 
+Please note that C style is always a matter of taste.
 
 @section naming Naming Conventions
 
@@ -177,7 +177,7 @@ The default indentation can be achieved with GNU indent with options
 -saw -nsc -nsob -nss
 @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
   for (;;) {
@@ -220,7 +220,7 @@ separate C files and isolated from the rest of the software with a
 wrapper interface.
 
 SU module handles abstraction to OS specific functionality such as
-memory management, sockets, threads and time functions. 
+memory management, sockets, threads and time functions.
 
 @subsection ansi_99 ANSI C 99 features
 
@@ -322,7 +322,7 @@ struct foo {
 
 If compiler decides to pack this structure, this code generates a
 structure that has @a bar and @a foo in the first seven bits, and then
-@a something beginning from the next 32 bit boundary. 
+@a something beginning from the next 32 bit boundary.
 
 One problem arises when using packed bit-fields: on ARM it is
 generally not possible to access a 32 bit field that does not start from
@@ -348,9 +348,9 @@ binary protocols), don't use them.
 @section file_organization File and Directory Structure
 
 A Sofia-SIP library module can be defined as a subdirectory under the
-libsofia-sip-ua directory hierarchy that contains a file \<modulename\>.docs 
-(where the \<modulename\> of course referes to the actual name of 
-the module). 
+libsofia-sip-ua directory hierarchy that contains a file \<modulename\>.docs
+(where the \<modulename\> of course referes to the actual name of
+the module).
 
 In case you like to start developing a new module, please
 contact Sofia-SIP development team so that they can help you to set up
@@ -364,16 +364,16 @@ An overview of the contents of a module directory:
     Contains any pictures/images
     that are needed by the module documentation. The
     file formats to use are GIF (for html pages) and
-    EPS (for latex). If some program (e.g. MS Visio) is 
+    EPS (for latex). If some program (e.g. MS Visio) is
     used to create the pictures, also the original
     files must be stored here.\n
     (Note that old modules may have "images" subdirectory instead of
     "pictures")
   - files Makefile.am \n
     See section @ref build "dealing with GNU Autotools" below.
-  - (optionally) source code file(s) of the module and module tests. 
+  - (optionally) source code file(s) of the module and module tests.
     The source code file(s) can also be located in subdirectories if necesary.
-    
+
 
 @section oo_with_c Writing Object-Oriented Code
 
@@ -423,17 +423,17 @@ header-specific data, like header name.
 
 @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
 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
 casted as a pointer to a base object. In other words, the derived object
 must have the base object at the beginning of its memory area:
 
 @code
-struct derived 
+struct derived
 {
   struct base base[1];
   int         extra;
@@ -452,19 +452,19 @@ The third alternative works because base was used as a 1-element array.
 
 @subsection oo_templates Templates
 
-There are a few template types implemented as macros in Sofia libraries. 
+There are a few template types implemented as macros in Sofia libraries.
 They include hash table, defined in <sofia-sip/htable.h>, which can be used
 to define hash tables types and accessor functions for different object, and
 red-black tree, defined in <sofia-sip/rbtree.h>.
 
 @section memory Memory Management
 
-The home-based memory management is useful when a lot of memory blocks are 
-allocated for given task. The allocations are done via the memory home, 
-which keeps a reference to each allocated memory block. When the memory 
-home is then freed, it will free all memory blocks to which it has 
-reference. This simplifies application logic because application code does 
-not need to keep track of the allocated memory and free every allocated block 
+The home-based memory management is useful when a lot of memory blocks are
+allocated for given task. The allocations are done via the memory home,
+which keeps a reference to each allocated memory block. When the memory
+home is then freed, it will free all memory blocks to which it has
+reference. This simplifies application logic because application code does
+not need to keep track of the allocated memory and free every allocated block
 separately.
 
 See documentation of <sofia-sip/su_alloc.h> and @ref su_alloc "memory managment tutorial"
@@ -502,8 +502,8 @@ A typical example of use of a memory home is to have a memory home structure
 @subsection combining Combining allocations
 
 Another place where home-based memory management makes programmers
-life easier is case where a sub-procedure makes multiple memory allocations 
-and, in case the sub-procedure fails, all the allocations must be released 
+life easier is case where a sub-procedure makes multiple memory allocations
+and, in case the sub-procedure fails, all the allocations must be released
 and, in case the sub-procedure is succesfull, all allocations must be
 controlled by upper level memory management.
 
@@ -522,7 +522,7 @@ controlled by upper level memory management.
     }
     /* destroy temporary memory home (and registered allocations) */
     /* 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);
 
     /* return ok/not-ok */
@@ -542,9 +542,9 @@ Here are some ideas of what you should test:
   - valid args
   - not valid args
 - Aim for 100% line coverage\n
-  (If there is a line of code that you have not tested, you don't know 
+  (If there is a line of code that you have not tested, you don't know
   if its working.) \n
-  For selected part of code you should also aim for 
+  For selected part of code you should also aim for
   100% branch/path coverage.\n
   But be anyway reasonable with these because in practise complete
   coverage is next to impossible to achive (so 80% is ok in practise).
@@ -573,13 +573,13 @@ test_foo_LDADD = -L. -lmy
 
 Each test program should either return zero for success or a non-zero
 error code in its main function. Now when you run "make check",
-@b my_test_foo and @b my_test_bar will be built and then run. 
+@b my_test_foo and @b my_test_bar will be built and then run.
 Make will print a
-summary of how the tests went. As these tests are run from the build 
-system, the tests must be non-interactive (no questions asked) and not 
+summary of how the tests went. As these tests are run from the build
+system, the tests must be non-interactive (no questions asked) and not
 rely on any files that are not in version control system.
 
-Sofia SIP's top-level makefile contains a recursive check target, so 
+Sofia SIP's top-level makefile contains a recursive check target, so
 you can use "cd sofia-sip ; make check" to run all the existing tests
 with a single command.
 
@@ -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">
 developer.gnome.org</a>. <a href="http://sources.redhat.com/autobook">Autobook</a>
 provides more detailed documentation for autoconf and automake.
-The <a href="http://www.gnu.org/manual/make/">GNU make manual</a> 
+The <a href="http://www.gnu.org/manual/make/">GNU make manual</a>
 is also a good source of information.
 
 @subsection autogen_sh autogen.sh
@@ -629,14 +629,14 @@ Contact Sofia-SIP development team, if you need changes to these files.
 
 @subsection aclocal_m4 aclocal.m4
 
-The aclocal.m4 contains the definitions of the autoconf macros used in 
+The aclocal.m4 contains the definitions of the autoconf macros used in
 @b configure.ac.
 
 This file is generated by aclocal command.
 
 @subsection Makefile_am Makefile.am
 
-Makefile.am is where you define what programs and libraries should 
+Makefile.am is where you define what programs and libraries should
 be built, and also what source files are needed to create them.
 When you run automake, it creates the file Makefile.in.
 
@@ -644,12 +644,12 @@ This file is created by the developer of the module.
 
 @subsection configure configure
 
-When you run configure script, it performs all the checks defined in 
-@b configure.ac and then replaces all @b xxx.in files with equivalent 
-@b xxx files. All @c @@FOO@@ variables in the source @b *.in files are 
+When you run configure script, it performs all the checks defined in
+@b configure.ac and then replaces all @b xxx.in files with equivalent
+@b xxx files. All @c @@FOO@@ variables in the source @b *.in files are
 replaced with values found during the configuration process. For instance
-the variable @c @@srcdir@@ in @b Makefile.in is replaced in @b Makefile 
-with the source directory path (useful when compiling outside the main 
+the variable @c @@srcdir@@ in @b Makefile.in is replaced in @b Makefile
+with the source directory path (useful when compiling outside the main
 source tree).
 
 This file is generated by autoconf command.
@@ -658,14 +658,14 @@ This file is generated by autoconf command.
 
 This script stores the last parameters given to configre command.
 If necessary you can rerun the last given configure script (with given
-parameters) by using command "./config.status -r" or 
+parameters) by using command "./config.status -r" or
 "./config.status --recheck".
 
 This file is generated by configure script.
 
 @subsection config_cache config.cache
 
-This file contains results of the various checks that configure script 
+This file contains results of the various checks that configure script
 performed. In case the configure script failed, you might try to
 delete this file and run the configure script again.
 
@@ -673,8 +673,8 @@ This file is generated by configure script.
 
 @subsection Makefile Makefile
 
-The @b Makefile contains the actual rules how to build the target 
-libraries and program. It is used by the @c make program. @b Makefile 
+The @b Makefile contains the actual rules how to build the target
+libraries and program. It is used by the @c make program. @b Makefile
 is generated from @b Makefile.in when you run @c autoconf command.
 Ensure that "make dist" and "make install" targets work.
 
@@ -726,7 +726,7 @@ The defined debug output levels are:
 - 7 SU_DEBUG_7() - media protocol actions (incoming packets, ...)
 - 9 SU_DEBUG_9() - entering/exiting functions, very verbatim progress
 
-In addition to the macros mentioned above, there is also functions for 
+In addition to the macros mentioned above, there is also functions for
 printing logging messages:
 - su_llog(), su_vllog()
 - su_perror(), su_perror2()
index 36d1bc9f18cf865f2730c0627c73ac0f0680b136..1e90d1db6585b572e61d9a02f254fc1c968a6647 100644 (file)
  */
 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.
  */
 char const * sofia_sip_has_smime;
 
 
-/** The name and version of software package providing TLS functionality, 
- *  NULL if none. 
- * 
+/** The name and version of software package providing TLS functionality,
+ *  NULL if none.
+ *
  * TLS over TCP is used as transport for SIP messages when using SIPS
  * scheme. Using TLS over TCP with SIP is described in @RFC3261.
  */
@@ -61,16 +61,16 @@ char const * sofia_sip_has_tls = tls_version;
 char const * sofia_sip_has_tls;
 #endif
 
-/** The name and version of software package providing DTLS functionality, 
- *  NULL if none. 
+/** The name and version of software package providing DTLS functionality,
+ *  NULL if none.
  *
  * DTLS or TLS over datagram transport (UDP) can be used as transport for
  * SIP messages.
  */
 char const * sofia_sip_has_dtls;
 
-/** The name and version of software package providing TLS over SCTP functionality, 
- *  NULL if none. 
+/** The name and version of software package providing TLS over SCTP functionality,
+ *  NULL if none.
  *
  * TLS over SCTP can be used as transport for SIP messages.
  */
@@ -80,8 +80,8 @@ char const * sofia_sip_has_tls_sctp;
 #include <sigcomp.h>
 #endif
 
-/** The name and version of software package providing SigComp functionality, 
- *  NULL if none. 
+/** The name and version of software package providing SigComp functionality,
+ *  NULL if none.
  *
  * 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;
 #endif
 
-/** The name and version of software package providing STUN functionality, 
- *  NULL if none. 
+/** The name and version of software package providing STUN functionality,
+ *  NULL if none.
  *
  * 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;
 #endif
 
-/** The name and version of software package providing TURN functionality, 
- *  NULL if none. 
+/** The name and version of software package providing TURN functionality,
+ *  NULL if none.
  *
  * TURN is a protocol used to traverse NATs or firewalls with TCP or UDP.
  */
 char const * sofia_sip_has_turn;
 
-/** The name and version of software package providing UPnP functionality, 
- *  NULL if none. 
+/** The name and version of software package providing UPnP functionality,
+ *  NULL if none.
  *
  * UPnP (Universal Plug and Play) can be used to traverse NATs or firewalls.
  */
 char const * sofia_sip_has_upnp;
 
-/** The name and version of software package providing SCTP functionality, 
+/** The name and version of software package providing SCTP functionality,
  *  NULL if none.
  *
  * SCTP can be used as transport for SIP messages. The software providing it
@@ -126,7 +126,7 @@ char const * sofia_sip_has_upnp;
 char const * sofia_sip_has_sctp;
 /* 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.
  *
  * IPv6 can be used to send SIP messages.
index b198220dab97ec75f648395f38f97ec734e0c645..9bde692e9c3e9e0f7ce3232886d3cf0cae613eec 100644 (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
 contains the name and release of currently available include files.
 
-The Sofia SIP binary API hides some protocols used under the SIP stack. 
-While the binary API stays the same, the features are not necessarily there. 
+The Sofia SIP binary API hides some protocols used under the SIP stack.
+While the binary API stays the same, the features are not necessarily there.
 These features are mainly related to encryption, compression and underlying
 transports.
 
index eb4fca4ee30fc761aaba37060d8b33db5b4eec47..8ba200bd29769e862a56882bd2469d04d16b2e03 100644 (file)
@@ -1,7 +1,7 @@
 PROJECT_NAME         = "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 = ../docs/Doxyfile.conf
index 808b6f639ad677820f6a928f0c11cf9fb50903bf..d683c7132ac10b2ba7b23566d060104db59f4fe8 100644 (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_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_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) \
                        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}
 
-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
        ${AWK_HTTP_AWK} PR=$@ TEMPLATE=${srcdir}/sofia-sip/http_protos.h.in ${SS_HTTP_H}
 
index 684d8390a9ab3a055ebcf755a0b7c4ba9ea763f6..06dc46785e56a41d3dcf7d52f6cb1620e1070fea 100644 (file)
  *  - @c http_X_t is the structure used to store parsed header,
  *  - @c HTTP_X_INIT() initializes a static instance of http_X_t,
  *  - @c http_X_p() tests if header object is instance of header X,
- *  - @c http_X_make() is a macro that creates a header X object by 
+ *  - @c http_X_make() is a macro that creates a header X object by
          decoding given string,
- *  - @c http_X_dup() duplicates (deeply copies) the header X (macro), 
+ *  - @c http_X_dup() duplicates (deeply copies) the header X (macro),
  *  - @c http_X_copy() is a macro that copies the header X (macro),
- *  - @c #msg_hclass_t http_X_class[] contains the @em header @em class 
+ *  - @c #msg_hclass_t http_X_class[] contains the @em header @em class
  *    for header X.
- * 
+ *
  * In addition to this interface, the parser provider interface is
  * documented in the <a href="../sip/group__sip__parser.html">SIP Parser module</a>.
  * The parser provider interface makes it possible to extend HTTP parser with
index 1e662a81bbe6010dbfeeb8309eff0ac2a224c697..f93adf7d1628b6be185904211b1df8fd7c9f6aa1 100644 (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 ||
       http_version_d(&s, &st->st_version) < 0 || *s ||
-      msg_uint32_d(&status, &code) == -1 || 
+      msg_uint32_d(&status, &code) == -1 ||
       status[0])
     return -1;
 
@@ -341,7 +341,7 @@ HTTP_HEADER_CLASS_LIST(allow, "Allow", list);
 #define http_authentication_info_dup_one msg_list_dup_one
 
 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);
 
 /* ====================================================================== */
@@ -427,7 +427,7 @@ HTTP_HEADER_CLASS_LIST(connection, "Connection", list_critical);
 /**@ingroup http_content_range
  * @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.
  *
  * 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 http_from From header. 
+/**@HTTP_HEADER http_from From header.
  *
  * @code
  *    From   = "From" ":" mailbox
@@ -773,7 +773,7 @@ HTTP_HEADER_CLASS_LIST(if_match, "If-Match", list);
 /**@ingroup http_if_modified_since
  * @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.
  *
  * 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
 
 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);
 
 /* ====================================================================== */
@@ -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 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
  * 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
  *   If-Range = "If-Range" ":" ( entity-tag / HTTP-date )
  * @endcode
- */    
+ */
 
 /** Parse If-Range header */
 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
  * @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.
  *
  * 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
 
 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);
 
 
index f9f8fa5d8e52d80a2ae7dd0a41cd7ffa564005bd..898ed3a0c89fa7737632fc882d26c5ebc7230933 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@CFILE http_extra.c 
+/**@CFILE http_extra.c
  *
  * Extra HTTP headers
  *
@@ -162,7 +162,7 @@ static issize_t cookie_scanner(char *s)
     }
     else {
       s += strcspn(s, ",;" LWS);
-      if (s == v) 
+      if (s == v)
        return -1;
     }
 
@@ -352,7 +352,7 @@ static issize_t set_cookie_scanner(char *s)
 
   /* Special cases from Netscape spec */
   if (LOOKING_AT(s, "expires=")) {
-    msg_time_t value; 
+    msg_time_t value;
     msg_date_d((char const **)&rest, &value);
   } else if (LOOKING_AT(s, "path=/")) {
     for (;;) {
@@ -366,8 +366,8 @@ static issize_t set_cookie_scanner(char *s)
   }
 #undef LOOKING_AT
 
-  if (IS_LWS(*rest)) { 
-    *rest++ = '\0'; skip_lws(&rest); 
+  if (IS_LWS(*rest)) {
+    *rest++ = '\0'; skip_lws(&rest);
   }
 
   return rest - s;
index 60c9e9d95845b851c63bef1a460ff16211fd5abc..4ae01598320d540ebad119c90f2e7bf0c5a6d68b 100644 (file)
@@ -88,7 +88,7 @@ int http_request_complete(msg_t *msg)
       msg_fragment_clear(http->http_content_length->l_common);
     }
   }
-  
+
   if (!http->http_separator)
     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 */
 int http_message_complete(msg_t *msg, http_t *http)
-{ 
+{
 #if 1
   if (!http->http_content_length) {
     http_content_length_t *l;
     http_payload_t *pl;
     size_t len = 0;
-    
+
     for (pl = http->http_payload; pl; pl = pl->pl_next)
       len += pl->pl_len;
 
@@ -148,8 +148,8 @@ int http_message_complete(msg_t *msg, http_t *http)
 }
 
 /** Add headers from the request to the response message. */
-int http_complete_response(msg_t *msg, 
-                          int status, char const *phrase, 
+int http_complete_response(msg_t *msg,
+                          int status, char const *phrase,
                           http_t const *request)
 {
   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);
 }
 
-http_header_t *http_header_format(su_home_t *home, 
+http_header_t *http_header_format(su_home_t *home,
                                  msg_hclass_t *hc,
                                  char const *fmt,
                                  ...)
index d3b2b3578120ea71a4ce128b3bc217df051c0a52..fe4bba289730c1e6082f97cb36d0c50c180d7d47 100644 (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) \
   (((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 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')))
       return 0;
 
-    m = CRLF_TEST(b); 
+    m = CRLF_TEST(b);
 
     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[0] &&
-       strcasecmp(http->http_transfer_encoding->k_items[0], 
+       strcasecmp(http->http_transfer_encoding->k_items[0],
                   "identity") != 0) {
       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;
   /* We cannot parse multipart/byteranges ... */
   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)
     return -1;
   else if (MSG_IS_MAILBOX(flags)) /* message fragments */
     body_len = 0;
-  else if (http->http_request) 
+  else if (http->http_request)
     body_len = 0;
   else if (eos)
     body_len = bsiz;
-  else 
+  else
     return 0;                  /* XXX */
 
   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;
 }
 
-/** Extract a chunk. 
+/** Extract a chunk.
  *
  * @retval -1    error
  * @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;
   char *b0 = b, *s;
   union {
-    msg_header_t *header;  
+    msg_header_t *header;
     msg_payload_t *chunk;
   } h = { NULL };
   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);
 
     /* Skip crlf */
-    b += crlf; bsiz -= crlf;  
+    b += crlf; bsiz -= crlf;
   }
 
   /* Now, looking at the chunk header */
-  n = strcspn(b, CRLF); 
-  if (!eos && n == bsiz) 
+  n = strcspn(b, CRLF);
+  if (!eos && n == bsiz)
     return 0;
   crlf = CRLF_TEST(b + n);
-  
+
   if (n == 0) {
     if (crlf == bsiz && eos) {
       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;
 
-    if ((eos && bsiz == 0) || crlf == 2 || 
+    if ((eos && bsiz == 0) || crlf == 2 ||
        (crlf == 1 && (bsiz > 1 || b[0] == '\n'))) {
       /* Shortcut - We got empty trailers */
       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;
 
     /* Extract chunk */
-    chunk = msg_extract_payload(msg, http, 
+    chunk = msg_extract_payload(msg, http,
                                &h.header, chunk_len + (b - b0),
                                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_len -= (b - b0);
     }
-  
+
     return chunk;
   }
 }
@@ -312,12 +312,12 @@ int http_version_d(char **ss, char const **ver)
   char const *result;
   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])) {
     result = http_version_1_1;
     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])) {
     result = http_version_1_0;
     s += version_size;
@@ -348,7 +348,7 @@ int http_version_d(char **ss, char const **ver)
       memmove(s + l1 + 1, s + n - l2, l2);
       s[l1 + 1 + l2] = 0;
 
-      /* Compare again with compacted version */ 
+      /* Compare again with compacted version */
       if (strcasecmp(s, http_version_1_1) == 0)
        result = http_version_1_1;
       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';
-  
+
   *ss = s;
 
-  if (ver) 
+  if (ver)
     *ver = result;
 
   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)
 
-  if (c >= 'a' && c <= 'z') 
+  if (c >= 'a' && c <= 'z')
     c += 'A' - 'a';
 
   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 'H': if (MATCH(s, "HEAD")) code = http_method_head; 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
             if (MATCH(s, "PUT")) code = http_method_put; 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
  * 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
- * return_value argument. 
+ * return_value argument.
  *
  * @note The @a query string will be modified.
  *
@@ -538,15 +538,15 @@ issize_t http_query_parse(char *query,
     valuelen = namelen + strcspn(q + namelen, "&");
 
     q_next = q + valuelen;
-    if (*q_next) 
+    if (*q_next)
       *q_next++ = '\0';
 
-    value = q + namelen; 
+    value = q + namelen;
     has_value = (*value) != '\0'; /* is the part in form of name=value? */
     if (has_value)
       *value++ = '\0';
 
-    name = url_unescape(q, q); 
+    name = url_unescape(q, q);
 
     if (has_value) {
       namelen = strlen(name);
@@ -570,4 +570,4 @@ issize_t http_query_parse(char *query,
   }
 
   return N;
-} 
+}
index 993664e649f4792f49c75b47f263cc1010d75049..d5ffdb05b191de601e31e48b52aa0a30e000f8d4 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 /**@internal
- * @CFILE http_parser_table.c 
+ * @CFILE http_parser_table.c
  * @brief HTTP parser table
  *
  * #AUTO#
index 222925f89a365202a8630970728fa4c6b0f98c04..aef456d2932b1aadfa1035583b7a392510006e3b 100644 (file)
@@ -79,7 +79,7 @@ char const
 
 char const *http_status_phrase(int status)
 {
-  if (status < 100 || status > 699) 
+  if (status < 100 || status > 699)
     return NULL;
 
   switch (status) {
index 57cc45030ce93005fd3002ab6bd5912ab93fd896..531a2c4e71a903395d8029b5d458298f14a8a556 100644 (file)
@@ -1,4 +1,4 @@
-/**@HTTP 
+/**@HTTP
  * @IFILE http_tag.c.in
  *
  * Template for <http_tag.c>.
@@ -35,7 +35,7 @@
  * This file is autogenerated from <http_tag.c.in>.
  *
  * #AUTO#
- * 
+ *
  * @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_version = STRTAG_TYPEDEF(version);
-tag_typedef_t httptag_header = 
+tag_typedef_t httptag_header =
        {{ TAG_NAMESPACE, "header", httphdrtag_class, 0 }};
 tag_typedef_t httptag_header_str = STRTAG_TYPEDEF(header_str);
 
index aaa627b0993f28960a000d3264f078f8c93fc13f..f69ff0cdaaf2ca89c1f1ea295af6df5cceadaae4 100644 (file)
@@ -49,7 +49,7 @@
 #include <sofia-sip/http_tag_class.h>
 #include <sofia-sip/su_tagarg.h>
 
-tag_class_t httphdrtag_class[1] = 
+tag_class_t httphdrtag_class[1] =
   {{
     sizeof(httphdrtag_class),
     /* tc_next */     NULL,
@@ -65,7 +65,7 @@ tag_class_t httphdrtag_class[1] =
     /* tc_scan */     msghdrtag_scan,
   }};
 
-tag_class_t httpstrtag_class[1] = 
+tag_class_t httpstrtag_class[1] =
   {{
     sizeof(httpstrtag_class),
     /* tc_next */     NULL,
@@ -81,7 +81,7 @@ tag_class_t httpstrtag_class[1] =
     /* tc_scan */     msghdrtag_scan,
   }};
 
-tag_class_t httpmsgtag_class[1] = 
+tag_class_t httpmsgtag_class[1] =
   {{
     sizeof(httpmsgtag_class),
     /* tc_next */     NULL,
@@ -100,7 +100,7 @@ tag_class_t httpmsgtag_class[1] =
 /** Filter a HTTP header structure. */
 tagi_t *httptag_filter(tagi_t *dst,
                      tagi_t const f[],
-                     tagi_t const *src, 
+                     tagi_t const *src,
                      void **bb)
 {
   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.
  */
@@ -209,8 +209,8 @@ int http_add_tl(msg_t *msg, http_t *http,
     else if (tag == httptag_header_str) {
       if (msg_header_add_str(msg, http, (char const *)value) < 0)
        break;
-    } 
-    else 
+    }
+    else
       continue;
 
     retval++;
@@ -218,7 +218,7 @@ int http_add_tl(msg_t *msg, http_t *http,
 
   ta_end(ta);
 
-  if (t) 
+  if (t)
     return -1;
 
   return retval;
index a80fd3a97e6c8a878d91ac2e3f81ad88540cadc3..d5bb617914ecefddd5e3ec461a730dc2eba75ad9 100644 (file)
 /** Defined when <sofia-sip/http.h> has been included. */
 #define HTTP_H
 
-/**@file sofia-sip/http.h 
- * 
+/**@file sofia-sip/http.h
+ *
  * HTTP message, methods, headers.
- * 
+ *
  * @sa <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -50,7 +50,7 @@
 SOFIA_BEGIN_DECLS
 
 /* ----------------------------------------------------------------------
- * 1) Constants 
+ * 1) Constants
  */
 
 #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;
 /** Unknown header. */
 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;
-/** Entity-body */ 
+/** Entity-body */
 typedef msg_payload_t               http_payload_t;
 /** Time in seconds since 01-Jan-1900. */
 typedef unsigned long               http_time_t;
@@ -327,7 +327,7 @@ struct http_s {
   unsigned                   http_size;                 /**< Size of this structure */
   int                        http_flags;                          /**< Flags */
   http_error_t              *http_error;              /**< Erroneous headers */
-  
+
   http_request_t            *http_request;                /**< Request line  */
   http_status_t             *http_status;                   /**< Status line */
 
@@ -389,19 +389,19 @@ struct http_s {
 
   /* === Headers end here */
   http_header_t             *http_unknown;             /**< Unknown headers. */
-  http_separator_t          *http_separator;     
+  http_separator_t          *http_separator;
                                  /**< Separator between message and payload */
   http_payload_t            *http_payload;         /**< Message entity-body */
 };
 
 /**Union representing any HTTP header.
- * 
+ *
  * Each different header is an array of size 1.
- * 
+ *
  * @deprecated
  */
 union http_header_u {
-  msg_common_t                sh_common[1]; 
+  msg_common_t                sh_common[1];
   struct {
     msg_common_t              shn_common;
     http_header_t            *shn_next;
index dc116e34be859c4d4f4e8b7312b6e157d7611b64..1394889c08661adfdf0e4ead4c63450b2e3993f3 100644 (file)
@@ -28,9 +28,9 @@
 
 /**@file sofia-sip/http_hclasses.h
  * @brief HTTP header classes.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  */
 
 #ifndef MSG_TYPES_H
index 6f8cf29fa95fcfd2a75571c470b84f8027eed79e..ba34a605100bd04a75b873d6ca8328582f959484 100644 (file)
@@ -26,7 +26,7 @@
 /** Defined when <sofia-sip/http_header.h> has been included.*/
 #define HTTP_HEADER_H
 
-/**@file sofia-sip/http_header.h 
+/**@file sofia-sip/http_header.h
  *
  * HTTP library prototypes.
  *
@@ -85,13 +85,13 @@ SOFIAPUBVAR char const http_version_0_9[];
 /** HTTP 1.0 */
 SOFIAPUBVAR char const http_version_1_0[];
 
-/** HTTP 1.1 version. */ 
+/** HTTP 1.1 version. */
 SOFIAPUBVAR char const http_version_1_1[];
 
 #define HTTP_VERSION_CURRENT http_version_1_1
 
 /* ----------------------------------------------------------------------
- * 3) Prototypes 
+ * 3) Prototypes
  */
 
 /** HTTP parser description. */
@@ -123,7 +123,7 @@ SOFIAPUBFUN int http_strip_hostport(url_t *url);
 
 /** Add required headers to the response message */
 SOFIAPUBFUN int http_complete_response(msg_t *msg,
-                                      int status, char const *phrase, 
+                                      int status, char const *phrase,
                                       http_t const *request);
 
 /** 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 char const *http_header_name(http_header_t const *h, int compact);
 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);
-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);
 SOFIAPUBFUN http_separator_t *http_separator_create(su_home_t *home);
 #endif
@@ -164,7 +164,7 @@ SOFIAPUBFUN http_status_t *http_status_create(su_home_t *home,
                                              char const *version);
 
 /** 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 *port);
 
@@ -184,7 +184,7 @@ SOFIAPUBFUN issize_t http_query_parse(char *query,
                                      ...);
 
 /* ----------------------------------------------------------------------
- * 4) Inlined functions 
+ * 4) Inlined functions
  */
 
 #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 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)
 {
   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
 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;
 }
 
-su_inline 
+su_inline
 http_content_length_t *http_content_length_create(su_home_t *home, uint32_t 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)
 {
   return msg_payload_create(home, data, len);
 }
 
-su_inline 
+su_inline
 http_separator_t *http_separator_create(su_home_t *home)
 {
   return msg_separator_create(home);
index 5801fedf1815ac941eec8bb7a032fc751706462c..22790772e5bf0f9adeacbcbc752f266ddaa5f6f3 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef HTTP_PARSER_H
 /**Defined when <sofia-sip/http_parser.h> has been included.*/
-#define HTTP_PARSER_H 
+#define HTTP_PARSER_H
 /**@file sofia-sip/http_parser.h
  * @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);
 
 /** 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);
 
 SOFIA_END_DECLS
index 8d6ca5686eacc77194dbdb8633e9cf0cb13f877a..b91774acb8c7d798e2007ec6770265245a4c3d8b 100644 (file)
 /** Defined when <sofia-sip/http_protos.h> has been included. */
 #define HTTP_PROTOS_H
 
-/**@file sofia-sip/http_protos.h 
+/**@file sofia-sip/http_protos.h
  *
  * Macros for each HTTP header.
  *
  * #AUTO#
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  */
 
@@ -61,18 +61,18 @@ SOFIA_BEGIN_DECLS
 
 /**@addtogroup http_#xxxxxx#*/ /** @{ */
 
-enum { 
+enum {
   /** Hash of #xxxxxxx_xxxxxxx#. @internal*/
-  http_#xxxxxx#_hash = #hash# 
+  http_#xxxxxx#_hash = #hash#
 };
 
 /**Header class for HTTP #xxxxxxx_xxxxxxx#.
- * 
+ *
  * The header class http_#xxxxxx#_class defines how a HTTP
  * #xxxxxxx_xxxxxxx# is parsed and printed.  It also
  * contains methods used by HTTP parser and other functions
  * to manipulate the http_#xxxxxx#_t header structure.
- * 
+ *
  */
 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;
 
 /**Initializer for structure http_#xxxxxx#_t.
- * 
+ *
  * A static http_#xxxxxx#_t structure must be initialized
  * with the HTTP_#XXXXXX#_INIT() macro. For instance,
- * @code 
- * 
+ * @code
+ *
  *  http_#xxxxxx#_t http_#xxxxxx# = HTTP_#XXXXXX#_INIT;
- * 
+ *
  * @endcode
  * @HI
  */
 #define HTTP_#XXXXXX#_INIT() HTTP_HDR_INIT(#xxxxxx#)
 
 /**Initialize a structure http_#xxxxxx#_t.
- * 
+ *
  * An http_#xxxxxx#_t structure can be initialized with the
  * http_#xxxxxx#_init() function/macro. For instance,
  * @code
- * 
+ *
  *  http_#xxxxxx#_t http_#xxxxxx#;
- * 
+ *
  *  http_#xxxxxx#_init(&http_#xxxxxx#);
- * 
+ *
  * @endcode
  * @HI
  */
@@ -121,20 +121,20 @@ su_inline http_#xxxxxx#_t *http_#xxxxxx#_init(http_#xxxxxx#_t x[1])
 #endif
 
 /**Test if header object is instance of http_#xxxxxx#_t.
- * 
+ *
  * The function http_is_#xxxxxx#() returns true (nonzero) if
  * the header class is an instance of #xxxxxxx_xxxxxxx#
  * object and false (zero) otherwise.
- * 
+ *
  * @param header pointer to the header structure to be tested
- * 
+ *
  * @return
  * The function http_is_x#xxxxxx#() returns true (nonzero) if
  * the header object is an instance of header #xxxxxx# and
  * false (zero) otherwise.
  */
 #if SU_HAVE_INLINE
-su_inline 
+su_inline
 int http_is_#xxxxxx#(http_header_t const *header)
 {
   return header && header->sh_class->hc_hash == http_#xxxxxx#_hash;
@@ -145,27 +145,27 @@ int http_is_#xxxxxx#(http_header_t const *header)
 #endif
 
 /**Duplicate (deep copy) @c http_#xxxxxx#_t.
- * 
+ *
  * The function http_#xxxxxx#_dup() duplicates a header
  * structure @a hdr.  If the header structure @a hdr
  * contains a reference (@c hdr->x_next) to a list of
  * headers, all the headers in the list are duplicated, too.
- * 
+ *
  * @param home  memory home used to allocate new structure
  * @param hdr   header structure to be duplicated
- * 
+ *
  * When duplicating, all parameter lists and non-constant
  * strings attached to the header are copied, too.  The
  * function uses given memory @a home to allocate all the
  * memory areas used to copy the header.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = http_#xxxxxx#_dup(home, http->http_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function http_#xxxxxx#_dup() returns a pointer to the
  * 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
 su_inline
 #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)
      __attribute__((__malloc__));
 
 /**Copy a http_#xxxxxx#_t header structure.
- * 
+ *
  * The function http_#xxxxxx#_copy() copies a header structure @a
  * hdr.  If the header structure @a hdr contains a reference (@c
  * hdr->h_next) to a list of headers, all the headers in that
  * list are copied, too. The function uses given memory @a home
  * to allocate all the memory areas used to copy the header
  * structure @a hdr.
- * 
+ *
  * @param home    memory home used to allocate new structure
  * @param hdr     pointer to the header structure to be duplicated
- * 
+ *
  * When copying, only the header structure and parameter lists
  * attached to it are duplicated.  The new header structure
  * retains all the references to the strings within the old @a
  * header, including the encoding of the old header, if present.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = http_#xxxxxx#_copy(home, http->http_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function http_#xxxxxx#_copy() returns a pointer to
  * 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
 su_inline
 #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)
      __attribute__((__malloc__));
 
 /**Make a header structure http_#xxxxxx#_t.
- * 
+ *
  * The function http_#xxxxxx#_make() makes a new
  * http_#xxxxxx#_t header structure.  It allocates a new
  * header structure, and decodes the string @a s as the
  * value of the structure.
- * 
+ *
  * @param home memory home used to allocate 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
  * http_header_make().
- * 
+ *
  * @return
  * The function http_#xxxxxx#_make() returns a pointer to
  * 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__));
 
 /**Make a #xxxxxxx_xxxxxxx# from formatting result.
- * 
+ *
  * The function http_#xxxxxx#_format() makes a new
  * #xxxxxxx_xxxxxxx# object using formatting result as its
  * value.  The function first prints the arguments according to
  * the format @a fmt specified.  Then it allocates a new header
  * structure, and uses the formatting result as the header
  * value.
- * 
+ *
  * @param home   memory home used to allocate new header structure.
  * @param fmt    string used as a printf()-style format
  * @param ...    argument list for format
- * 
+ *
  * @note This function is usually implemented as a macro calling
  * msg_header_format().
- * 
+ *
  * @return
  * The function http_#xxxxxx#_format() returns a pointer to newly
  * makes header structure, or NULL upon an error.
- * 
+ *
  * @HIDE
  */
 #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;
   va_list ap;
-  
+
   va_start(ap, fmt);
   h = http_header_vformat(home, http_#xxxxxx#_class, fmt, ap);
   va_end(ap);
+
   return (http_#xxxxxx#_t *)h;
 }
 
 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 *)
     msg_header_dup_as(home, http_#xxxxxx#_class, (msg_header_t const *)o);
 }
 
 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 *)
-    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)
 {
   return (http_#xxxxxx#_t *)http_header_make(home, http_#xxxxxx#_class, s);
index 875b21298e5297a16b375d73cc5b391ca6d4ca5f..5893b185b48fe6ba57ed5b9664f2f194f8854fcf 100644 (file)
  *
  */
 
-#ifndef HTTP_STATUS_H 
-#define HTTP_STATUS_H 
+#ifndef HTTP_STATUS_H
+#define HTTP_STATUS_H
 
-/**@file sofia-sip/http_status.h 
+/**@file sofia-sip/http_status.h
  *
  * HTTP status codes.
  *
index f057ef3d2d8b339a749b73cf5d7fcf6acff891fa..c6bd61b8e3c761470513fe65b8e3e470d5e33497 100644 (file)
@@ -105,7 +105,7 @@ SOFIAPUBVAR tag_typedef_t httptag_http_ref;
 #if SU_INLINE_TAG_CAST
 su_inline
 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; }
 #else
 #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.
  *
  * The HTTPTAG_HEADER() macro is used to include a tag item containing an
- * unknown HTTP header in the tag list, e.g., 
- * @code 
+ * unknown HTTP header in the tag list, e.g.,
+ * @code
  * http_header_t *hdr;
  *
  * HTTPTAG_HEADER(hdr).
@@ -199,7 +199,7 @@ SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#;
  *
  * 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.
  *
  * @param s pointer to a string containing http_#xxxxxx#_t value, or NULL.
index e12d378f4ddd9800cfd8a21318a2e79bb5bb4527..34c29cf656665c91fba60a2928a1df2d278e6798 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef HTTP_TAG_CLASS_H
 /**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
  * @brief Tag classes for HTTP headers.
@@ -62,9 +62,9 @@ SOFIA_BEGIN_DECLS
   {{ TAG_NAMESPACE, #t, httpmsgtag_class, \
      (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[],
-                                  tagi_t const *src, 
+                                  tagi_t const *src,
                                   void **bb);
 
 SOFIA_END_DECLS
index 118ea59f0b51d3b95c4fc705f9838a8c0a9a8a8f..c9e698eb1a89c28547e110b59f33ff54b29e3f48 100644 (file)
@@ -189,7 +189,7 @@ msg_t *read_message_byte_by_byte(char const buffer[])
   for (i = 0; i < n;) {
     /* This prevent msg_recv_iovec() from allocating extra slack */
     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) {
       perror("msg_recv_iovec");
@@ -1008,7 +1008,7 @@ static int http_header_test(void)
                              "CUSTOMER=WILE_E_COYOTE; "
                              "path=/; "
                              "expires=Wednesday, 09-Nov-99 23:12:40 GMT");
-    
+
     TEST_1(sc);
     TEST_1(sc->sc_params);
     TEST_S(sc->sc_name, "CUSTOMER=WILE_E_COYOTE");
index 2a59107f9d2947e78bf561d8b578dea851543db1..c61be09fcca5043f55e9b27b3f66875c43f9dfe2 100644 (file)
@@ -36,7 +36,7 @@
 #include <string.h>
 #include "sofia-sip/base64.h"
 
-static unsigned char const code[] = 
+static unsigned char const code[] =
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 #define B64NOP 128
@@ -48,22 +48,22 @@ static unsigned char const code[] =
  * 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
- * 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.
- * 
+ *
  * @param buf  Buffer to store decoded data
  * @param bsiz Size of @a buf
  * @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:
  * Format of Internet Message Bodies"</i>,
  * N. Freed, N. Borenstein, November 1996.
  *
  * @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:
  * @code
  * int decoder(char const *encoded, void **return_decoded)
@@ -76,7 +76,7 @@ static unsigned char const code[] =
  * }
  * @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] = "";
   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) {
     /* Prepare decoding table */
     for (i = 1; i < 256; i++)
-      decode[i] = B64NOP; 
+      decode[i] = B64NOP;
 
     for (i = 0; i < 64; 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)
       len++;
   }
-  
+
   total_len = len = len * 3 / 4;
 
   if (buf == NULL || bsiz == 0)
     return total_len;
 
-  if (len > bsiz) 
+  if (len > bsiz)
     len = bsiz;
-  
+
   for (i = 0, s = (unsigned char const *)b64s; i < len; ) {
-      
+
     while ((b1 = decode[*s++]) == B64NOP)
       ;
     if (b1 != B64EOF)
@@ -126,7 +126,7 @@ isize_t base64_d(char buf[], isize_t bsiz, char const *b64s)
     if (b3 != B64EOF)
       while ((b4 = decode[*s++]) == B64NOP)
        ;
-      
+
     if (((b1 | b2 | b3 | b4) & (B64NOP|B64EOF)) == 0) {
       /* Normal case, 4 B64 chars to 3 data bytes */
       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.
- * 
- * 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.
  *
@@ -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,
  * 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:
  * Format of Internet Message Bodies"</i>,
  * 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 *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)
     s = NULL;
-  
+
   for (i = 0, n = 0; i < dsize; i += 3, n += 4) {
     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 + 3] = code[(w) & 63];
       } else {
-       if (n + 1 < bsize) 
+       if (n + 1 < bsize)
          s[n + 0] = code[(w >> 18) & 63];
-       if (n + 2 < bsize) 
+       if (n + 2 < bsize)
          s[n + 1] = code[(w >> 12) & 63];
        if (n + 3 < bsize)
          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;
       }
     }
-  }                       
-  
+  }
+
   if (slack) {
     if (s) {
       if (slack == 2)
@@ -230,7 +230,7 @@ isize_t base64_e(char buf[], isize_t bsiz, void *data, isize_t dsiz)
       else
        w = (b[i] << 16);
 
-      if (n + 1 < bsize) 
+      if (n + 1 < bsize)
        s[n + 0] = code[(w >> 18) & 63];
       if (n + 2 < bsize)
        s[n + 1] = code[(w >> 12) & 63];
index 73f6e1aeac13fc4d35d4b93033c391b7b32b18c2..1dddd7d099c36271440244d5e6a7ecbdb5affd91 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- c -*- */
 
 /**@MODULEPAGE "ipt" - Utility Module
- * 
+ *
  * @section ipt_meta Module Meta Information
  *
  * Utility library for IP Telephony applications.
@@ -14,7 +14,7 @@
  *
  * @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/token64.h> encoding/decoding binary as SIP/HTTP token.
  */
index 44fb1d381a145730b7b7e960fedcbb918019a28b..a343c130419a764157400058080f94f68ed071ee 100644 (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;
   rc4_u8 *array = state->rc4_array;
 
-  state->rc4_i = 0;     
-  state->rc4_j = 0;     
+  state->rc4_i = 0;
+  state->rc4_j = 0;
 
-  for (i = 0; i < 256; i++)              
-    array[i] = (rc4_u8) i;               
+  for (i = 0; i < 256; i++)
+    array[i] = (rc4_u8) i;
 
-  for (i = 0, j = 0, k = 0; 
-       i < 256; 
+  for (i = 0, j = 0, k = 0;
+       i < 256;
        i++, k++, k >= seed_len ? k = 0 : 0) {
     rc4_u8 a = array[i];
     rc4_u8 b = array[j += a + seed[k]];
 
     array[i] = b;
     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 *array = state->rc4_array;
-  rc4_u8 i = state->rc4_i;     
+  rc4_u8 i = state->rc4_i;
   rc4_u8 j = state->rc4_j;
-    
-  while (len-- > 0) {               
-    rc4_u8 a = array[++i];     
+
+  while (len-- > 0) {
+    rc4_u8 a = array[++i];
     rc4_u8 b = array[j += a];
 
     array[i] = b;
     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;
 }
 
@@ -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 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 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, 
+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, };
 
-rc4_u8 output_4[] = { 
-  0x75, 0x95, 0xc3, 0xe6, 0x11, 0x4a, 0x09, 0x78, 0x0c, 0x4a, 0xd4, 
-  0x52, 0x33, 0x8e, 0x1f, 0xfd, 0x9a, 0x1b, 0xe9, 0x49, 0x8f, 
-  0x81, 0x3d, 0x76, 0x53, 0x34, 0x49, 0xb6, 0x77, 0x8d, 0xca, 
-  0xd8, 0xc7, 0x8a, 0x8d, 0x2b, 0xa9, 0xac, 0x66, 0x08, 0x5d, 
-  0x0e, 0x53, 0xd5, 0x9c, 0x26, 0xc2, 0xd1, 0xc4, 0x90, 0xc1, 
-  0xeb, 0xbe, 0x0c, 0xe6, 0x6d, 0x1b, 0x6b, 0x1b, 0x13, 0xb6, 
-  0xb9, 0x19, 0xb8, 0x47, 0xc2, 0x5a, 0x91, 0x44, 0x7a, 0x95, 
-  0xe7, 0x5e, 0x4e, 0xf1, 0x67, 0x79, 0xcd, 0xe8, 0xbf, 0x0a, 
-  0x95, 0x85, 0x0e, 0x32, 0xaf, 0x96, 0x89, 0x44, 0x4f, 0xd3, 
-  0x77, 0x10, 0x8f, 0x98, 0xfd, 0xcb, 0xd4, 0xe7, 0x26, 0x56, 
-  0x75, 0x00, 0x99, 0x0b, 0xcc, 0x7e, 0x0c, 0xa3, 0xc4, 0xaa, 
-  0xa3, 0x04, 0xa3, 0x87, 0xd2, 0x0f, 0x3b, 0x8f, 0xbb, 0xcd, 
-  0x42, 0xa1, 0xbd, 0x31, 0x1d, 0x7a, 0x43, 0x03, 0xdd, 0xa5, 
-  0xab, 0x07, 0x88, 0x96, 0xae, 0x80, 0xc1, 0x8b, 0x0a, 0xf6, 
-  0x6d, 0xff, 0x31, 0x96, 0x16, 0xeb, 0x78, 0x4e, 0x49, 0x5a, 
-  0xd2, 0xce, 0x90, 0xd7, 0xf7, 0x72, 0xa8, 0x17, 0x47, 0xb6, 
-  0x5f, 0x62, 0x09, 0x3b, 0x1e, 0x0d, 0xb9, 0xe5, 0xba, 0x53, 
-  0x2f, 0xaf, 0xec, 0x47, 0x50, 0x83, 0x23, 0xe6, 0x71, 0x32, 
-  0x7d, 0xf9, 0x44, 0x44, 0x32, 0xcb, 0x73, 0x67, 0xce, 0xc8, 
-  0x2f, 0x5d, 0x44, 0xc0, 0xd0, 0x0b, 0x67, 0xd6, 0x50, 0xa0, 
-  0x75, 0xcd, 0x4b, 0x70, 0xde, 0xdd, 0x77, 0xeb, 0x9b, 0x10, 
-  0x23, 0x1b, 0x6b, 0x5b, 0x74, 0x13, 0x47, 0x39, 0x6d, 0x62, 
-  0x89, 0x74, 0x21, 0xd4, 0x3d, 0xf9, 0xb4, 0x2e, 0x44, 0x6e, 
-  0x35, 0x8e, 0x9c, 0x11, 0xa9, 0xb2, 0x18, 0x4e, 0xcb, 0xef, 
-  0x0c, 0xd8, 0xe7, 0xa8, 0x77, 0xef, 0x96, 0x8f, 0x13, 0x90, 
-  0xec, 0x9b, 0x3d, 0x35, 0xa5, 0x58, 0x5c, 0xb0, 0x09, 0x29, 
-  0x0e, 0x2f, 0xcd, 0xe7, 0xb5, 0xec, 0x66, 0xd9, 0x08, 0x4b, 
-  0xe4, 0x40, 0x55, 0xa6, 0x19, 0xd9, 0xdd, 0x7f, 0xc3, 0x16, 
-  0x6f, 0x94, 0x87, 0xf7, 0xcb, 0x27, 0x29, 0x12, 0x42, 0x64, 
-  0x45, 0x99, 0x85, 0x14, 0xc1, 0x5d, 0x53, 0xa1, 0x8c, 0x86, 
-  0x4c, 0xe3, 0xa2, 0xb7, 0x55, 0x57, 0x93, 0x98, 0x81, 0x26, 
-  0x52, 0x0e, 0xac, 0xf2, 0xe3, 0x06, 0x6e, 0x23, 0x0c, 0x91, 
-  0xbe, 0xe4, 0xdd, 0x53, 0x04, 0xf5, 0xfd, 0x04, 0x05, 0xb3, 
-  0x5b, 0xd9, 0x9c, 0x73, 0x13, 0x5d, 0x3d, 0x9b, 0xc3, 0x35, 
-  0xee, 0x04, 0x9e, 0xf6, 0x9b, 0x38, 0x67, 0xbf, 0x2d, 0x7b, 
-  0xd1, 0xea, 0xa5, 0x95, 0xd8, 0xbf, 0xc0, 0x06, 0x6f, 0xf8, 
-  0xd3, 0x15, 0x09, 0xeb, 0x0c, 0x6c, 0xaa, 0x00, 0x6c, 0x80, 
-  0x7a, 0x62, 0x3e, 0xf8, 0x4c, 0x3d, 0x33, 0xc1, 0x95, 0xd2, 
-  0x3e, 0xe3, 0x20, 0xc4, 0x0d, 0xe0, 0x55, 0x81, 0x57, 0xc8, 
-  0x22, 0xd4, 0xb8, 0xc5, 0x69, 0xd8, 0x49, 0xae, 0xd5, 0x9d, 
-  0x4e, 0x0f, 0xd7, 0xf3, 0x79, 0x58, 0x6b, 0x4b, 0x7f, 0xf6, 
-  0x84, 0xed, 0x6a, 0x18, 0x9f, 0x74, 0x86, 0xd4, 0x9b, 0x9c, 
-  0x4b, 0xad, 0x9b, 0xa2, 0x4b, 0x96, 0xab, 0xf9, 0x24, 0x37, 
-  0x2c, 0x8a, 0x8f, 0xff, 0xb1, 0x0d, 0x55, 0x35, 0x49, 0x00, 
-  0xa7, 0x7a, 0x3d, 0xb5, 0xf2, 0x05, 0xe1, 0xb9, 0x9f, 0xcd, 
-  0x86, 0x60, 0x86, 0x3a, 0x15, 0x9a, 0xd4, 0xab, 0xe4, 0x0f, 
-  0xa4, 0x89, 0x34, 0x16, 0x3d, 0xdd, 0xe5, 0x42, 0xa6, 0x58, 
-  0x55, 0x40, 0xfd, 0x68, 0x3c, 0xbf, 0xd8, 0xc0, 0x0f, 0x12, 
-  0x12, 0x9a, 0x28, 0x4d, 0xea, 0xcc, 0x4c, 0xde, 0xfe, 0x58, 
-  0xbe, 0x71, 0x37, 0x54, 0x1c, 0x04, 0x71, 0x26, 0xc8, 0xd4, 
-  0x9e, 0x27, 0x55, 0xab, 0x18, 0x1a, 0xb7, 0xe9, 0x40, 0xb0, 
+rc4_u8 output_4[] = {
+  0x75, 0x95, 0xc3, 0xe6, 0x11, 0x4a, 0x09, 0x78, 0x0c, 0x4a, 0xd4,
+  0x52, 0x33, 0x8e, 0x1f, 0xfd, 0x9a, 0x1b, 0xe9, 0x49, 0x8f,
+  0x81, 0x3d, 0x76, 0x53, 0x34, 0x49, 0xb6, 0x77, 0x8d, 0xca,
+  0xd8, 0xc7, 0x8a, 0x8d, 0x2b, 0xa9, 0xac, 0x66, 0x08, 0x5d,
+  0x0e, 0x53, 0xd5, 0x9c, 0x26, 0xc2, 0xd1, 0xc4, 0x90, 0xc1,
+  0xeb, 0xbe, 0x0c, 0xe6, 0x6d, 0x1b, 0x6b, 0x1b, 0x13, 0xb6,
+  0xb9, 0x19, 0xb8, 0x47, 0xc2, 0x5a, 0x91, 0x44, 0x7a, 0x95,
+  0xe7, 0x5e, 0x4e, 0xf1, 0x67, 0x79, 0xcd, 0xe8, 0xbf, 0x0a,
+  0x95, 0x85, 0x0e, 0x32, 0xaf, 0x96, 0x89, 0x44, 0x4f, 0xd3,
+  0x77, 0x10, 0x8f, 0x98, 0xfd, 0xcb, 0xd4, 0xe7, 0x26, 0x56,
+  0x75, 0x00, 0x99, 0x0b, 0xcc, 0x7e, 0x0c, 0xa3, 0xc4, 0xaa,
+  0xa3, 0x04, 0xa3, 0x87, 0xd2, 0x0f, 0x3b, 0x8f, 0xbb, 0xcd,
+  0x42, 0xa1, 0xbd, 0x31, 0x1d, 0x7a, 0x43, 0x03, 0xdd, 0xa5,
+  0xab, 0x07, 0x88, 0x96, 0xae, 0x80, 0xc1, 0x8b, 0x0a, 0xf6,
+  0x6d, 0xff, 0x31, 0x96, 0x16, 0xeb, 0x78, 0x4e, 0x49, 0x5a,
+  0xd2, 0xce, 0x90, 0xd7, 0xf7, 0x72, 0xa8, 0x17, 0x47, 0xb6,
+  0x5f, 0x62, 0x09, 0x3b, 0x1e, 0x0d, 0xb9, 0xe5, 0xba, 0x53,
+  0x2f, 0xaf, 0xec, 0x47, 0x50, 0x83, 0x23, 0xe6, 0x71, 0x32,
+  0x7d, 0xf9, 0x44, 0x44, 0x32, 0xcb, 0x73, 0x67, 0xce, 0xc8,
+  0x2f, 0x5d, 0x44, 0xc0, 0xd0, 0x0b, 0x67, 0xd6, 0x50, 0xa0,
+  0x75, 0xcd, 0x4b, 0x70, 0xde, 0xdd, 0x77, 0xeb, 0x9b, 0x10,
+  0x23, 0x1b, 0x6b, 0x5b, 0x74, 0x13, 0x47, 0x39, 0x6d, 0x62,
+  0x89, 0x74, 0x21, 0xd4, 0x3d, 0xf9, 0xb4, 0x2e, 0x44, 0x6e,
+  0x35, 0x8e, 0x9c, 0x11, 0xa9, 0xb2, 0x18, 0x4e, 0xcb, 0xef,
+  0x0c, 0xd8, 0xe7, 0xa8, 0x77, 0xef, 0x96, 0x8f, 0x13, 0x90,
+  0xec, 0x9b, 0x3d, 0x35, 0xa5, 0x58, 0x5c, 0xb0, 0x09, 0x29,
+  0x0e, 0x2f, 0xcd, 0xe7, 0xb5, 0xec, 0x66, 0xd9, 0x08, 0x4b,
+  0xe4, 0x40, 0x55, 0xa6, 0x19, 0xd9, 0xdd, 0x7f, 0xc3, 0x16,
+  0x6f, 0x94, 0x87, 0xf7, 0xcb, 0x27, 0x29, 0x12, 0x42, 0x64,
+  0x45, 0x99, 0x85, 0x14, 0xc1, 0x5d, 0x53, 0xa1, 0x8c, 0x86,
+  0x4c, 0xe3, 0xa2, 0xb7, 0x55, 0x57, 0x93, 0x98, 0x81, 0x26,
+  0x52, 0x0e, 0xac, 0xf2, 0xe3, 0x06, 0x6e, 0x23, 0x0c, 0x91,
+  0xbe, 0xe4, 0xdd, 0x53, 0x04, 0xf5, 0xfd, 0x04, 0x05, 0xb3,
+  0x5b, 0xd9, 0x9c, 0x73, 0x13, 0x5d, 0x3d, 0x9b, 0xc3, 0x35,
+  0xee, 0x04, 0x9e, 0xf6, 0x9b, 0x38, 0x67, 0xbf, 0x2d, 0x7b,
+  0xd1, 0xea, 0xa5, 0x95, 0xd8, 0xbf, 0xc0, 0x06, 0x6f, 0xf8,
+  0xd3, 0x15, 0x09, 0xeb, 0x0c, 0x6c, 0xaa, 0x00, 0x6c, 0x80,
+  0x7a, 0x62, 0x3e, 0xf8, 0x4c, 0x3d, 0x33, 0xc1, 0x95, 0xd2,
+  0x3e, 0xe3, 0x20, 0xc4, 0x0d, 0xe0, 0x55, 0x81, 0x57, 0xc8,
+  0x22, 0xd4, 0xb8, 0xc5, 0x69, 0xd8, 0x49, 0xae, 0xd5, 0x9d,
+  0x4e, 0x0f, 0xd7, 0xf3, 0x79, 0x58, 0x6b, 0x4b, 0x7f, 0xf6,
+  0x84, 0xed, 0x6a, 0x18, 0x9f, 0x74, 0x86, 0xd4, 0x9b, 0x9c,
+  0x4b, 0xad, 0x9b, 0xa2, 0x4b, 0x96, 0xab, 0xf9, 0x24, 0x37,
+  0x2c, 0x8a, 0x8f, 0xff, 0xb1, 0x0d, 0x55, 0x35, 0x49, 0x00,
+  0xa7, 0x7a, 0x3d, 0xb5, 0xf2, 0x05, 0xe1, 0xb9, 0x9f, 0xcd,
+  0x86, 0x60, 0x86, 0x3a, 0x15, 0x9a, 0xd4, 0xab, 0xe4, 0x0f,
+  0xa4, 0x89, 0x34, 0x16, 0x3d, 0xdd, 0xe5, 0x42, 0xa6, 0x58,
+  0x55, 0x40, 0xfd, 0x68, 0x3c, 0xbf, 0xd8, 0xc0, 0x0f, 0x12,
+  0x12, 0x9a, 0x28, 0x4d, 0xea, 0xcc, 0x4c, 0xde, 0xfe, 0x58,
+  0xbe, 0x71, 0x37, 0x54, 0x1c, 0x04, 0x71, 0x26, 0xc8, 0xd4,
+  0x9e, 0x27, 0x55, 0xab, 0x18, 0x1a, 0xb7, 0xe9, 0x40, 0xb0,
   0xc0, };
 
 #include <stdio.h>
@@ -210,7 +210,7 @@ void printout(const char *title, rc4_u8 *data, int len) {
   for (i = 0; i < len; i++) {
     printf("0x%02x ", data[i]);
   }
-  
+
   putchar('\n');
 }
 
index 10552e097ebe266b39c30f6750b3b75dac36333f..296b1a8647861a674c26ec31c7c7c8b6049ed003 100644 (file)
  * [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.
  *
- * @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:
  * Format of Internet Message Bodies"</i>,
- * N. Freed, N. Borenstein, 
+ * N. Freed, N. Borenstein,
  * November 1996.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
index 1d3332b6b1f178298ea30f565201d81c5aa451e0..1edbfd663b925a951253bd1932f30befba152520 100644 (file)
@@ -28,9 +28,9 @@
 
 /**@file sofia-sip/rc4.h
  * @brief Arcfour random number generator.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Sun Jun  9 14:32:58 1996 ppessi
  */
 
@@ -45,21 +45,21 @@ extern "C" {
 /** Byte. */
 typedef uint8_t rc4_u8;
 
-/** RC4 context. 
- * 
+/** RC4 context.
+ *
  * The RC4 context is accessed and modified through rc4_init() and rc4()
  * functions only.
  */
-typedef struct {      
-  uint8_t rc4_i;        
+typedef struct {
+  uint8_t rc4_i;
   uint8_t rc4_j;
-  uint8_t rc4_array[256];       
+  uint8_t rc4_array[256];
 } rc4_t;
 
 /** Key RC4 context. */
 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);
 
 #if defined(__cplusplus)
index 51ad90ac3d61861dd3305158a5271f67bf06d6f7..6f9a1c0133b2635f3561fbdced77e15f8b9fb318 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef UNIQUEID_H
 /** Defined when <sofia-sip/uniqueid.h> has been included. */
-#define UNIQUEID_H 
+#define UNIQUEID_H
 
 /**@file sofia-sip/uniqueid.h
  *
@@ -38,7 +38,7 @@
  */
 
 /* Compatibility functionality */
-#define guid_t su_guid_t 
+#define guid_t su_guid_t
 #define guid_generate su_guid_generate
 #define guid_sprintf su_guid_sprintf
 #define guid_strlen su_guid_strlen
index b75a8b03c6ca4a243709ce1d74163b654e403998..fa85605d838f5f10aba501bb7728c36c0269dcd6 100644 (file)
@@ -32,7 +32,7 @@
  *
  * @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>,
  * 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);
 
 /*
- * 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
  */
 #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)[4]=((c>>6)&63)|128,\
                      (s)[5]=((c)&63)|128)
-     
+
 SOFIA_END_DECLS
 
 #endif /* UTF8_H */
index dd7548f9bbb8898c5a1fd5e9225de922b80d970f..0bf6c5c7397bbc12c50ab80d35790bb85f8238f6 100644 (file)
  *
  */
 
-/**@internal @file token64.c  
+/**@internal @file token64.c
  *
  * Token encoding.
  *
  * @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 "sofia-sip/token64.h"
 
-static const char code[65] = 
+static const char code[65] =
 "0123456789-abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
-/** Encode data as a SIP/HTTP token. 
+/** Encode data as a SIP/HTTP token.
  *
  * @note
  * 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) {
     unsigned char h0 = h[i], h1 = h[i + 1], h2 = h[i + 2];
-    
+
     s[0] = code[h0 >> 2];
     s[1] = code[((h0 << 4)|(h1 >> 4)) & 63];
     s[2] = code[((h1 << 4)|(h2 >> 6)) & 63];
index 7ad59f14c1af5a6c1403c7d86e083429b41f6f6b..328604fd509a5a5845a594118baa9ae846ce43a7 100644 (file)
@@ -36,7 +36,7 @@
 #include "utf8internal.h"
 
 /*
- * Decode utf8 string into ucs2 string, 
+ * Decode utf8 string into ucs2 string,
  * return number of ucs2 characters decoded
  */
 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,
  * 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
- * 
+ *
  */
 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;
   ucs2 c;
-  
+
   while (n-- > 0) {
     c = *s++;
     if (c < 0x80u)
@@ -157,7 +157,7 @@ size_t ucs2len(ucs2 const *s)
 {
   size_t len = 0;
 
-  if (s) while (*s++) 
+  if (s) while (*s++)
     len++;
 
   return len;
@@ -170,7 +170,7 @@ int ucs2cmp(ucs2 const *s1, ucs2 const *s2)
 {
   int retval = s1 - s2;
 
-  if (s1 && s2) 
+  if (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;
 
-  if (s1 && s2) 
+  if (s1 && s2)
     while (n-- > 0 && (retval = (*s1 - *s2)) && (*s1++) && (*s2++))
       ;
 
index 19946c19298f634771404dc407d84d6fc09e5515..1c6eafcaeaf362d93a05356b97eccc5a69262673 100644 (file)
@@ -35,7 +35,7 @@
 #include "utf8internal.h"
 
 /*
- * Decode utf8 string into ucs4 string, 
+ * Decode utf8 string into ucs4 string,
  * return number of ucs4 characters decoded
  */
 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,
  * 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
- * 
+ *
  */
 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;
   ucs4 c;
-  
+
   while (n-- > 0) {
     c = *s++;
     if (c < 0x80u)
@@ -183,7 +183,7 @@ size_t ucs4len(ucs4 const *s)
 {
   size_t len = 0;
 
-  if (s) while (*s++) 
+  if (s) while (*s++)
     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)
 {
index bd6e6e0878b99f333bd27a0ad4a6c2b35407e7ae..715f3b84598f79a91bae7757641e49190c81a782 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@CFILE utf8.c 
+/**@CFILE utf8.c
  *
  * utf8 string handling.
  *
index f7ed661d3da3172bb787a333da25ff05b23c351a..730ddaf2ef9cdf69daf10bde702599269c4f664f 100644 (file)
@@ -23,9 +23,9 @@
  */
 
 #ifndef UTF8INTERNAL_H
-#define UTF8INTERNAL_H 
+#define UTF8INTERNAL_H
 
-/**@IFILE utf8internal.h 
+/**@IFILE utf8internal.h
  * UTF-8 macros.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
index 8a1d22cfb2b33dd253eaff9bf1462dc2512ee4fe..cf2fde6e0dc6c163f7294d67e8a9e22c3e61cc6f 100644 (file)
 
 int main(int argc, char *argv[])
 {
-  static ucs4 ucs4test0[] = { 
+  static ucs4 ucs4test0[] = {
     0x41u, 0xC1u, 0x841u, 0x10041u, 0x200041u, 0x4000041u, 0
   };
-  static utf8 ucs4test1[] = 
-    "A" 
+  static utf8 ucs4test1[] =
+    "A"
     "\303\201"
     "\340\241\201"
     "\360\220\201\201"
     "\370\210\200\201\201"
     "\374\204\200\200\201\201";
 
-  static ucs2 ucs2test0[] = { 
+  static ucs2 ucs2test0[] = {
     0x41u, 0xC1u, 0x841u, 0
   };
-  static utf8 ucs2test1[] = 
-    "A" 
+  static utf8 ucs2test1[] =
+    "A"
     "\303\201"
     "\340\241\201";
 
   ucs4 ucs4s[1024] = { 0 };
-  ucs2 ucs2s[1024] = { 0 }; 
+  ucs2 ucs2s[1024] = { 0 };
   utf8 utf8s[1024] = { 0 };
 
   size_t len;
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
   else puts("OK");
 
   /* UCS2 */
-  
+
   puts("testing ucs2len(ucs2test0)");
 
   len = ucs2len(ucs2test0);
index 2198c40083d5194ad87968cea03d5c6a1a8a5878..098099f12f158cb0a23a44781bafed12815ee579 100644 (file)
@@ -1,7 +1,7 @@
 PROJECT_NAME         = "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 = ../docs/Doxyfile.conf
index 66bdf58102d2d130f46217f2253777f2e25e8ddf..20d1287204c8522d1aa9c8eee514dd1bf7cf0d93 100644 (file)
 
 #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 *realm);
 
 static void ca_destroy(su_home_t *home, 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,
                        char const *scheme,
                        char const *realm);
@@ -73,9 +73,9 @@ static int ca_info(auth_client_t *ca,
                   msg_auth_info_t const *ai,
                   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 *realm, 
+                         char const *realm,
                          char const *user,
                          char const *pass);
 
@@ -85,19 +85,19 @@ static int ca_clear_credentials(auth_client_t *ca);
 /** Initialize authenticators.
  *
  * 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] home      memory home used for allocating authenticators
  * @param[in] ch        challenge to be processed
  * @param[in] crcl      credential class
- * 
+ *
  * @retval 1 when challenge was updated
  * @retval 0 when there was no new challenges
  * @retval -1 upon an error
  */
 int auc_challenge(auth_client_t **auc_list,
-                 su_home_t *home, 
+                 su_home_t *home,
                  msg_auth_t const *ch,
                  msg_hclass_t *crcl)
 {
@@ -139,7 +139,7 @@ int auc_challenge(auth_client_t **auc_list,
   return retval;
 }
 
-/** Update authentication client. 
+/** Update authentication client.
  *
  * @retval -1 upon an error
  * @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
  */
 static
-int ca_challenge(auth_client_t *ca, 
+int ca_challenge(auth_client_t *ca,
                 msg_auth_t const *ch,
                 msg_hclass_t *credential_class,
-                char const *scheme, 
+                char const *scheme,
                 char const *realm)
 {
   int stale = 0;
@@ -165,7 +165,7 @@ int ca_challenge(auth_client_t *ca,
   if (strcmp(ca->ca_realm, realm))
     return 0;
 
-  if (ca->ca_credential_class && 
+  if (ca->ca_credential_class &&
       ca->ca_credential_class != credential_class)
     return 0;
 
@@ -205,7 +205,7 @@ int ca_challenge(auth_client_t *ca,
  * processed.
  *
  * @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
  * client. The result of storing authentication info can be quite unexpected
  * 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;
 }
 
-/** Update authentication client with authentication info. 
+/** Update authentication client with authentication info.
  *
  * @retval -1 upon an error
  * @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
  */
 static
-int ca_info(auth_client_t *ca, 
+int ca_info(auth_client_t *ca,
            msg_auth_info_t const *info,
            msg_hclass_t *credential_class)
 {
@@ -262,7 +262,7 @@ int ca_info(auth_client_t *ca,
     return 0;
 
   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)
       || !ca->ca_auc->auc_info)
     return 0;
@@ -283,14 +283,14 @@ int ca_info(auth_client_t *ca,
  *
  * @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] data          colon-separated authentication data
- * 
+ *
  * @retval 0 when successful
  * @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)
 {
   int retval = 0, match;
@@ -317,7 +317,7 @@ int auc_credentials(auth_client_t **auc_list, su_home_t *home,
        retval = -1;
        break;
       }
-      if (match) 
+      if (match)
        retval++;
     }
   }
@@ -330,25 +330,25 @@ int auc_credentials(auth_client_t **auc_list, su_home_t *home,
 /**Feed authentication data to the authenticator.
  *
  * 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
  *
  * @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] realm         realm to use (NULL, if any)
- * @param[in] user          username 
+ * @param[in] user          username
  * @param[in] pass          password
- * 
+ *
  * @retval number of updated clients
  * @retval 0 when no client was updated
  * @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 *realm, 
+                       char const *realm,
                        char const *user,
                        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);
       if (match < 0)
        return -1;
-      if (match) 
+      if (match)
        retval++;
     }
   }
@@ -371,9 +371,9 @@ int auc_all_credentials(auth_client_t **auc_list,
   return retval;
 }
 
-int ca_credentials(auth_client_t *ca, 
+int ca_credentials(auth_client_t *ca,
                   char const *scheme,
-                  char const *realm, 
+                  char const *realm,
                   char const *user,
                   char const *pass)
 {
@@ -465,21 +465,21 @@ int auc_copy_credentials(auth_client_t **dst,
 
   return retval;
 }
-             
+
 
 /**Clear authentication data from the authenticator.
  *
  * The function auc_clear_credentials() is used to remove the credentials
  * from the authenticators.
  *
- * @param[in,out] auc_list  list of authenticators 
- * @param[in] scheme    scheme (if non-null, remove only matching credentials) 
+ * @param[in,out] auc_list  list of authenticators
+ * @param[in] scheme    scheme (if non-null, remove only matching credentials)
  * @param[in] realm     realm (if non-null, remove only matching credentials)
  *
  * @retval 0 when successful
  * @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 *realm)
 {
@@ -502,7 +502,7 @@ int auc_clear_credentials(auth_client_t **auc_list,
       retval = -1;
       break;
     }
-    if (match) 
+    if (match)
       retval++;
   }
 
@@ -523,7 +523,7 @@ int ca_clear_credentials(auth_client_t *ca)
 }
 
 /** Check if we have all required credentials.
- * 
+ *
  * @retval 1 when authorization can proceed
  * @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
  * 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] pub          headers of the message
  * @param[in] method        request method
  * @param[in] url           request URI
  * @param[in] body          message body (NULL if empty)
- * 
+ *
  * @retval 1 when successful
  * @retval 0 when there is not enough credentials
  * @retval -1 upon an error
  */
 int auc_authorization(auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub,
-                     char const *method, 
-                     url_t const *url, 
+                     char const *method,
+                     url_t const *url,
                      msg_payload_t const *body)
 {
   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
  * 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] method        request method
  * @param[in] url           request URI
  * @param[in] body          message body (NULL if empty)
  * @param[out] return_headers  authorization headers return value
- * 
+ *
  * @retval 1 when successful
  * @retval 0 when there is not enough credentials
  * @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,
-                             char const *method, 
-                             url_t const *url, 
+                             char const *method,
+                             url_t const *url,
                              msg_payload_t const *body,
                              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,
                                   su_home_t *h,
-                                  char const *method, 
-                                  url_t const *url, 
+                                  char const *method,
+                                  url_t const *url,
                                   msg_payload_t const *body,
                                   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_size: */        sizeof (auth_client_t),
   /* 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 user user name
  * @param pass password
- * 
+ *
  * @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.
  */
-int auc_basic_authorization(auth_client_t *ca, 
+int auc_basic_authorization(auth_client_t *ca,
                            su_home_t *home,
-                           char const *method, 
-                           url_t const *url, 
+                           char const *method,
+                           url_t const *url,
                            msg_payload_t const *body,
                            msg_header_t **return_headers)
 {
@@ -742,7 +742,7 @@ int auc_basic_authorization(auth_client_t *ca,
   userpass[ulen] = ':';
   memcpy(userpass + ulen + 1, pass, plen);
   userpass[uplen] = '\0';
-  
+
   base64_e(base64, b64len + 1, userpass, uplen);
 
   base64[b64len] = '\0';
@@ -767,22 +767,22 @@ typedef struct auth_digest_client_s
   auth_challenge_t cda_ac[1];
 } 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);
-static int auc_digest_authorization(auth_client_t *ca, 
+static int auc_digest_authorization(auth_client_t *ca,
                                    su_home_t *h,
-                                   char const *method, 
-                                   url_t const *url, 
+                                   char const *method,
+                                   url_t const *url,
                                    msg_payload_t const *body,
                                    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);
 
-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_size: */        sizeof (auth_digest_client_t),
-  /* auc_name: */       "Digest", 
+  /* auc_name: */       "Digest",
   /* auc_challenge: */   auc_digest_challenge,
   /* auc_authorize: */   auc_digest_authorization,
   /* 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
  * 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 -1 upon an error
  */
 static
-int auc_digest_authorization(auth_client_t *ca, 
+int auc_digest_authorization(auth_client_t *ca,
                             su_home_t *home,
-                            char const *method, 
-                            url_t const *url, 
+                            char const *method,
+                            url_t const *url,
                             msg_payload_t const *body,
                             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_response(ar, response, sessionkey, method, data, dlen);
 
-  h = msg_header_format(home, hc, 
+  h = msg_header_format(home, hc,
                        "Digest "
                        "username=\"%s\", "
                        "realm=\"%s\", "
@@ -935,21 +935,21 @@ int auc_digest_authorization(auth_client_t *ca,
                        "response=\"%s\""
                        "%s%s"
                        "%s%s",
-                       ar->ar_username, 
+                       ar->ar_username,
                        ar->ar_realm,
                        ar->ar_nonce,
-                       cnonce ? "\",  cnonce=\"" : "", 
+                       cnonce ? "\",  cnonce=\"" : "",
                        cnonce ? cnonce : "",
-                       ar->ar_opaque ? "\",  opaque=\"" : "", 
+                       ar->ar_opaque ? "\",  opaque=\"" : "",
                        ar->ar_opaque ? ar->ar_opaque : "",
                        ar->ar_algorithm ? "\", algorithm=" : "",
                        ar->ar_algorithm ? ar->ar_algorithm : "",
                        ar->ar_uri,
                        response,
-                       ar->ar_auth || ar->ar_auth_int ? ", qop=" : "", 
-                       ar->ar_auth_int ? "auth-int" : 
+                       ar->ar_auth || ar->ar_auth_int ? ", qop=" : "",
+                       ar->ar_auth_int ? "auth-int" :
                        (ar->ar_auth ? "auth" : ""),
-                       cnonce ? ", nc=" : "", 
+                       cnonce ? ", nc=" : "",
                        cnonce ? ncount : "");
 
   su_free(home, uri);
@@ -965,7 +965,7 @@ int auc_digest_authorization(auth_client_t *ca,
 
 #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
 };
@@ -984,7 +984,7 @@ int auc_register_plugin(auth_client_plugin_t const *plugin)
     return errno = EINVAL, -1;
 
   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) {
       ca_plugins[i] = plugin;
       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
  * 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] sip       sip headers of the message
- * 
+ *
  * @retval 1 when successful
  * @retval 0 when there is not enough credentials
  * @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)
     return 0;
 
-  return auc_authorization(auc_list, msg, (msg_pub_t *)sip, 
-                          rq->rq_method_name, 
+  return auc_authorization(auc_list, msg, (msg_pub_t *)sip,
+                          rq->rq_method_name,
                           /*
                             RFC 3261 defines the protection domain based
                             only on realm, so we do not bother get a
                             correct URI to auth module.
                           */
-                          rq->rq_url, 
+                          rq->rq_url,
                           sip->sip_payload);
 }
 #endif
index ec0123789b109cb7e246cc0e1a919aefc5af1e15..3fe6e076dccd19364e87f708f13c9edc8da831bf 100644 (file)
@@ -63,20 +63,20 @@ typedef struct auth_ntlm_client_s
   auth_challenge_t ntlm_ac[1];
 } 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);
-static int auc_ntlm_authorization(auth_client_t *ca, 
+static int auc_ntlm_authorization(auth_client_t *ca,
                                    su_home_t *h,
-                                   char const *method, 
-                                   url_t const *url, 
+                                   char const *method,
+                                   url_t const *url,
                                    msg_payload_t const *body,
                                    msg_header_t **);
 
-auth_client_plugin_t const _ntlm_client_plugin = 
-{ 
+auth_client_plugin_t const _ntlm_client_plugin =
+{
   sizeof ca_ntlm_plugin,
   sizeof (auth_ntlm_client_t),
-  "NTLM", 
+  "NTLM",
   auc_ntlm_challenge,
   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 ac      challenge structure
  * @param cnonce  client nonce
- * @param nc      client nonce count 
+ * @param nc      client nonce count
  * @param method  request method
  * @param uri     request uri
  * @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
  * error.
  */
-int auc_ntlm_authorization(auth_client_t *ca, 
+int auc_ntlm_authorization(auth_client_t *ca,
                             su_home_t *home,
-                            char const *method, 
-                            url_t const *url, 
+                            char const *method,
+                            url_t const *url,
                             msg_payload_t const *body,
                             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_response(ar, response, sessionkey, method, data, dlen);
 
-  h = msg_header_format(home, hc, 
+  h = msg_header_format(home, hc,
                        "NTLM "
                        "username=\"%s\", "
                        "realm=\"%s\", "
@@ -213,21 +213,21 @@ int auc_ntlm_authorization(auth_client_t *ca,
                        "response=\"%s\""
                        "%s%s"
                        "%s%s",
-                       ar->ar_username, 
+                       ar->ar_username,
                        ar->ar_realm,
                        ar->ar_nonce,
-                       cnonce ? "\",  cnonce=\"" : "", 
+                       cnonce ? "\",  cnonce=\"" : "",
                        cnonce ? cnonce : "",
-                       ar->ar_opaque ? "\",  opaque=\"" : "", 
+                       ar->ar_opaque ? "\",  opaque=\"" : "",
                        ar->ar_opaque ? ar->ar_opaque : "",
                        ar->ar_algorithm ? "\", algorithm=" : "",
                        ar->ar_algorithm ? ar->ar_algorithm : "",
                        ar->ar_uri,
                        response,
-                       ar->ar_auth || ar->ar_auth_int ? ", qop=" : "", 
-                       ar->ar_auth_int ? "auth-int" : 
+                       ar->ar_auth || ar->ar_auth_int ? ", qop=" : "",
+                       ar->ar_auth_int ? "auth-int" :
                        (ar->ar_auth ? "auth" : ""),
-                       cnonce ? ", nc=" : "", 
+                       cnonce ? ", nc=" : "",
                        cnonce ? ncount : "");
 
   su_free(home, uri);
index 2fd6a6e21d4471480808b89b6f670031fd574e3f..ad40282d35d320b3f097a49323afce6aa6e610e8 100644 (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
  * 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
- * the given address. 
+ * the given address.
  *
  * @note The field name should contain the equal ("=") sign.
  *
index 7a45809526138613f81eaf1c0e5d24571af649e2..cae56f166d724bc75c7e4b29a484eaf4b0ae1825 100644 (file)
@@ -59,7 +59,7 @@
  * found, or -1 upon an error.
  */
 issize_t auth_digest_challenge_get(su_home_t *home,
-                                  auth_challenge_t *ac0, 
+                                  auth_challenge_t *ac0,
                                   char const * const params[])
 {
   ssize_t n;
@@ -70,7 +70,7 @@ issize_t auth_digest_challenge_get(su_home_t *home,
 
   ac->ac_size = sizeof(ac);
 
-  assert(ac0); 
+  assert(ac0);
   assert(ac0->ac_size >= (int) sizeof(*ac));
 
   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));
 
   SU_DEBUG_5(("%s(): got "MOD_ZD"\n", "auth_digest_challenge_get", 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.
  */
 issize_t auth_digest_response_get(su_home_t *home,
-                                 auth_response_t *ar0, 
+                                 auth_response_t *ar0,
                                  char const *const params[])
 {
   ssize_t n;
@@ -189,7 +189,7 @@ static void unquote_update(su_md5_t md5[1], char const *quoted)
   if (!quoted)
     /*xyzzy*/;
   else if (quoted[0] == '"') {
-    char const *q; 
+    char const *q;
     size_t n;
 
     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);
 }
 
-/** 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,
                   char const *secret)
 {
@@ -222,13 +222,13 @@ int auth_digest_a1(auth_response_t *ar,
 
   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));
 
   return 0;
 }
 
-int auth_digest_a1sess(auth_response_t *ar, 
+int auth_digest_a1sess(auth_response_t *ar,
                       auth_hexmd5_t ha1sess,
                       char const *ha1)
 {
@@ -243,15 +243,15 @@ int auth_digest_a1sess(auth_response_t *ar,
 
   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));
 
   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,
                           char const *secret)
 {
@@ -263,7 +263,7 @@ int auth_digest_sessionkey(auth_response_t *ar,
     return -1;
 
   if (ar->ar_md5sess) {
-    auth_hexmd5_t base_ha1; 
+    auth_hexmd5_t base_ha1;
     auth_digest_a1(ar, base_ha1, secret);
     auth_digest_a1sess(ar, ha1, base_ha1);
   } else {
@@ -273,12 +273,12 @@ int auth_digest_sessionkey(auth_response_t *ar,
   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 const ha1, 
+                        auth_hexmd5_t const ha1,
                         char const *method_name,
                         void const *data, isize_t dlen)
 {
@@ -314,7 +314,7 @@ int auth_digest_response(auth_response_t *ar,
   }
   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 : ""));
 
   /* Calculate response */
@@ -333,17 +333,17 @@ int auth_digest_response(auth_response_t *ar,
   }
 
   su_md5_update(md5, ":", 1);
-  su_md5_update(md5, HA2, 32);      
+  su_md5_update(md5, HA2, 32);
   su_md5_hexdigest(md5, response);
 
-  SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n", 
-             response, ha1, ar->ar_nonce, 
-             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_auth ||  ar->ar_auth_int ? ar->ar_cnonce : "", 
-             ar->ar_auth ||  ar->ar_auth_int ? ":" : "", 
-             ar->ar_auth ||  ar->ar_auth_int ? ar->ar_qop : "", 
+  SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n",
+             response, ha1, ar->ar_nonce,
+             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_auth ||  ar->ar_auth_int ? ar->ar_cnonce : "",
+             ar->ar_auth ||  ar->ar_auth_int ? ":" : "",
+             ar->ar_auth ||  ar->ar_auth_int ? ar->ar_qop : "",
              HA2,
              ar->ar_qop ? ar->ar_qop : "NONE"));
 
index a4148b43d883cc1f7a2389082be25d94cb27bf8b..cd37c3aafe91173bd6dd818de0d160c849d6904b 100644 (file)
@@ -80,7 +80,7 @@ static void auth_call_scheme_destructor(void *);
 static void auth_md5_hmac_key(auth_mod_t *am);
 
 HTABLE_PROTOS_WITH(auth_htable, aht, auth_passwd_t, usize_t, unsigned);
-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);
 
 /**Allocate an authentication module instance.
index 3de7c348311680e2af6e0a34354ac9cd48a67440..98a63e4b26d46f512bed2b568d17f590e8c2c8ac 100644 (file)
@@ -25,7 +25,7 @@
 /**@internal
  * @file auth_module_http.c
  * @brief Authenticate HTTP request
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Jari Urpalainen <Jari.Urpalainen@nokia.com>
  *
 
 #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 }};
 
-static auth_challenger_t http_proxy_challenger[] = 
+static auth_challenger_t http_proxy_challenger[] =
   {{ HTTP_407_PROXY_AUTH, http_proxy_authenticate_class }};
 
 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,
                                auth_kind_t proxy)
 {
-  msg_auth_t *credentials = 
+  msg_auth_t *credentials =
     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;
 
   if (http->http_request) {
     if (!as->as_method)
       as->as_method = http->http_request->rq_method_name;
 #if 0
-    if (!as->as_uri) 
+    if (!as->as_uri)
       as->as_uri = http->http_request->rq_url;
 #endif
   }
 
   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;
 
   /* Call real authentication method */
index c9563ff09c9c87732ea39ac51092491de1dd6bb9..a634cdac748edc491c63b6be80ea8b57ef54541e 100644 (file)
@@ -25,7 +25,7 @@
 /**@internal
  * @file auth_module_sip.c
  * @brief Authenticate SIP request
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Jari Urpalainen <Jari.Urpalainen@nokia.com>
  *
 
 #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_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 }};
 
-/** Authenticate an incoming SIP request. 
+/** Authenticate an incoming SIP request.
  *
  * The function auth_mod_check() completes the @a as structure and calls the
  * scheme-specific authentication method performing the actual
- * authentication.  
+ * authentication.
  *
  * A successful authentication is indicated by setting @a as->as_status to
  * 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;
 
   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;
 
   auth_mod_method(am, as, credentials, challenger);
index d8249e516fefa21b1c07c993492ded1ce56f3da8..b0b097236fb1affd67bd6786c1b7f73a2a507d27 100644 (file)
@@ -58,7 +58,7 @@ su_inline int has_token(char const *qstring, char const *token);
  * found, or -1 upon an error.
  */
 issize_t auth_ntlm_challenge_get(su_home_t *home,
-                               auth_challenge_t *ac0, 
+                               auth_challenge_t *ac0,
                                char const * const params[])
 {
   ssize_t n;
@@ -68,7 +68,7 @@ issize_t auth_ntlm_challenge_get(su_home_t *home,
 
   ac->ac_size = sizeof(ac);
 
-  assert(ac0); 
+  assert(ac0);
   assert(ac0->ac_size >= sizeof(*ac));
 
   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));
 
   SU_DEBUG_5(("%s(): got %d\n", "auth_ntlm_challenge_get", n));
-  
+
   return n;
 }
 
@@ -119,7 +119,7 @@ issize_t auth_ntlm_challenge_get(su_home_t *home,
  * found, or -1 upon an error.
  */
 issize_t auth_ntlm_response_get(su_home_t *home,
-                               auth_response_t *ar0, 
+                               auth_response_t *ar0,
                                char const *const params[])
 {
   ssize_t n;
@@ -169,9 +169,9 @@ issize_t auth_ntlm_response_get(su_home_t *home,
 
 #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,
                   char const *secret)
 {
@@ -187,13 +187,13 @@ int auth_digest_a1(auth_response_t *ar,
 
   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));
 
   return 0;
 }
 
-int auth_digest_a1sess(auth_response_t *ar, 
+int auth_digest_a1sess(auth_response_t *ar,
                       auth_hexmd5_t ha1sess,
                       char const *ha1)
 {
@@ -208,15 +208,15 @@ int auth_digest_a1sess(auth_response_t *ar,
 
   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));
 
   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,
                           char const *secret)
 {
@@ -228,7 +228,7 @@ int auth_digest_sessionkey(auth_response_t *ar,
     return -1;
 
   if (ar->ar_md5sess) {
-    auth_hexmd5_t base_ha1; 
+    auth_hexmd5_t base_ha1;
     auth_digest_a1(ar, base_ha1, secret);
     auth_digest_a1sess(ar, ha1, base_ha1);
   } else {
@@ -243,12 +243,12 @@ int auth_digest_sessionkey(auth_response_t *ar,
 
 #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 const ha1, 
+                        auth_hexmd5_t const ha1,
                         char const *method_name,
                         void const *data, issize_t dlen)
 {
@@ -284,7 +284,7 @@ int auth_digest_response(auth_response_t *ar,
   }
   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 : ""));
 
   /* Calculate response */
@@ -303,17 +303,17 @@ int auth_digest_response(auth_response_t *ar,
   }
 
   su_md5_update(md5, ":", 1);
-  su_md5_update(md5, HA2, 32);      
+  su_md5_update(md5, HA2, 32);
   su_md5_hexdigest(md5, response);
 
-  SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n", 
-             response, ha1, ar->ar_nonce, 
-             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_auth ||  ar->ar_auth_int ? ar->ar_cnonce : "", 
-             ar->ar_auth ||  ar->ar_auth_int ? ":" : "", 
-             ar->ar_auth ||  ar->ar_auth_int ? ar->ar_qop : "", 
+  SU_DEBUG_5(("auth_response: %s = MD5(%s:%s%s%s%s%s%s%s:%s) (qop=%s)\n",
+             response, ha1, ar->ar_nonce,
+             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_auth ||  ar->ar_auth_int ? ar->ar_cnonce : "",
+             ar->ar_auth ||  ar->ar_auth_int ? ":" : "",
+             ar->ar_auth ||  ar->ar_auth_int ? ar->ar_qop : "",
              HA2,
              ar->ar_qop ? ar->ar_qop : "NONE"));
 
index 6e203eace06abe101890171cea3c9f7d9019dce6..3b0324722b002d9d6f6e4eb056f2fb4f7a646a6d 100644 (file)
@@ -25,9 +25,9 @@
 /**@internal
  * @file auth_plugin.c
  * @brief Plugin interface for authentication verification modules.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Apr 27 15:23:31 2004 ppessi
  */
 
@@ -69,7 +69,7 @@ static auth_scheme_t *schemes[N] = {
   auth_scheme_delayed
 };
 
-/** Register an authentication plugin. 
+/** Register an authentication plugin.
  *
  * @retval 0 when successful
  * @retval -1 upon an error
@@ -82,17 +82,17 @@ int auth_mod_register_plugin(auth_scheme_t *asch)
     if (i == N)
       return -1;
   }
-  
+
   schemes[i] = asch;
 
   return 0;
 }
 
-/**Create an authentication plugin module. 
+/**Create an authentication plugin module.
  *
  * The function auth_mod_create() creates a module used to authenticate the
  * requests.
- * 
+ *
  * @param root pointer to a su_root_t object
  * @param tag,value,... tagged argument list
  *
@@ -123,7 +123,7 @@ auth_mod_t *auth_mod_create(su_root_t *root,
     size_t len;
 
     base = strrchr(method, '+');
-    if (base) 
+    if (base)
       len = base++ - method;
     else
       len = strlen(method);
@@ -132,7 +132,7 @@ auth_mod_t *auth_mod_create(su_root_t *root,
       ;
     else if (strcasecmp(base, "Basic") == 0)
       bscheme = auth_scheme_basic;
-    else if (strcasecmp(base, "Digest") == 0) 
+    else if (strcasecmp(base, "Digest") == 0)
       bscheme = auth_scheme_digest;
 
     if (base == NULL || bscheme) {
@@ -152,6 +152,6 @@ auth_mod_t *auth_mod_create(su_root_t *root,
   }
 
   ta_end(ta);
-  
+
   return am;
 }
index 69178a1c5140cfe452702a906bfc7bc10f778b94..4a5853f882f1b1d8a2e6953fe7c5b952f782d074 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@CFILE auth_plugin_delayed.c
  *
- * @brief Plugin for delayed authentication. 
+ * @brief Plugin for delayed authentication.
  *
  * This authentication plugin provides authentication operation that is
  * 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_plugin.h"
 
-struct auth_plugin_t 
+struct auth_plugin_t
 {
   su_root_t      *ap_root;
   auth_scheme_t  *ap_base;
@@ -81,7 +81,7 @@ static void delayed_auth_method(auth_mod_t *am,
                                msg_auth_t *auth,
                                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_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);
 
-auth_scheme_t auth_scheme_delayed[1] = 
+auth_scheme_t auth_scheme_delayed[1] =
   {{
       "Delayed",
       sizeof (struct { auth_mod_t mod[1]; auth_plugin_t plug[1]; }),
       delayed_auth_init,
-      delayed_auth_method, 
+      delayed_auth_method,
       delayed_auth_challenge,
       delayed_auth_cancel,
       delayed_auth_destroy
@@ -118,13 +118,13 @@ static int delayed_auth_init(auth_mod_t *am,
 
     retval = 0;
   }
-    
+
   ta_end(ta);
 
   return retval;
 }
 
-struct auth_splugin_t 
+struct auth_splugin_t
 {
   void const      *asp_cookie;
   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;
   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),
                    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);
 }
 
-static void delayed_auth_challenge(auth_mod_t *am, 
+static void delayed_auth_challenge(auth_mod_t *am,
                                   auth_status_t *as,
                                   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);
 
   (void)ap;                    /* xyzzy */
-  
+
   if (as->as_plugin && as->as_plugin->asp_cookie == delayed_asp_cookie)
     as->as_plugin->asp_canceled = 1;
 
index 42a44592dbc405e7f3b3f91c62d21d3de048c31b..9c11ad25d55eafc79d792820cb304ecfe31a8861 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@CFILE auth_plugin_ntlm.c
  *
- * @brief Plugin for delayed authentication. 
+ * @brief Plugin for delayed authentication.
  *
  * This authentication plugin provides authentication operation that is
  * 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) {
     retval = 0;
   }
-    
+
   ta_end(ta);
 
   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.
  */
@@ -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,
                      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_match = (msg_header_t *)au;
     return;
-  } 
+  }
 
   if (au) {
     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. */
-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 *opaque,
                                  char const *gssapidata,
@@ -216,19 +216,19 @@ void auth_check_ntlm(auth_mod_t *am,
 
 #define PA "Authorization missing "
 
-  if ((!ar->ar_username && (phrase = PA "username")) || 
-      (!ar->ar_nonce && (phrase = PA "nonce")) || 
-      (!ar->ar_uri && (phrase = PA "URI")) || 
-      (!ar->ar_response && (phrase = PA "response")) || 
+  if ((!ar->ar_username && (phrase = PA "username")) ||
+      (!ar->ar_nonce && (phrase = PA "nonce")) ||
+      (!ar->ar_uri && (phrase = PA "URI")) ||
+      (!ar->ar_response && (phrase = PA "response")) ||
       /* (!ar->ar_opaque && (phrase = PA "opaque")) || */
       /* Check for qop */
-      (ar->ar_qop && 
-       ((ar->ar_auth && 
+      (ar->ar_qop &&
+       ((ar->ar_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\"")))
        && (phrase = PA "has invalid qop"))) {
     assert(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 */
 #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) {
 #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) {
 #endif
     as->as_blacklist = am->am_blacklist;
@@ -262,9 +262,9 @@ void auth_check_ntlm(auth_mod_t *am,
     a1 = apw->apw_hash;
   else if (apw && apw->apw_pass)
     auth_ntlm_a1(ar, a1buf, apw->apw_pass), a1 = a1buf;
-  else 
+  else
     auth_ntlm_a1(ar, a1buf, "xyzzy"), a1 = a1buf, apw = NULL;
-  
+
   if (ar->ar_md5sess)
     auth_ntlm_a1sess(ar, a1buf, a1), a1 = a1buf;
 #else
@@ -272,19 +272,19 @@ void auth_check_ntlm(auth_mod_t *am,
     a1 = apw->apw_hash;
   else if (apw && apw->apw_pass)
     auth_digest_a1(ar, a1buf, apw->apw_pass), a1 = a1buf;
-  else 
+  else
     auth_digest_a1(ar, a1buf, "xyzzy"), a1 = a1buf, apw = NULL;
-  
+
   if (ar->ar_md5sess)
     auth_digest_a1sess(ar, a1buf, a1), a1 = a1buf;
 #endif
 
-  /* XXX - replace with auth_ntlm_response */      
+  /* XXX - replace with auth_ntlm_response */
 #if 0
-  auth_ntlm_response(ar, response, a1, 
+  auth_ntlm_response(ar, response, a1,
                     as->as_method, as->as_body, as->as_bodylen);
 #else
-  auth_digest_response(ar, response, a1, 
+  auth_digest_response(ar, response, a1,
                       as->as_method, as->as_body, as->as_bodylen);
 #endif
 
@@ -321,7 +321,7 @@ void auth_check_ntlm(auth_mod_t *am,
 }
 
 /** 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_challenger_t const *ach)
 {
@@ -337,8 +337,8 @@ void auth_challenge_ntlm(auth_mod_t *am,
   u = as->as_uri;
   d = as->as_pdomain;
 
-  as->as_response = 
-    msg_header_format(as->as_home, ach->ach_header, 
+  as->as_response =
+    msg_header_format(as->as_home, ach->ach_header,
                      "Ntlm"
                      " realm=\"%s\","
                      "%s%s%s"
@@ -346,12 +346,12 @@ void auth_challenge_ntlm(auth_mod_t *am,
                      " nonce=\"%s\","
                      "%s%s%s"
                      "%s"      /* stale */
-                     " algorithm=%s" 
+                     " algorithm=%s"
                      "%s%s%s",
-                     as->as_realm, 
-                     u ? " uri=\"" : "", u ? u : "", u ? "\"," : "", 
-                     d ? " domain=\"" : "", d ? d : "", d ? "\"," : "", 
-                     nonce, 
+                     as->as_realm,
+                     u ? " uri=\"" : "", u ? u : "", u ? "\"," : "",
+                     d ? " domain=\"" : "", d ? d : "", d ? "\"," : "",
+                     nonce,
                      am->am_opaque ? " 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. */
-void auth_info_ntlm(auth_mod_t *am, 
+void auth_info_ntlm(auth_mod_t *am,
                      auth_status_t *as,
                      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());
 #endif
 
-    as->as_info = 
+    as->as_info =
       msg_header_format(as->as_home, ach->ach_info, "nextnonce=\"%s\"", nonce);
   }
 }
index 9b850318bddbbfb7e81b596897f6061cb33cc6fb..6d383940f8609676100d3218869d8867ccb4c97f 100644 (file)
 #include <sofia-sip/url_tag_class.h>
 
 /**@def AUTHTAG_ANY()
- * 
+ *
  * Filter tag matching any AUTHTAG_*().
  */
 tag_typedef_t authtag_any = NSTAG_TYPEDEF(*);
 
 /**@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
  * 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()
  *
  * Name of the authentication scheme.
- * 
+ *
  * The tag AUTHTAG_METHOD() specifies the authentication module and scheme
  * to be used by the auth_module. The name can specify a basic
  * 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.
  */
@@ -87,7 +87,7 @@ tag_typedef_t authtag_realm = STRTAG_TYPEDEF(realm);
  *
  * 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
  * 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()
  *
  * Quality-of-protection used by Digest authentication.
- * 
+ *
  * The tag AUTHTAG_QOP() specifies the qop scheme to be used by the
  * digest authentication.
  */
@@ -124,7 +124,7 @@ tag_typedef_t authtag_qop = STRTAG_TYPEDEF(qop);
 /**@def AUTHTAG_ALGORITHM()
  *
  * Authentication algorithm used by Digest authentication.
- * 
+ *
  * The tag AUTHTAG_ALGORITHM() specifies the qop scheme to be used by the
  * digest authentication.
  */
@@ -133,7 +133,7 @@ tag_typedef_t authtag_algorithm = STRTAG_TYPEDEF(algorithm);
 /**@def AUTHTAG_EXPIRES()
  *
  * Nonce expiration time for Digest authentication.
- * 
+ *
  * 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
  * 3600 seconds.
@@ -143,7 +143,7 @@ tag_typedef_t authtag_expires = UINTTAG_TYPEDEF(expires);
 /**@def AUTHTAG_NEXT_EXPIRES()
  *
  * Next nonce expiration time for Digest authentication.
- * 
+ *
  * The tag AUTHTAG_NEXT_EXPIRES() specifies the time in seconds that a
  * nextnonce sent in Authentication-Info header is considered valid. If 0,
  * 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()
  *
  * Max nonce count value.
- * 
+ *
  * 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.
  */
@@ -164,7 +164,7 @@ tag_typedef_t authtag_max_ncount = UINTTAG_TYPEDEF(max_ncount);
 /**@def AUTHTAG_BLACKLIST()
  *
  * Blacklist time.
- * 
+ *
  * The tag AUTHTAG_BLACKLIST() specifies the time the server delays its
  * response if it is given bad credentials or malformed nonce. The default
  * time is 5 seconds.
@@ -176,7 +176,7 @@ tag_typedef_t authtag_blacklist = UINTTAG_TYPEDEF(blacklist);
 /**@def AUTHTAG_FORBIDDEN()
  *
  * Respond with 403 Forbidden.
- * 
+ *
  * When given a true argument, the tag AUTHTAG_FORBIDDEN() specifies that the
  * server responds with 403 Forbidden (instead of 401/407) when it receives
  * bad credentials.
@@ -208,8 +208,8 @@ tag_typedef_t authtag_fake = BOOLTAG_TYPEDEF(fake);
 /**@def AUTHTAG_REMOTE()
  *
  * 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
  * authentication module is selected by AUTHTAG_METHOD().
  */
@@ -217,15 +217,15 @@ tag_typedef_t authtag_remote = URLTAG_TYPEDEF(remote);
 
 /**@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
  * comma-separated list of methods, for example,
  * @code
  * AUTHTAG_ALLOW("ACK, BYE, CANCEL").
  * @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
  * within an already established dialog.
  */
@@ -234,7 +234,7 @@ tag_typedef_t authtag_allow = STRTAG_TYPEDEF(allow);
 /**@def AUTHTAG_MASTER_KEY()
  *
  * Private master key for the authentication module.
- * 
+ *
  * The tag AUTHTAG_MASTER_KEY() specifies a private master key that can be
  * used by the authentication module for various purposes (for instance,
  * 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()
  *
  * Time to cache user data.
- * 
+ *
  * The tag AUTHTAG_CACHE_USERS() specifies how many seconds the user data is
  * 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()
  *
  * Time to cache errors.
- * 
+ *
  * The tag AUTHTAG_CACHE_ERRORS() specifies the lifetime in seconds for
  * errors in the local authentication data cache. Note that the errors
  * generated locally (e.g., because of connectivity problem with
index 715a724301e254cdb9e751588f63bd3ea113ba44..9aa077603268acfc19505662026a2ede0e13ac85 100644 (file)
@@ -5,10 +5,10 @@
  * @section iptsec_meta Module Meta Information
  *
  * The iptsec module currently provides interfaces to HTTP
- * Basic and Digest authentication, used by HTTP and SIP protocol elements. 
- * There are both 
- * @ref auth_client "client-side" and 
- * @ref auth_module "server-side" 
+ * Basic and Digest authentication, used by HTTP and SIP protocol elements.
+ * There are both
+ * @ref auth_client "client-side" and
+ * @ref auth_module "server-side"
  * (authentication verification) functionality available.
  *
  * @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
  * operation is simple enough:
  * -# server initializes an #auth_status_t structure with information from
  *    the request
- * -# server calls auth_mod_method() 
- * -# server checks the status from auth_status_t structure, sends an error 
+ * -# server calls auth_mod_method()
+ * -# server checks the status from auth_status_t structure, sends an error
  *    response to the client if authentication fails
  * -# server proceeds serving the authenticated request.
  *
  * 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
  * structure. The callback function is invoked when the authentication
  * operation is completed. An asynchronous authentication operation can be
@@ -62,7 +62,7 @@
  * -# store the challenge to a list with auc_challenge()
  * -# prompt user and feed credentials (username and password) to the list
  *    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
  *
  * If there are several username/password pairs for multiple authentication
index a85ea3c86a60d82a35233e695f780b8dcbf780ee..81377789e9071c853705c18621f1b0d2873a98b0 100644 (file)
@@ -24,9 +24,9 @@
 
 /**@internal @file iptsec_debug.c
  * @brief Debug log for IPTSEC module.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @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
  * logging level for @iptsec module. The default level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, #iptsec_log, #SOFIA_DEBUG
  */
 extern IPTSEC_DEBUG;
@@ -62,7 +62,7 @@ extern IPTSEC_DEBUG;
 #endif
 
 /** Common log for client and server components.
- * 
+ *
  * The iptsec_log is the log object used by @iptsec module. The level of
  * #iptsec_log is set using #IPTSEC_DEBUG environment variable.
  */
index 9619da3f990479436f324221f64523ea66160892..bca87f3965d54a2cb08cec6c47a4bf132aca0170 100644 (file)
@@ -29,9 +29,9 @@
 /**@internal
  * @file iptsec_debug.h
  * @brief Debug log for IPTSEC module.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Dec 19 15:56:35 2002 ppessi
  */
 
index 645025c02a95259f8a1cebe0f64c3b2c6d708eae..f5bea7676cb12fb74e08b22caa65eac958cb55e1 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef AUTH_CLIENT_H
 /** Defined when <sofia-sip/auth_client.h> has been included. */
-#define AUTH_CLIENT_H 
+#define AUTH_CLIENT_H
 
 /**@file sofia-sip/auth_client.h
  *
@@ -49,7 +49,7 @@ SOFIA_BEGIN_DECLS
 typedef struct auth_client_s auth_client_t;
 
 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_hclass_t *crcl);
 
@@ -62,14 +62,14 @@ int auc_info(auth_client_t **auc_list,
             msg_hclass_t *credential_class);
 
 SOFIAPUBFUN
-int auc_all_credentials(auth_client_t **auc_list, 
+int auc_all_credentials(auth_client_t **auc_list,
                        char const *scheme,
-                       char const *realm, 
+                       char const *realm,
                        char const *user,
                        char const *pass);
 
 SOFIAPUBFUN
-int auc_clear_credentials(auth_client_t **auc_list, 
+int auc_clear_credentials(auth_client_t **auc_list,
                          char const *scheme,
                          char const *realm);
 
@@ -81,15 +81,15 @@ int auc_has_authorization(auth_client_t **auc_list);
 
 SOFIAPUBFUN
 int auc_authorization(auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub,
-                     char const *method, 
-                     url_t const *url, 
+                     char const *method,
+                     url_t const *url,
                      msg_payload_t const *body);
 
 SOFIAPUBFUN
-int auc_authorization_headers(auth_client_t **auc_list, 
+int auc_authorization_headers(auth_client_t **auc_list,
                              su_home_t *home,
-                             char const *method, 
-                             url_t const *url, 
+                             char const *method,
+                             url_t const *url,
                              msg_payload_t const *body,
                              msg_header_t **return_headers);
 
@@ -105,4 +105,4 @@ int auc_register_plugin(auth_client_plugin_t const *plugin);
 
 SOFIA_END_DECLS
 
-#endif 
+#endif
index b6ccdfd1276b003432e877868cc9d23058d7e03c..36104ec8bde3fb8f1f44c301ada77417857b713a 100644 (file)
 
 #ifndef AUTH_CLIENT_PLUGIN_H
 /** 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
  * @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
  * before including this file.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @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 */
 
   char const *auc_name;                /* Name of the autentication scheme */
-  
+
   /** Store challenge */
-  int (*auc_challenge)(auth_client_t *ca, 
+  int (*auc_challenge)(auth_client_t *ca,
                       msg_auth_t const *ch);
 
   /** Authorize request. */
-  int (*auc_authorize)(auth_client_t *ca, 
+  int (*auc_authorize)(auth_client_t *ca,
                       su_home_t *h,
-                      char const *method, 
-                      url_t const *url, 
+                      char const *method,
+                      url_t const *url,
                       msg_payload_t const *body,
                       msg_header_t **return_headers);
 
index 5b8fa7e6b734d497cd224cc77070bb79a756f2ed..638413cd77b0f9f92ce658ce294c06d38271d0f1 100644 (file)
@@ -26,7 +26,7 @@
 /** Defined when <sofia-sip/auth_common.h> has been included. */
 #define AUTH_COMMON_H
 
-/**@file sofia-sip/auth_common.h 
+/**@file sofia-sip/auth_common.h
  *
  * Functions common for client/server.
  *
@@ -43,7 +43,7 @@ SOFIA_BEGIN_DECLS
 
 SOFIAPUBFUN issize_t auth_get_params(su_home_t *home,
                                     char const * const params[], ...
-                                 /* char const * name, 
+                                 /* char const * name,
                                     char const **return_value */);
 
 SOFIAPUBFUN int auth_struct_copy(void *dst, void const *src, isize_t s_size);
index 8bc22e8f1b8b37febbe6f982c4610030b4960c03..0f40061392bdfecfaf22420736880fb9dcaebf08 100644 (file)
 /** Defined when <sofia-sip/auth_digest.h> has been included. */
 #define AUTH_DIGEST_H
 
-/**@file sofia-sip/auth_digest.h 
+/**@file sofia-sip/auth_digest.h
  * Datatypes and functions for Digest authentication.
  *
  * The structures and functions here follow the RFC 2617.
  *
  * @sa @RFC2617,
  * <i>"HTTP Authentication: Basic and Digest Access Authentication"</i>,
- * J. Franks et al, 
+ * J. Franks et al,
  * June 1999.
  *
  * @sa @RFC3261 section 22
@@ -96,7 +96,7 @@ typedef struct {
  *
  * @code
  *   credentials      = "Digest" digest-response
- *   digest-response  = 1#( username | realm | nonce | digest-uri | 
+ *   digest-response  = 1#( username | realm | nonce | digest-uri |
  *                          response | [ algorithm ] | [cnonce] | [opaque] |
  *                          [message-qop] | [nonce-count] | [auth-param] )
  *   username         = "username" "=" username-value
index a9bcfd1e2f4cf973d531856068903cd83253db05..de4e72d579e72afecdade47a7ad14664554454e0 100644 (file)
@@ -24,9 +24,9 @@
 
 #ifndef AUTH_MODULE_H
 /** 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.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -56,7 +56,7 @@ typedef struct auth_mod_t auth_mod_t;
 /** Authentication operation. */
 typedef struct auth_status_t auth_status_t;
 
-#ifdef  AUTH_MAGIC_T 
+#ifdef  AUTH_MAGIC_T
 typedef AUTH_MAGIC_T auth_magic_t;
 #else
 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
  * verifying the authentication fills the auth_status_t structure, then
  * 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
- * 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
  * structure. The callback function is invoked when the authentication
  * operation is completed.
@@ -105,7 +105,7 @@ struct auth_status_t
   url_t const    *as_user_uri; /* Return user's identity [in/out] */
   char const     *as_ident;    /**< Identities [out] */
   unsigned        as_profile;  /**< User profile (group) [out] */
-  
+
   su_addrinfo_t  *as_source;   /**< Source address [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. */
-  auth_splugin_t *as_plugin;   
+  auth_splugin_t *as_plugin;
 };
 
 /** Authentication challenge.
@@ -146,7 +146,7 @@ struct auth_status_t
  * with 401 response code and phrase along with header class for
  * @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 */
   char const   *ach_phrase;    /**< Response phrase for challenge response */
index c84e96d734597f3633050ffa98acee02cea3802b..0176b9b8cd2ebfc3e30aadb477f153cade6927ba 100644 (file)
 
 #ifndef AUTH_NTLM_H
 /** 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.
  *
  * The structures and functions here follow the RFC 2617.
  *
- * @sa 
- * <a href="ftp://ftp.ietf.org/rfc/rfc2617.txt">RFC 2617</a>, 
+ * @sa
+ * <a href="ftp://ftp.ietf.org/rfc/rfc2617.txt">RFC 2617</a>,
  * <i>"HTTP Authentication: Basic and Ntlm Access Authentication"</i>,
- * J. Franks et al, 
+ * J. Franks et al,
  * 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>.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 
 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[]);
-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[]);
 
-int auth_ntlm_a1(auth_response_t *ar, 
+int auth_ntlm_a1(auth_response_t *ar,
                   auth_hexmd5_t ha1,
                   char const *secret);
 
-int auth_ntlm_a1sess(auth_response_t *ar, 
+int auth_ntlm_a1sess(auth_response_t *ar,
                       auth_hexmd5_t ha1sess,
                       char const *ha1);
 
 int auth_ntlm_sessionkey(auth_response_t *, auth_hexmd5_t ha1,
                           char const *secret);
 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);
 
 /** 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 *opaque,
                                  char const *gssapidata,
                                  char const *targetname);
 
-void auth_challenge_ntlm(auth_mod_t *am, 
+void auth_challenge_ntlm(auth_mod_t *am,
                         auth_status_t *as,
                         auth_challenger_t const *ach);
 
@@ -97,18 +97,18 @@ void auth_check_ntlm(auth_mod_t *am,
                     auth_response_t *ar,
                     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[],
                             size_t buffer_len,
                             int nextnonce,
                             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_response_t *ar,
                             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_challenger_t const *ach);
 
index e7e571ef588923c5dcc11ddbf5a9676636af04a1..4ee2c0ddcef0df9e60fce6ca782c62791ca1fb71 100644 (file)
 
 #ifndef AUTH_PLUGIN_H
 /** Defined when <sofia-sip/auth_plugin.h> has been included. */
-#define AUTH_PLUGIN_H 
+#define AUTH_PLUGIN_H
 
 /**@file sofia-sip/auth_plugin.h
  * @brief Plugin interface for authentication verification modules.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @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, ...);
 
   /** 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,
                     msg_auth_t *auth,
                     auth_challenger_t const *ch);
 
   /** 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_challenger_t const *ch);
 
-  /** Cancel an asynchronous authentication request. 
+  /** Cancel an asynchronous authentication request.
    * Invoked by auth_mod_cancel().
    */
-  void (*asch_cancel)(auth_mod_t *am, 
+  void (*asch_cancel)(auth_mod_t *am,
                      auth_status_t *as);
 
   /** Reclaim resources an authentication module.
@@ -161,7 +161,7 @@ struct auth_mod_t
   unsigned       am_count;     /**< Nonce counter */
 
   uint8_t        am_master_key[16]; /**< Private master key */
-  
+
   su_md5_t       am_hmac_ipad; /**< MD5 with inner 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 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 *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, ...);
 
 #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);
 
 SOFIAPUBFUN
-void auth_challenge_basic(auth_mod_t *am, 
+void auth_challenge_basic(auth_mod_t *am,
                          auth_status_t *as,
                          auth_challenger_t const *ach);
 
 /** Digest scheme */
 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 *opaque);
 
@@ -228,7 +228,7 @@ void auth_method_digest(auth_mod_t *am,
                        auth_challenger_t const *ach);
 
 SOFIAPUBFUN
-void auth_info_digest(auth_mod_t *am, 
+void auth_info_digest(auth_mod_t *am,
                      auth_status_t *as,
                      auth_challenger_t const *ach);
 
@@ -239,19 +239,19 @@ void auth_check_digest(auth_mod_t *am,
                       auth_challenger_t const *ach);
 
 SOFIAPUBFUN
-void auth_challenge_digest(auth_mod_t *am, 
+void auth_challenge_digest(auth_mod_t *am,
                           auth_status_t *as,
                           auth_challenger_t const *ach);
 
 SOFIAPUBFUN
-isize_t auth_generate_digest_nonce(auth_mod_t *am, 
+isize_t auth_generate_digest_nonce(auth_mod_t *am,
                                   char buffer[],
                                   size_t buffer_len,
                                   int nextnonce,
                                   msg_time_t now);
 
 SOFIAPUBFUN
-int auth_validate_digest_nonce(auth_mod_t *am, 
+int auth_validate_digest_nonce(auth_mod_t *am,
                               auth_status_t *as,
                               auth_response_t *ar,
                               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 */
 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);
 
 SOFIA_END_DECLS
index c42b58dd38bb4344a78d3e5f60d896a19c6fdee3..523568d2fac5ce2b8c84b0af1bb95f6aa60f83a8 100644 (file)
@@ -77,7 +77,7 @@
 int tstflags;
 char *argv0;
 
-#define TSTFLAGS tstflags 
+#define TSTFLAGS tstflags
 
 #include <sofia-sip/tstdef.h>
 
@@ -105,14 +105,14 @@ int test_digest()
     "algorithm=MD5, "
     "qop=\"auth\"";
 
-  char response[] = 
+  char response[] =
     "DIGEST USERNAME=\"digest\", "
     "REALM=\"garage.sr.ntc.nokia.com\", "
     "NONCE=\"MjAwMS0wMS0yMSAxNTowODo1OA==\", "
     "RESPONSE=\"d9d7f1ae99a013cb05f319f0f678251d\", "
     "URI=\"sip:garage.sr.ntc.nokia.com\"";
 
-  char rfc2617[] = 
+  char rfc2617[] =
     "Digest username=\"Mufasa\", "
     "realm=\"testrealm@host.com\", "
     "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
@@ -122,7 +122,7 @@ int test_digest()
     "algorithm=\"md5\", "
     "uri=\"/dir/index.html\"";
 
-  char indigo[] = 
+  char indigo[] =
     "Digest username=\"user1\", "
     "realm=\"nokia-proxy\", "
     "nonce=\"0YXwH29PCT4lEz8+YJipQg==\", "
@@ -134,7 +134,7 @@ int test_digest()
     "qop=auth, "
     "nc=000000002";
 
-  char proxy_authenticate[] = 
+  char proxy_authenticate[] =
     "Digest realm=\"IndigoSw\", "
     "domain=\"indigosw.com aol.com\", "
     "nonce=\"V2VkIEF1ZyAxNSAxNzoxNzozNyBCU1QgMjAwMVtCQDE3OWU4Yg==\", "
@@ -172,12 +172,12 @@ int test_digest()
   TEST_SIZE(auth_digest_response_get(home, ar, au->au_params), 10);
 
   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);
   TEST0(strcmp(sessionkey, "939e7578ed9e3c518a452acee763bce9") == 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);
   TEST0(strcmp(hresponse, "6629fae49393a05397450978507c4ef1") == 0);
 
@@ -195,11 +195,11 @@ int test_digest()
   TEST_1(ac->ac_auth_int);
 
   {
-    char challenge[] = 
+    char challenge[] =
       "Digest realm=\"opera.ntc.nokia.com\", "
       "nonce=\"InyiWI+qIdvDKkO2jFK7mg==\"";
 
-    char credentials[] = 
+    char credentials[] =
       "Digest username=\"samuel.privat.saturday@opera.ntc.nokia.com\", "
       "realm=\"opera.ntc.nokia.com\", nonce=\"InyiWI+qIdvDKkO2jFK7mg==\", "
       "algorithm=MD5, uri=\"sip:opera.ntc.nokia.com\", "
@@ -247,12 +247,12 @@ Authorization: Digest       username="Mufasa",
                             opaque="5ccc069c403ebaf9f0171e9517f40e41"
     */
 
-    char challenge[] = 
+    char challenge[] =
       "Digest realm=\"testrealm@host.com\", "
       "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
       "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"";
 
-    char rfc2069_cred[] = 
+    char rfc2069_cred[] =
       "Digest username=\"Mufasa\", "
       "realm=\"testrealm@host.com\", "
       "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", "
@@ -278,10 +278,10 @@ Authorization: Digest       username="Mufasa",
   }
 
   {
-    char worldcom_chal[] = 
+    char worldcom_chal[] =
       "Digest realm=\"WCOM\", nonce=\"ce2292f3f748fbe239bda9e852e8b986\"";
 
-    char worldcom_cred[] = 
+    char worldcom_cred[] =
       "Digest realm=\"WCOM\", username=\"jari\", "
       "nonce=\"ce2292f3f748fbe239bda9e852e8b986\", "
       "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\", "
       "nonce=\"wB7JBwIb/XhtgfGp1VuPoQ==\", opaque=\"wkJxwA==\", "
       ", algorithm=MD5, qop=\"auth\"";
 
-    char etri_cred[] = 
+    char etri_cred[] =
       "Digest username=\"myhuh\", realm=\"nokia-proxy\", "
       "nonce=\"wB7JBwIb/XhtgfGp1VuPoQ==\", uri=\"sip:194.2.188.133\", "
       "response=\"32960a62bdc202171ca5a294dc229a6d\", "
@@ -317,13 +317,13 @@ Authorization: Digest       username="Mufasa",
 
     memset(ac, 0, sizeof(ac)); ac->ac_size = sizeof(ac);
     memset(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar);
-    
+
     TEST0(pa = sip_proxy_authenticate_make(home, etri_chal));
     TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 8);
 
     TEST0(pz = sip_proxy_authorization_make(home, etri_cred));
     TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 6 /* 8 */);
-    
+
     ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
 
     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\", "
       "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(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar);
-    
+
     TEST0(pa = sip_proxy_authenticate_make(home, chal));
     TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 6);
 
     TEST0(pz = sip_proxy_authorization_make(home, cred));
     TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 8);
-    
+
     ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
 
     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\", "
       "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", opaque=\"+GNywA==\", "
       "algorithm=MD5, qop=\"auth-int\"";
-    char credentials[] = 
+    char credentials[] =
       "Digest username=\"test\", realm=\"nokia-proxy\", "
       "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", "
       "cnonce=\"11RkhFg9EdaIRD36w0EMVA==\", opaque=\"+GNywA==\", "
       "uri=\"sip:3000@194.2.188.133\", algorithm=MD5, "
       "response=\"26e8b9aaacfca2d68770fab1ec04e2c7\", "
       "qop=auth-int, nc=00000001";
-    char data[] = 
+    char data[] =
       "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
       "<presence>\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(ar, 0, sizeof(ar)); ar->ar_size = sizeof(ar);
-    
+
     TEST0(pa = sip_proxy_authenticate_make(home, challenge));
     TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 8);
 
     TEST0(pz = sip_proxy_authorization_make(home, credentials));
     TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 12);
-    
+
     ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
 
     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)));
     TEST_S(hresponse, "26e8b9aaacfca2d68770fab1ec04e2c7");
   }
 
   su_home_deinit(home);
-  
+
   END();
 }
 
@@ -418,7 +418,7 @@ msg_t *read_message(int flags, char const buffer[])
   msg_iovec_t iovec[2];
 
   n = strlen(buffer);
-  if (n == 0) 
+  if (n == 0)
     return NULL;
 
   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);
 }
 
-static 
+static
 void init_as(auth_status_t *as)
 {
-  memset(as, 0, sizeof *as); 
+  memset(as, 0, sizeof *as);
   as->as_home->suh_size = (sizeof *as);
   su_home_init(as->as_home);
   as->as_method = "REGISTER";
@@ -458,14 +458,14 @@ void init_as(auth_status_t *as)
   as->as_phrase = "Infernal Error";
 }
 
-static 
+static
 void deinit_as(auth_status_t *as)
 {
   su_home_deinit(as->as_home);
   memset(as, 0, sizeof *as);
 }
 
-static 
+static
 void reinit_as(auth_status_t *as)
 {
   deinit_as(as); init_as(as);
@@ -475,9 +475,9 @@ void reinit_as(auth_status_t *as)
 int test_digest_client()
 {
   BEGIN();
-  
+
   {
-    char challenge[] = 
+    char challenge[] =
       PROTOCOL " 401 Unauthorized\r\n"
       "Call-ID:0e3dc2b2-dcc6-1226-26ac-258b5ce429ab\r\n"
       "CSeq:32439043 REGISTER\r\n"
@@ -488,8 +488,8 @@ int test_digest_client()
       "Content-Length:0\r\n"
       "Security-Server:digest\r\n"
       "r\n";
-      
-    char request[] = 
+
+    char request[] =
       "REGISTER sip:ims3.so.noklab.net " PROTOCOL "\r\n"
       "Via: SIP/2.0/UDP 10.21.36.70:23800;rport;branch=z9hG4bKRE18GFwa3AS\r\n"
       "Max-Forwards: 80\r\n"
@@ -515,13 +515,13 @@ int test_digest_client()
     auth_mod_t *am;
     auth_status_t as[1];
     sip_www_authenticate_t *au;
-    auth_challenger_t ach[1] = 
-      {{ 401, "Authorization required", 
+    auth_challenger_t ach[1] =
+      {{ 401, "Authorization required",
         sip_www_authenticate_class,
         sip_authentication_info_class
        }};
-    auth_challenger_t pach[1] = 
-      {{ 407, "Proxy Authorization required", 
+    auth_challenger_t pach[1] =
+      {{ 407, "Proxy Authorization required",
         sip_proxy_authenticate_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(sip = sip_object(m1));
-    
+
     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);
     TEST_1(aucs != NULL);
     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);
 
     TEST_1(m2 = read_message(MSG_DO_EXTRACT_COPY, request));
     TEST_1(sip = sip_object(m2));
     TEST_P(sip->sip_authorization, NULL);
     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);
     TEST_1(sip->sip_authorization);
     TEST_S(msg_params_find(sip->sip_authorization->au_params,
                           "response="),
           "\"860f5ecc9990772e16937750ced9594d\"");
 
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
     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(am = auth_mod_create(NULL, 
+    TEST_1(am = auth_mod_create(NULL,
                                AUTHTAG_METHOD("Digest"),
                                AUTHTAG_REALM("ims3.so.noklab.net"),
                                AUTHTAG_DB(testpasswd),
@@ -582,7 +582,7 @@ int test_digest_client()
     auth_mod_check_client(am, as, sip->sip_authorization, ach);
     TEST(as->as_status, 401);
 
-    TEST_1(au = sip_authorization_make(home, 
+    TEST_1(au = sip_authorization_make(home,
                                       "Digest username=\"user1\", "
                                       "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\", "
                                       "opaque=\"+GNywA==\", "
@@ -602,7 +602,7 @@ int test_digest_client()
       char const *uri = au->au_params[3];
       char const *response = au->au_params[4];
       char const *realm = au->au_params[5];
-      
+
       TEST_S(username, "username=\"user1\"");
       TEST_S(nonce, "nonce=\"3wWGOvaWn3n+hFv8PK2ABQ==\"");
       TEST_S(opaque, "opaque=\"+GNywA==\"");
@@ -653,24 +653,24 @@ int test_digest_client()
     as->as_response = (msg_header_t *)
       sip_www_authenticate_make(as->as_home, "Unknown realm=\"huu haa\"");
     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);
     aucs = NULL;
 
     reinit_as(as);
     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);
     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);
 
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
 
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
 
@@ -683,7 +683,7 @@ int test_digest_client()
     auth_mod_destroy(am);
     aucs = NULL;
 
-    TEST_1(am = auth_mod_create(NULL, 
+    TEST_1(am = auth_mod_create(NULL,
                                AUTHTAG_METHOD("Digest"),
                                AUTHTAG_REALM("ims3.so.noklab.net"),
                                AUTHTAG_DB(testpasswd),
@@ -713,11 +713,11 @@ int test_digest_client()
       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);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     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(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);
       msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
 
-      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                            (url_t *)"sip:surf3@ims3.so.noklab.net", 
+      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                            (url_t *)"sip:surf3@ims3.so.noklab.net",
                             sip->sip_payload), 1);
 
       TEST_1(sip->sip_authorization);
@@ -774,7 +774,7 @@ int test_digest_client()
     {
       msg_auth_t *au;
 
-      TEST_1(am = auth_mod_create(NULL, 
+      TEST_1(am = auth_mod_create(NULL,
                                  AUTHTAG_METHOD("Digest"),
                                  AUTHTAG_DB(testpasswd),
                                  AUTHTAG_ALGORITHM("MD5-sess"),
@@ -790,12 +790,12 @@ int test_digest_client()
       au = (void *)msg_header_dup(home, as->as_response); TEST_1(au);
 
       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);
       msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
 
-      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                            (url_t *)"sip:surf3@ims3.so.noklab.net", 
+      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                            (url_t *)"sip:surf3@ims3.so.noklab.net",
                             sip->sip_payload), 1);
 
       TEST_1(sip->sip_authorization);
@@ -812,7 +812,7 @@ int test_digest_client()
     {
       char const *nonce1, *nextnonce, *nonce2;
 
-      TEST_1(am = auth_mod_create(NULL, 
+      TEST_1(am = auth_mod_create(NULL,
                                  AUTHTAG_METHOD("Digest"),
                                  AUTHTAG_REALM("ims3.so.noklab.net"),
                                  AUTHTAG_DB(testpasswd),
@@ -823,21 +823,21 @@ int test_digest_client()
                                     if NEXT_EXPIRES in nonzero */
                                  AUTHTAG_NEXT_EXPIRES(900),
                                  TAG_END()));
-      
+
       reinit_as(as);
       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);
-      TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", 
+      TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
                               "user1", "secret"), 1);
       msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                            (url_t *)"sip:surf3@ims3.so.noklab.net", 
+      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                            (url_t *)"sip:surf3@ims3.so.noklab.net",
                             sip->sip_payload), 1);
       TEST_1(sip->sip_authorization);
       TEST_1(nonce1 = msg_header_find_param(sip->sip_authorization->au_common, "nonce"));
-      
+
       reinit_as(as);
       auth_mod_check_client(am, as, sip->sip_authorization, ach);
       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);
 
       msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                            (url_t *)"sip:surf3@ims3.so.noklab.net", 
+      TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                            (url_t *)"sip:surf3@ims3.so.noklab.net",
                             sip->sip_payload), 1);
       TEST_1(sip->sip_authorization);
       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;
     }
 
-    TEST_1(am = auth_mod_create(NULL, 
+    TEST_1(am = auth_mod_create(NULL,
                                AUTHTAG_METHOD("Digest"),
                                AUTHTAG_REALM("ims3.so.noklab.net"),
                                AUTHTAG_DB(testpasswd),
@@ -878,13 +878,13 @@ int test_digest_client()
     reinit_as(as);
     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);
-    TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", 
+    TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
                             "user1", "secret"), 1);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
 
@@ -893,7 +893,7 @@ int test_digest_client()
     TEST(as->as_status, 0);
     auth_mod_destroy(am); aucs = NULL;
 
-    TEST_1(am = auth_mod_create(NULL, 
+    TEST_1(am = auth_mod_create(NULL,
                                AUTHTAG_METHOD("Digest"),
                                AUTHTAG_REALM("ims3.so.noklab.net"),
                                AUTHTAG_DB(testpasswd),
@@ -907,13 +907,13 @@ int test_digest_client()
     reinit_as(as);
     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);
-    TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"", 
+    TEST(auc_all_credentials(&aucs, "Digest", "\"ims3.so.noklab.net\"",
                             "user1", "secret"), 1);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     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);
 
     /* 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\"");
     reinit_as(as);
     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_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);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
     TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="),
@@ -965,8 +965,8 @@ int test_digest_client()
 
     /* Test nonce count check */
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
     TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="),
@@ -983,15 +983,15 @@ int test_digest_client()
     /* Test anonymous operation */
     reinit_as(as);
     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);
     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);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
 
@@ -1000,20 +1000,20 @@ int test_digest_client()
     auth_mod_destroy(am); aucs = NULL;
 
     /* Test empty realm */
-    TEST_1(am = auth_mod_create(root, 
+    TEST_1(am = auth_mod_create(root,
                                AUTHTAG_METHOD("Digest"),
                                AUTHTAG_REALM(""),
                                AUTHTAG_DB(testpasswd),
                                TAG_END()));
     reinit_as(as);
     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);
     reinit_as(as);
 
     TEST(auc_all_credentials(&aucs, "Digest", "\"\"", "user1", "secret"), 1);
     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",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
@@ -1021,15 +1021,15 @@ int test_digest_client()
     auth_mod_check_client(am, as, sip->sip_authorization, ach);
     TEST(as->as_status, 0);
     aucs = NULL;
-    reinit_as(as); 
+    reinit_as(as);
     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);
     reinit_as(as);
 
     TEST(auc_credentials(&aucs, as->as_home, "Digest:\"\":user1:secret"), 1);
     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",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_proxy_authorization);
@@ -1040,25 +1040,25 @@ int test_digest_client()
     auth_mod_destroy(am); aucs = NULL;
 
     /* Test Basic authentication scheme */
-    TEST_1(am = auth_mod_create(root, 
+    TEST_1(am = auth_mod_create(root,
                                AUTHTAG_METHOD("Basic"),
                                AUTHTAG_REALM("ims3.so.noklab.net"),
                                AUTHTAG_DB(testpasswd),
                                TAG_END()));
 
-    reinit_as(as);    
-    auth_mod_check_client(am, as, NULL, ach); 
+    reinit_as(as);
+    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);
-    reinit_as(as);    
+    reinit_as(as);
 
-    TEST(auc_all_credentials(&aucs, "Basic", "\"ims3.so.noklab.net\"", 
+    TEST(auc_all_credentials(&aucs, "Basic", "\"ims3.so.noklab.net\"",
                             "user1", "secret"), 1);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
 
@@ -1067,20 +1067,20 @@ int test_digest_client()
 
     aucs = NULL;
 
-    reinit_as(as);    
-    auth_mod_check_client(am, as, NULL, ach); 
+    reinit_as(as);
+    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);
-    reinit_as(as);    
+    reinit_as(as);
 
-    TEST(auc_all_credentials(&aucs, "Basic", "\"ims3.so.noklab.net\"", 
-         "very-long-user-name-that-surely-exceeds-the-static-buffer", 
+    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);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
 
@@ -1091,7 +1091,7 @@ int test_digest_client()
 
     /* Test asynchronous operation */
     aucs = NULL;
-    TEST_1(am = auth_mod_create(root, 
+    TEST_1(am = auth_mod_create(root,
                                AUTHTAG_METHOD("Delayed+Digest"),
                                AUTHTAG_REALM("ims3.so.noklab.net"),
                                AUTHTAG_DB(testpasswd),
@@ -1107,19 +1107,19 @@ int test_digest_client()
     TEST(as->as_status, 100);
     su_root_run(root);
     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);
 
     reinit_as(as);
     as->as_callback = test_callback;
     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);
     msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
-    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
-                          (url_t *)"sip:surf3@ims3.so.noklab.net", 
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name,
+                          (url_t *)"sip:surf3@ims3.so.noklab.net",
                           sip->sip_payload), 1);
     TEST_1(sip->sip_authorization);
 
@@ -1188,7 +1188,7 @@ int test_module_io()
   TEST(close(tmpfd), 0);
 
   /* Test file reading operation */
-  am = auth_mod_create(NULL, 
+  am = auth_mod_create(NULL,
                       AUTHTAG_METHOD("Digest"),
                       AUTHTAG_REALM("realm"),
                       AUTHTAG_DB(tmppasswd),
@@ -1201,7 +1201,7 @@ int test_module_io()
 
   apw = auth_mod_getpass(am, "user2", NULL); TEST_1(apw);
   TEST_S(apw->apw_hash, "4cbc2aff0b5b2b33675c0731c0db1c14");
-  
+
   apw2 = apw;
 
   *am0 = *am;
@@ -1312,7 +1312,7 @@ int main(int argc, char *argv[])
 
       if (rest == NULL || *rest)
        usage(1);
-      
+
       su_log_set_level(iptsec_log, level);
     } else {
       usage(1);
index f48ee71f90a981ebe78627bc84325ad80df403c9..bc43f5011181f7fadf346747ca2cc7cf03c41ff8 100644 (file)
@@ -6,7 +6,7 @@
 
        * 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_table.c(.in) as test_table.c(.in).
 
 
        * msg_parser.c: Using header-specific flags to classify parsing
        errors with msg_extract_errors().
-       
+
        Added support for apndlist headers.
 
        * msg_header.h: Added support for apndlist headers.
 
        * msg_mime.c: Various Accept* headers are now apndlist meaning
        that they are printed on single line by default.
-       
+
 2005-07-18  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * Initial import of the module to Sofia-SIP tree.
index 441e99bd7b0e281439e48157d9b4b556e8cc8d47..a1d0203eae6632e35e5a7fab45c89e4b24aa7abf 100644 (file)
@@ -33,7 +33,7 @@ PUBLIC_H =            sofia-sip/msg.h sofia-sip/msg_header.h \
 INTERNAL_H = msg_internal.h test_class.h
 
 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
 
@@ -55,7 +55,7 @@ LDADD =               libtest_msg.a libmsg.la \
                        ../bnf/libbnf.la \
                        ../url/liburl.la \
                        ../ipt/libipt.la \
-                       ../su/libsu.la 
+                       ../su/libsu.la
 
 test_msg_LDFLAGS =     -static
 
index 96e6954f06adf4ffbe65f024e4a5e42d603ad061..264ca267f87e902bb9eeef1776790fb023aa4415 100644 (file)
@@ -95,7 +95,7 @@ msg_t *msg_create(msg_mclass_t const *mc, int flags)
  * destroyed.
  *
  * @param msg   message of which a reference is created
- * 
+ *
  * @return
  * A pointer to a message.
  */
@@ -137,7 +137,7 @@ void msg_set_parent(msg_t *kid, msg_t *dad)
  * @relatesalso msg_s
  *
  * @param ref pointer to msg object
- * 
+ *
  * @deprecated Use msg_destroy() instead.
  */
 void msg_ref_destroy(msg_t *ref)
@@ -154,7 +154,7 @@ void msg_ref_destroy(msg_t *ref)
 void msg_destroy(msg_t *msg)
 {
   msg_t *parent;
-  
+
   for (; msg; msg = parent) {
     int refs;
     su_home_mutex_lock(msg->m_home);
@@ -174,9 +174,9 @@ void msg_destroy(msg_t *msg)
 /**Retrieve public message structure.
  *
  * Get a pointer to the public message structure.
- * 
+ *
  * @param msg pointer to msg object
- * 
+ *
  * @returns
  * 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
  * given protocol.
- * 
+ *
  * @param msg pointer to msg object
  * @param tag tag of public message structure
- * 
+ *
  * @returns
  * A pointer to the public message structure, or NULL if there is none or
  * 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
  * (factory object for the message).
- * 
+ *
  * @param msg pointer to msg object
- * 
+ *
  * @returns
  * 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.
  *
  * @sa msg_addrinfo(), msg_set_address(), msg_get_address(), msg_addr_copy().
- */ 
+ */
 void msg_addr_zero(msg_t *msg)
 {
   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;
 }
 
-/** Get pointer to socket address structure. 
+/** Get pointer to socket address structure.
  *
  * @relatesalso msg_s
  *
@@ -269,7 +269,7 @@ su_sockaddr_t *msg_addr(msg_t *msg)
  *
  * @param msg pointer to msg object
  * @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
  *
  * @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;
 }
 
-/** Set message address. 
+/** Set message address.
  *
  * @relatesalso msg_s
  *
  * Copy the supplied socket address to the socket address structure
  * associated with the message.
- * 
+ *
  * @param msg pointer to msg object
  * @param su pointer to 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
  * message object.
  *
- * @param dst pointer to destination message object 
+ * @param dst pointer to destination message object
  * @param src pointer to source message object
  *
  * @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.ai_next = 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);
   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);
 }
 
@@ -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
  * sets the corresponding extract error flags. The flags corresponding to
- * each header are stored in the message parser (msg_mclass_t) structure. 
- * They are set when the header is added to the parser table. 
- * 
+ * each header are stored in the message parser (msg_mclass_t) structure.
+ * 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
  * SIP headers, the flags for each header are listed in a separate text file
  * (sip_bad_mask) read by msg_parser.awk.
index ad44f3a956108efed172e02e11fb4b19bb2c8fd8..5ce63d618ecb1bfd601724c5daecca7fde342d2a 100644 (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
 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
-parsers are as follows: 
-- <sofia-sip/msg_parser.h> parsing functions, macros 
-- <sofia-sip/msg_mclass.h> message factory object definition 
+parsers are as follows:
+- <sofia-sip/msg_parser.h> parsing functions, macros
+- <sofia-sip/msg_mclass.h> message factory object definition
 - <sofia-sip/msg_mclass_hash.h> hashing of header names
 
 @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
 <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
-lists. 
+lists.
 
 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
@@ -73,18 +73,18 @@ For header @e X of protocol @e NS, there are types, functions, macros and
 header class as follows:
 
  - @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,
  - @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_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_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 ns_X_dup() duplicates (deeply copies) the header X, 
- - @c ns_X_copy() copies the header X, 
+ - @c ns_X_dup() duplicates (deeply 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_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.
 
 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
 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
-message only. 
+message only.
 
 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
@@ -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.)
 
 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
 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
@@ -195,7 +195,7 @@ typedef struct msg_accept_s
   char const         *ac_subtype;   //< Points after first slash in type
   msg_param_t const  *ac_params;    //< List of parameters
   msg_param_t         ac_q;        //< Value of q parameter
-} 
+}
 msg_accept_t;
 @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 qvalue is assigned to @c ac_q field.
 
-In the beginning of the header structure there are two boilerplate members. 
-The @c ac_common[1] contains information common to all message fragments. 
+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_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
 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
 at the message level, for example, accessing directly the @b Accept header
 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
 protocol-specific type is #sip_t, #http_t or #msg_multipart_t for
 SIP, HTTP and MIME, respectively.
@@ -283,7 +283,7 @@ CSeq: 2
 
 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
 
 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;
  *
- * Message object. 
+ * Message object.
  *
  * The @a msg_t is the type of a message object used by Sofia signaling
  * protocols and parsers. Its contents are not directly accessible.
@@ -454,7 +454,7 @@ encountered.
 
 /**@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
  * protocol parsers. Instead of #msg_common_t, most interfaces use
index c81e9f0ca58f1281b0492ced78bb4adafead46a4..5bab45d10e3a24de10707c1f06990a81d7df77e8 100644 (file)
@@ -76,9 +76,9 @@ static size_t msg_auth_item_scan(char *start)
 
 /* ====================================================================== */
 /*
- * auth           = ("Authorization" | "Encryption" | 
+ * auth           = ("Authorization" | "Encryption" |
  *                   "Proxy-Authenticate" | "Proxy-Authorization" |
- *                   "Response-Key" | "WWW-Authenticate") ":" 
+ *                   "Response-Key" | "WWW-Authenticate") ":"
  *                    scheme 1*SP #auth-param
  * scheme         = token
  * auth-param     = token | token "=" token | token "=" quoted-string
@@ -93,12 +93,12 @@ issize_t msg_auth_d(su_home_t *home,
   msg_auth_t *au = (msg_auth_t *)h;
 
   au->au_scheme = s;
-  
+
   skip_token(&s);
   if (!IS_LWS(*s)) return -1;
   *s++ = '\0';                 /* NUL-terminate scheme */
 
-  return msg_commalist_d(home, &s, (msg_param_t **)&au->au_params, 
+  return msg_commalist_d(home, &s, (msg_param_t **)&au->au_params,
                         NULL /* msg_auth_item_scan */);
 }
 
@@ -114,11 +114,11 @@ issize_t msg_auth_e(char b[], isize_t bsiz, msg_header_t const *h, int f)
     MSG_COMMALIST_E(b, end, au->au_params, compact);
   }
   MSG_TERM_E(b, end);
-  
+
   return b - b0;
 }
 
-/**@internal 
+/**@internal
  * Extra size of a msg_auth_t object.
  *
  * This function calculates extra size required by a msg_auth_t object.
@@ -134,7 +134,7 @@ isize_t msg_auth_dup_xtra(msg_header_t const *h, isize_t offset)
 
   MSG_PARAMS_SIZE(offset, au->au_params);
   offset += MSG_STRING_SIZE(au->au_scheme);
-    
+
   return offset;
 }
 
@@ -150,7 +150,7 @@ char *msg_auth_dup_one(msg_header_t *dst,
 
   b = msg_params_dup(&au->au_params, o->au_params, b, xtra);
   MSG_STRING_DUP(b, au->au_scheme, o->au_scheme);
-    
+
   assert(b <= end); (void)end;
 
   return b;
index fad8fe686f8a06db8e0342c153e3bc73b43b5b66..44fbf3a0f340650d50cb4bdeb04dc6606bf1b9c5 100644 (file)
@@ -61,7 +61,7 @@
  * @defgroup msg_error Erroneous Headers
  *
  * The erroneous headers are stored in #msg_error_t structure.
- * 
+ *
  * @note Parser may put other headers (like duplicate Content-Length
  * headers) into the list of erroneous headers. If the list of erroneous
  * headers is processed, the header type must be validated first by calling
@@ -111,7 +111,7 @@ char *msg_error_dup_one(msg_header_t *dst, msg_header_t const *src,
  * The unknown headers are handled with #msg_unknown_t structure. The whole
  * unknown header including its name is included in the header value string
  * @a g_value.
- * 
+ *
  * @note It is possible to speed up parsing process by creating a parser
  * which does understand only a minimum number of headers. If such a parser
  * is used, some well-known headers are not regocnized or parser, but they
@@ -139,7 +139,7 @@ issize_t msg_unknown_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
   *s++ = '\0';
   skip_lws(&s);
   un->un_value = s;
-                                          
+
   return 0;
 }
 
@@ -153,7 +153,7 @@ issize_t msg_unknown_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
   MSG_CHAR_E(b, end, ':');
   if (!compact) MSG_CHAR_E(b, end, ' ');
   MSG_STRING_E(b, end, un->un_value);
-  
+
   return b - b0;
 }
 
@@ -184,7 +184,7 @@ char *msg_unknown_dup_one(msg_header_t *dst, msg_header_t const *src,
  * @defgroup msg_payload Message Body
  *
  * The payload object contains the message body. The message body has no
- * structure, but it is stored in the @a pl_data buffer as a byte array. 
+ * structure, but it is stored in the @a pl_data buffer as a byte array.
  * Multiple payload objects may be linked to a list.
  */
 
@@ -197,7 +197,7 @@ char *msg_unknown_dup_one(msg_header_t *dst, msg_header_t const *src,
  * @code
  * typedef struct msg_payload_s {
  *   msg_common_t    pl_common[1];      // Common fragment info
- *   msg_header_t   *pl_next;           // Next payload object 
+ *   msg_header_t   *pl_next;           // Next payload object
  *   char           *pl_data;           // Data - may contain zero bytes
  *   usize_t         pl_len;            // Length of message payload
  * } msg_payload_t;
@@ -263,7 +263,7 @@ isize_t msg_payload_dup_xtra(msg_header_t const *h, isize_t offset)
 
 char *msg_payload_dup_one(msg_header_t *dst,
                          msg_header_t const *src,
-                         char *b, 
+                         char *b,
                          isize_t xtra)
 {
   msg_payload_t *pl = dst->sh_payload;
@@ -288,7 +288,7 @@ usize_t msg_payload_length(msg_payload_t const *pl)
 /* ====================================================================== */
 
 /**@ingroup msg_headers
- * @defgroup msg_separator Message Separator 
+ * @defgroup msg_separator Message Separator
  *
  * An empty line separates headers from the message body. In order to avoid
  * modifying messages with integrity protection, the separator line has its
@@ -325,7 +325,7 @@ issize_t msg_separator_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen
 
   if (len == 0 && slen > 0)
     return -1;
-  
+
   memcpy(h->sh_separator->sep_data, s, len);
   h->sh_separator->sep_data[len] = '\0';
 
@@ -345,7 +345,7 @@ issize_t msg_separator_e(char b[], isize_t bsiz, msg_header_t const *h, int flag
 
 msg_separator_t *msg_separator_create(su_home_t *home)
 {
-  msg_separator_t *sep = 
+  msg_separator_t *sep =
     msg_header_alloc(home, msg_separator_class, 0)->sh_separator;
 
   if (sep)
index 3b09b31f5b2f48e2c12dc7bd7c46e9c5ce2caafc..d5886b229856f18abf006183f57e47d3936707e4 100644 (file)
@@ -59,7 +59,7 @@ msg_time_t msg_now(void)
  *
  * First day of the epoch year should be Monday.
  */
-#define EPOCH 1900             
+#define EPOCH 1900
 /** Is this year a leap year? @internal */
 #define LEAP_YEAR(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
 /** Day number of New Year Day of given year. @internal */
@@ -69,25 +69,25 @@ msg_time_t msg_now(void)
 
 /* ====================================================================== */
 
-static unsigned char const days_per_months[12] = 
+static unsigned char const days_per_months[12] =
   {
     31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
   };
 
 /** Offset of first day of the month with formula day = 30 * month + offset. */
-static signed char const first_day_offset[12] = 
+static signed char const first_day_offset[12] =
   {
     0, 1, -1, 0, 0, 1, 1, 2, 3, 3, 4, 4
   };
 
-static char const wkdays[7 * 4] = 
+static char const wkdays[7 * 4] =
   "Mon\0" "Tue\0" "Wed\0" "Thu\0" "Fri\0" "Sat\0" "Sun";
 
-static char const months[12 * 4] = 
-  "Jan\0" "Feb\0" "Mar\0" "Apr\0" "May\0" "Jun\0" 
+static char const months[12 * 4] =
+  "Jan\0" "Feb\0" "Mar\0" "Apr\0" "May\0" "Jun\0"
   "Jul\0" "Aug\0" "Sep\0" "Oct\0" "Nov\0" "Dec";
 
-/** Parse a month name. 
+/** Parse a month name.
  *
  * @return The function month_d() returns 0..11 if given first three letters
  * of month name, or -1 if no month name matches.
@@ -126,19 +126,19 @@ int month_d(char const *s)
 
 /* Parse SP 2DIGIT ":" 2DIGIT ":" 2DIGIT SP */
 su_inline
-int time_d(char const **ss, 
+int time_d(char const **ss,
           unsigned long *hour, unsigned long *min, unsigned long *sec)
 {
   char const *s = *ss;
-  if (!IS_LWS(*s)) 
-    return -1; 
+  if (!IS_LWS(*s))
+    return -1;
   skip_lws(&s);
   if (!is_digit(*s)) return -1;
   *hour = *s++ - '0'; if (is_digit(*s)) *hour = 10 * (*hour) + *s++ - '0';
-  if (*s++ != ':' || !is_digit(s[0]) || !is_digit(s[1])) 
+  if (*s++ != ':' || !is_digit(s[0]) || !is_digit(s[1]))
     return -1;
   *min = 10 * s[0] + s[1] - 11 * '0'; s += 2;
-  if (*s++ != ':' || !is_digit(s[0]) || !is_digit(s[1])) 
+  if (*s++ != ':' || !is_digit(s[0]) || !is_digit(s[1]))
     return -1;
   *sec = 10 * s[0] + s[1] - 11 * '0'; s += 2;
   if (*s) {
@@ -149,10 +149,10 @@ int time_d(char const **ss,
 }
 
 /**Decode RFC1123-date, RFC822-date or asctime-date.
- * 
- * The function msg_date_d() decodes <HTTP-date>, which may have 
+ *
+ * The function msg_date_d() decodes <HTTP-date>, which may have
  * different formats.
- * 
+ *
  * @code
  * HTTP-date    = rfc1123-date / rfc850-date / asctime-date
  *
@@ -174,7 +174,7 @@ int time_d(char const **ss,
  * wkday        = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
  * weekday      = "Monday" / "Tuesday" / "Wednesday"
  *              / "Thursday" / "Friday" / "Saturday" / "Sunday"
- * month        = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" 
+ * month        = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun"
  *              / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
  * @endcode
  */
@@ -189,26 +189,26 @@ issize_t msg_date_d(char const **ss, msg_time_t *date)
   if (!IS_TOKEN(*s) || !date)
     return -1;
 
-  wkday = s; skip_token(&s); if (*s == ',') s++; 
+  wkday = s; skip_token(&s); if (*s == ',') s++;
   while (IS_LWS(*s)) s++;
 
   if (is_digit(*s)) {
     day = *s++ - '0'; if (is_digit(*s)) day = 10 * day + *s++ - '0';
-    
+
     if (*s == ' ') {
-      /* rfc1123-date = 
+      /* rfc1123-date =
         wkday "," SP 2DIGIT SP month SP 4DIGIT SP time SP "GMT"
        */
       mon = month_d(++s); skip_token(&s);
       if (mon < 0 || !IS_LWS(*s)) return -1;
       s++;
-      if (!is_digit(s[0]) || !is_digit(s[1]) || 
+      if (!is_digit(s[0]) || !is_digit(s[1]) ||
          !is_digit(s[2]) || !is_digit(s[3]))
        return -1;
       year = 1000 * s[0] + 100 * s[1] + 10 * s[2] + s[3] - 1111 * '0'; s += 4;
     }
     else if (*s == '-') {
-      /* rfc822-date = 
+      /* rfc822-date =
         weekday "," SP 2DIGIT "-" month "-" 2DIGIT SP time SP "GMT"
        */
 
@@ -216,9 +216,9 @@ issize_t msg_date_d(char const **ss, msg_time_t *date)
       if (mon < 0 || s[3] != '-' ||
          !is_digit(s[4]) || !is_digit(s[5]))
        return -1;
-      year = 10 * s[4] + s[5] - 11 * '0'; 
+      year = 10 * s[4] + s[5] - 11 * '0';
       if (is_digit(s[6]) && is_digit(s[7])) {
-       /* rfc2822-date = 
+       /* rfc2822-date =
           weekday "," SP 2DIGIT "-" month "-" 4DIGIT SP time SP "GMT"
        */
        year = year * 100 + 10 * s[6] + s[7] - 11 * '0';
@@ -243,26 +243,26 @@ issize_t msg_date_d(char const **ss, msg_time_t *date)
     }
   }
   else {
-    /* actime-date = 
+    /* actime-date =
        wkday SP month SP ( 2DIGIT | ( SP 1DIGIT )) SP time SP 4DIGIT */
     mon = month_d(s); skip_token(&s);
     if (mon < 0 || !IS_LWS(*s)) return -1; s++;
-    while (IS_LWS(*s)) s++; 
+    while (IS_LWS(*s)) s++;
     if (!is_digit(*s)) return -1;
     day = *s++ - '0'; if (is_digit(*s)) day = 10 * day + *s++ - '0';
     if (time_d(&s, &hour, &min, &sec) < 0) return -1;
-    /* Accept also unix date (if it is GMT) */ 
+    /* Accept also unix date (if it is GMT) */
     if ((s[0] == 'G' && s[1] == 'M' && s[2] == 'T' && s[3] == ' ') ||
        (s[0] == 'U' && s[1] == 'T' && s[2] == 'C' && s[3] == ' '))
       s += 4;
     else if (s[0] == 'U' && s[1] == 'T' && s[2] == ' ')
       s += 3;
-    if (!is_digit(s[0]) || !is_digit(s[1]) || 
+    if (!is_digit(s[0]) || !is_digit(s[1]) ||
        !is_digit(s[2]) || !is_digit(s[3]))
       return -1;
     year = 1000 * s[0] + 100 * s[1] + 10 * s[2] + s[3] - 1111 * '0'; s += 4;
   }
-  
+
   if (hour > 24 || min >= 60 || sec >= 60 ||
       (hour == 24 && min > 0 && sec > 0))
     return -1;
@@ -271,7 +271,7 @@ issize_t msg_date_d(char const **ss, msg_time_t *date)
     if (day != 29 || mon != 1 || !LEAP_YEAR(year))
       return -1;
   }
-  
+
   if (year < EPOCH) {
     *date = 0;
   }
@@ -281,17 +281,17 @@ issize_t msg_date_d(char const **ss, msg_time_t *date)
   else {
     int leap_year = LEAP_YEAR(year);
     msg_time_t ydays = YEAR_DAYS(year) - YEAR_DAYS(EPOCH);
-    
+
 #if 0
-    printf("Year %d%s starts %ld = %d - %d days since epoch (%d)\n", 
-              year, leap_year ? " (leap year)" : "", 
+    printf("Year %d%s starts %ld = %d - %d days since epoch (%d)\n",
+              year, leap_year ? " (leap year)" : "",
           ydays, YEAR_DAYS(year), YEAR_DAYS(EPOCH), EPOCH);
 #endif
-    
-    *date = sec + 60 * 
-      (min + 60 * 
-          (hour + 24 * 
-           (day - 1 + mon * 30 + first_day_offset[mon] + 
+
+    *date = sec + 60 *
+      (min + 60 *
+          (hour + 24 *
+           (day - 1 + mon * 30 + first_day_offset[mon] +
             (leap_year && mon > 2) + ydays)));
   }
   *ss = s;
@@ -301,10 +301,10 @@ issize_t msg_date_d(char const **ss, msg_time_t *date)
 
 
 /**Encode RFC1123-date.
- * 
+ *
  * The function msg_date_e() prints @e http-date in the <rfc1123-date>
  * format. The format is as follows:
- * 
+ *
  * @code
  * rfc1123-date = wkday "," SP date SP time SP "GMT"
  * wkday        = "Mon" | "Tue" | "Wed"
@@ -317,11 +317,11 @@ issize_t msg_date_d(char const **ss, msg_time_t *date)
  * time         = 2DIGIT ":" 2DIGIT ":" 2DIGIT
  *                ; 00:00:00 - 23:59:59
  * @endcode
- * 
+ *
  * @param b         buffer to print the date
  * @param bsiz      size of the buffer
  * @param http_date seconds since 01 Jan 1900.
- * 
+ *
  * @return The function msg_date_e() returns the size of the formatted date.
  */
 issize_t msg_date_e(char b[], isize_t bsiz, msg_time_t http_date)
@@ -349,7 +349,7 @@ issize_t msg_date_e(char b[], isize_t bsiz, msg_time_t http_date)
   day -= YEAR_DAYS(year);
   leap_year = LEAP_YEAR(year);
 
-  month = 0, days_per_month = 31; 
+  month = 0, days_per_month = 31;
   while (day >= days_per_month) {
     day -= days_per_month;
     month++;
@@ -357,13 +357,13 @@ issize_t msg_date_e(char b[], isize_t bsiz, msg_time_t http_date)
   }
 
   return snprintf(b, bsiz, "%s, %02ld %s %04ld %02ld:%02ld:%02ld GMT",
-                 wkdays + wkday * 4, day + 1, months + month * 4, 
+                 wkdays + wkday * 4, day + 1, months + month * 4,
                  year, hour, min, sec);
 }
 
 
 /**Decode a delta-seconds.
- * 
+ *
  * The function msg_delta_d() decodes a <delta-seconds> field.
  *
  * The <delta-seconds> is defined as follows:
@@ -393,9 +393,9 @@ issize_t msg_delta_e(char b[], isize_t bsiz, msg_time_t delta)
   return snprintf(b, bsiz, "%lu", (unsigned long)delta);
 }
 
-/** Decode a HTTP date or delta 
- * 
- * Decode a @ref msg_date_d() "<http-date>" or 
+/** Decode a HTTP date or delta
+ *
+ * Decode a @ref msg_date_d() "<http-date>" or
  * @ref msg_delta_d() "<delta-seconds>" field.
  */
 issize_t msg_date_delta_d(char const **ss,
index b0b80678e14a0d248de51678ca88a75b2e9eeb5a..897663ea714aed9361d2441d6ac3a44693790b8f 100644 (file)
  *
  */
 
-/**@internal 
+/**@internal
  * @ingroup msg_parser
  * @file msg_generic.c
  * @brief Functions for generic headers
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Thu Jan 23 20:08:00 2003 ppessi
- * 
+ *
  */
 
 #include "config.h"
  *
  * The function msg_generic_d() parses a generic header structure.
  *
- * @param[in]     home memory home 
- * @param[in,out] h    header structure 
- * @param[in]     s    string to be parsed 
- * @param[in]     slen length of the string 
+ * @param[in]     home memory home
+ * @param[in,out] h    header structure
+ * @param[in]     s    string to be parsed
+ * @param[in]     slen length of the string
  *
- * @retval 0 when successful, 
+ * @retval 0 when successful,
  * @retval -1 upon an error.
  */
 issize_t msg_generic_d(su_home_t *home,
                       msg_header_t *h,
-                      char *s, 
+                      char *s,
                       isize_t slen)
 {
   h->sh_generic->g_string = s;
@@ -80,9 +80,9 @@ issize_t msg_generic_d(su_home_t *home,
  */
 issize_t msg_generic_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 {
-  msg_generic_t const *g = h->sh_generic;  
+  msg_generic_t const *g = h->sh_generic;
   size_t n = strlen(g->g_string);
-  
+
   if (bsiz > n)
     strcpy(b, g->g_string);
 
@@ -142,7 +142,7 @@ issize_t msg_numeric_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 /* ====================================================================== */
 /* Comma-separated list */
 
-/** @typedef struct msg_list_s msg_list_t; 
+/** @typedef struct msg_list_s msg_list_t;
  *
  * Type for token list headers.
  *
@@ -157,14 +157,14 @@ issize_t msg_list_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 {
   int compact = MSG_IS_COMPACT(flags);
   char *b0 = b, *end = b + bsiz;
-  
+
   MSG_COMMALIST_E(b, end, h->sh_list->k_items, compact);
   MSG_TERM_E(b, end);
 
   return b - b0;
 }
 
-/**@internal 
+/**@internal
  * Extra size of a msg_auth_t object.
  *
  * This function calculates extra size required by a msg_auth_t object.
@@ -182,14 +182,14 @@ isize_t msg_list_dup_xtra(msg_header_t const *h, isize_t offset)
 
 char *msg_list_dup_one(msg_header_t *dst,
                       msg_header_t const *src,
-                      char *b, 
+                      char *b,
                       isize_t xtra)
 {
   char *end = b + xtra;
   msg_param_t const ** items = (msg_param_t const **)&dst->sh_list->k_items;
 
   b = msg_params_dup(items, src->sh_list->k_items, b, xtra);
-    
+
   assert(b <= end); (void)end;
 
   return b;
@@ -200,8 +200,8 @@ char *msg_list_dup_one(msg_header_t *dst,
  * @retval 0 when successful
  * @retval -1 upon an error
  */
-int msg_list_append_items(su_home_t *home, 
-                         msg_list_t *k, 
+int msg_list_append_items(su_home_t *home,
+                         msg_list_t *k,
                          msg_param_t const items[])
 {
   size_t i;
index f5380f480c56eec4db7ba45bcd827b7479dbd292..bcae541382b488ee3f57575e88637bbc557375ae 100644 (file)
@@ -23,8 +23,8 @@
  */
 
 /**@ingroup msg_headers
- * @CFILE msg_header_copy.c 
- * 
+ * @CFILE msg_header_copy.c
+ *
  * Copying and duplicating headers structures.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -65,7 +65,7 @@ size_t msg_params_copy_xtra(msg_param_t const pp[], size_t offset)
 /** Copy a vector of parameters */
 su_inline
 char *msg_params_copy(char *b, size_t size,
-                     msg_param_t **dst, 
+                     msg_param_t **dst,
                      msg_param_t const src[])
 {
   size_t n = msg_params_count(src);
@@ -90,11 +90,11 @@ char *msg_params_copy(char *b, size_t size,
  * @param hc   header class for the copied header
  * @param src  pointer to a header object
  *
- * @return 
+ * @return
  * The function @c msg_header_copy_as() returns a pointer to the the shallow copy
  * of the header object, or @c NULL upon an error.
  */
-static msg_header_t *msg_header_copy_one_as(su_home_t *home, 
+static msg_header_t *msg_header_copy_one_as(su_home_t *home,
                                            msg_hclass_t *hc,
                                            msg_header_t const *src)
 {
@@ -145,7 +145,7 @@ static msg_header_t *msg_header_copy_one_as(su_home_t *home,
  * @return The function @c msg_header_copy_as() returns a pointer to the
  * first of the copied msg header object(s), or @c NULL upon an error.
  */
-msg_header_t *msg_header_copy_as(su_home_t *home, 
+msg_header_t *msg_header_copy_as(su_home_t *home,
                                 msg_hclass_t *hc,
                                 msg_header_t const *src)
 {
@@ -161,7 +161,7 @@ msg_header_t *msg_header_copy_as(su_home_t *home,
     if (!(h = msg_header_copy_one_as(home, hc, src)))
       break;
 
-    if (!rv) 
+    if (!rv)
       rv = h;
     else
       prev->sh_next = h;
@@ -210,7 +210,7 @@ msg_header_t *msg_header_copy(su_home_t *home, msg_header_t const *src)
  * @return Return a pointer to the
  * the duplicated msg header object(s), or @c NULL upon an error.
  */
-msg_header_t *msg_header_dup_one(su_home_t *home, 
+msg_header_t *msg_header_dup_one(su_home_t *home,
                                 msg_header_t const *src)
 {
   msg_hclass_t *hc;
@@ -277,7 +277,7 @@ msg_header_t *msg_header_dup_as(su_home_t *home, msg_hclass_t *hc,
     if (!(h = msg_header_alloc(home, hc, (isize_t)xtra)))
       break;                   /* error */
 
-    if (!rv) 
+    if (!rv)
       rv = h;
 
     if (!(end = hc->hc_dup_one(h, src, (char *)h + size, xtra)))
@@ -343,7 +343,7 @@ isize_t msg_default_dup_xtra(msg_header_t const *header, isize_t offset)
  */
 char *msg_default_dup_one(msg_header_t *h,
                          msg_header_t const *src,
-                         char *b, 
+                         char *b,
                          isize_t xtra)
 {
   memcpy(&h->sh_header_next[1],
@@ -357,9 +357,9 @@ char *msg_default_dup_one(msg_header_t *h,
 /* Copying or duplicating all headers in a message */
 
 static int msg_copy_chain(msg_t *msg, msg_t const *copied);
-static int msg_dup_or_copy_all(msg_t *msg, 
+static int msg_dup_or_copy_all(msg_t *msg,
                               msg_t const *original,
-                              msg_header_t *(*copy_one)(su_home_t *h, 
+                              msg_header_t *(*copy_one)(su_home_t *h,
                                                         msg_header_t const *));
 
 
@@ -383,8 +383,8 @@ msg_t *msg_copy(msg_t *original)
     msg_t *copy = msg_create(original->m_class, original->m_object->msg_flags);
 
     if (copy) {
-      if (original->m_chain 
-         ? msg_copy_chain(copy, original) < 0 
+      if (original->m_chain
+         ? msg_copy_chain(copy, original) < 0
          : msg_dup_or_copy_all(copy, original, msg_header_copy_one) < 0) {
        msg_destroy(copy), copy = NULL;
       }
@@ -412,18 +412,18 @@ int msg_copy_chain(msg_t *msg, msg_t const *original)
   msg_header_t *dh;
   msg_header_t const *sh;
   msg_header_t **hh;
-  
+
   tail = msg->m_tail;
-  
+
   for (sh = original->m_chain; sh; sh = (msg_header_t const *)sh->sh_succ) {
     hh = msg_hclass_offset(msg->m_class, dst, sh->sh_class);
     if (!hh)
       break;
     while (*hh)
       hh = &(*hh)->sh_next;
-      
+
     dh = msg_header_copy_one(home, sh);
-    if (!dh) 
+    if (!dh)
       break;
 
     dh->sh_prev = tail, *tail = dh, tail = &dh->sh_succ;
@@ -468,15 +468,15 @@ msg_t *msg_dup(msg_t const *original)
   return NULL;
 }
 
-/** Copy a complete message, not keeping the header chain structure. 
+/** Copy a complete message, not keeping the header chain structure.
  *
  * @retval 0 when successful
  * @retval -1 upon an error
  */
 static
-int msg_dup_or_copy_all(msg_t *msg, 
+int msg_dup_or_copy_all(msg_t *msg,
                        msg_t const *original,
-                       msg_header_t *(*copy_one)(su_home_t *h, 
+                       msg_header_t *(*copy_one)(su_home_t *h,
                                                  msg_header_t const *))
 {
   su_home_t *home = msg_home(msg);
@@ -493,7 +493,7 @@ int msg_dup_or_copy_all(msg_t *msg,
   assert(copy_one);
 
   end = (msg_header_t**)((char *)src + src->msg_size);
-  
+
   for (ssh = &src->msg_request; ssh < end; ssh++) {
     sh = *ssh;
     if (!sh)
index 5a8ad8aaedcd0581ad6b9577479a12d98f99b65f..c2be7eadfb89790ab2d796ab1c6035071bc2f087 100644 (file)
 #include <assert.h>
 
 /** Make a header from a value string. */
-msg_header_t *msg_header_make(su_home_t *home, 
+msg_header_t *msg_header_make(su_home_t *home,
                              msg_hclass_t *hc,
                              char const *s)
 {
   size_t xtra;
   msg_header_t *h;
   int normal = hc->hc_name ||
-    (hc->hc_hash != msg_payload_hash && 
+    (hc->hc_hash != msg_payload_hash &&
      hc->hc_hash != msg_separator_hash &&
      hc->hc_hash != msg_error_hash);
 
@@ -76,7 +76,7 @@ msg_header_t *msg_header_make(su_home_t *home,
     return NULL;
 
   /* For normal headers, strip LWS from both ends */
-  if (normal) 
+  if (normal)
     skip_lws(&s);
   xtra = strlen(s);
   if (normal)
@@ -91,7 +91,7 @@ msg_header_t *msg_header_make(su_home_t *home,
     strncpy(b, s, xtra)[xtra] = 0;
 
     if (hc->hc_parse(home, h, b, xtra) == -1) {
-      /* Note: parsing function is responsible to free 
+      /* Note: parsing function is responsible to free
         everything it has allocated (like parameter lists) */
       /* XXX - except header structures */
       su_free(home, h), h = NULL;
@@ -102,13 +102,13 @@ msg_header_t *msg_header_make(su_home_t *home,
 }
 
 /** Make a MSG header with formatting provided. */
-msg_header_t *msg_header_vformat(su_home_t *home, 
+msg_header_t *msg_header_vformat(su_home_t *home,
                                msg_hclass_t *hc,
                                char const *fmt,
                                va_list ap)
 {
   msg_header_t *h;
-  
+
   int n;
   size_t xtra = 64;            /* reasonable default */
 
@@ -121,7 +121,7 @@ msg_header_t *msg_header_vformat(su_home_t *home,
     fmt = va_arg(ap, char const *);
     return msg_header_make(home, hc, fmt);
   }
-  
+
   if (!(h = msg_header_alloc(home, hc, xtra)))
     return NULL;
 
@@ -131,7 +131,7 @@ msg_header_t *msg_header_vformat(su_home_t *home,
     va_copy(aq, ap);
     n = vsnprintf(MSG_HEADER_DATA(h), xtra, fmt, aq);
     va_end(aq);
-    
+
     if (n >= 0 && (size_t)n < xtra)
       break;
 
@@ -148,13 +148,13 @@ msg_header_t *msg_header_vformat(su_home_t *home,
 
     if (xtra > INT_MAX)
       xtra = INT_MAX;
-    
+
     if (!(h = msg_header_alloc(home, hc, xtra)))
       return NULL;
   }
-  
+
   if (hc->hc_parse(home, h, MSG_HEADER_DATA(h), (size_t)n) == -1) {
-    /* Note: parsing function is responsible to free 
+    /* Note: parsing function is responsible to free
        everything it has allocated (like parameter lists) */
     su_free(home, h), h = NULL;
   }
@@ -162,7 +162,7 @@ msg_header_t *msg_header_vformat(su_home_t *home,
   return h;
 }
 
-msg_header_t *msg_header_format(su_home_t *home, 
+msg_header_t *msg_header_format(su_home_t *home,
                                msg_hclass_t *hc,
                                char const *fmt,
                                ...)
index 722033254d376e64e31150d9eff85248c5294f2f..b73561c9152a853de040f7c9203a4daa54d709ff 100644 (file)
 
 #ifndef MSG_INTERNAL_H
 /** Defined when <msg_internal.h> has been included. */
-#define MSG_INTERNAL_H 
+#define MSG_INTERNAL_H
 
-/**@IFILE msg_internal.h 
- * @brief Abstract messages - internal interface 
+/**@IFILE msg_internal.h
+ * @brief Abstract messages - internal interface
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
@@ -131,7 +131,7 @@ su_inline int msg_is_prepend(msg_header_t const *h)
 
 su_inline int msg_is_append(msg_header_t const *h)
 {
-  return 
+  return
     h->sh_class->hc_kind == msg_kind_append ||
     h->sh_class->hc_kind == msg_kind_apndlist;
 }
index 01914ce9e2f58e7f5492d7bf08f2300e931b6208..e049f872a94b34a17ce65496bfe1c44d4a8bdeac 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@ingroup msg_parser 
+/**@ingroup msg_parser
  * @CFILE msg_mclass.c
  *
  * Message factory object.
  * empty is true, the copied message class object will not recognize any
  * headers. This is useful if more fine-grained control of parsing process
  * is required, for instance.
- * 
- * @param[in] old      pointer to the message class object to be copied 
- * @param[in] newsize  size of hash table in the copied object 
- * @param[in] empty    if true, resulting copy does not contain any headers 
- * 
- * @return 
+ *
+ * @param[in] old      pointer to the message class object to be copied
+ * @param[in] newsize  size of hash table in the copied object
+ * @param[in] empty    if true, resulting copy does not contain any headers
+ *
+ * @return
  * The function msg_mclass_clone() returns a pointer to a newly
  * copied message class object, or NULL upon an error.
  * The returned message class object can be freed with free().
@@ -78,7 +78,7 @@
  * A memory allocation failed.
  * @ERROR EINVAL
  * The function was given invalid arguments.
- * 
+ *
  * @note The empty parser can handle request/status line. All headers are
  * put into list of unknown headers (unless they are malformed, and they are
  * put into list of erronous headers). However, SIP, RTSP, and HTTP
@@ -90,7 +90,7 @@
 msg_mclass_t *msg_mclass_clone(msg_mclass_t const *old, int newsize, int empty)
 {
   size_t size, shortsize;
-  msg_mclass_t *mc; 
+  msg_mclass_t *mc;
   int identical;
   unsigned short i;
 
@@ -126,7 +126,7 @@ msg_mclass_t *msg_mclass_clone(msg_mclass_t const *old, int newsize, int empty)
       memcpy(mc, old, size);
       mc->mc_short = NULL;
     }
-    
+
     if (shortsize) {
       if (empty)
        mc->mc_short = memset((char *)mc + size, 0, shortsize);
@@ -147,8 +147,8 @@ msg_mclass_t *msg_mclass_clone(msg_mclass_t const *old, int newsize, int empty)
  * structure" is zero, the function extends the public message structure in
  * order to store newly inserted header there.
  *
- * @param[in,out] mc       pointer to a message class object 
- * @param[in]     hc       pointer to a header class object 
+ * @param[in,out] mc       pointer to a message class object
+ * @param[in]     hc       pointer to a header class object
  * @param[in]     offset   offset of the header in
  *                         @ref msg_pub_t "public message structure"
  *
@@ -156,10 +156,10 @@ msg_mclass_t *msg_mclass_clone(msg_mclass_t const *old, int newsize, int empty)
  * the public message structure and places the header at the end of message.
  *
  * @return Number of collisions in hash table, or -1 upon an error.
- * 
+ *
  * @deprecated Use msg_mclass_insert_with_mask() instead.
  */
-int msg_mclass_insert_header(msg_mclass_t *mc, 
+int msg_mclass_insert_header(msg_mclass_t *mc,
                             msg_hclass_t *hc,
                             unsigned short offset)
 {
@@ -195,13 +195,13 @@ int msg_mclass_insert_header(msg_mclass_t *mc,
  *
  * @param[in,out] mc       pointer to a message class
  * @param[in]     hc       pointer to a header class
- * @param[in]     offset   offset of the header in 
- *                         @ref msg_pub_t "public message structure" 
- * @param[in]     flags    classification flags for the header 
+ * @param[in]     offset   offset of the header in
+ *                         @ref msg_pub_t "public message structure"
+ * @param[in]     flags    classification flags for the header
  *
  * @return Number of collisions in hash table, or -1 upon an error.
  */
-int msg_mclass_insert_with_mask(msg_mclass_t *mc, 
+int msg_mclass_insert_with_mask(msg_mclass_t *mc,
                                msg_hclass_t *hc,
                                unsigned short offset,
                                unsigned short flags)
@@ -232,8 +232,8 @@ int msg_mclass_insert_with_mask(msg_mclass_t *mc,
  *
  * @relatesalso msg_mclass_s
  *
- * @param[in,out] mc       pointer to a message class object 
- * @param[in]     hr       header reference object 
+ * @param[in,out] mc       pointer to a message class object
+ * @param[in]     hr       header reference object
  *
  * @return Number of collisions in hash table, or -1 upon an error.
  */
@@ -249,7 +249,7 @@ int msg_mclass_insert(msg_mclass_t *mc, msg_href_t const *hr)
     return -1;
   }
 
-  if (hr == NULL || (hc = hr->hr_class) == NULL) 
+  if (hr == NULL || (hc = hr->hr_class) == NULL)
     return 0;
 
   /* Add short form */
@@ -260,10 +260,10 @@ int msg_mclass_insert(msg_mclass_t *mc, msg_href_t const *hr)
     if (compact < 'a' || compact > 'z')
       return -1;
 
-    if (shorts[compact - 'a'].hr_class && 
+    if (shorts[compact - 'a'].hr_class &&
        shorts[compact - 'a'].hr_class != hc)
       return -1;
-      
+
     shorts[compact - 'a'] = *hr;
   }
 
@@ -281,7 +281,7 @@ int msg_mclass_insert(msg_mclass_t *mc, msg_href_t const *hr)
 
   mc->mc_hash[j] = hr[0];
   mc->mc_hash_used++;
-  
+
   return collisions;
 }
 
@@ -296,8 +296,8 @@ int msg_mclass_insert(msg_mclass_t *mc, msg_href_t const *hr)
  * class based on the contents of the header to be parsed. The buffer @a s
  * should point to the first character in the header name.
  *
- * @param[in]  mc   message class object 
- * @param[in]  s    header contents 
+ * @param[in]  mc   message class object
+ * @param[in]  s    header contents
  * @param[out] return_start_of_content start of header content (may be NULL)
  *
  * @return The function msg_find_hclass() returns a pointer to a header
@@ -309,11 +309,11 @@ int msg_mclass_insert(msg_mclass_t *mc, msg_href_t const *hr)
  * start of the header contents within @a s, or 0 upon an error parsing the
  * header name and following colon.
  *
- * @par 
+ * @par
  * Upon a fatal error, a NULL pointer is returned.
  */
-msg_href_t const *msg_find_hclass(msg_mclass_t const *mc, 
-                                 char const *s, 
+msg_href_t const *msg_find_hclass(msg_mclass_t const *mc,
+                                 char const *s,
                                  isize_t *return_start_of_content)
 {
   msg_href_t const *hr;
index f3099b5d8f953128b4dfd997c168b69506c1afca..109a7ab8fda9737b8371c9b5b8d408b9bc042cb5 100644 (file)
@@ -132,7 +132,7 @@ char const msg_mime_version_1_0[] = "MIME/1.0";
  *                 part. Note that the semantics of a part differ from the
  *                 semantics of a message, as described in the text.>
  *
- *   encapsulation := delimiter transport-padding CRLF 
+ *   encapsulation := delimiter transport-padding CRLF
  *                    body-part
  *
  *   close-delimiter := delimiter "--"
@@ -144,26 +144,26 @@ char const msg_mime_version_1_0[] = "MIME/1.0";
  * @endcode
  *
  * @par Parsing a Multipart Message
- * 
+ *
  * When a message body contains a multipart entity (in other words, it has a
  * MIME media type of "multipart"), the application can split the multipart
  * entity into body parts
  *
  * The parsing is relatively simple, the application just gives a memory
- * home object, a Content-Type header object and message body object as an 
+ * home object, a Content-Type header object and message body object as an
  * argument to msg_multipart_parse() function:
  * @code
- *    if (sip->sip_content_type && 
+ *    if (sip->sip_content_type &&
  *        strncasecmp(sip->sip_content_type, "multipart/", 10) == 0) {
  *      msg_multipart_t *mp;
  *
  *      if (sip->sip_multipart)
  *        mp = sip->sip_multipart;
  *      else
- *        mp = msg_multipart_parse(msg_home(msg), 
+ *        mp = msg_multipart_parse(msg_home(msg),
  *                                 sip->sip_content_type,
  *                                 (sip_payload_t *)sip->sip_payload);
- * 
+ *
  *      if (mp)
  *        ... processing multipart ...
  *      else
@@ -194,12 +194,12 @@ char const msg_mime_version_1_0[] = "MIME/1.0";
  *   msg_header_t *h = NULL;
  *   char *b;
  *   size_t len, offset;
- * 
+ *
  *   mp = msg_multipart_create(home, "text/html;level=3", html, strlen(html));
  *   mp->mp_next = msg_multipart_create(home, "image/gif", gif, giflen);
  *
  *   c = sip_content_type_make(home, "multipart/mixed");
- * 
+ *
  *   // Add delimiters to multipart, and boundary parameter to content-type
  *   if (msg_multipart_complete(home, c, mp) < 0)
  *     return -1;              // Error
@@ -209,14 +209,14 @@ char const msg_mime_version_1_0[] = "MIME/1.0";
  *   if (msg_multipart_serialize(&h, mp) < 0)
  *     return -1;              // Error
  *
- *   // Encode all multipart components 
+ *   // Encode all multipart components
  *   len = msg_multipart_prepare(msg, mp, 0);
  *   if (len < 0)
  *     return -1;              // Error
  *
  *   pl = sip_payload_create(home, NULL, len);
  *
- *   // Copy each element from multipart to pl_data 
+ *   // Copy each element from multipart to pl_data
  *   b = pl->pl_data;
  *   for (offset = 0, h = mp; offset < len; h = h->sh_succ) {
  *     memcpy(b + offset, h->sh_data, h->sh_len);
@@ -292,7 +292,7 @@ msg_multipart_boundary(su_home_t *home, char const *b)
 
 
 /** Boundary chars. */
-static char const bchars[] = 
+static char const bchars[] =
 "'()+_,-./:=?"
 "0123456789"
 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -331,7 +331,7 @@ msg_multipart_search_boundary(su_home_t *home, char const *p, size_t len)
       }
       return boundary;
     }
-  } 
+  }
 
   /* Look for LF -- */
   for (;(p = memmem(p, end - p, LF "--", 3)); p += 3) {
@@ -362,9 +362,9 @@ msg_multipart_search_boundary(su_home_t *home, char const *p, size_t len)
  * The function msg_multipart_parse() parses a MIME multipart message. The
  * common syntax of multiparts is described in @RFC2046 (section 7).
  *
- * @param[in,out] home home for allocating structures 
- * @param[in]     c    content-type header for multipart 
- * @param[in]     pl   payload structure for multipart 
+ * @param[in,out] home home for allocating structures
+ * @param[in]     c    content-type header for multipart
+ * @param[in]     pl   payload structure for multipart
  *
  * After parsing, the @a pl will contain the plain-text preamble (if any).
  *
@@ -418,7 +418,7 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home,
 
   /* Split multipart into parts */
   for (;;) {
-    while (p[0] == ' ') 
+    while (p[0] == ' ')
       p++;
 
     p += p[0] == '\r' ? 1 + (p[1] == '\n') : (p[0] == '\n');
@@ -464,7 +464,7 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home,
       break;
     }
 
-    b = next; p = next + m; 
+    b = next; p = next + m;
   }
 
   if (!mp || !mp->mp_close_delim) {
@@ -516,7 +516,7 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home,
   blen = strlen(boundary);
 
   for (mp = all; mp; mp = mp->mp_next) {
-    mp->mp_data = boundary; 
+    mp->mp_data = boundary;
     mp->mp_len = blen;
 
     assert(mp->mp_payload || mp->mp_separator);
@@ -546,19 +546,19 @@ msg_multipart_t *msg_multipart_parse(su_home_t *home,
 }
 
 /**Add all missing parts to the multipart.
- * 
+ *
  * Add missing components such as boundaries between body parts, separators
  * between body-part headers and data, and close-delimiter after last
  * body-part to the multipart message.
- * 
- * @param[in,out] home home for allocating structures 
- * @param[in,out] c    content-type header for multipart 
- * @param[in,out] mp   pointer to first multipart structure 
+ *
+ * @param[in,out] home home for allocating structures
+ * @param[in,out] c    content-type header for multipart
+ * @param[in,out] mp   pointer to first multipart structure
  *
  * @retval 0 when successful
  * @retval -1 upon an error
  *
- * @ERRORS 
+ * @ERRORS
  * @ERROR EBADMSG
  * The @b Content-Type header @a c is malformed, or multipart message
  * contains a malformed @b Content-Type header.
@@ -635,7 +635,7 @@ int msg_multipart_complete(su_home_t *home,
 
     if (mp->mp_next == NULL) {
       if (!mp->mp_close_delim)
-       mp->mp_close_delim = msg_payload_format(home, "%.*s--" CR LF, 
+       mp->mp_close_delim = msg_payload_format(home, "%.*s--" CR LF,
                                                (int)m, boundary);
       if (!mp->mp_close_delim)
        return -1;
@@ -813,7 +813,7 @@ issize_t msg_multipart_prepare(msg_t *msg, msg_multipart_t *mp, int flags)
   if (!mp || !mp->mp_data)
     return -1;
 
-  if (!mp->mp_common->h_data || 
+  if (!mp->mp_common->h_data ||
       mp->mp_common->h_len != mp->mp_len - 2 ||
       memcmp(mp->mp_common->h_data, mp->mp_data + 2, mp->mp_len - 2)) {
     mp->mp_common->h_data = mp->mp_data + 2;
@@ -833,10 +833,10 @@ issize_t msg_multipart_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen
   assert(h && msg_is_multipart(h));
 
   msg_payload_init(pl);
-  
+
   result = (msg_multipart_t *)h;
 
-  pl->pl_data = s; 
+  pl->pl_data = s;
   pl->pl_len = slen;
 
   mp = msg_multipart_parse(tmphome, NULL, pl);
@@ -845,14 +845,14 @@ issize_t msg_multipart_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen
     *result = *mp;
 
     if (result->mp_common->h_succ->sh_prev)
-      result->mp_common->h_succ->sh_prev = 
+      result->mp_common->h_succ->sh_prev =
        &result->mp_common->h_succ;
 
     su_free(tmphome, mp);
-    
+
     su_home_move(home, tmphome);
   }
-   
+
   su_home_deinit(tmphome);
 
   return mp ? 0 : -1;
@@ -877,7 +877,7 @@ isize_t msg_multipart_dup_xtra(msg_header_t const *h, isize_t offset)
   offset = msg_payload_dup_xtra(h, offset);
 
   for (hh = (msg_header_t const **)&((msg_pub_t *)mp)->msg_request;
-       (char *)hh <= (char *)&mp->mp_close_delim; 
+       (char *)hh <= (char *)&mp->mp_close_delim;
        hh++) {
     for (h = *hh; h; h = h->sh_next) {
       MSG_STRUCT_SIZE_ALIGN(offset);
@@ -899,7 +899,7 @@ char *msg_multipart_dup_one(msg_header_t *dst, msg_header_t const *src,
   b = msg_payload_dup_one(dst, src, b, xtra);
 
   for (hh = &((msg_pub_t*)mp)->msg_request;
-       (char *)hh <= (char *)&mp->mp_close_delim; 
+       (char *)hh <= (char *)&mp->mp_close_delim;
        hh++) {
     for (h = *hh; h; h = h->sh_next) {
       MSG_STRUCT_ALIGN(b);
@@ -972,8 +972,8 @@ unsigned msg_q_value(char const *q)
  *
  * The function msg_mediatype_d() parses a mediatype string.
  *
- * @param[in,out] ss    string to be parsed 
- * @param[out]    type  value result for media type 
+ * @param[in,out] ss    string to be parsed
+ * @param[out]    type  value result for media type
  *
  * @retval 0 when successful,
  * @retval -1 upon an error.
@@ -1059,7 +1059,7 @@ issize_t msg_mediatype_d(char **ss, char const **type)
  */
 
 msg_hclass_t msg_accept_class[] =
-MSG_HEADER_CLASS(msg_, accept, "Accept", "", ac_params, apndlist, 
+MSG_HEADER_CLASS(msg_, accept, "Accept", "", ac_params, apndlist,
                 msg_accept, msg_accept);
 
 issize_t msg_accept_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
@@ -1136,8 +1136,8 @@ char *msg_accept_dup_one(msg_header_t *dst, msg_header_t const *src,
   return b;
 }
 
-/** Update parameter(s) for Accept header. */ 
-int msg_accept_update(msg_common_t *h, 
+/** Update parameter(s) for Accept header. */
+int msg_accept_update(msg_common_t *h,
                      char const *name, isize_t namelen,
                      char const *value)
 {
@@ -1223,8 +1223,8 @@ char *msg_accept_any_dup_one(msg_header_t *dst, msg_header_t const *src,
   return b;
 }
 
-/** Update parameter(s) for Accept-* header. */ 
-int msg_accept_any_update(msg_common_t *h, 
+/** Update parameter(s) for Accept-* header. */
+int msg_accept_any_update(msg_common_t *h,
                          char const *name, isize_t namelen,
                          char const *value)
 {
@@ -1431,7 +1431,7 @@ issize_t msg_accept_language_e(char b[], isize_t bsiz, msg_header_t const *h, in
  */
 
 /**@ingroup msg_content_disposition
- * @typedef struct msg_content_disposition_s msg_content_disposition_t; 
+ * @typedef struct msg_content_disposition_s msg_content_disposition_t;
  *
  * The structure msg_content_disposition_t contains representation of an @b
  * Content-Disposition header.
@@ -1548,7 +1548,7 @@ int msg_content_disposition_update(msg_common_t *h,
  */
 
 /**@ingroup msg_content_encoding
- * @typedef struct msg_list_s msg_content_encoding_t; 
+ * @typedef struct msg_list_s msg_content_encoding_t;
  *
  * The structure msg_content_encoding_t contains representation of an @b
  * Content-Encoding header.
@@ -1715,7 +1715,7 @@ msg_content_length_t *msg_content_length_create(su_home_t *home, uint32_t n)
  */
 
 /**@ingroup msg_content_md5
- * @typedef struct msg_generic_s msg_content_md5_t; 
+ * @typedef struct msg_generic_s msg_content_md5_t;
  *
  * The structure msg_content_md5_t contains representation of an @b
  * Content-MD5 header.
@@ -1896,7 +1896,7 @@ char *msg_content_type_dup_one(msg_header_t *dst, msg_header_t const *src,
  */
 
 /**@ingroup msg_mime_version
- * @typedef struct msg_generic_s msg_mime_version_t; 
+ * @typedef struct msg_generic_s msg_mime_version_t;
  *
  * The structure msg_mime_version_t contains representation of an @b
  * MIME-Version header.
@@ -1935,7 +1935,7 @@ issize_t msg_mime_version_e(char b[], isize_t bsiz, msg_header_t const *h, int f
  */
 
 /**@ingroup msg_content_location
- * @typedef struct msg_generic_s msg_content_location_t; 
+ * @typedef struct msg_generic_s msg_content_location_t;
  *
  * The structure msg_content_location_t contains representation of an @b
  * Content-Location header.
@@ -2000,7 +2000,7 @@ MSG_HEADER_CLASS_G(content_base, "Content-Base", "", single);
  */
 
 /**@ingroup msg_content_transfer_encoding
- * @typedef struct msg_generic_s msg_content_transfer_encoding_t; 
+ * @typedef struct msg_generic_s msg_content_transfer_encoding_t;
  *
  * The structure msg_content_transfer_encoding_t contains representation of
  * an @b Content-Transfer-Encoding header.
@@ -2027,11 +2027,11 @@ MSG_HEADER_CLASS_G(content_transfer_encoding, "Content-Transfer-Encoding",
 
 /**@ingroup msg_mime
  * @defgroup msg_warning Warning Header
- * 
+ *
  * The Warning response-header field is used to carry additional information
  * about the status of a response. Its syntax is defined in [S20.43]
  * as follows:
- * 
+ *
  * @code
  *    Warning        =  "Warning" HCOLON warning-value *(COMMA warning-value)
  *    warning-value  =  warn-code SP warn-agent SP warn-text
@@ -2045,7 +2045,7 @@ MSG_HEADER_CLASS_G(content_transfer_encoding, "Content-Transfer-Encoding",
  */
 
 /**@ingroup msg_warning
- * @typedef struct msg_warning_s msg_warning_t; 
+ * @typedef struct msg_warning_s msg_warning_t;
  *
  * The structure msg_warning_t contains representation of an @b
  * Warning header.
@@ -2073,7 +2073,7 @@ issize_t msg_warning_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
     *s = '\0', s += span_lws(s + 1) + 1;
 
   /* Parse protocol */
-  if (!IS_DIGIT(*s))   
+  if (!IS_DIGIT(*s))
     return -1;
   w->w_code = strtoul(s, &s, 10);
   skip_lws(&s);
@@ -2098,7 +2098,7 @@ issize_t msg_warning_e(char b[], isize_t bsiz, msg_header_t const *h, int f)
   int n;
   size_t m;
 
-  n = snprintf(b, bsiz, "%03u %s%s%s ", 
+  n = snprintf(b, bsiz, "%03u %s%s%s ",
               w->w_code, w->w_host, port ? ":" : "", port ? port : "");
   if (n < 0)
     return n;
@@ -2122,9 +2122,9 @@ isize_t msg_warning_dup_xtra(msg_header_t const *h, isize_t offset)
   return offset;
 }
 
-char *msg_warning_dup_one(msg_header_t *dst, 
-                         msg_header_t const *src, 
-                         char *b, 
+char *msg_warning_dup_one(msg_header_t *dst,
+                         msg_header_t const *src,
+                         char *b,
                          isize_t xtra)
 {
   msg_warning_t *w = (msg_warning_t *)dst;
@@ -2143,6 +2143,6 @@ char *msg_warning_dup_one(msg_header_t *dst,
 
 #define msg_warning_update NULL
 
-msg_hclass_t msg_warning_class[] = 
-  MSG_HEADER_CLASS(msg_, warning, "Warning", "", w_common, append, 
+msg_hclass_t msg_warning_class[] =
+  MSG_HEADER_CLASS(msg_, warning, "Warning", "", w_common, append,
                   msg_warning, msg_warning);
index 0d26ae0c0a705fcb2bd33cbcdcc765abce9cfd9f..e7843bd52c1036bf14dcfcbb180a70320d8e550a 100644 (file)
@@ -31,8 +31,8 @@
  */
 
 /**@ingroup msg_mime
- * 
- * @CFILE msg_mime_table.c 
+ *
+ * @CFILE msg_mime_table.c
  * @brief Parser table used for testing.
  *
  * #AUTO#
index c937340ea93ca0d5dc9786700652ce1c208d3e70..91f79bfe405bee041bb0cb5676973e77661b2fe9 100644 (file)
@@ -24,9 +24,9 @@
 
 /**@ingroup test_msg
  * @CFILE msg_name_hash.c
- * 
- * Calculate hash for given header name. 
- * 
+ *
+ * Calculate hash for given header name.
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Tue Aug 20 16:27:01 EEST 2002 ppessi
index 3bc0cd80ca4b1af930869bac3c34d52ed0cb9b25..4590618eb2243d019a01b996682f9489bf819baa 100644 (file)
@@ -49,7 +49,7 @@ BEGIN {
   # Initialize these as arrays
   split("", symbols);
   split("", names);
-  split("", comments); 
+  split("", comments);
   split("", hashes);
   split("", NAMES);
   split("", Comments);
@@ -81,7 +81,7 @@ function name_hash (name)
 {
   hash = 0;
 
-  len = length(name); 
+  len = length(name);
 
   for (i = 1; i <= len; i++) {
     c = tolower(substr(name, i, 1));
@@ -112,7 +112,7 @@ function name_hash (name)
 function protos (name, comment, hash, since)
 {
   NAME=toupper(name);
-  sub(/.*[\/][*][*][<][        ]*/, "", comment); 
+  sub(/.*[\/][*][*][<][        ]*/, "", comment);
   sub(/[       ]*[*][\/].*/, "", comment);
   sub(/[       ]+/, " ", comment);
 
@@ -132,12 +132,12 @@ function protos (name, comment, hash, since)
     if (name2 != name && name2 != tprefix "_" name) {
       print name " mismatch with " comment " (" real ")" > "/dev/stderr";
     }
-    
+
     hash = name_hash(parts[1]);
 
     hashed[name] = hash;
 
-    if (comment !~ /header/) { 
+    if (comment !~ /header/) {
       comment = comment " header";
     }
   }
@@ -149,13 +149,13 @@ function protos (name, comment, hash, since)
   COMMENT = toupper(comment);
 
   # Store the various forms into an array for the footer processing
-  N++; 
-  hashes[N] = hash; 
+  N++;
+  hashes[N] = hash;
   names[N] = name;
-  NAMES[N] = NAME; 
-  comments[N] = comment; 
-  Comments[N] = comment; 
-  COMMENTS[N] = COMMENT; 
+  NAMES[N] = NAME;
+  comments[N] = comment;
+  Comments[N] = comment;
+  COMMENTS[N] = COMMENT;
 
   symbols[name] = comment;
   if (since) {
@@ -165,8 +165,8 @@ function protos (name, comment, hash, since)
   expr = (without_experimental > 0 && do_hash);
   if (expr) {
     printf "%s is experimental\n", Comment;
-  }    
-  
+  }
+
   experimental[N] = expr;
 
   if (PR) {
@@ -190,7 +190,7 @@ function replace (p, hash, name, NAME, comment, Comment, COMMENT, since)
   #
   if (p) {
     gsub(/#hash#/, hash, p);
-    gsub(/#xxxxxx#/, name, p); 
+    gsub(/#xxxxxx#/, name, p);
     gsub(/#XXXXXX#/, NAME, p);
     gsub(/#xxxxxxx_xxxxxxx#/, comment, p);
     gsub(/#Xxxxxxx_Xxxxxxx#/, Comment, p);
@@ -203,17 +203,17 @@ function replace (p, hash, name, NAME, comment, Comment, COMMENT, since)
       # Remove line with #version#
       gsub(/\n[^#\n]*#version#[^\n]*/, "", p);
     }
-           
+
     print p > PR;
   }
 }
 
-# 
+#
 # Repeat each line in the footer containing the magic replacement
 # pattern with an instance of all headers
 #
 function process_footer (text)
-{ 
+{
   if (!match(tolower(text), /#(xxxxxx(x_xxxxxxx)?|hash)#/)) {
     n = length(text);
     while (substr(text, n) == "\n") {
@@ -224,7 +224,7 @@ function process_footer (text)
       print text > PR;
     return;
   }
-  
+
   n = split(text, lines, RS);
 
   for (i = 1; i <= n; i++) {
@@ -247,7 +247,7 @@ function process_footer (text)
        gsub(/#xxxxxxx_xxxxxxx#/, comments[j], l);
        gsub(/#Xxxxxxx_Xxxxxxx#/, Comments[j], l);
        gsub(/#XXXXXXX_XXXXXXX#/, COMMENTS[j], l);
-       gsub(/#xxxxxx#/, names[j], l); 
+       gsub(/#xxxxxx#/, names[j], l);
        gsub(/#XXXXXX#/, NAMES[j], l);
        print l > PR;
       }
@@ -272,7 +272,7 @@ function read_header_flags (flagfile,    line, tokens, name, value)
     if (line ~ /^#/ || line ~ /^$/)
       continue;
 
-    split(line, tokens,  /[ \t]*=[ \t]*/); 
+    split(line, tokens,  /[ \t]*=[ \t]*/);
     name = tolower(tokens[1]);
     gsub(/-/, "_", name);
     gsub(/,/, " ", name);
@@ -297,7 +297,7 @@ function read_header_flags (flagfile,    line, tokens, name, value)
 function templates ()
 {
   if (!auto) {
-    auto = FILENAME; 
+    auto = FILENAME;
 
     if (!prefix) { prefix = module; }
     if (!tprefix) { tprefix = prefix; }
@@ -369,11 +369,11 @@ function templates ()
 
 /^#### EXTRA HEADER LIST STARTS HERE ####$/ { HLIST=1; templates(); }
 HLIST && /^#### DEFAULT HEADER LIST ENDS HERE ####$/ { basic=total; }
-HLIST && /^#### EXPERIMENTAL HEADER LIST STARTS HERE ####$/ { 
+HLIST && /^#### EXPERIMENTAL HEADER LIST STARTS HERE ####$/ {
   without_experimental = total; }
 
-HLIST && /^[a-z]/ { protos($1, $0, 0, $2); 
-  headers[total++] = $1; 
+HLIST && /^[a-z]/ { protos($1, $0, 0, $2);
+  headers[total++] = $1;
   Extra[$1] = extra++;
 }
 /^#### EXTRA HEADER LIST ENDS HERE ####$/ { HLIST=0;  }
@@ -383,14 +383,14 @@ HLIST && /^[a-z]/ { protos($1, $0, 0, $2);
 
 PT && /^ *\/\* === Hash headers end here \*\// { in_header_list=0;}
 
-in_header_list && /^  (sip|rtsp|http|msg|mp)_[a-z_0-9]+_t/ { 
+in_header_list && /^  (sip|rtsp|http|msg|mp)_[a-z_0-9]+_t/ {
   n=$0
-  sub(/;.*$/, "", n);   
+  sub(/;.*$/, "", n);
   sub(/^ *(sip|rtsp|http|msg|mp)_[a-z0-9_]*_t[         ]*/, "", n);
   sub(/^[*](sip|rtsp|http|msg|mp)_/, "", n);
 
   if ($0 !~ /[\/][*][*][<]/) {
-    getline; 
+    getline;
   }
   if ($0 !~ /[\/][*][*][<]/) {
     printf "msg_protos.awk: header %s is malformed\n", n;
@@ -446,7 +446,7 @@ function print_parser_table(struct, scope, name, N, N_EXPERIMENTAL)
     len = split("request status separator payload unknown error", unnamed, " ");
 
     for (i = 1; i <= len; i++) {
-      printf("  {{ %s_%s_class, msg_offsetof(%s_t, %s_%s) }},\n", 
+      printf("  {{ %s_%s_class, msg_offsetof(%s_t, %s_%s) }},\n",
             tprefix, unnamed[i], module, prefix, unnamed[i]) > PT;
     }
     if (multipart) {
@@ -456,7 +456,7 @@ function print_parser_table(struct, scope, name, N, N_EXPERIMENTAL)
       printf("  {{ NULL, 0 }},\n") > PT;
     }
     if (MC_SHORT_SIZE) {
-      printf("  %s_short_forms, \n", module) > PT;      
+      printf("  %s_short_forms, \n", module) > PT;
     }
     else {
       printf("  NULL, \n") > PT;
@@ -488,11 +488,11 @@ function print_parser_table(struct, scope, name, N, N_EXPERIMENTAL)
 
        if (i >= ordinary) {
          printf("    { %s_%s_class,\n" \
-                "      msg_offsetof(struct %s, extra[%u])%s }%s\n", 
+                "      msg_offsetof(struct %s, extra[%u])%s }%s\n",
                 tprefix, n, struct, Extra[n], flags, c) > PT;
        }
        else {
-         printf("    { %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n", 
+         printf("    { %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
                 tprefix, n, module, prefix, n, flags, c) > PT;
        }
 
@@ -520,7 +520,7 @@ END {
     if (multipart)
       protos("multipart", "/**< Multipart payload */", -7);
   }
-    
+
   if (PR) {
     process_footer(footer);
   }
@@ -547,17 +547,17 @@ END {
 
     if (MC_SHORT_SIZE) {
       printf("static msg_href_t const " \
-            "%s_short_forms[MC_SHORT_SIZE] = \n{\n", 
-            module) > PT;      
+            "%s_short_forms[MC_SHORT_SIZE] = \n{\n",
+            module) > PT;
 
       for (i = 1; i <= MC_SHORT_SIZE; i = i + 1) {
        c = (i == MC_SHORT_SIZE) ? "" : ",";
        if (i in shorts) {
          n = shorts[i];
         flags = header_flags[n]; if (flags) flags = ",\n      " flags;
-         
-       printf("  { /* %s */ %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n", 
-              substr(lower_case, i, 1), 
+
+       printf("  { /* %s */ %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
+              substr(lower_case, i, 1),
               tprefix, n, module, prefix, n, flags, c) \
            > PT;
        }
@@ -566,7 +566,7 @@ END {
            > PT;
        }
       }
-      printf("};\n\n") > PT;      
+      printf("};\n\n") > PT;
     }
 
     # printf("extern msg_hclass_t msg_multipart_class[];\n\n") > PT;
index a037c95aeca0e560a18e5b25d9c060786a045db1..b5e8d33794e7f7cf27fb4549aa299d5128ab9af1 100644 (file)
@@ -209,7 +209,7 @@ usize_t msg_buf_commit(msg_t *msg, usize_t size, int eos)
        /* realloc and cut down buffer */
        size_t new_size;
        void *new_data;
-       
+
        if (eos)
          new_size = mb->mb_commit + 1;
        else
@@ -324,11 +324,11 @@ void *msg_buf_move(msg_t *dst, msg_t const *src)
  * blocks, so the caller should allocate at least two elements for the I/O
  * vector @a vec.
  *
- * @param[in]  msg     message object 
- * @param[out] vec     I/O vector 
- * @param[in]  veclen  available length of @a vec 
+ * @param[in]  msg     message object
+ * @param[out] vec     I/O vector
+ * @param[in]  veclen  available length of @a vec
  * @param[in]  n       number of possibly available bytes 
- * @param[in]  exact   true if data ends at message boundary 
+ * @param[in]  exact   true if data ends at message boundary
  *
  * @return
  * The length of I/O vector to
@@ -815,7 +815,7 @@ int msg_unref_external(msg_t *msg, msg_buffer_t *b)
 su_inline int extract_incomplete_chunks(msg_t *, int eos);
 static issize_t extract_first(msg_t *, msg_pub_t *,
                            char b[], isize_t bsiz, int eos);
-su_inline issize_t extract_next(msg_t *, msg_pub_t *, char *, isize_t bsiz, 
+su_inline issize_t extract_next(msg_t *, msg_pub_t *, char *, isize_t bsiz,
                                  int eos, int copy);
 static issize_t extract_header(msg_t *, msg_pub_t*,
                             char b[], isize_t bsiz, int eos, int copy);
@@ -992,7 +992,7 @@ issize_t extract_first(msg_t *msg, msg_pub_t *mo, char b[], isize_t bsiz, int eo
 
 /* Extract header or message body */
 su_inline issize_t
-extract_next(msg_t *msg, msg_pub_t *mo, char *b, isize_t bsiz, 
+extract_next(msg_t *msg, msg_pub_t *mo, char *b, isize_t bsiz,
             int eos, int copy)
 {
   if (IS_CRLF(b[0]))
@@ -1002,7 +1002,7 @@ extract_next(msg_t *msg, msg_pub_t *mo, char *b, isize_t bsiz,
 }
 
 /** Extract a header. */
-issize_t msg_extract_header(msg_t *msg, msg_pub_t *mo, 
+issize_t msg_extract_header(msg_t *msg, msg_pub_t *mo,
                           char b[], isize_t bsiz, int eos)
 {
   return extract_header(msg, mo, b, bsiz, eos, 0);
@@ -1187,16 +1187,16 @@ msg_header_t *error_header_parse(msg_t *msg, msg_pub_t *mo,
   return h;
 }
 
-/** Complete this header field and parse next header field. 
+/** Complete this header field and parse next header field.
  *
  * This function completes parsing a multi-field header like @Accept,
- * @Contact, @Via or @Warning. It scans for the next header field and 
+ * @Contact, @Via or @Warning. It scans for the next header field and
  * if one is found, it calls the parsing function recursively.
  *
- * @param home          memory home used ot allocate 
+ * @param home          memory home used ot allocate
  *                      new header structures and parameter lists
  * @param prev          pointer to header structure already parsed
- * @param s             header content to parse; should point to the area after 
+ * @param s             header content to parse; should point to the area after
  *                      current header field (either end of line or to a comma
  *                      separating header fields)
  * @param slen          ignored
@@ -1206,7 +1206,7 @@ msg_header_t *error_header_parse(msg_t *msg, msg_pub_t *mo,
  * @retval >= 0 when successful
  * @retval -1 upon an error
  */
-issize_t msg_parse_next_field(su_home_t *home, msg_header_t *prev, 
+issize_t msg_parse_next_field(su_home_t *home, msg_header_t *prev,
                              char *s, isize_t slen)
 {
   msg_hclass_t *hc = prev->sh_class;
@@ -1224,7 +1224,7 @@ issize_t msg_parse_next_field(su_home_t *home, msg_header_t *prev,
 
   if (*s == 0)
     return 0;
-  
+
   h = msg_header_alloc(home, hc, 0);
   if (!h)
     return -1;
@@ -1764,19 +1764,19 @@ msg_header_name_e(char b[], size_t bsiz, msg_header_t const *h, int flags)
 
 /** Convert a message to a string.
  *
- * A message is encoded and the encoding result is returned as a string. 
+ * A message is encoded and the encoding result is returned as a string.
  * Because the message may contain binary payload (or NUL in headers), the
  * message length is returned separately in @a *return_len, too.
  *
- * Note that the message is serialized as a side effect. 
+ * Note that the message is serialized as a side effect.
  *
  * @param home memory home used to allocate the string
  * @param msg  message to encode
  * @param pub  message object to encode (may be NULL)
  * @param flags flags used when encoding
  * @param return_len return-value parameter for encoded message length
- * 
- * @return Encoding result as a C string. 
+ *
+ * @return Encoding result as a C string.
  *
  * @since New in @VERSION_1_12_4
  *
@@ -1843,7 +1843,7 @@ char *msg_as_string(su_home_t *home, msg_t *msg, msg_pub_t *pub, int flags,
       b2 = su_realloc(home, b, bsiz);
 
       if (b2 == NULL) {
-       errno = ENOMEM; 
+       errno = ENOMEM;
        su_free(home, b);
        return NULL;
       }
@@ -2110,8 +2110,8 @@ isize_t msg_iovec(msg_t *msg, msg_iovec_t vec[], isize_t veclen)
  * Headers are either inserted just before the payload, or after the first
  * line, depending on their type.
  *
- * @param[in]     msg  message object 
- * @param[in,out] pub  public message structure 
+ * @param[in]     msg  message object
+ * @param[in,out] pub  public message structure
  * @param prepend if true, add before same type of headers (instead after them)
  * @param head head of chain
  * @param h    header to insert
@@ -2128,7 +2128,7 @@ void msg_insert_chain(msg_t *msg,
   msg_header_t **hh;
   msg_header_t **separator;
   msg_header_t **payload;
-  
+
   assert(msg && pub && head && h);
 
   mc = msg->m_class;
@@ -2523,7 +2523,7 @@ append_parsed(msg_t *msg, msg_pub_t *mo, msg_href_t const *hr, msg_header_t *h,
   *hh = h;
 }
 
-static int _msg_header_add_list_items(msg_t *msg, 
+static int _msg_header_add_list_items(msg_t *msg,
                                      msg_header_t **hh,
                                      msg_header_t const *src);
 
@@ -2658,7 +2658,7 @@ int _msg_header_add_dup_as(msg_t *msg,
 }
 
 /* Add list items */
-static int _msg_header_add_list_items(msg_t *msg, 
+static int _msg_header_add_list_items(msg_t *msg,
                                      msg_header_t **hh,
                                      msg_header_t const *src)
 {
@@ -2667,17 +2667,17 @@ static int _msg_header_add_list_items(msg_t *msg,
 
   if (!s || !*s)
     return 0;
-  
+
   msg_fragment_clear(h->sh_common);
-  
+
   /* Remove empty headers */
   for (hh = &h->sh_next; *hh; *hh = (*hh)->sh_next)
     msg_chain_remove(msg, *hh);
-  
+
   if (msg_header_join_items(msg_home(msg), h->sh_common, src->sh_common, 1)
       < 0)
     return -1;
-  
+
   return 0;
 }
 
@@ -2801,12 +2801,12 @@ int msg_header_add_str(msg_t *msg,
 
   return msg_header_parse_str(msg, pub, s);
 }
-  
+
 /**Add string to message.
  *
  * Parse a string containing headers (or a message body, if the string
  * starts with linefeed) and add resulting header objects to the message
- * object. 
+ * object.
  *
  * @param msg  message object
  * @param pub  message header structure where heades are added (may be NULL)
@@ -2816,7 +2816,7 @@ int msg_header_add_str(msg_t *msg,
  * @retval -1 upon an error
  *
  * @sa msg_header_add_str(), url_headers_as_string()
- * 
+ *
  * @since New in @VERSION_1_12_4.
  */
 int msg_header_parse_str(msg_t *msg,
@@ -2880,7 +2880,7 @@ int msg_header_insert(msg_t *msg, msg_pub_t *pub, msg_header_t *h)
 
   assert(msg);
 
-  if (msg == NULL || h == NULL || h == MSG_HEADER_NONE || 
+  if (msg == NULL || h == NULL || h == MSG_HEADER_NONE ||
       h->sh_class == NULL)
     return -1;
   if (pub == NULL)
@@ -2906,7 +2906,7 @@ int msg_header_remove(msg_t *msg, msg_pub_t *pub, msg_header_t *h)
 {
   msg_header_t **hh, **hh0;
 
-  if (msg == NULL || h == NULL || h == MSG_HEADER_NONE || 
+  if (msg == NULL || h == NULL || h == MSG_HEADER_NONE ||
       h->sh_class == NULL)
     return -1;
   if (pub == NULL)
@@ -2955,7 +2955,7 @@ int msg_header_remove_all(msg_t *msg, msg_pub_t *pub, msg_header_t *h)
   msg_header_t **hh, **hh0;
   void const *data;
 
-  if (msg == NULL || h == NULL || h == MSG_HEADER_NONE || 
+  if (msg == NULL || h == NULL || h == MSG_HEADER_NONE ||
       h->sh_class == NULL)
     return -1;
   if (pub == NULL)
index 6223b1bef73f0c5fe5e05c145370e2de3e90d751..d14b553b18fd33fc08eb006ce8789f7f60281412 100644 (file)
@@ -102,7 +102,7 @@ int msg_firstline_d(char *s, char **return_part2, char **return_part3)
  * in @a return_token, and updates the @a ss to the end of token and
  * possible whitespace.
  */
-issize_t msg_token_d(char **ss, char const **return_token) 
+issize_t msg_token_d(char **ss, char const **return_token)
 {
   char *s = *ss;
   size_t n = span_token(s);
@@ -131,7 +131,7 @@ issize_t msg_uint32_d(char **ss, uint32_t *return_value)
   uint32_t value;
   unsigned digit;
 
-  if (!IS_DIGIT(*s))   
+  if (!IS_DIGIT(*s))
     return -1;
 
   for (value = 0; IS_DIGIT(*s); s++) {
@@ -169,26 +169,26 @@ issize_t msg_uint32_d(char **ss, uint32_t *return_value)
  * list.
  *
  * The function @b must be passed a scanning function @a scanner. The
- * scanning function scans for a legitimate list item, for example, a token. 
+ * scanning function scans for a legitimate list item, for example, a token.
  * It should also compact the list item, for instance, if the item consists
  * of @c name=value parameter definitions it should remove whitespace around
  * "=" sign. The scanning function returns the length of the scanned item,
  * including any linear whitespace after it.
  *
- * @param[in]     home    memory home for allocating list pointers 
- * @param[in,out] ss      pointer to pointer to string to be parsed 
+ * @param[in]     home    memory home for allocating list pointers
+ * @param[in,out] ss      pointer to pointer to string to be parsed
  * @param[in,out] append_list  pointer to list
  *                             where parsed list items are appended
- * @param[in]     sep     separator character 
+ * @param[in]     sep     separator character
  * @param[in]     scanner pointer to function for scanning a single item
- * 
+ *
  * @retval 0  if successful.
  * @retval -1 upon an error.
  */
-issize_t msg_any_list_d(su_home_t *home, 
-                       char **ss, 
+issize_t msg_any_list_d(su_home_t *home,
+                       char **ss,
                        msg_param_t **append_list,
-                       issize_t (*scanner)(char *s), 
+                       issize_t (*scanner)(char *s),
                        int sep)
 {
   char const *stack[MSG_N_PARAMS];
@@ -232,7 +232,7 @@ issize_t msg_any_list_d(su_home_t *home,
          goto error;
        list = re_list;
       }
-      
+
       list[n++] = s;
       s += tlen;
     }
@@ -240,7 +240,7 @@ issize_t msg_any_list_d(su_home_t *home,
     if (*s == sep) {
       *s++ = '\0';
       skip_lws(&s);
-    } 
+    }
     else if (*s)
       break;
   }
@@ -278,11 +278,11 @@ issize_t msg_any_list_d(su_home_t *home,
  * This function compacts the scanned value. It removes the
  * whitespace around equal sign "=" by moving the equal sign character and
  * value towards name.
- * 
- * If there is whitespace within the scanned value or after it, 
+ *
+ * If there is whitespace within the scanned value or after it,
  * NUL-terminates the scanned attribute.
  *
- * @retval > 0 number of characters scanned, 
+ * @retval > 0 number of characters scanned,
  *             including the whitespace within the value
  * @retval -1 upon an error
  */
@@ -313,9 +313,9 @@ issize_t msg_attribute_value_scanner(char *s)
       v = s; s += qlen;
     }
     else {
-      v = s; 
+      v = s;
       skip_param(&s);
-      if (s == v) 
+      if (s == v)
        return -1;
     }
 
@@ -339,16 +339,16 @@ issize_t msg_attribute_value_scanner(char *s)
  *  av-pair = token ["=" ( value / quoted-string) ]        ; optional value
  * @endcode
  *
- * @param[in]     home      pointer to a memory home 
- * @param[in,out] ss        pointer to string at the start of parameter list 
+ * @param[in]     home      pointer to a memory home
+ * @param[in,out] ss        pointer to string at the start of parameter list
  * @param[in,out] append_list  pointer to list
  *                             where parsed list items are appended
  *
  * @retval >= 0 if successful
  * @retval -1 upon an error
  */
-issize_t msg_avlist_d(su_home_t *home, 
-                     char **ss, 
+issize_t msg_avlist_d(su_home_t *home,
+                     char **ss,
                      msg_param_t const **append_list)
 {
   char const *stack[MSG_N_PARAMS];
@@ -369,7 +369,7 @@ issize_t msg_avlist_d(su_home_t *home,
     params = stack;
     N = MSG_PARAMS_NUM(1);
   }
-  
+
   for (;;) {
     char *p;
     size_t tlen;
@@ -398,9 +398,9 @@ issize_t msg_avlist_d(su_home_t *home,
        v = s; s += qlen;
       }
       else {
-       v = s; 
+       v = s;
        skip_param(&s);
-       if (s == v) 
+       if (s == v)
          goto error;
       }
       if (p + tlen + 1 != v) {
@@ -440,7 +440,7 @@ issize_t msg_avlist_d(su_home_t *home,
   }
   else if (n == N) {
     /* Reallocate params */
-    char **nparams = su_alloc(home, 
+    char **nparams = su_alloc(home,
                              (N = MSG_PARAMS_NUM(N + 1)) * sizeof(*params));
     if (!nparams) {
       goto error;
@@ -467,8 +467,8 @@ issize_t msg_avlist_d(su_home_t *home,
  *  *(";" token [ "=" (token | quoted-string)]).
  * @endcode
  *
- * @param[in]     home      pointer to a memory home 
- * @param[in,out] ss        pointer to string at the start of parameter list 
+ * @param[in]     home      pointer to a memory home
+ * @param[in,out] ss        pointer to string at the start of parameter list
  * @param[in,out] append_list  pointer to list
  *                             where parsed list items are appended
  *
@@ -477,8 +477,8 @@ issize_t msg_avlist_d(su_home_t *home,
  *
  * @sa msg_avlist_d()
  */
-issize_t msg_params_d(su_home_t *home, 
-                     char **ss, 
+issize_t msg_params_d(su_home_t *home,
+                     char **ss,
                      msg_param_t const **append_list)
 {
   if (**ss == ';') {
@@ -487,7 +487,7 @@ issize_t msg_params_d(su_home_t *home,
     return msg_avlist_d(home, ss, append_list);
   }
 
-  if (IS_LWS(**ss)) { 
+  if (IS_LWS(**ss)) {
     *(*ss)++ = '\0'; skip_lws(ss);
   }
 
@@ -501,7 +501,7 @@ isize_t msg_params_e(char b[], isize_t bsiz, msg_param_t const pparams[])
   char *end = b + bsiz, *b0 = b;
   msg_param_t p;
 
-  if (pparams) 
+  if (pparams)
     for (i = 0; (p = pparams[i]); i++) {
       if (p[0]) {
        MSG_CHAR_E(b, end, ';');
@@ -537,13 +537,13 @@ char *msg_params_dup(msg_param_t const **d, msg_param_t const s[],
     MSG_STRING_DUP(b, pp[i], s[i]);
   }
   pp[i] = NULL;
+
   assert(b <= end); (void)end;
+
   *d = (msg_param_t const *)pp;
 
   return b;
-} 
+}
 
 
 /** Parse a comma-separated list.
@@ -565,18 +565,18 @@ char *msg_params_dup(msg_param_t const **d, msg_param_t const s[],
  * By default, the scanning function accepts tokens, quoted strings or
  * separators (except comma, of course).
  *
- * @param[in]     home    memory home for allocating list pointers 
- * @param[in,out] ss      pointer to pointer to string to be parsed 
+ * @param[in]     home    memory home for allocating list pointers
+ * @param[in,out] ss      pointer to pointer to string to be parsed
  * @param[in,out] append_list  pointer to list
  *                             where parsed list items are appended
- * @param[in]     scanner pointer to function scanning a single item 
+ * @param[in]     scanner pointer to function scanning a single item
  *                        (optional)
- * 
+ *
  * @retval 0  if successful.
  * @retval -1 upon an error.
  */
-issize_t msg_commalist_d(su_home_t *home, 
-                        char **ss, 
+issize_t msg_commalist_d(su_home_t *home,
+                        char **ss,
                         msg_param_t **append_list,
                         issize_t (*scanner)(char *s))
 {
@@ -603,7 +603,7 @@ issize_t msg_comma_scanner(char *start)
 {
   size_t tlen;
   char *s, *p;
-  
+
   s = p = start;
 
   if (s[0] == ',')
@@ -613,22 +613,22 @@ issize_t msg_comma_scanner(char *start)
     /* Grab next section - token, quoted string, or separator character */
     char c = *s;
 
-    if (IS_TOKEN(c)) 
+    if (IS_TOKEN(c))
       tlen = span_token(s);
     else if (c == '"')
       tlen = span_quoted(s);
     else /* if (IS_SEPARATOR(c)) */
       tlen = 1;
-    
+
     if (tlen == 0)
       return -1;
 
     if (p != s)
       memmove(p, s, tlen);     /* Move section to end of paramexter */
     p += tlen; s += tlen;
-    
+
     skip_lws(&s);              /* Skip possible LWS */
-    
+
     if (*s == '\0' || *s == ',') {             /* Test for possible end */
       if (p != s) *p = '\0';
       return s - start;
@@ -661,15 +661,15 @@ issize_t msg_comment_d(char **ss, char const **return_comment)
 
   if (return_comment)
     *return_comment = s;
-      
+
   while (level) switch (*s++) {
   case '(': level++; break;
   case ')': level--; break;
   case '\0': /* ERROR */ return -1;
   }
-      
+
   assert(s[-1] == ')');
-      
+
   s[-1] = '\0';
   skip_lws(&s);
   *ss = s;
@@ -730,12 +730,12 @@ int msg_quoted_len(char const *u)
  * string via @a ss, and pointers to which parsed host and port are assigned
  * via @a hhost and @a pport, respectively. The value-result parameter @a
  * *pport must be initialized to default value (e.g., NULL).
- * 
+ *
  * @param ss    pointer to pointer to string to be parsed
  * @param return_host value-result parameter for @e host
  * @param return_port value-result parameter for @e port
 
- * @return 
+ * @return
  * Returns zero when successful, and a negative value upon an error. The
  * parsed values for host and port are assigned via @a return_host and @a
  * return_port, respectively. The function also updates the pointer @a *ss,
@@ -747,15 +747,15 @@ int msg_quoted_len(char const *u)
  * NUL-terminated.  The calling function @b must NUL terminate the value by
  * setting the @a **ss to NUL after first examining its value.
  */
-int msg_hostport_d(char **ss, 
-                  char const **return_host, 
+int msg_hostport_d(char **ss,
+                  char const **return_host,
                   char const **return_port)
 {
   char *host, *s = *ss;
   char *port = NULL;
 
   /* Host name */
-  host = s; 
+  host = s;
   if (s[0] != '[') {
     skip_token(&s); if (host == s) return -1;
   }
@@ -785,7 +785,7 @@ int msg_hostport_d(char **ss,
 
   *return_host = host;
   *return_port = port;
-  
+
   *ss = s;
 
   return 0;
@@ -816,7 +816,7 @@ char const *msg_header_find_param(msg_common_t const *h, char const *name)
 }
 
 /**Modify a parameter value or list item in a header.
- * 
+ *
  * A header parameter @a param can be just a C-string (@a is_item > 0), or
  * it can have internal format <i>name [ "=" value]</i>. In the latter case,
  * the value part following = is ignored when replacing or removing the
@@ -834,11 +834,11 @@ char const *msg_header_find_param(msg_common_t const *h, char const *name)
  *                  - 1 add
  *
  * @retval 1 if parameter was replaced or removed successfully
- * @retval 0 if parameter was added successfully, 
+ * @retval 0 if parameter was added successfully,
  *           or there was nothing to remove
  * @retval -1 upon an error
  */
-static 
+static
 int msg_header_param_modify(su_home_t *home, msg_common_t *h,
                            char const *param,
                            int is_item,
@@ -855,12 +855,12 @@ int msg_header_param_modify(su_home_t *home, msg_common_t *h,
 
   plen = is_item > 0 ? strlen(param) : strcspn(param, "=");
   n = 0;
-  
+
   if (params) {
     /* Existing list, try to replace or remove  */
     for (; params[n]; n++) {
       char const *maybe = params[n];
-      
+
       if (remove_replace_add > 0)
        continue;
 
@@ -877,7 +877,7 @@ int msg_header_param_modify(su_home_t *home, msg_common_t *h,
       }
     }
   }
-  
+
   /* Not found? */
   if (!params || !params[n]) {
     if (remove_replace_add < 0)
@@ -885,22 +885,22 @@ int msg_header_param_modify(su_home_t *home, msg_common_t *h,
     else
       remove_replace_add = 1;  /* Add instead of replace */
   }
-  
+
   if (remove_replace_add < 0) { /* Remove */
-    for (; params[n]; n++) 
+    for (; params[n]; n++)
       params[n] = params[n + 1];
   }
   else {
     if (remove_replace_add > 0) { /* Add */
       size_t m_before = MSG_PARAMS_NUM(n + 1);
       size_t m_after =  MSG_PARAMS_NUM(n + 2);
-      
+
       assert(!params || !params[n]);
-      
+
       if (m_before != m_after || !params) {
        msg_param_t *p;
        /* XXX - we should know when to do realloc */
-       p = su_alloc(home, m_after * sizeof(*p)); 
+       p = su_alloc(home, m_after * sizeof(*p));
        if (!p) return -1;
        if (n > 0)
          memcpy(p, params, n * sizeof(p[0]));
@@ -908,25 +908,25 @@ int msg_header_param_modify(su_home_t *home, msg_common_t *h,
       }
       params[n + 1] = NULL;
     }
-    
+
     params[n] = param; /* Add .. or replace */
   }
-  
+
   msg_fragment_clear(h);
 
   if (h->h_class->hc_update) {
     /* Update shortcuts */
     size_t namelen;
     char const *name, *value;
-    
+
     name = param;
     namelen = strcspn(name, "=");
-    
+
     if (remove_replace_add < 0)
       value = NULL;
     else
       value = param + namelen + (name[namelen] == '=');
-    
+
     h->h_class->hc_update(h, name, namelen, value);
   }
 
@@ -958,21 +958,21 @@ int msg_header_param_modify(su_home_t *home, msg_common_t *h,
  * @retval 0 if parameter was added
  * @retval -1 upon an error
  *
- * @sa msg_header_replace_param(), msg_header_remove_param(), 
+ * @sa msg_header_replace_param(), msg_header_remove_param(),
  * msg_header_update_params(),
- * #msg_common_t, #msg_header_t, 
+ * #msg_common_t, #msg_header_t,
  * #msg_hclass_t, msg_hclass_t::hc_params, msg_hclass_t::hc_update
  */
 int msg_header_add_param(su_home_t *home, msg_common_t *h, char const *param)
 {
-  return msg_header_param_modify(home, h, param, 
-                                0 /* case-insensitive name=value */, 
+  return msg_header_param_modify(home, h, param,
+                                0 /* case-insensitive name=value */,
                                 1 /* add */);
 }
 
 
 
-/** Replace or add a parameter to a header. 
+/** Replace or add a parameter to a header.
  *
  * A header parameter @a param is a string of format <i>name "=" value</i>
  * or just name. The value part following "=" is ignored when selecting a
@@ -994,17 +994,17 @@ int msg_header_add_param(su_home_t *home, msg_common_t *h, char const *param)
  * @retval 1 if parameter was replaced
  * @retval -1 upon an error
  *
- * @sa msg_header_add_param(), msg_header_remove_param(), 
+ * @sa msg_header_add_param(), msg_header_remove_param(),
  * msg_header_update_params(),
- * #msg_common_t, #msg_header_t, 
+ * #msg_common_t, #msg_header_t,
  * #msg_hclass_t, msg_hclass_t::hc_params, msg_hclass_t::hc_update
  */
-int msg_header_replace_param(su_home_t *home, 
-                            msg_common_t *h, 
+int msg_header_replace_param(su_home_t *home,
+                            msg_common_t *h,
                             char const *param)
 {
-  return msg_header_param_modify(home, h, param, 
-                                0 /* case-insensitive name=value */, 
+  return msg_header_param_modify(home, h, param,
+                                0 /* case-insensitive name=value */,
                                 0 /* replace */);
 }
 
@@ -1028,13 +1028,13 @@ int msg_header_replace_param(su_home_t *home,
  *
  * @sa msg_header_add_param(), msg_header_replace_param(),
  * msg_header_update_params(),
- * #msg_common_t, #msg_header_t, 
+ * #msg_common_t, #msg_header_t,
  * #msg_hclass_t, msg_hclass_t::hc_params, msg_hclass_t::hc_update
  */
 int msg_header_remove_param(msg_common_t *h, char const *name)
 {
-  return msg_header_param_modify(NULL, h, name, 
-                                0 /* case-insensitive name=value */, 
+  return msg_header_param_modify(NULL, h, name,
+                                0 /* case-insensitive name=value */,
                                 -1 /* remove */);
 }
 
@@ -1053,7 +1053,7 @@ int msg_header_remove_param(msg_common_t *h, char const *name)
  *
  * @sa msg_header_add_param(), msg_header_replace_param(),
  * msg_header_update_params(),
- * #msg_common_t, #msg_header_t, 
+ * #msg_common_t, #msg_header_t,
  * #msg_hclass_t, msg_hclass_t::hc_params, msg_hclass_t::hc_update
  */
 int msg_header_update_params(msg_common_t *h, int clear)
@@ -1065,7 +1065,7 @@ int msg_header_update_params(msg_common_t *h, int clear)
   msg_param_t const *params;
   size_t n;
   char const *p, *v;
-  
+
   if (h == NULL)
     return errno = EFAULT, -1;
 
@@ -1107,13 +1107,13 @@ int msg_header_update_params(msg_common_t *h, int clear)
  *
  * @since New in @VERSION_1_12_4
  *
- * @sa msg_header_replace_item(), msg_header_remove_item(), 
+ * @sa msg_header_replace_item(), msg_header_remove_item(),
  * @Allow, @AllowEvents
  */
 char const *msg_header_find_item(msg_common_t const *h, char const *item)
 {
   if (h && h->h_class->hc_params) {
-    char const * const * items = 
+    char const * const * items =
       *(char const * const * const *)
       ((char *)h + h->h_class->hc_params);
 
@@ -1148,22 +1148,22 @@ char const *msg_header_find_item(msg_common_t const *h, char const *item)
  * @since New in @VERSION_1_12_4.
  *
  * @sa msg_header_remove_item(), @Allow, @AllowEvents,
- * msg_header_replace_param(), msg_header_remove_param(), 
+ * msg_header_replace_param(), msg_header_remove_param(),
  * #msg_common_t, #msg_header_t, #msg_list_t
  * #msg_hclass_t, msg_hclass_t::hc_params
  */
-int msg_header_replace_item(su_home_t *home, 
-                           msg_common_t *h, 
+int msg_header_replace_item(su_home_t *home,
+                           msg_common_t *h,
                            char const *item)
 {
-  return msg_header_param_modify(home, h, item, 
-                                1 /* string item */, 
+  return msg_header_param_modify(home, h, item,
+                                1 /* string item */,
                                 0 /* replace */);
 }
 
 /**Remove an item from a header.
  *
- * This function treats a #msg_header_t as set of C strings. The @a item is a 
+ * This function treats a #msg_header_t as set of C strings. The @a item is a
  * C string. If identical string is found from the list, it is removed.
  *
  * The shortcuts, if any, to item values are updated accordingly.
@@ -1178,14 +1178,14 @@ int msg_header_replace_item(su_home_t *home,
  * @since New in @VERSION_1_12_4.
  *
  * @sa msg_header_replace_item(), @Allow, @AllowEvents,
- * msg_header_replace_param(), msg_header_remove_param(), 
+ * msg_header_replace_param(), msg_header_remove_param(),
  * #msg_common_t, #msg_header_t, #msg_list_t
  * #msg_hclass_t, msg_hclass_t::hc_params
  */
 int msg_header_remove_item(msg_common_t *h, char const *name)
 {
-  return msg_header_param_modify(NULL, h, name, 
-                                1 /* item */, 
+  return msg_header_param_modify(NULL, h, name,
+                                1 /* item */,
                                 -1 /* remove */);
 }
 
@@ -1193,11 +1193,11 @@ int msg_header_remove_item(msg_common_t *h, char const *name)
 /** Find a parameter from a parameter list.
  *
  * Searches for given parameter @a token from the parameter list. If
- * parameter is found, it returns a non-NULL pointer to the parameter value. 
+ * parameter is found, it returns a non-NULL pointer to the parameter value.
  * If there is no value for the parameter (the parameter is of form "name"
  * or "name="), the returned pointer points to a NUL character.
  *
- * @param params list (or vector) of parameters 
+ * @param params list (or vector) of parameters
  * @param token  parameter name (with or without "=" sign)
  *
  * @return
@@ -1230,7 +1230,7 @@ msg_param_t msg_params_find(msg_param_t const params[], msg_param_t token)
  * parameter is found, it returns a non-NULL pointer to the item containing
  * the parameter.
  *
- * @param params list (or vector) of parameters 
+ * @param params list (or vector) of parameters
  * @param token  parameter name (with or without "=" sign)
  *
  * @return
@@ -1259,7 +1259,7 @@ msg_param_t *msg_params_find_slot(msg_param_t params[], msg_param_t token)
   return NULL;
 }
 
-/** Replace or add a parameter from a list. 
+/** Replace or add a parameter from a list.
  *
  * A non-NULL parameter list must have been created by msg_params_d()
  * or by msg_params_dup().
@@ -1275,7 +1275,7 @@ msg_param_t *msg_params_find_slot(msg_param_t params[], msg_param_t token)
  * @retval -1 upon an error
  */
 int msg_params_replace(su_home_t *home,
-                      msg_param_t **inout_params, 
+                      msg_param_t **inout_params,
                       msg_param_t param)
 {
   msg_param_t *params;
@@ -1297,7 +1297,7 @@ int msg_params_replace(su_home_t *home,
 
       if (!(strncasecmp(maybe, param, n))) {
        if (maybe[n] == '=' || maybe[n] == 0) {
-         params[i] = param;    
+         params[i] = param;
          return 1;
        }
       }
@@ -1308,7 +1308,7 @@ int msg_params_replace(su_home_t *home,
   return msg_params_add(home, inout_params, param);
 }
 
-/** Remove a parameter from a list. 
+/** Remove a parameter from a list.
  *
  * @retval 1 if parameter was removed
  * @retval 0 if parameter was not found
@@ -1369,7 +1369,7 @@ size_t msg_params_length(char const * const * params)
  * @param inout_params   pointer to pointer to parameter list
  * @param param     parameter to be added
  *
- * @retval 0 if parameter was added 
+ * @retval 0 if parameter was added
  * @retval -1 upon an error
  */
 int msg_params_add(su_home_t *home,
@@ -1377,7 +1377,7 @@ int msg_params_add(su_home_t *home,
                   msg_param_t param)
 {
   size_t n, m_before, m_after;
-  msg_param_t *p = *inout_params;  
+  msg_param_t *p = *inout_params;
 
   if (param == NULL)
     return -1;
@@ -1388,9 +1388,9 @@ int msg_params_add(su_home_t *home,
 
   m_before = MSG_PARAMS_NUM(n + 1);
   m_after =  MSG_PARAMS_NUM(n + 2);
-  
+
   if (m_before != m_after || !p) {
-    p = su_alloc(home, m_after * sizeof(*p)); 
+    p = su_alloc(home, m_after * sizeof(*p));
     assert(p); if (!p) return -1;
     if (n)
       memcpy(p, *inout_params, n * sizeof(*p));
@@ -1403,7 +1403,7 @@ int msg_params_add(su_home_t *home,
   return 0;
 }
 
-static 
+static
 int msg_param_prune(msg_param_t const d[], msg_param_t p, unsigned prune)
 {
   size_t i, nlen;
@@ -1414,10 +1414,10 @@ int msg_param_prune(msg_param_t const d[], msg_param_t p, unsigned prune)
     nlen = 0;
 
   for (i = 0; d[i]; i++) {
-    if ((prune == 1 && 
-        strncasecmp(p, d[i], nlen) == 0 
+    if ((prune == 1 &&
+        strncasecmp(p, d[i], nlen) == 0
         && (d[i][nlen] == '=' || d[i][nlen] == '\0'))
-       || 
+       ||
        (prune == 2 && strcasecmp(p, d[i]) == 0)
        ||
        (prune == 3 && strcmp(p, d[i]) == 0))
@@ -1436,10 +1436,10 @@ int msg_param_prune(msg_param_t const d[], msg_param_t p, unsigned prune)
  * @param home    memory home
  * @param dst     pointer to pointer to destination parameter list
  * @param src     source list
- * @param prune   prune duplicates 
+ * @param prune   prune duplicates
  * @param dup     duplicate parameters in src list
  *
- * @par Pruning 
+ * @par Pruning
  * <table>
  * <tr><td>0<td>do not prune</tr>
  * <tr><td>1<td>prune parameters with identical names</tr>
@@ -1458,7 +1458,7 @@ issize_t msg_params_join(su_home_t *home,
                         int dup)
 {
   size_t n, m, n_before, n_after, pruned, total = 0;
-  msg_param_t *d = *dst;  
+  msg_param_t *d = *dst;
 
   if (prune > 3)
     return -1;
@@ -1483,9 +1483,9 @@ issize_t msg_params_join(su_home_t *home,
   }
 
   n_after = MSG_PARAMS_NUM(n + m - pruned + 1);
-  
+
   if (n_before != n_after || !d) {
-    d = su_alloc(home, n_after * sizeof(*d)); 
+    d = su_alloc(home, n_after * sizeof(*d));
     assert(d); if (!d) return -1;
     if (n)
       memcpy(d, *dst, n * sizeof(*d));
@@ -1503,7 +1503,7 @@ issize_t msg_params_join(su_home_t *home,
       d[n++] = su_strdup(home, src[m]);        /* XXX */
     else
       d[n++] = src[m];
-  }  
+  }
 
   d[n] = NULL;
 
@@ -1605,12 +1605,12 @@ int msg_header_join_items(su_home_t *home,
 
   for (m = 0; m < M; m++) {
     d[N++] = memcpy(dup, temp[m], len[m] + 1);
-    
+
     if (update)
       update(dst, dup, len[m], dup + len[m]);
 
     dup += len[m] + 1;
-  }  
+  }
 
   d[N] = NULL;
 
@@ -1627,7 +1627,7 @@ int msg_header_join_items(su_home_t *home,
 }
 
 /**Compare parameter lists.
- * 
+ *
  * Compares parameter lists.
  *
  * @param a pointer to a parameter list
@@ -1658,7 +1658,7 @@ int msg_params_cmp(char const * const a[], char const * const b[])
 }
 
 
-/** Unquote string 
+/** Unquote string
  *
  * Duplicates the string @a q in unquoted form.
  */
@@ -1681,7 +1681,7 @@ char *msg_unquote_dup(su_home_t *home, char const *q)
       break;
     m = strcspn(q + n + 2, "\"\\");
     total += m + 1;
-    n += m + 2; 
+    n += m + 2;
   }
 
   if (!(d = su_alloc(home, total + 1)))
@@ -1689,16 +1689,16 @@ char *msg_unquote_dup(su_home_t *home, char const *q)
 
   for (n = 0;;) {
     m = strcspn(q, "\"\\");
-    memcpy(d + n, q, m); 
+    memcpy(d + n, q, m);
     n += m, q += m;
     if (q[0] == '\0' || q[0] == '"' || q[1] == '\0')
       break;
-    d[n++] = q[1]; 
+    d[n++] = q[1];
     q += 2;
   }
   assert(total == n);
   d[n] = '\0';
-  
+
   return d;
 }
 
@@ -1742,7 +1742,7 @@ issize_t msg_unquoted_e(char *b, isize_t bsiz, char const *s)
   if (b && b + 1 < end)
     *b = '"';
   b++;
-  
+
   for (;*s;) {
     size_t n = strcspn(s, "\"\\");
 
@@ -1783,7 +1783,7 @@ unsigned long msg_hash_string(char const *id)
 
   if (hash == 0)
     hash = (unsigned long)-1;
-  
+
   return hash;
 }
 
@@ -1798,14 +1798,14 @@ isize_t msg_header_size(msg_header_t const *h)
 }
 
 
-/** Encode a message to the buffer. 
+/** Encode a message to the buffer.
  *
  * The function msg_encode_e encodes a message to a given buffer.
  * It returns the length of the message to be encoded, even if the
  * buffer is too small (just like snprintf() is supposed to do).
  *
  * @param b        buffer (may be NULL)
- * @param size     size of buffer 
+ * @param size     size of buffer
  * @param mo       public message structure (#sip_t, #http_t)
  * @param flags    see #
  */
@@ -1837,7 +1837,7 @@ issize_t msg_object_e(char b[], isize_t size, msg_pub_t const *mo, int flags)
 /** Encode header contents. */
 issize_t msg_header_field_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 {
-  assert(h); assert(h->sh_class); 
+  assert(h); assert(h->sh_class);
 
   return h->sh_class->hc_print(b, bsiz, h, flags);
 }
@@ -1846,7 +1846,7 @@ issize_t msg_header_field_e(char b[], isize_t bsiz, msg_header_t const *h, int f
 msg_header_t **
 msg_header_offset(msg_t const *msg, msg_pub_t const *mo, msg_header_t const *h)
 {
-  if (h == NULL || h->sh_class == NULL) 
+  if (h == NULL || h->sh_class == NULL)
     return NULL;
 
   return msg_hclass_offset(msg->m_class, mo, h->sh_class);
@@ -1871,7 +1871,7 @@ msg_header_access(msg_pub_t const *pub, msg_hclass_t *hc)
 
   if (hh)
     return *hh;
-  else 
+  else
     return NULL;
 }
 
@@ -1880,7 +1880,7 @@ msg_header_access(msg_pub_t const *pub, msg_hclass_t *hc)
 /** Generates a random token.
  *
  */
-issize_t msg_random_token(char token[], isize_t tlen, 
+issize_t msg_random_token(char token[], isize_t tlen,
                          void const *rmemp, isize_t rsize)
 {
   uint32_t random = 0, rword;
@@ -1889,7 +1889,7 @@ issize_t msg_random_token(char token[], isize_t tlen,
   size_t i;
   ssize_t n;
 
-  static char const token_chars[33] = 
+  static char const token_chars[33] =
     /* Create aesthetically pleasing raNDom capS LooK */
     "aBcDeFgHjKmNpQrStUvXyZ0123456789";
 
@@ -1908,7 +1908,7 @@ issize_t msg_random_token(char token[], isize_t tlen,
     else
       return rsize / 5 * 8;
   }
-    
+
   for (i = 0, n = 0; i < tlen;) {
     if (n < 5) {
       if (rsize == 0)
@@ -1931,7 +1931,7 @@ issize_t msg_random_token(char token[], isize_t tlen,
     if (n < 0 || (n == 0 && rsize == 0))
       break;
   }
-  
+
   token[i] = 0;
 
   return i;
@@ -1955,7 +1955,7 @@ issize_t msg_random_token(char token[], isize_t tlen,
  * @param flags message flags (see #msg_flg_user)
  * @param data message text
  * @param len size of message text (if -1, use strlen(data))
- * 
+ *
  * @retval A pointer to a freshly allocated and parsed message.
  *
  * Upon parsing error, the header structure may be left incomplete. The
@@ -1973,7 +1973,7 @@ msg_t *msg_make(msg_mclass_t const *mc, int flags,
 
   if (len == -1)
     len = strlen(data);
-  if (len == 0) 
+  if (len == 0)
     return NULL;
 
   msg = msg_create(mc, flags);
index c6364ea5e1e506f82b57757afcab3b20ee341543..2be30b04b97a8239810b10e7146baad2d9268bb8 100644 (file)
@@ -58,9 +58,9 @@ int msghdrtag_snprintf(tagi_t const *t, char b[], size_t size)
 
   assert(t);
 
-  if (!t) { 
-    if (size) b[0] = 0; 
-    return 0; 
+  if (!t) {
+    if (size) b[0] = 0;
+    return 0;
   }
 
   h = (msg_header_t const *)t->t_value;
@@ -103,7 +103,7 @@ tagi_t *msghdrtag_dup(tagi_t *dst, tagi_t const *src, void **bb)
   char *b;
   size_t size;
 
-  assert(src); assert(*bb); 
+  assert(src); assert(*bb);
 
   dst->t_tag = src->t_tag;
   dst->t_value = 0L;
@@ -149,8 +149,8 @@ tagi_t *msghdrtag_dup(tagi_t *dst, tagi_t const *src, void **bb)
 
 
 /** Convert a string to a header structure based on to the tag. */
-int msghdrtag_scan(tag_type_t tt, su_home_t *home, 
-                  char const *s, 
+int msghdrtag_scan(tag_type_t tt, su_home_t *home,
+                  char const *s,
                   tag_value_t *return_value)
 {
   msg_hclass_t *hc = (msg_hclass_t *)tt->tt_magic;
@@ -158,19 +158,19 @@ int msghdrtag_scan(tag_type_t tt, su_home_t *home,
   int retval;
 
   h = msg_header_make(home, hc, s);
-  
+
   if (h)
     *return_value = (tag_value_t)h, retval = 1;
   else
     *return_value = (tag_value_t)NULL, retval = -1;
-  
+
   return retval;
 }
 
 
 tagi_t *msgstrtag_filter(tagi_t *dst,
                         tagi_t const f[],
-                        tagi_t const *src, 
+                        tagi_t const *src,
                         void **bb);
 
 int msgobjtag_snprintf(tagi_t const *t, char b[], size_t size)
@@ -179,9 +179,9 @@ int msgobjtag_snprintf(tagi_t const *t, char b[], size_t size)
 
   assert(t);
 
-  if (!t || !t->t_value) { 
-    if (size) b[0] = 0; 
-    return 0; 
+  if (!t || !t->t_value) {
+    if (size) b[0] = 0;
+    return 0;
   }
 
   mo = (msg_pub_t *)t->t_value;
@@ -230,7 +230,7 @@ tagi_t *msgobjtag_dup(tagi_t *dst, tagi_t const *src, void **bb)
   msg_header_t const *o;
   char *b;
 
-  assert(src); assert(*bb); 
+  assert(src); assert(*bb);
 
   omo = (msg_pub_t const *)src->t_value;
 
@@ -320,7 +320,7 @@ tagi_t *msgtag_multipart_dup(tagi_t *dst, tagi_t const *src, void **bb)
   msg_header_t const *o;
   char *b;
 
-  assert(src); assert(*bb); 
+  assert(src); assert(*bb);
 
   omo = (msg_pub_t const *)src->t_value;
 
index ddfd10d571c713a3128307323bc99f47476a286f..99e9be7beab89f6156ced9d1a6aef05e471acc92 100644 (file)
@@ -55,7 +55,7 @@ SOFIAPUBFUN void msg_set_parent(msg_t *kid, msg_t *dad);
 
 SOFIAPUBFUN msg_t *msg_ref_create(msg_t *);
 SOFIAPUBFUN void msg_ref_destroy(msg_t *);
-     
+
 SOFIAPUBFUN msg_pub_t *msg_public(msg_t const *msg, void *tag);
 SOFIAPUBFUN msg_pub_t *msg_object(msg_t const *msg);
 SOFIAPUBFUN msg_mclass_t const *msg_mclass(msg_t const *msg);
@@ -103,9 +103,9 @@ enum msg_flg_user {
   /** Cache a copy of headers when parsing. */
   MSG_FLG_EXTRACT_COPY = (1<<2),
   /** Print comma-separated lists instead of separate headers */
-  MSG_FLG_COMMA_LISTS = (1<<3),        
+  MSG_FLG_COMMA_LISTS = (1<<3),
 
-  /**Use mailbox format when parsing - in mailbox format 
+  /**Use mailbox format when parsing - in mailbox format
    * message has no body unless Content-Length header is present.
    */
   MSG_FLG_MAILBOX = (1<<4),
index a213e6c9f65cd2b742f9f3b21e62f51b8dee6a6b..fbeb1dea159a2bbda2e4516abb5b865770e941ed 100644 (file)
 
 #ifndef MSG_ADDR_H
 /** Defined when <sofia-sip/msg_addr.h> has been included. */
-#define MSG_ADDR_H 
+#define MSG_ADDR_H
 
 
-/**@file sofia-sip/msg_addr.h 
+/**@file sofia-sip/msg_addr.h
  * @brief Addressing and I/O interface for messages.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -66,8 +66,8 @@ enum {
   msg_n_fragments = 8
 };
 
-/** I/O vector type. 
- * @sa msg_recv_iovec(), msg_iovec(), #su_iovec_s, su_vsend(), su_vrecv(). 
+/** I/O vector type.
+ * @sa msg_recv_iovec(), msg_iovec(), #su_iovec_s, su_vsend(), su_vrecv().
  */
 typedef struct su_iovec_s msg_iovec_t;
 #define mv_base siv_base
@@ -88,8 +88,8 @@ SOFIAPUBFUN int msg_set_next(msg_t *msg, msg_t *next);
 
 SOFIAPUBFUN void msg_clear_committed(msg_t *msg);
 
-SOFIAPUBFUN issize_t msg_buf_external(msg_t *msg, 
-                                     usize_t N, 
+SOFIAPUBFUN issize_t msg_buf_external(msg_t *msg,
+                                     usize_t N,
                                      usize_t blocksize);
 
 SOFIA_END_DECLS
index f35ce966319835667cfa16762f80d4a7f3c1d4b1..027d3a30ede0e56f54c040feacae33510c6128ac 100644 (file)
 #define MSG_BUFFER_H
 
 /**@file sofia-sip/msg_buffer.h
- * @brief Internal buffer management functions. 
- * 
+ * @brief Internal buffer management functions.
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Fri Nov  8 12:23:00 2002 ppessi
  *
  */
index 9c8305f5f5479fcabaaea5fc636ec07360f4ea2c..4e215c786c61706d3bd4587e1a82494af8daa0cc 100644 (file)
 
 #ifndef MSG_DATE_H
 /** Defined when <sofia-sip/msg_date.h> has been included. */
-#define MSG_DATE_H 
+#define MSG_DATE_H
 
 /**@ingroup msg_parser
- * @file sofia-sip/msg_date.h 
+ * @file sofia-sip/msg_date.h
  * @brief Types and functions for handling dates and times.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Thu Jun  8 19:28:55 2000 ppessi
- * 
+ *
  */
 
 #ifndef SU_TYPES_H
index b80aeccd94947883f633388b88c31b1ed4d379b2..91fd72316bfb2e0793f7ba8003792963b402daa3 100644 (file)
@@ -33,7 +33,7 @@
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Mon Aug 27 15:44:27 2001 ppessi
- * 
+ *
  */
 
 #include <stdarg.h>
@@ -203,13 +203,13 @@ SOFIAPUBFUN issize_t msg_headers_prepare(msg_t *,
 
 #ifdef SU_HAVE_INLINE
 /** Clear encoded data from header structure. */
-su_inline void msg_fragment_clear(msg_common_t *h) 
+su_inline void msg_fragment_clear(msg_common_t *h)
 {
   h->h_data = NULL, h->h_len = 0;
 }
 
 /** Pointer to header parameters. */
-su_inline 
+su_inline
 msg_param_t **msg_header_params(msg_common_t const *h)
 {
   if (h && h->h_class->hc_params) {
index 0e5caf80f2921e307dd07594bdc3827f27f46c55..473fe279c68b39c056c26990ec13cb52f7c995b6 100644 (file)
 
 SOFIA_BEGIN_DECLS
 
-enum { 
+enum {
   /** Default size of hash table */
-  MC_HASH_SIZE = 127, 
+  MC_HASH_SIZE = 127,
   /** Size of short form table */
-  MC_SHORT_SIZE = 'Z' - 'A' + 1 
+  MC_SHORT_SIZE = 'Z' - 'A' + 1
 };
 
 /**Header reference.
  *
- * A header reference object contains a pointer to a 
- * @ref msg_hclass_s "header class" 
+ * A header reference object contains a pointer to a
+ * @ref msg_hclass_s "header class"
  * and a offset to the header objects within the @ref msg_pub_t "public
  * message structure".
- * 
+ *
  * The @a hr_flags field is used to provide classification of headers. For
  * instance, the msg_extract_errors() returns bitwise or of all hr_flags
  * belonging to headers with parsing errors.
@@ -102,7 +102,7 @@ struct msg_mclass_s
   unsigned      mc_flags;      /**< Default flags */
   unsigned      mc_msize;      /**< Size of public message structure */
   /** Function extracting the message contents. */
-  issize_t    (*mc_extract_body)(msg_t *msg, msg_pub_t *pub, 
+  issize_t    (*mc_extract_body)(msg_t *msg, msg_pub_t *pub,
                                 char b[], isize_t bsiz, int eos);
 
   msg_href_t    mc_request[1]; /**< Request line reference */
@@ -117,7 +117,7 @@ struct msg_mclass_s
   short         mc_hash_size;  /**< Size of parsing table  */
   short         mc_hash_used;  /**< Number of headers in parsing table */
   /** Hash table for parsing containing reference for each header. */
-  msg_href_t    mc_hash[MC_HASH_SIZE]; 
+  msg_href_t    mc_hash[MC_HASH_SIZE];
 };
 
 enum { msg_mclass_copy = 0, msg_mclass_empty = 1 };
@@ -128,12 +128,12 @@ SOFIAPUBFUN msg_mclass_t *msg_mclass_clone(msg_mclass_t const *old,
 SOFIAPUBFUN int msg_mclass_insert(msg_mclass_t *mc, msg_href_t const *hr);
 
 SOFIAPUBFUN
-int msg_mclass_insert_header(msg_mclass_t *mc, 
+int msg_mclass_insert_header(msg_mclass_t *mc,
                             msg_hclass_t *hc,
                             unsigned short offset);
 
 SOFIAPUBFUN
-int msg_mclass_insert_with_mask(msg_mclass_t *mc, 
+int msg_mclass_insert_with_mask(msg_mclass_t *mc,
                                msg_hclass_t *hc,
                                unsigned short offset,
                                unsigned short mask);
index 4e349219022dae857ae13c3444692aa9534eba01..1eba2b24d8ed49ce3a766cc8014787eab95a16b2 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef MSG_MCLASS_HASH_H
 /** Defined when <sofia-sip/msg_mclass_hash.h> has been included. */
-#define MSG_MCLASS_HASH_H 
+#define MSG_MCLASS_HASH_H
 
 /**@ingroup msg_parser
  * @file sofia-sip/msg_mclass_hash.h
@@ -34,7 +34,7 @@
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Tue Aug 21 16:03:45 2001 ppessi
- * 
+ *
  */
 
 #include <sofia-sip/su_config.h>
@@ -49,7 +49,7 @@ SOFIA_BEGIN_DECLS
 #define MC_HASH(s, n)     (msg_header_name_hash(s, NULL) % (unsigned)(n))
 
 /** Hash header name */
-su_inline 
+su_inline
 unsigned short msg_header_name_hash(char const *s, isize_t *llen)
 {
   unsigned short hash = 0;
index 33e6651fe706d63ac446f25a92e4b6ffecb6baee..ee9a1429039bad9c3584dcb3376d0680f25d2022 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef MSG_MIME_H
 /** Defined when <sofia-sip/msg_mime.h> has been included. */
-#define MSG_MIME_H 
+#define MSG_MIME_H
 
 /**@ingroup msg_mime
  * @file sofia-sip/msg_mime.h
@@ -34,7 +34,7 @@
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Fri Aug 16 19:18:26 EEST 2002 ppessi
- * 
+ *
  */
 
 #ifndef URL_H
@@ -58,7 +58,7 @@ typedef msg_accept_any_t            msg_accept_charset_t;
 typedef msg_accept_any_t           msg_accept_encoding_t;
 typedef msg_accept_any_t           msg_accept_language_t;
 
-typedef struct msg_content_disposition_s 
+typedef struct msg_content_disposition_s
                                     msg_content_disposition_t;
 typedef msg_list_t                 msg_content_encoding_t;
 typedef msg_generic_t               msg_content_id_t;
@@ -100,7 +100,7 @@ struct msg_accept_any_s
   char const         *aa_q;        /**< Value of q parameter */
 };
 
-/**@ingroup msg_content_disposition 
+/**@ingroup msg_content_disposition
  * @brief Structure for @b Content-Disposition header.
  */
 struct msg_content_disposition_s
@@ -208,12 +208,12 @@ msg_multipart_t *msg_multipart_create(su_home_t *home,
                                      char const *content_type,
                                      void const *data,
                                      isize_t dlen);
-SOFIAPUBFUN 
-msg_multipart_t *msg_multipart_parse(su_home_t *home, 
+SOFIAPUBFUN
+msg_multipart_t *msg_multipart_parse(su_home_t *home,
                                     msg_content_type_t const *c,
                                     msg_payload_t *pl);
 SOFIAPUBFUN
-int msg_multipart_complete(su_home_t *home, 
+int msg_multipart_complete(su_home_t *home,
                           msg_content_type_t *c,
                           msg_multipart_t *mp);
 SOFIAPUBFUN msg_header_t *msg_multipart_serialize(msg_header_t **head0,
index ffd0779b351fcae8281ac4a166189dd851792643..4ba204b2382b7a902ba3fa4621e4074e88c4c81f 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef MSG_MIME_PROTOS_H
 /** Defined when <sofia-sip/msg_mime_protos.h> has been included. */
-#define MSG_MIME_PROTOS_H 
+#define MSG_MIME_PROTOS_H
 
 /**@ingroup msg_mime
  * @file sofia-sip/msg_mime_protos.h
@@ -64,13 +64,13 @@ MSG_DLL extern msg_mclass_t const msg_multipart_mclass[1];
 \f
 /* Declare internal prototypes for #xxxxxxx_xxxxxxx# */
 
-/**@addtogroup msg_#xxxxxx# 
- * @{ 
+/**@addtogroup msg_#xxxxxx#
+ * @{
  */
 
-enum { 
+enum {
   /** Hash of #xxxxxxx_xxxxxxx#. @internal */
-  msg_#xxxxxx#_hash = #hash# 
+  msg_#xxxxxx#_hash = #hash#
 };
 
 /** Parse a #xxxxxxx_xxxxxxx#. @internal */
@@ -83,43 +83,43 @@ MSG_DLL msg_xtra_f msg_#xxxxxx#_dup_xtra;
 MSG_DLL msg_dup_f msg_#xxxxxx#_dup_one;
 
 /**Header class for #xxxxxxx_xxxxxxx#.
- * 
- * The header class msg_#xxxxxx#_class defines how a 
+ *
+ * The header class msg_#xxxxxx#_class defines how a
  * #xxxxxxx_xxxxxxx# header is parsed and printed.  It also
  * contains methods used by message parser and other functions
  * to manipulate the #msg_#xxxxxx#_t header structure.
- * 
+ *
  */
 #ifndef msg_#xxxxxx#_class
 MSG_DLL extern msg_hclass_t msg_#xxxxxx#_class[];
 #endif
 
 /**Initializer for an #msg_#xxxxxx#_t structure.
- * 
+ *
  * A static msg_#xxxxxx#_t structure must be initialized
  * with the MSG_#XXXXXX#_INIT() macro. For instance,
- * @code 
- * 
+ * @code
+ *
  *  msg_#xxxxxx#_t msg_#xxxxxx# = MSG_#XXXXXX#_INIT;
- * 
+ *
  * @endcode
  * @HI
  */
 #define MSG_#XXXXXX#_INIT() MSG_HDR_INIT(#xxxxxx#)
 
 /**Initialize an #msg_#xxxxxx#_t structure.
- * 
+ *
  * An #msg_#xxxxxx#_t structure can be initialized with the
  * msg_#xxxxxx#_init() function/macro. For instance,
  * @code
- * 
+ *
  *  msg_#xxxxxx#_t msg_#xxxxxx#;
- * 
+ *
  *  msg_#xxxxxx#_init(&msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
- * @param x pointer to #msg_#xxxxxx#_t structure 
+ *
+ * @param x pointer to #msg_#xxxxxx#_t structure
  */
 #if SU_HAVE_INLINE
 su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_init(msg_#xxxxxx#_t x[1])
@@ -132,13 +132,13 @@ su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_init(msg_#xxxxxx#_t x[1])
 #endif
 
 /**Test if header object is an instance of #msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_is_#xxxxxx#() returns true (nonzero) if
  * the header class is an instance of #xxxxxxx_xxxxxxx#
  * object and false (zero) otherwise.
- * 
+ *
  * @param header pointer to the header structure to be tested
- * 
+ *
  * @return The function msg_is_#xxxxxx#() returns true (nonzero) if the
  * header object is an instance of header #xxxxxxx_xxxxxxx# and false (zero)
  * otherwise.
@@ -155,27 +155,27 @@ int msg_is_#xxxxxx#(msg_header_t const *header);
 #define msg_#xxxxxx#_p(h) msg_is_#xxxxxx#((h))
 
 /**Duplicate (deep copy) #msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_#xxxxxx#_dup() duplicates a header structure @a
  * header. If the header structure @a header contains a reference
  * (@c header->x_next) to a list of headers, all the headers in the
  * list are duplicated, too.
- * 
+ *
  * @param home   memory home used to allocate new structure
  * @param header header structure to be duplicated
- * 
+ *
  * When duplicating, all parameter lists and non-constant strings
  * attached to the header are copied, too. The function uses given
  * memory @a home to allocate all the memory areas used to copy the
  * header.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = msg_#xxxxxx#_dup(home, msg->msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_dup() returns a pointer to the
  * newly duplicated #msg_#xxxxxx#_t header structure, or NULL
@@ -184,44 +184,44 @@ int msg_is_#xxxxxx#(msg_header_t const *header);
 #if SU_HAVE_INLINE
 su_inline
 #endif
-msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home,
                                 msg_#xxxxxx#_t const *header);
 
 #if SU_HAVE_INLINE
 su_inline
-msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home,
                                 msg_#xxxxxx#_t const *header)
 {
   return (msg_#xxxxxx#_t *)
-    msg_header_dup_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header); 
+    msg_header_dup_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header);
 }
 #endif
 
 
 /**Copy an #msg_#xxxxxx#_t header structure.
- * 
+ *
  * The function msg_#xxxxxx#_copy() copies a header structure @a
  * header. If the header structure @a header contains a reference
  * (@c header->h_next) to a list of headers, all the headers in that
  * list are copied, too. The function uses given memory @a home to
  * allocate all the memory areas used to copy the header structure
  * @a header.
- * 
+ *
  * @param home    memory home used to allocate new structure
  * @param header  pointer to the header structure to be duplicated
- * 
+ *
  * When copying, only the header structure and parameter lists
  * attached to it are duplicated. The new header structure retains
  * all the references to the strings within the old @a header,
  * including the encoding of the old header, if present.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = msg_#xxxxxx#_copy(home, msg->msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_copy() returns a pointer to
  * newly copied header structure, or NULL upon an error.
@@ -229,32 +229,32 @@ msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home,
 #if SU_HAVE_INLINE
 su_inline
 #endif
-msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home,
                                  msg_#xxxxxx#_t const *header);
 
 #if SU_HAVE_INLINE
 su_inline
-msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home,
                                  msg_#xxxxxx#_t const *header)
 {
   return (msg_#xxxxxx#_t *)
-    msg_header_copy_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header); 
+    msg_header_copy_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header);
 }
 #endif
 
 
 /**Make a header structure #msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_#xxxxxx#_make() makes a new #msg_#xxxxxx#_t header
  * structure. It allocates a new header structure, and decodes the string @a
  * s as the value of the structure.
- * 
+ *
  * @param home memory home used to allocate new header structure.
  * @param s    string to be decoded as value of the new header structure
- * 
+ *
  * @note This function may be implemented as a macro calling
  * msg_header_make().
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_make() returns a pointer to newly maked
  * #msg_#xxxxxx#_t header structure, or NULL upon an error.
@@ -270,24 +270,24 @@ msg_#xxxxxx#_t *msg_#xxxxxx#_make(su_home_t *home, char const *s);
 
 
 /**Make a #xxxxxxx_xxxxxxx# from formatting result.
- * 
+ *
  * The function msg_#xxxxxx#_format() makes a new #xxxxxxx_xxxxxxx# object
  * using snprintf-formatted result as its value. The function first
  * prints the arguments according to the format @a fmt specified. Then it
  * allocates a new header structure, and uses the formatting result as the
  * header value.
- * 
+ *
  * @param home   memory home used to allocate new header structure.
  * @param fmt    string used as a printf()-style format
  * @param ...    argument list for format
- * 
+ *
  * @note This function may be implemented as a macro calling
  * msg_header_format().
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_format() returns a pointer to newly
  * makes header structure, or NULL upon an error.
- * 
+ *
  * @HIDE
  */
 #if SU_HAVE_INLINE
@@ -301,11 +301,11 @@ su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt,
 {
   msg_header_t *h;
   va_list ap;
-  
+
   va_start(ap, fmt);
   h = msg_header_vformat(home, msg_#xxxxxx#_class, fmt, ap);
   va_end(ap);
+
   return (msg_#xxxxxx#_t*)h;
 }
 #endif
index 701a55ede5fe36034aa38a718d91da64743699ae..c2fc31f8622b969a300afaa344a824b2324133e5 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef MSG_PARSER_H
 /** Defined when <sofia-sip/msg_parser.h> has been included. */
-#define MSG_PARSER_H 
+#define MSG_PARSER_H
 
 /**@ingroup msg_parser
  * @file sofia-sip/msg_parser.h
@@ -101,8 +101,8 @@ SOFIAPUBFUN issize_t msg_extract_header(msg_t *msg, msg_pub_t *mo,
                                   char b[], isize_t bsiz, int eos);
 SOFIAPUBFUN issize_t msg_extract_separator(msg_t *msg, msg_pub_t *mo,
                                           char b[], isize_t bsiz, int eos);
-SOFIAPUBFUN issize_t msg_extract_payload(msg_t *msg, msg_pub_t *mo, 
-                                        msg_header_t **return_payload, 
+SOFIAPUBFUN issize_t msg_extract_payload(msg_t *msg, msg_pub_t *mo,
+                                        msg_header_t **return_payload,
                                         usize_t body_len,
                                         char b[], isize_t bsiz, int eos);
 
@@ -113,9 +113,9 @@ SOFIAPUBFUN issize_t msg_extract_payload(msg_t *msg, msg_pub_t *mo,
 SOFIAPUBFUN int msg_firstline_d(char *s, char **ss2, char **ss3);
 
 SOFIAPUBFUN isize_t msg_default_dup_xtra(msg_header_t const *header, isize_t offset);
-SOFIAPUBFUN char *msg_default_dup_one(msg_header_t *dst, 
+SOFIAPUBFUN char *msg_default_dup_one(msg_header_t *dst,
                                      msg_header_t const *src,
-                                     char *b, 
+                                     char *b,
                                      isize_t xtra);
 
 SOFIAPUBFUN issize_t msg_numeric_d(su_home_t *, msg_header_t *h, char *s, isize_t slen);
@@ -133,7 +133,7 @@ SOFIAPUBFUN issize_t msg_generic_e(char [], isize_t, msg_header_t const *, int);
 SOFIAPUBFUN isize_t msg_generic_dup_xtra(msg_header_t const *h, isize_t offset);
 SOFIAPUBFUN char *msg_generic_dup_one(msg_header_t *dst,
                                      msg_header_t const *src,
-                                     char *b, 
+                                     char *b,
                                      isize_t xtra);
 
 SOFIAPUBFUN isize_t msg_unknown_dup_xtra(msg_header_t const *h, isize_t offset);
@@ -159,7 +159,7 @@ SOFIAPUBFUN issize_t msg_separator_e(char [], isize_t, msg_header_t const *, int
 SOFIAPUBFUN issize_t msg_auth_d(su_home_t *, msg_header_t *h, char *s, isize_t slen);
 SOFIAPUBFUN issize_t msg_auth_e(char b[], isize_t bsiz, msg_header_t const *h, int f);
 SOFIAPUBFUN isize_t msg_auth_dup_xtra(msg_header_t const *h, isize_t offset);
-SOFIAPUBFUN char *msg_auth_dup_one(msg_header_t *dst, msg_header_t const *src, 
+SOFIAPUBFUN char *msg_auth_dup_one(msg_header_t *dst, msg_header_t const *src,
                                   char *b, isize_t xtra);
 
 /* ---------------------------------------------------------------------------
@@ -189,7 +189,7 @@ SOFIAPUBFUN issize_t msg_parse_next_field(su_home_t *home, msg_header_t *prev,
 #define MSG_TERM_E(p, e) ((p) < (e) ? (p)[0] = '\0' : '\0')
 
 /** Encode a character. @HI */
-#define MSG_CHAR_E(p, e, c) (++(p) < (e) ? ((p)[-1]=(c)) : (c)) 
+#define MSG_CHAR_E(p, e, c) (++(p) < (e) ? ((p)[-1]=(c)) : (c))
 
 /** Calculate separator and string length. @HI */
 #define MSG_STRING_LEN(s, sep_size) ((s) ? (strlen(s) + sep_size) : 0)
@@ -214,7 +214,7 @@ SOFIAPUBFUN issize_t msg_commalist_d(su_home_t *, char **ss,
 SOFIAPUBFUN issize_t msg_token_scan(char *start);
 SOFIAPUBFUN issize_t msg_attribute_value_scanner(char *s);
 
-SOFIAPUBFUN issize_t msg_any_list_d(su_home_t *, char **ss, 
+SOFIAPUBFUN issize_t msg_any_list_d(su_home_t *, char **ss,
                                    msg_param_t **append_list,
                                    issize_t (*scanner)(char *s),
                                    int sep);
@@ -269,7 +269,7 @@ SOFIAPUBFUN issize_t msg_params_join(su_home_t *,
 #define MSG_PARAMS_SIZE(rv, params) (rv = msg_params_dup_xtra(params, rv))
 
 /** Duplicate a parameter list */
-SOFIAPUBFUN char *msg_params_dup(msg_param_t const **d, msg_param_t const *s, 
+SOFIAPUBFUN char *msg_params_dup(msg_param_t const **d, msg_param_t const *s,
                                 char *b, isize_t xtra);
 
 /** Count number of parameters in the list */
index 49e6a7efd35311ce8d08eced91853b2ad360e707..43427094e21de4c966021ce73e3a099b8861d4ed 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef MSG_PROTOS_H
 /** Defined when <sofia-sip/msg_protos.h> has been included. */
-#define MSG_PROTOS_H 
+#define MSG_PROTOS_H
 
 /**@ingroup msg_headers
  * @file sofia-sip/msg_protos.h
@@ -58,13 +58,13 @@ enum {
 \f
 /* Declare internal prototypes for #xxxxxxx_xxxxxxx# */
 
-/**@addtogroup msg_#xxxxxx# 
- * @{ 
+/**@addtogroup msg_#xxxxxx#
+ * @{
  */
 
-enum { 
+enum {
   /** Hash of #xxxxxxx_xxxxxxx#. @internal */
-  msg_#xxxxxx#_hash = #hash# 
+  msg_#xxxxxx#_hash = #hash#
 };
 
 /** Parse a #xxxxxxx_xxxxxxx#. @internal */
@@ -74,41 +74,41 @@ MSG_DLL msg_parse_f msg_#xxxxxx#_d;
 MSG_DLL msg_print_f msg_#xxxxxx#_e;
 
 /**Header class for #xxxxxxx_xxxxxxx#.
- * 
- * The header class msg_#xxxxxx#_class defines how a 
+ *
+ * The header class msg_#xxxxxx#_class defines how a
  * #xxxxxxx_xxxxxxx# header is parsed and printed.  It also
  * contains methods used by message parser and other functions
  * to manipulate the msg_#xxxxxx#_t header structure.
- * 
+ *
  */
 MSG_DLL extern msg_hclass_t msg_#xxxxxx#_class[];
 
 /**Initializer for structure msg_#xxxxxx#_t.
- * 
+ *
  * A static msg_#xxxxxx#_t structure must be initialized
  * with the MSG_#XXXXXX#_INIT() macro. For instance,
- * @code 
- * 
+ * @code
+ *
  *  msg_#xxxxxx#_t msg_#xxxxxx# = MSG_#XXXXXX#_INIT;
- * 
+ *
  * @endcode
  * @HI
  */
 #define MSG_#XXXXXX#_INIT() MSG_HDR_INIT(#xxxxxx#)
 
 /**Initialize a structure msg_#xxxxxx#_t.
- * 
+ *
  * An msg_#xxxxxx#_t structure can be initialized with the
  * msg_#xxxxxx#_init() function/macro. For instance,
  * @code
- * 
+ *
  *  msg_#xxxxxx#_t msg_#xxxxxx#;
- * 
+ *
  *  msg_#xxxxxx#_init(&msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
- * @param x pointer to msg_#xxxxxx#_t structure 
+ *
+ * @param x pointer to msg_#xxxxxx#_t structure
  */
 #if SU_HAVE_INLINE
 su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_init(msg_#xxxxxx#_t x[1])
@@ -121,13 +121,13 @@ su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_init(msg_#xxxxxx#_t x[1])
 #endif
 
 /**Test if header object is instance of msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_is_#xxxxxx#() returns true (nonzero) if
  * the header class is an instance of #xxxxxxx_xxxxxxx#
  * object and false (zero) otherwise.
- * 
+ *
  * @param header pointer to the header structure to be tested
- * 
+ *
  * @return
  * The function msg_is_#xxxxxx#() returns true (nonzero) if
  * the header object is an instance of header #xxxxxx# and
@@ -144,27 +144,27 @@ int msg_is_#xxxxxx#(msg_header_t const *header);
 #endif
 
 /**Duplicate (deep copy) @c msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_#xxxxxx#_dup() duplicates a header structure @a
  * header. If the header structure @a header contains a reference
  * (@c header->x_next) to a list of headers, all the headers in the
  * list are duplicated, too.
- * 
+ *
  * @param home   memory home used to allocate new structure
  * @param header header structure to be duplicated
- * 
+ *
  * When duplicating, all parameter lists and non-constant strings
  * attached to the header are copied, too. The function uses given
  * memory @a home to allocate all the memory areas used to copy the
  * header.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = msg_#xxxxxx#_dup(home, msg->msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_dup() returns a pointer to the
  * newly duplicated msg_#xxxxxx#_t header structure, or NULL
@@ -173,45 +173,45 @@ int msg_is_#xxxxxx#(msg_header_t const *header);
 #if SU_HAVE_INLINE
 su_inline
 #endif
-msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home,
                                 msg_#xxxxxx#_t const *header)
      __attribute__((__malloc__));
 
 #if SU_HAVE_INLINE
 su_inline
-msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home,
                                 msg_#xxxxxx#_t const *header)
 {
   return (msg_#xxxxxx#_t *)
-    msg_header_dup_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header); 
+    msg_header_dup_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header);
 }
 #endif
 
 
 /**Copy a msg_#xxxxxx#_t header structure.
- * 
+ *
  * The function msg_#xxxxxx#_copy() copies a header structure @a
  * header. If the header structure @a header contains a reference
  * (@c header->h_next) to a list of headers, all the headers in that
  * list are copied, too. The function uses given memory @a home to
  * allocate all the memory areas used to copy the header structure
  * @a header.
- * 
+ *
  * @param home    memory home used to allocate new structure
  * @param header  pointer to the header structure to be duplicated
- * 
+ *
  * When copying, only the header structure and parameter lists
  * attached to it are duplicated. The new header structure retains
  * all the references to the strings within the old @a header,
  * including the encoding of the old header, if present.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = msg_#xxxxxx#_copy(home, msg->msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_copy() returns a pointer to
  * newly copied header structure, or NULL upon an error.
@@ -219,33 +219,33 @@ msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home,
 #if SU_HAVE_INLINE
 su_inline
 #endif
-msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home,
                                  msg_#xxxxxx#_t const *header)
      __attribute__((__malloc__));
 
 #if SU_HAVE_INLINE
 su_inline
-msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home,
                                  msg_#xxxxxx#_t const *header)
 {
   return (msg_#xxxxxx#_t *)
-    msg_header_copy_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header); 
+    msg_header_copy_as(home, msg_#xxxxxx#_class, (msg_header_t const *)header);
 }
 #endif
 
 /**Make a header structure msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_#xxxxxx#_make() makes a new
  * msg_#xxxxxx#_t header structure.  It allocates a new
  * header structure, and decodes the string @a s as the
  * value of the structure.
- * 
+ *
  * @param home memory home used to allocate 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
  * msg_header_make().
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_make() returns a pointer to
  * newly maked msg_#xxxxxx#_t header structure, or NULL upon
@@ -262,25 +262,25 @@ msg_#xxxxxx#_t *msg_#xxxxxx#_make(su_home_t *home, char const *s)
 #endif
 
 /**Make a #xxxxxxx_xxxxxxx# from formatting result.
- * 
+ *
  * The function msg_#xxxxxx#_format() makes a new
  * #xxxxxxx_xxxxxxx# object using formatting result as its
  * value.  The function first prints the arguments according to
  * the format @a fmt specified.  Then it allocates a new header
  * structure, and uses the formatting result as the header
  * value.
- * 
+ *
  * @param home   memory home used to allocate new header structure.
  * @param fmt    string used as a printf()-style format
  * @param ...    argument list for format
- * 
+ *
  * @note This function is usually implemented as a macro calling
  * msg_header_format().
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_format() returns a pointer to newly
  * makes header structure, or NULL upon an error.
- * 
+ *
  * @HIDE
  */
 #if SU_HAVE_INLINE
@@ -294,11 +294,11 @@ su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt,
 {
   msg_header_t *h;
   va_list ap;
-  
+
   va_start(ap, fmt);
   h = msg_header_vformat(home, msg_#xxxxxx#_class, fmt, ap);
   va_end(ap);
+
   return (msg_#xxxxxx#_t*)h;
 }
 #endif
index 4adbb2cddb8fb821f2188115cfa63f2844189397..089d4943be3b66dbce429531d3ea62f10eead920 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef MSG_TAG_CLASS_H
 /** Defined when <sofia-sip/msg_tag_class.h> has been included */
-#define MSG_TAG_CLASS_H 
+#define MSG_TAG_CLASS_H
 
 /**@file sofia-sip/msg_tag_class.h
  * @brief Functions for constructing per-protocol tag classes.
@@ -44,15 +44,15 @@ SOFIAPUBFUN int msghdrtag_snprintf(tagi_t const *t, char b[], size_t size);
 SOFIAPUBFUN size_t msghdrtag_xtra(tagi_t const *t, size_t offset);
 SOFIAPUBFUN tagi_t *msghdrtag_dup(tagi_t *dst, tagi_t const *src,
                                  void **inout_buffer);
-SOFIAPUBFUN int msghdrtag_scan(tag_type_t tt, su_home_t *home, 
-                              char const *s, 
+SOFIAPUBFUN int msghdrtag_scan(tag_type_t tt, su_home_t *home,
+                              char const *s,
                               tag_value_t *return_value);
-SOFIAPUBFUN tagi_t *msghdrtag_filter(tagi_t *dst, tagi_t const f[], 
-                                    tagi_t const *src, 
+SOFIAPUBFUN tagi_t *msghdrtag_filter(tagi_t *dst, tagi_t const f[],
+                                    tagi_t const *src,
                                     void **inout_buffer);
 
 SOFIAPUBFUN tagi_t *msgstrtag_filter(tagi_t *dst, tagi_t const f[],
-                                    tagi_t const *src, 
+                                    tagi_t const *src,
                                     void **inout_buffer);
 
 SOFIAPUBFUN int msgobjtag_snprintf(tagi_t const *t, char b[], size_t size);
index e8f061ec4dda90a650044089edc71c65de152e1a..aaf1bee42ac98cd51ead702b7935d005c2516480 100644 (file)
@@ -28,9 +28,9 @@
 
 /**@file sofia-sip/msg_types.h
  * @brief Types for messages and common headers
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Jan 23 15:43:17 2003 ppessi
  *
  */
@@ -65,15 +65,15 @@ typedef unsigned long msg_time_t;
 #endif
 
 #ifndef MSG_PUB_T
-#ifdef MSG_OBJ_T 
+#ifdef MSG_OBJ_T
 #define MSG_PUB_T MSG_OBJ_T
 #else
 #define MSG_PUB_T struct msg_pub_s
 #endif
 #endif
 
-/**Public protocol-specific message structure for accessing the message. 
- * 
+/**Public protocol-specific message structure for accessing the message.
+ *
  * This type can be either #sip_t, #http_t, or #msg_multipart_t, depending
  * on the message. The base structure used by msg module is defined in
  * struct #msg_pub_s.
@@ -104,7 +104,7 @@ typedef struct msg_auth_info_s      msg_auth_info_t;
 
 #define MSG_HEADER_N 16377
 
-/** Common part of the header objects (or message fragments). 
+/** Common part of the header objects (or message fragments).
  *
  * This structure is also known as #msg_common_t or #sip_common_t.
  */
@@ -132,7 +132,7 @@ struct msg_pub_s {
 
 #define msg_ident msg_common->h_class
 
-/** Numeric header. 
+/** Numeric header.
  *
  * A numeric header has value range of a 32-bit, 0..4294967295. The @a
  * x_value field is unsigned long, however.
@@ -143,7 +143,7 @@ struct msg_numeric_s {
   unsigned long  x_value;          /**< Numeric header value */
 };
 
-/** Generic header. 
+/** Generic header.
  *
  * A generic header does not have any internal structure. Its value is
  * represented as a string.
@@ -154,8 +154,8 @@ struct msg_generic_s {
   char const    *g_string;         /**< Header value */
 };
 
-/** List header. 
- * 
+/** List header.
+ *
  * A list header consists of comma-separated list of tokens.
  */
 struct msg_list_s {
@@ -164,7 +164,7 @@ struct msg_list_s {
   msg_param_t       *k_items;      /**< List of items */
 };
 
-/** Authentication header. 
+/** Authentication header.
  *
  * An authentication header has authentication scheme name and
  * comma-separated list of parameters as its value.
@@ -244,13 +244,13 @@ union msg_header_u {
 
 /* ====================================================================== */
 
-/**Define how to handle existing headers 
- * when a new header is added to a message. 
+/**Define how to handle existing headers
+ * when a new header is added to a message.
  */
 typedef enum {
   msg_kind_single,             /**< Only one header is allowed */
   msg_kind_append,             /**< New header is appended */
-  msg_kind_list,               /**< A token list header, 
+  msg_kind_list,               /**< A token list header,
                                 * new header is combined with old one. */
   msg_kind_apndlist,           /**< A complex list header. */
   msg_kind_prepend             /**< New header is prepended */
@@ -259,17 +259,17 @@ typedef enum {
 struct su_home_s;
 
 typedef issize_t msg_parse_f(struct su_home_s *, msg_header_t *, char *, isize_t);
-typedef issize_t msg_print_f(char buf[], isize_t bufsiz, 
+typedef issize_t msg_print_f(char buf[], isize_t bufsiz,
                             msg_header_t const *, int flags);
-typedef char *msg_dup_f(msg_header_t *dst, msg_header_t const *src, 
+typedef char *msg_dup_f(msg_header_t *dst, msg_header_t const *src,
                        char *buf, isize_t bufsiz);
 typedef isize_t msg_xtra_f(msg_header_t const *h, isize_t offset);
 
 typedef int msg_update_f(msg_common_t *, char const *name, isize_t namelen,
                         char const *value);
 
-/** Factory object for a header. 
- * 
+/** Factory object for a header.
+ *
  * The #msg_hclass_t object, "header class", defines how a header is
  * handled. It has parsing and printing functions, functions used to copy
  * header objects, header name and other information used when parsing,
index e458bfb777f5270b3a330b9d22827e9d7a2467e4..1de4c0864e400ebedc338ceb279cb3116e63f942 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@ingroup test_msg
  * @file test_class.c
- * 
+ *
  * Message class for testing parser and transports.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -65,7 +65,7 @@ static msg_xtra_f msg_request_dup_xtra;
 static msg_dup_f msg_request_dup_one;
 
 msg_hclass_t msg_request_class[] =
-MSG_HEADER_CLASS(msg_, request, NULL, "", rq_common, 
+MSG_HEADER_CLASS(msg_, request, NULL, "", rq_common,
                 single_critical, msg_request, msg_generic);
 
 /** Decode a request line */
@@ -133,7 +133,7 @@ static msg_xtra_f msg_status_dup_xtra;
 static msg_dup_f msg_status_dup_one;
 
 msg_hclass_t msg_status_class[1] =
-MSG_HEADER_CLASS(msg_, status, NULL, "", st_common, 
+MSG_HEADER_CLASS(msg_, status, NULL, "", st_common,
                 single_critical, msg_status, msg_generic);
 
 /** Parse status line */
@@ -162,7 +162,7 @@ issize_t msg_status_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
   if (status > 999 || status < 100)
     status = 0;
 
-  return snprintf(b, bsiz, "%s %03u %s" CRLF, 
+  return snprintf(b, bsiz, "%s %03u %s" CRLF,
                  st->st_version, status, st->st_phrase);
 }
 
@@ -201,19 +201,19 @@ msg_hclass_t test_auth_class[] =
   MSG_HEADER_CLASS(msg_, auth, "Auth", "", au_params,
                   append, msg_auth, msg_generic);
 
-/** Extract the message body, including separator line. 
+/** Extract the message body, including separator line.
  *
- * @param[in,out] msg  message object 
- * @param[in,out] pub  public message structure 
- * @param[in]     b    buffer containing unparsed data 
- * @param[in]     bsiz buffer size 
+ * @param[in,out] msg  message object
+ * @param[in,out] pub  public message structure
+ * @param[in]     b    buffer containing unparsed data
+ * @param[in]     bsiz buffer size
  * @param[in]     eos  true if buffer contains whole message
  *
  * @retval -1     error
  * @retval 0      message is incomplete
  * @retval other  number of bytes extracted
  */
-issize_t msg_test_extract_body(msg_t *msg, msg_pub_t *pub, 
+issize_t msg_test_extract_body(msg_t *msg, msg_pub_t *pub,
                               char b[], isize_t bsiz, int eos)
 {
   msg_test_t *tst = (msg_test_t *)pub;
@@ -249,14 +249,14 @@ issize_t msg_test_extract_body(msg_t *msg, msg_pub_t *pub,
 
   if ((m = msg_extract_payload(msg, (msg_pub_t *)tst, NULL, body_len, b, bsiz, eos) ) == -1)
     return -1;
-  
+
   tst->msg_flags |= MSG_FLG_FRAGS;
   if (bsiz >= body_len)
     tst->msg_flags |= MSG_FLG_COMPLETE;
   return m;
 }
 
-msg_href_t const msg_content_length_href[1] = 
+msg_href_t const msg_content_length_href[1] =
   {{
     msg_content_length_class,
     offsetof(msg_test_t, msg_content_length)
@@ -269,11 +269,11 @@ msg_href_t const msg_content_length_href[1] =
 
 tagi_t *tsttag_filter(tagi_t *dst,
                      tagi_t const f[],
-                     tagi_t const *src, 
+                     tagi_t const *src,
                      void **bb);
 
 /** Tag class for test header tags. @HIDE */
-tag_class_t tsthdrtag_class[1] = 
+tag_class_t tsthdrtag_class[1] =
   {{
     sizeof(tsthdrtag_class),
     /* tc_next */     NULL,
@@ -290,7 +290,7 @@ tag_class_t tsthdrtag_class[1] =
   }};
 
 /** Tag class for TST header string tags. @HIDE */
-tag_class_t tststrtag_class[1] = 
+tag_class_t tststrtag_class[1] =
   {{
     sizeof(tststrtag_class),
     /* tc_next */     NULL,
@@ -307,7 +307,7 @@ tag_class_t tststrtag_class[1] =
   }};
 
 /** Tag class for TST message tags. @HIDE */
-tag_class_t tstmsgtag_class[1] = 
+tag_class_t tstmsgtag_class[1] =
   {{
     sizeof(tstmsgtag_class),
     /* tc_next */     NULL,
@@ -322,7 +322,7 @@ tag_class_t tstmsgtag_class[1] =
     /* tc_ref_set */  t_ptr_ref_set,
   }};
 
-tag_typedef_t tsttag_header = 
+tag_typedef_t tsttag_header =
        {{ TAG_NAMESPACE, "header", tsthdrtag_class, 0 }};
 
 tag_typedef_t tsttag_header_str = STRTAG_TYPEDEF(header_str);
@@ -330,7 +330,7 @@ tag_typedef_t tsttag_header_str = STRTAG_TYPEDEF(header_str);
 /** Filter a TST header structure. */
 tagi_t *tsttag_filter(tagi_t *dst,
                      tagi_t const f[],
-                     tagi_t const *src, 
+                     tagi_t const *src,
                      void **bb)
 {
   tagi_t stub[2] = {{ NULL }};
@@ -348,7 +348,7 @@ tagi_t *tsttag_filter(tagi_t *dst,
       msg_hclass_offset(mc, (msg_pub_t *)tst, hc);
     msg_header_t const *h;
 
-    if (tst == NULL || 
+    if (tst == NULL ||
        (char *)hh >= ((char *)tst + tst->msg_size) ||
        (char *)hh < (char const *)&tst->msg_request)
       return dst;
index 83a60b6c54b7618a6c6421ec664423fa88e3e2a3..038a6657628c9e99b6c73921ca8c6abac4c057ea 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef TEST_CLASS_H
 /** Defined when <test_class.h> has been included. */
-#define TEST_CLASS_H 
+#define TEST_CLASS_H
 
 /**@ingroup test_msg
  * @file test_class.h
@@ -65,16 +65,16 @@ typedef struct msg_request_s msg_request_t;
 typedef struct msg_status_s  msg_status_t;
 
 /** Request line. */
-struct msg_request_s { 
+struct msg_request_s {
   msg_common_t     rq_common[1];   /**< Common fragment info */
   msg_header_t    *rq_next;       /**< Link to next header */
   char const      *rq_method_name; /**< Method name */
   url_t            rq_url[1];     /**< RequestURI */
   char const      *rq_version;     /**< Protocol version */
-}; 
+};
 
 /** Status line. */
-struct msg_status_s { 
+struct msg_status_s {
   msg_common_t   st_common[1]; /**< Common fragment info */
   msg_header_t *st_next;       /**< Link to next (dummy) */
   char const    *st_version;   /**< Protocol version */
@@ -107,7 +107,7 @@ typedef struct msg_test_s {
   msg_accept_language_t  *msg_accept_language; /**< Accept-Language */
   msg_mime_version_t     *msg_mime_version;    /**< MIME-Version */
   msg_content_md5_t      *msg_content_md5;     /**< Content-MD5 */
-  msg_content_encoding_t *msg_content_encoding; 
+  msg_content_encoding_t *msg_content_encoding;
                                                /**< Content-Encoding */
   msg_content_length_t   *msg_content_length;  /**< Content-Length */
 
@@ -140,7 +140,7 @@ union msg_test_u
   msg_content_id_t          sh_content_id[1];
   msg_content_md5_t         sh_content_md5[1];
   msg_content_language_t    sh_content_language[1];
-  msg_content_length_t      sh_content_length[1]; 
+  msg_content_length_t      sh_content_length[1];
   msg_content_location_t    sh_content_location[1];
   msg_content_type_t        sh_content_type[1];
   msg_mime_version_t        sh_mime_version[1];
index 9efcd7eef625992175bbaaa5b69297fa73b5af0d..78ed94b2e1e4528ed54fc6989faf1e63c945b3f4 100644 (file)
@@ -138,7 +138,7 @@ static int msg_time_test(void)
 static int addr_test(void)
 {
   BEGIN();
-  
+
   /* It *will* fail. */
   /* TEST(sizeof(socklen_t), sizeof(msg_addrlen(NULL))); */
 
@@ -268,7 +268,7 @@ int test_header_parsing(void)
 
     msg_param_t const *p = NULL;
     char *master = ";0", *list, *end;
-    
+
     for (i = 1; i < 256; i++) {
       master = su_sprintf(home, "%s; %u", master, i); TEST_1(master);
       list = end = su_strdup(home, master);
@@ -294,7 +294,7 @@ int test_header_parsing(void)
 
     msg_list_t k1[1] = {{{{ 0 }}}};
     char list1[] = "foo, bar, baz  zi  \"baz\"";
-    
+
     TEST_1(msg_list_d(home, (msg_header_t *)k1, list1, strlen(list1)) >= 0);
     TEST_1(k1->k_items);
     TEST_S(k1->k_items[0], "foo");
@@ -310,7 +310,7 @@ int test_header_parsing(void)
     su_home_t home[1] = { SU_HOME_INIT(home) };
     msg_list_t k2[1] = {{{{ 0 }}}};
     char list2[] = "one, two, three, four, five, six, seven, eight";
-    
+
     TEST_1(
          msg_list_d(home, (msg_header_t *)k2, list2, strlen(list2)) >= 0);
     TEST_1(k2->k_items);
@@ -319,33 +319,33 @@ int test_header_parsing(void)
 
     su_home_deinit(home);
   }
-    
+
   {
     /* Test that list longer than MSG_PARAMS_N is handled correctly */
     su_home_t home[1] = { SU_HOME_INIT(home) };
     msg_list_t k3[1] = {{{{ 0 }}}};
     char list3[] = "one, two, three, four, five, six, seven, eight, nine";
-    
+
     TEST_1(
          msg_list_d(home, (msg_header_t *)k3, list3, strlen(list3)) >= 0);
     TEST_1(k3->k_items);
     TEST_1(k3->k_items[7]);
     TEST_1(k3->k_items[8]);
     TEST_1(k3->k_items[9] == NULL);
-  
+
     su_home_deinit(home);
   }
 
   {
     /* Test that long lists are handled correctly */
     su_home_t home[1] = { SU_HOME_INIT(home) };
-    
+
     msg_param_t *k = NULL;
     char *s;
     char list1[] = "one, two, three, four, five, six, seven, eight";
     char list2[] = "one, two, three, four, five, six, seven, eight";
     char list3[] = "one, two, three, four, five, six, seven, eight";
-    char list4[] = "one, two, three, four, five, six, seven, eight, nine";    
+    char list4[] = "one, two, three, four, five, six, seven, eight, nine";
 
     s = list1; TEST_1(msg_commalist_d(home, &s, &k, msg_token_scan) >= 0);
     TEST_1(k);
@@ -366,7 +366,7 @@ int test_header_parsing(void)
 
     msg_param_t *p = NULL;
     char *master = "0", *list, *end;
-    
+
     for (i = 1; i < 256; i++) {
       master = su_sprintf(home, "%s, %u", master, i); TEST_1(master);
       list = end = su_strdup(home, master);
@@ -389,7 +389,7 @@ int test_header_parsing(void)
   {
     /* Test that errors in lists are handled correctly */
     su_home_t home[1] = { SU_HOME_INIT(home) };
-    
+
     msg_param_t *k = NULL;
     char *s;
     char list1[] = "one, two, three, four, five, six, seven, foo=\"eight";
@@ -409,7 +409,7 @@ int test_header_parsing(void)
 
     msg_list_t k4[1] = {{{{ 0 }}}};
     char list4[] = ", ,\t,\r\n\t,  ,   ";
-    
+
     TEST_1(
          msg_list_d(home, (msg_header_t *)k4, list4, strlen(list4)) >= 0);
     TEST_1(k4->k_items == NULL);
@@ -423,7 +423,7 @@ int test_header_parsing(void)
     msg_auth_t au[1] = {{{{ 0 }}}};
     char s[] = "Basic foo = \"bar==\" ,, bar=baari,"
       "baz=\"bof,\\\\ \\\" baff\", base\t64/ - is== ,,";
-    
+
     TEST_1(msg_auth_d(home, (msg_header_t *)au, s, strlen(s)) >= 0);
     TEST_S(au->au_scheme, "Basic");
     TEST_1(au->au_params);
@@ -441,7 +441,7 @@ int test_header_parsing(void)
     su_home_t home[1] = { SU_HOME_INIT(home) };
 
     msg_content_type_t *c;
-    
+
     c = msg_content_type_format(home, "%s/%s;%s;%s;%s;%s;%s;%s",
                                "text", "plain",
                                "charset=iso-8859-15",
@@ -487,7 +487,7 @@ int hash_test(void)
   int i, j, hash = 0;
   msg_mclass_t const *mc = msg_test_mclass;
   msg_hclass_t *hc;
-  
+
   BEGIN();
 
   for (i = 0; i < mc->mc_hash_size; i++) {
@@ -517,12 +517,12 @@ msg_t *read_msg(char const buffer[])
   return msg_make(msg_test_mclass, MSG_DO_EXTRACT_COPY, buffer, -1);
 }
 
-/**Check if header chain contains any loops. 
+/**Check if header chain contains any loops.
  *
  * @return
  * Return 0 if no loop, -1 otherwise.
  */
-static 
+static
 int msg_chain_loop(msg_header_t const *h)
 {
   msg_header_t const *h2;
@@ -542,7 +542,7 @@ int msg_chain_loop(msg_header_t const *h)
   return 0;
 }
 
-/** Check header chain consistency. 
+/** Check header chain consistency.
  *
  * @return
  * Return 0 if consistent, number of errors otherwise.
@@ -552,7 +552,7 @@ int msg_chain_errors(msg_header_t const *h)
 {
   if (msg_chain_loop(h))
     return -1;
-  
+
   for (; h; h = h->sh_succ) {
     if (h->sh_succ && h->sh_succ->sh_prev != &h->sh_succ)
       return -1;
@@ -606,14 +606,14 @@ int test_msg_parsing(void)
 
   TEST_1(separator = msg_separator_make(home, "\r\n"));
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (msg_header_t *)separator), 0);
-  TEST_P(tst->msg_separator, separator); 
+  TEST_P(tst->msg_separator, separator);
   TEST_P(separator->sep_common->h_succ, tst->msg_payload);
 
   /* Try to add a new payload */
   TEST_1(payload = msg_payload_make(home, "foofaa\r\n"));
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (msg_header_t *)payload), 0);
   /* It is appended */
-  TEST_P(tst->msg_payload->pl_next, payload); 
+  TEST_P(tst->msg_payload->pl_next, payload);
   TEST_P(tst->msg_payload->pl_common->h_succ, payload);
 
   {
@@ -622,10 +622,10 @@ int test_msg_parsing(void)
     msg_param_t foo = "foo=bar";
 
     vs = NULL;
-    MSG_PARAM_MATCH(vs, foo, "foo"); 
+    MSG_PARAM_MATCH(vs, foo, "foo");
     TEST_S(vs, "bar");
     vs = NULL;
-    MSG_PARAM_MATCH(vs, foo, "fo"); 
+    MSG_PARAM_MATCH(vs, foo, "fo");
     TEST_P(vs, NULL);
     vi = 0;
     MSG_PARAM_MATCH_P(vi, foo, "foo");
@@ -670,14 +670,14 @@ int test_msg_parsing(void)
     TEST_1(se = fi->aa_next);
 
     TEST_S(en->aa_value, "en");
-    TEST_M(en->aa_common->h_data, 
+    TEST_M(en->aa_common->h_data,
           "Accept-Language: en;q=0.8, fi, se ; q = 0.6" CRLF,
           en->aa_common->h_len);
 
-    TEST_P((char *)en->aa_common->h_data + en->aa_common->h_len, 
+    TEST_P((char *)en->aa_common->h_data + en->aa_common->h_len,
           fi->aa_common->h_data);
     TEST(fi->aa_common->h_len, 0);
-    TEST_P((char *)en->aa_common->h_data + en->aa_common->h_len, 
+    TEST_P((char *)en->aa_common->h_data + en->aa_common->h_len,
           se->aa_common->h_data);
     TEST(se->aa_common->h_len, 0);
 
@@ -689,9 +689,9 @@ int test_msg_parsing(void)
     TEST_P(fi->aa_next, de);
     TEST_P(de->aa_next, NULL);
 
-    TEST_P(en->aa_common->h_succ, fi); 
+    TEST_P(en->aa_common->h_succ, fi);
     TEST_P(en->aa_common->h_prev, &deflate->aa_common->h_succ);
-    TEST_P(fi->aa_common->h_succ, de); 
+    TEST_P(fi->aa_common->h_succ, de);
     TEST_P(fi->aa_common->h_prev, &en->aa_common->h_succ);
     TEST_P(de->aa_common->h_succ, NULL);
     TEST_P(de->aa_common->h_prev, &fi->aa_common->h_succ);
@@ -700,21 +700,21 @@ int test_msg_parsing(void)
     TEST_P(se->aa_common->h_succ, NULL);
     TEST_P(se->aa_common->h_prev, NULL);
 
-    TEST_1(sv = msg_accept_language_make(msg_home(msg), 
+    TEST_1(sv = msg_accept_language_make(msg_home(msg),
                                         "sv;q=0.6,sv_FI;q=0.7"));
     TEST_1(sv_fi = sv->aa_next);
 
     TEST(msg_header_replace(msg, (msg_pub_t *)tst, (void *)fi, (void *)sv), 0);
 
     TEST_P(en->aa_next, sv);
-    TEST_P(sv->aa_next->aa_next, de); 
+    TEST_P(sv->aa_next->aa_next, de);
     TEST_P(de->aa_next, NULL);
 
-    TEST_P(en->aa_common->h_succ, sv); 
+    TEST_P(en->aa_common->h_succ, sv);
     TEST_P(en->aa_common->h_prev, &deflate->aa_common->h_succ);
-    TEST_P(sv->aa_common->h_succ, sv_fi); 
+    TEST_P(sv->aa_common->h_succ, sv_fi);
     TEST_P(sv->aa_common->h_prev, &en->aa_common->h_succ);
-    TEST_P(sv_fi->aa_common->h_succ, de); 
+    TEST_P(sv_fi->aa_common->h_succ, de);
     TEST_P(sv_fi->aa_common->h_prev, &sv->aa_common->h_succ);
     TEST_P(de->aa_common->h_succ, NULL);
     TEST_P(de->aa_common->h_prev, &sv_fi->aa_common->h_succ);
@@ -727,7 +727,7 @@ int test_msg_parsing(void)
                 "Foo: bar" CRLF
                 "Content-Length: 6" CRLF
                 CRLF
-                "test" CRLF 
+                "test" CRLF
                 "extra stuff" CRLF);
   TEST_1(orig);
   otst = msg_test_public(orig);
@@ -743,7 +743,7 @@ int test_msg_parsing(void)
 
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (void *)request), 0);
 
-  TEST_1(location = 
+  TEST_1(location =
         msg_content_location_make(home, "http://localhost:8080/wife"));
 
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (void *)location), 0);
@@ -751,14 +751,14 @@ int test_msg_parsing(void)
   TEST(msg_serialize(msg, (msg_pub_t *)tst), 0);
   TEST_1(msg_prepare(msg) > 0);
 
-  TEST_1(language = 
+  TEST_1(language =
         msg_content_language_make(home, "se-FI, fi-FI, sv-FI"));
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (void *)language), 0);
 
   TEST_1(se = msg_accept_language_make(home, "se, fi, sv"));
   TEST_1(se->aa_next);  TEST_1(se->aa_next->aa_next);
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (void *)se), 0);
-  
+
   TEST(msg_serialize(msg, (msg_pub_t *)tst), 0);
   TEST_1(msg_prepare(msg) > 0);
 
@@ -789,9 +789,9 @@ int test_msg_parsing(void)
     char const encoded[] = "Accept-Language: se, fi, sv\r\n";
     TEST_SIZE(se->aa_common->h_len, strlen(encoded));
     TEST_M(se->aa_common->h_data, encoded, se->aa_common->h_len);
-    TEST_P((char *)se->aa_common->h_data + se->aa_common->h_len, 
+    TEST_P((char *)se->aa_common->h_data + se->aa_common->h_len,
           se->aa_next->aa_common->h_data);
-    TEST_P((char *)se->aa_common->h_data + se->aa_common->h_len, 
+    TEST_P((char *)se->aa_common->h_data + se->aa_common->h_len,
           se->aa_next->aa_next->aa_common->h_data);
   }
 
@@ -804,7 +804,7 @@ int test_msg_parsing(void)
 
     /* Bug #1726034 */
     for (i = 0; i < 15; i++)
-      strcpy(body + i * 66, 
+      strcpy(body + i * 66,
             "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
             "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n");
     pl = msg_payload_make(msg_home(msg), body);
@@ -812,7 +812,7 @@ int test_msg_parsing(void)
     TEST(msg_header_insert(msg, (msg_pub_t *)tst, (void *)pl), 0);
 
     s = msg_as_string(msg_home(msg), msg, NULL, 0, &size);
-    TEST_S(s, 
+    TEST_S(s,
 "GET a-wife HTTP/1.1" CRLF
 "Foo: bar" CRLF
 "Content-Length: 6" CRLF
@@ -854,7 +854,7 @@ static int test_warning(void)
 
   TEST_1(home = su_home_new(sizeof *home));
 
-  TEST_1((w = msg_warning_make(home, 
+  TEST_1((w = msg_warning_make(home,
                               "399 host:5060 \"Ok\", "
                               "399 [::1]:39999 \"foo\\\" bar\"")));
   TEST(w->w_code, 399);
@@ -980,8 +980,8 @@ int test_mclass(void)
   TEST_1(la->k_next->k_common->h_data);
   TEST_1(la->k_next->k_items == NULL);
 
-  TEST(msg_header_add_make(msg, (msg_pub_t *)tst, 
-                          msg_content_language_class, 
+  TEST(msg_header_add_make(msg, (msg_pub_t *)tst,
+                          msg_content_language_class,
                           "en-gb"), 0);
   TEST_P(la, tst->msg_content_language);
   TEST_P(la->k_common->h_data, NULL);
@@ -998,19 +998,19 @@ int test_mclass(void)
 
   TEST_1(separator = msg_separator_make(home, "\r\n"));
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (msg_header_t *)separator), 0);
-  TEST_P(tst->msg_separator, separator); 
+  TEST_P(tst->msg_separator, separator);
   TEST_P(separator->sep_common->h_succ, tst->msg_payload);
 
   /* Try to add a new payload */
   TEST_1(payload = msg_payload_make(home, "foofaa\r\n"));
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (msg_header_t *)payload), 0);
   /* The new payload should be appended */
-  TEST_P(tst->msg_payload->pl_next, payload); 
+  TEST_P(tst->msg_payload->pl_next, payload);
   TEST_P(tst->msg_payload->pl_common->h_succ, payload);
 
   /* Try to add a new header */
-  TEST_1(l = msg_content_length_create(home, 
-                                      tst->msg_payload->pl_len + 
+  TEST_1(l = msg_content_length_create(home,
+                                      tst->msg_payload->pl_len +
                                       payload->pl_len));
   TEST(msg_header_insert(msg, (msg_pub_t *)tst, (msg_header_t *)l), 0);
   /* The new header should be last before separator */
@@ -1056,7 +1056,7 @@ int test_copy(void)
   msg_common_t *h, *h_succ;
   msg_iovec_t iovec[8];
 
-  char const s[] = 
+  char const s[] =
     "GET /a-life HTTP/1.1" CRLF
     "Content-Length: 6" CRLF
     "Content-Type: *" CRLF
@@ -1078,10 +1078,10 @@ int test_copy(void)
   TEST_1(copy = msg_test_public(msg));
   TEST_1(copy->msg_request);
   TEST_1(tst0->msg_request);
-  TEST_S(copy->msg_request->rq_url->url_path, 
+  TEST_S(copy->msg_request->rq_url->url_path,
         tst0->msg_request->rq_url->url_path);
   TEST_S(copy->msg_request->rq_url->url_path, "a-life");
-  TEST_P(copy->msg_request->rq_url->url_path, 
+  TEST_P(copy->msg_request->rq_url->url_path,
         tst0->msg_request->rq_url->url_path);
 
   msg_destroy(msg);
@@ -1090,10 +1090,10 @@ int test_copy(void)
   TEST_1(dup = msg_test_public(msg));
   TEST_1(dup->msg_request);
   TEST_1(tst0->msg_request);
-  TEST_S(dup->msg_request->rq_url->url_path, 
+  TEST_S(dup->msg_request->rq_url->url_path,
         tst0->msg_request->rq_url->url_path);
   TEST_S(dup->msg_request->rq_url->url_path, "a-life");
-  TEST_1(dup->msg_request->rq_url->url_path != 
+  TEST_1(dup->msg_request->rq_url->url_path !=
         tst0->msg_request->rq_url->url_path);
 
   msg_destroy(msg);
@@ -1156,7 +1156,7 @@ int test_mime(void)
   msg_content_id_t *cid;
   msg_content_transfer_encoding_t *cte;
 
-  char const s[] = 
+  char const s[] =
     "GET /a-life HTTP/1.1" CRLF
     "Accept: text/html;level=4;q=1" CRLF
     "Accept: text / plain;q=0.9" CRLF
@@ -1175,13 +1175,13 @@ int test_mime(void)
     /* "Content-Length: 305" CRLF */
     "Content-MD5: LLO7gLaGqGt4BI6HouiWng==" CRLF
     CRLF
-    "test" CRLF                        
+    "test" CRLF
     CRLF                       /* 1 */
-    "--LaGqGt4BI6Ho" "  " CRLF 
+    "--LaGqGt4BI6Ho" "  " CRLF
     CRLF                       /* 2 */
     "part 1" CRLF              /* 3 */
     CRLF                       /* 4 */
-    "--LaGqGt4BI6Ho" CRLF      
+    "--LaGqGt4BI6Ho" CRLF
     "Content-Type: text/plain ; charset = iso-8859-1" CRLF /* 5 */
     "Content-ID: <m7ZvEEm49xdTT0WCDUgnww@localhost>" CRLF /* 6 */
     "Content-Transfer-Encoding: quoted-unreadable" CRLF        /* 7 */
@@ -1191,10 +1191,10 @@ int test_mime(void)
     "Content-Type: text/html" CRLF /* 11 */
     "Content-ID: <4SP77aQZ9z6Top2dvLqKPQ@localhost>" CRLF /* 12 */
     CRLF                       /* 13 */
-#define BODY3 "<html><body>part 3</body></html>" CRLF 
+#define BODY3 "<html><body>part 3</body></html>" CRLF
     BODY3                      /* 14 */
     CRLF                       /* 15 */
-    "--LaGqGt4BI6Ho--" CRLF;   
+    "--LaGqGt4BI6Ho--" CRLF;
 
   BEGIN();
 
@@ -1240,7 +1240,7 @@ int test_mime(void)
   TEST_1(mp->mp_data);
   TEST(memcmp(mp->mp_data, CRLF "--" "LaGqGt4BI6Ho" CRLF, mp->mp_len), 0);
   TEST_1(mp->mp_common->h_data);
-  TEST_M(mp->mp_common->h_data, CRLF "--" "LaGqGt4BI6Ho" "  " CRLF, 
+  TEST_M(mp->mp_common->h_data, CRLF "--" "LaGqGt4BI6Ho" "  " CRLF,
         mp->mp_common->h_len);
 
   TEST_1(pl = mp->mp_payload); TEST_1(pl->pl_data);
@@ -1254,7 +1254,7 @@ int test_mime(void)
 
   TEST_1(c = mp->mp_content_type);
   TEST_S(c->c_type, "text/plain"); TEST_S(c->c_subtype, "plain");
-  TEST_1(c->c_params);   TEST_1(c->c_params[0]); 
+  TEST_1(c->c_params);   TEST_1(c->c_params[0]);
   TEST_S(c->c_params[0], "charset=iso-8859-1");
 
   TEST_1(cid = mp->mp_content_id);
@@ -1265,7 +1265,7 @@ int test_mime(void)
   TEST_1(pl = mp->mp_payload); TEST_1(pl->pl_data);
   TEST_SIZE(strlen("part 2"), pl->pl_len);
   TEST(memcmp(pl->pl_data, "part 2", pl->pl_len), 0);
-  
+
   TEST_1(mp = mp->mp_next);
 
   TEST_1(mp->mp_data);
@@ -1295,7 +1295,7 @@ int test_mime(void)
 
   TEST(n, 15);
 
-  head = NULL; 
+  head = NULL;
   TEST_1(h = msg_multipart_serialize(&head, mp0));
   TEST_P(h, mpX->mp_close_delim);
   TEST_1(!msg_chain_errors((msg_header_t *)mp0));
@@ -1306,15 +1306,15 @@ int test_mime(void)
 
   TEST(n, 15);
 
-  /* Add a new part to multipart */   
-  mpnew = su_zalloc(home, sizeof(*mpnew)); TEST_1(mpnew); 
+  /* Add a new part to multipart */
+  mpnew = su_zalloc(home, sizeof(*mpnew)); TEST_1(mpnew);
   removed = mpX->mp_close_delim;
   mpX->mp_next = mpnew; mpX = mpnew;
   mpnew->mp_content_type = msg_content_type_make(home, "multipart/mixed");
   TEST_1(mpnew->mp_content_type);
   TEST(msg_multipart_complete(msg_home(msg), tst->msg_content_type, mp0), 0);
 
-  head = NULL; 
+  head = NULL;
   TEST_1(h = msg_multipart_serialize(&head, mp0));
   TEST_P((void *)h, mpX->mp_close_delim);
   TEST_1(!msg_chain_errors((msg_header_t *)mp0));
@@ -1355,14 +1355,14 @@ int test_mime(void)
   TEST(n, 19);
 
   /* Add an recursive multipart */
-  mpnew = su_zalloc(home, sizeof(*mpnew)); TEST_1(mpnew); 
+  mpnew = su_zalloc(home, sizeof(*mpnew)); TEST_1(mpnew);
   mpX->mp_multipart = mpnew;
   mpnew->mp_content_type = msg_content_type_make(home, "text/plain");
   TEST_1(mpnew->mp_content_type);
   TEST(msg_multipart_complete(msg_home(msg), tst->msg_content_type, mp0), 0);
   TEST_1(mpnew->mp_close_delim);
 
-  head = NULL; 
+  head = NULL;
   TEST_1(h = msg_multipart_serialize(&head, mp0));
   TEST_P(h, mpX->mp_close_delim);
 
@@ -1393,7 +1393,7 @@ int test_mime2(void)
   msg_payload_t *pl;
   char const *end;
 
-  char const s[] = 
+  char const s[] =
     "GET /a-life HTTP/1.1" CRLF
     "Accept: text/html;level=4;q=1" CRLF
     "Accept: text / plain;q=0.9" CRLF
@@ -1411,13 +1411,13 @@ int test_mime2(void)
     "Content-Type: multipart/alternative ; boundary=\"LaGqGt4BI6Ho\"" CRLF
     "Content-MD5: LLO7gLaGqGt4BI6HouiWng==" CRLF
     CRLF
-    "test" CRLF                        
+    "test" CRLF
     CRLF                       /* 1 */
-    "--LaGqGt4BI6Ho" "  " CRLF 
+    "--LaGqGt4BI6Ho" "  " CRLF
     CRLF                       /* 2 */
     "part 1" CRLF              /* 3 */
     CRLF                       /* 4 */
-    "--LaGqGt4BI6Ho" CRLF      
+    "--LaGqGt4BI6Ho" CRLF
     "Content-Type: text/plain;charset=iso-8859-1" CRLF /* 5 */
     "Content-ID: <m7ZvEEm49xdTT0WCDUgnww@localhost>" CRLF /* 6 */
     "Content-Transfer-Encoding: quoted-unreadable" CRLF        /* 7 */
@@ -1427,10 +1427,10 @@ int test_mime2(void)
     "Content-Type: text/html" CRLF /* 11 */
     "Content-ID: <4SP77aQZ9z6Top2dvLqKPQ@localhost>" CRLF /* 12 */
     CRLF                       /* 13 */
-#define BODY3 "<html><body>part 3</body></html>" CRLF 
+#define BODY3 "<html><body>part 3</body></html>" CRLF
     BODY3                      /* 14 */
     CRLF                       /* 15 */
-    "--LaGqGt4BI6Ho--" CRLF;   
+    "--LaGqGt4BI6Ho--" CRLF;
 
   char const part1[] = "This is text\n";
   char const part2[] = "<html><body>This is html</body></html>";
@@ -1465,19 +1465,19 @@ int test_mime2(void)
     su_home_t h0[1] = { SU_HOME_INIT(h0) };
 
     pl = msg_payload_dup(h0, tst->msg_payload); TEST_1(pl);
-  
+
     mp = msg_multipart_parse(home, c, pl); TEST_1(mp);
 
-    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++) 
+    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++)
       h->sh_data = NULL, h->sh_len = 0;
     TEST(n, 15);
-    
+
     n = msg_multipart_prepare(msg, mp, 0);
-    
+
     TEST_1(end = strstr(s, "--LaGqGt4BI6Ho  "));
     len = strlen(end);
     TEST(len, n);
-    
+
     TEST_1(mp = msg_multipart_dup(h0, mp));
 
     su_home_check(h0);
@@ -1489,20 +1489,20 @@ int test_mime2(void)
     su_home_t h0[1] = { SU_HOME_INIT(h0) };
 
     pl = msg_payload_dup(h0, tst->msg_payload); TEST_1(pl);
-  
+
     mp = msg_multipart_parse(h0, NULL, pl);
     TEST_1(mp);
 
-    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++) 
+    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++)
       h->sh_data = NULL, h->sh_len = 0;
     TEST(n, 15);
-    
+
     n = msg_multipart_prepare(msg, mp, 0);
-    
+
     TEST_1(end = strstr(s, "--LaGqGt4BI6Ho  "));
     len = strlen(end);
     TEST(len, n);
-    
+
     TEST_1(mp = msg_multipart_dup(h0, mp));
 
     su_home_check(h0);
@@ -1514,7 +1514,7 @@ int test_mime2(void)
     su_home_t h0[1] = { SU_HOME_INIT(h0) };
 
     pl = msg_payload_dup(h0, tst->msg_payload); TEST_1(pl);
-  
+
     n = strstr(pl->pl_data, "--LaGqGt4BI6Ho") - (char *)pl->pl_data;
     pl->pl_data = n + (char *)pl->pl_data; pl->pl_len -= n;
 
@@ -1522,14 +1522,14 @@ int test_mime2(void)
 
     mp = msg_multipart_parse(h0, NULL, pl); TEST_1(mp);
 
-    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++) 
+    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++)
       h->sh_data = NULL, h->sh_len = 0;
     TEST(n, 15);
-    
+
     n = msg_multipart_prepare(msg, mp, 0);
 
     TEST(len, n);
-    
+
     TEST_1(mp = msg_multipart_dup(h0, mp));
 
     su_home_check(h0);
@@ -1542,7 +1542,7 @@ int test_mime2(void)
     char *b;
 
     pl = msg_payload_dup(h0, tst->msg_payload); TEST_1(pl);
-  
+
     /* Remove CRs */
     b = pl->pl_data, len = pl->pl_len;
     for (n = m = 0; n < len; n++) {
@@ -1550,14 +1550,14 @@ int test_mime2(void)
        m++;
     }
     pl->pl_len = m;
-    
+
     mp = msg_multipart_parse(h0, NULL, pl);
     TEST_1(mp);
-    
-    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++) 
+
+    for (n = 0, h = (msg_header_t *)mp; h; h = h->sh_succ, n++)
       h->sh_data = NULL, h->sh_len = 0;
     TEST(n, 15);
-    
+
     n = msg_multipart_prepare(msg, mp, 0);
     TEST_1(n > 0);
 
@@ -1571,10 +1571,10 @@ int test_mime2(void)
   TEST_1(c = msg_content_type_make(home, "multipart/related"));
 
   TEST_1(mp = msg_multipart_create(home, "text/plain", part1, strlen(part1)));
-  TEST_1(mp->mp_next = 
+  TEST_1(mp->mp_next =
         msg_multipart_create(home, "text/html", part2, strlen(part2)));
-  TEST_1(mp->mp_next->mp_next = 
-        msg_multipart_create(home, "application/octet-stream", 
+  TEST_1(mp->mp_next->mp_next =
+        msg_multipart_create(home, "application/octet-stream",
                              part3, sizeof part3));
 
   TEST(msg_multipart_complete(home, c, mp), 0);
@@ -1605,7 +1605,7 @@ int test_serialize(void)
   msg_accept_encoding_t *aen;
   msg_accept_language_t *ala;
 
-  char const s[] = 
+  char const s[] =
     "GET /a-life HTTP/1.1" CRLF
     "Accept-Language: fi" CRLF
     "Accept-Encoding: z0" CRLF
@@ -1629,7 +1629,7 @@ int test_serialize(void)
   TEST(msg_header_remove(msg, (msg_pub_t *)tst, (msg_header_t *)ala), 0);
   TEST_S(ala->aa_value, "de");
 
-  TEST_1(ala = tst->msg_accept_language); 
+  TEST_1(ala = tst->msg_accept_language);
   TEST_1(ala = ala->aa_next); TEST_S(ala->aa_value, "se");
   /* Make sure that cached encoding of se is reset */
   TEST_1(ala->aa_common->h_data == NULL);
@@ -1642,12 +1642,12 @@ int test_serialize(void)
   TEST_1(aen = tst->msg_accept_encoding->aa_next->aa_next);
   TEST(msg_header_remove_all(msg, (msg_pub_t *)tst, (msg_header_t *)aen), 0);
 
-  TEST_1(aen = tst->msg_accept_encoding); 
+  TEST_1(aen = tst->msg_accept_encoding);
   TEST_1(aen = aen->aa_next); TEST_S(aen->aa_value, "z1");
   /* Make sure that cached encoding of z1 is reset */
   TEST_1(aen->aa_common->h_data == NULL);
   TEST_1(aen->aa_common->h_len == 0);
-  TEST_1(aen->aa_next == NULL); 
+  TEST_1(aen->aa_next == NULL);
 
   TEST_1(aen->aa_common->h_succ == (void *)ala);
   TEST_1(ala->aa_next->aa_common);
@@ -1708,7 +1708,7 @@ static int random_test(void)
   TEST_S(token, "aaaaaaaaaaaaa");
   TEST_SIZE(msg_random_token(token, 32, zeros, 12), 20);
   TEST_S(token, "aaaaaaaaaaaaaaaaaaaa");
-  
+
   END();
 }
 
index 3563a68e2af2794b1d3c96f0fb7bfc97ba2080c6..dc7da323df4d5cd6d2ab281689f7eaabd99cfb74 100644 (file)
@@ -1,4 +1,4 @@
-/**-*- c -*- 
+/**-*- c -*-
  * @ingroup msg
  * @internal @file test_protos.h.in
  *
 
 #ifndef TEST_PROTOS_H
 /** Defined when <test_protos.h> has been included. */
-#define TEST_PROTOS_H 
+#define TEST_PROTOS_H
 
 /**@ingroup test_msg
  * @file test_protos.h
  *
  * Prototypes and macros for dummy testing protocol headers.
- * 
+ *
  * #AUTO#
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  */
 
@@ -85,8 +85,8 @@ extern tag_class_t tstmsgtag_class[1];
 /**Tag list item for header string.
  *
  * The TSTTAG_HEADER_STR() macro is used to include a tag item containing a
- * header string in the tag list, e.g., 
- * @code 
+ * header string in the tag list, e.g.,
+ * @code
  * TSTTAG_HEADER_STR("Priority: urgent").
  * @endcode
  *
@@ -134,7 +134,7 @@ extern tag_typedef_t tsttag_header_str_ref;
 #if HAVE_INLINE
 su_inline
 tag_value_t tsttag_tst_v(msg_test_t const *v) { return (tag_value_t)v; }
-su_inline 
+su_inline
 tag_value_t tsttag_tst_vr(msg_test_t const **vp) { return (tag_value_t)vp; }
 #else
 #define tsttag_tst_v(v)   (tag_value_t)(v)
@@ -153,8 +153,8 @@ msg_print_f msg_#xxxxxx#_e;
 
 
 /**Header class for #xxxxxxx_xxxxxxx#.
- * 
- * The header class msg_#xxxxxx#_class defines how a 
+ *
+ * The header class msg_#xxxxxx#_class defines how a
  * #xxxxxxx_xxxxxxx# is parsed and printed.  It also
  * contains methods used by message parser and other functions
  * to manipulate the msg_#xxxxxx#_t header structure.
@@ -162,28 +162,28 @@ msg_print_f msg_#xxxxxx#_e;
 extern msg_hclass_t msg_#xxxxxx#_class[];
 
 /**Initializer for structure msg_#xxxxxx#_t.
- * 
+ *
  * A static msg_#xxxxxx#_t structure must be initialized
  * with the MSG_#XXXXXX#_INIT() macro. For instance,
- * @code 
- * 
+ * @code
+ *
  *  msg_#xxxxxx#_t msg_#xxxxxx# = MSG_#XXXXXX#_INIT;
- * 
+ *
  * @endcode
  * @HI
  */
 #define MSG_#XXXXXX#_INIT() MSG_HDR_INIT(#xxxxxx#)
 
 /**Initialize a structure msg_#xxxxxx#_t.
- * 
+ *
  * An msg_#xxxxxx#_t structure can be initialized with the
  * msg_#xxxxxx#_init() function/macro. For instance,
  * @code
- * 
+ *
  *  msg_#xxxxxx#_t msg_#xxxxxx#;
- * 
+ *
  *  msg_#xxxxxx#_init(&msg_#xxxxxx#);
- * 
+ *
  * @endcode
  * @HI
  */
@@ -198,13 +198,13 @@ su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_init(msg_#xxxxxx#_t x[1])
 #endif
 
 /**Test if header object is instance of msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_is_#xxxxxx#() returns true (nonzero) if
  * the header class is an instance of #xxxxxxx_xxxxxxx#
  * object and false (zero) otherwise.
- * 
+ *
  * @param header pointer to the header structure to be tested
- * 
+ *
  * @return
  * The function msg_is_x#xxxxxx#() returns true (nonzero) if
  * the header object is an instance of header #xxxxxx# and
@@ -222,27 +222,27 @@ int msg_is_#xxxxxx#(msg_header_t const *header);
 #define msg_#xxxxxx#_p(h) msg_is_#xxxxxx#((h))
 
 /**Duplicate (deep copy) @c msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_#xxxxxx#_dup() duplicates a header
  * structure @a hdr.  If the header structure @a hdr
  * contains a reference (@c hdr->x_next) to a list of
  * headers, all the headers in the list are duplicated, too.
- * 
+ *
  * @param home  memory home used to allocate new structure
  * @param hdr   header structure to be duplicated
- * 
+ *
  * When duplicating, all parameter lists and non-constant
  * strings attached to the header are copied, too.  The
  * function uses given memory @a home to allocate all the
  * memory areas used to copy the header.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = msg_#xxxxxx#_dup(home, tst->msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_dup() returns a pointer to the
  * newly duplicated msg_#xxxxxx#_t header structure, or NULL
@@ -251,49 +251,49 @@ int msg_is_#xxxxxx#(msg_header_t const *header);
 msg_#xxxxxx#_t *msg_#xxxxxx#_dup(su_home_t *home, msg_#xxxxxx#_t const *hdr);
 
 /**Copy a msg_#xxxxxx#_t header structure.
- * 
+ *
  * The function msg_#xxxxxx#_copy() copies a header structure @a
  * hdr.  If the header structure @a hdr contains a reference (@c
  * hdr->h_next) to a list of headers, all the headers in that
  * list are copied, too. The function uses given memory @a home
  * to allocate all the memory areas used to copy the header
  * structure @a hdr.
- * 
+ *
  * @param home    memory home used to allocate new structure
  * @param hdr     pointer to the header structure to be duplicated
- * 
+ *
  * When copying, only the header structure and parameter lists
  * attached to it are duplicated.  The new header structure
  * retains all the references to the strings within the old @a
  * header, including the encoding of the old header, if present.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = msg_#xxxxxx#_copy(home, tst->msg_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_copy() returns a pointer to
  * newly copied header structure, or NULL upon an error.
  */
-msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home, 
+msg_#xxxxxx#_t *msg_#xxxxxx#_copy(su_home_t *home,
                                  msg_#xxxxxx#_t const *hdr);
 
 /**Make a header structure msg_#xxxxxx#_t.
- * 
+ *
  * The function msg_#xxxxxx#_make() makes a new
  * msg_#xxxxxx#_t header structure.  It allocates a new
  * header structure, and decodes the string @a s as the
  * value of the structure.
- * 
+ *
  * @param home memory home used to allocate 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
  * msg_header_make().
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_make() returns a pointer to
  * newly maked msg_#xxxxxx#_t header structure, or NULL upon
@@ -309,25 +309,25 @@ msg_#xxxxxx#_t *msg_#xxxxxx#_make(su_home_t *home, char const *s);
 #endif
 
 /**Make a #xxxxxxx_xxxxxxx# from formatting result.
- * 
+ *
  * The function msg_#xxxxxx#_format() makes a new
  * #xxxxxxx_xxxxxxx# object using formatting result as its
  * value.  The function first prints the arguments according to
  * the format @a fmt specified.  Then it allocates a new header
  * structure, and uses the formatting result as the header
  * value.
- * 
+ *
  * @param home   memory home used to allocate new header structure.
  * @param fmt    string used as a printf()-style format
  * @param ...    argument list for format
- * 
+ *
  * @note This function is usually implemented as a macro calling
  * msg_header_format().
- * 
+ *
  * @return
  * The function msg_#xxxxxx#_format() returns a pointer to newly
  * makes header structure, or NULL upon an error.
- * 
+ *
  * @HIDE
  */
 #if SU_HAVE_INLINE
@@ -341,11 +341,11 @@ su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt,
 {
   msg_header_t *h;
   va_list ap;
-  
+
   va_start(ap, fmt);
   h = msg_header_vformat(home, msg_#xxxxxx#_class, fmt, ap);
   va_end(ap);
+
   return (msg_#xxxxxx#_t *)h;
 }
 #endif
index d9453ee0c041df2b776b15d3fd72f5e13443a93c..68ac0c22a7a24b7934f8e8647771ea1fabbea41e 100644 (file)
@@ -31,8 +31,8 @@
  */
 
 /**@ingroup test_msg
- * 
- * @CFILE test_table.c 
+ *
+ * @CFILE test_table.c
  * @brief Parser table used for testing.
  *
  * #AUTO#
index 484147fbc2c40a6d2665c9246a97267984377643..04f526e6a07d2c645b9302ff9e207ab50ba0f7de 100644 (file)
@@ -1,7 +1,7 @@
 PROJECT_NAME         = "nea"
 OUTPUT_DIRECTORY     = ../docs/html/nea
 
-INPUT               = @srcdir@/nea.docs @srcdir@/sofia-sip @srcdir@ . 
+INPUT               = @srcdir@/nea.docs @srcdir@/sofia-sip @srcdir@ .
 
 @INCLUDE_PATH = . @srcdir@
 @INCLUDE = ../docs/Doxyfile.conf
index 43b4cce91896286c2bcabaa7d410b71780e9b37c..c538214ed4e0ef60300cf9592b8aad90c988f70b 100644 (file)
@@ -22,7 +22,7 @@ INCLUDES =    -I$(srcdir)/../ipt -I../ipt \
 
 noinst_LTLIBRARIES =   libnea.la
 
-TESTS = 
+TESTS =
 
 # ----------------------------------------------------------------------
 # Rules for building the targets
@@ -49,7 +49,7 @@ LDADD =               libnea.la \
                        ../msg/libmsg.la \
                        ../url/liburl.la \
                        ../bnf/libbnf.la \
-                       ../su/libsu.la 
+                       ../su/libsu.la
 
 # ----------------------------------------------------------------------
 # Install and distribution rules
index 778c87618eca29469614d55620b8475b65195949..3e1cfb863ef45129e06293c406da3c95cd8fd7f4 100644 (file)
@@ -66,7 +66,7 @@ struct nea_s {
   sip_to_t         *nea_to;            /**< The other end of subscription :) */
   nea_notify_f      nea_callback;      /**< Notify callback  */
   nea_magic_t      *nea_context;       /**< Application context */
-   
+
   sip_contact_t    *nea_contact;       /**< */
   sip_expires_t    *nea_expires;       /**< Proposed expiration time */
 
@@ -84,12 +84,12 @@ int details = 0;
 
 static int process_nea_request(nea_t *nea,
                               nta_leg_t *leg,
-                              nta_incoming_t *ireq, 
+                              nta_incoming_t *ireq,
                               sip_t const *sip);
 
-static int handle_notify(nta_leg_magic_t *lmagic, 
+static int handle_notify(nta_leg_magic_t *lmagic,
                         nta_leg_t *leg,
-                        nta_incoming_t *ireq, 
+                        nta_incoming_t *ireq,
                         sip_t const *sip);
 
 static int response_to_subscribe(nea_t *nea,
@@ -126,13 +126,13 @@ nea_t *nea_create(nta_agent_t *agent,
 
   ta_start(ta, tag, value);
 
-  have_to = 
+  have_to =
     tl_find(ta_args(ta), siptag_to) || tl_find(ta_args(ta), siptag_to_str);
-  have_from = 
+  have_from =
     tl_find(ta_args(ta), siptag_from) || tl_find(ta_args(ta), siptag_from_str);
   have_contact =
-    tl_find(ta_args(ta), siptag_contact) || 
-    tl_find(ta_args(ta), siptag_contact_str);    
+    tl_find(ta_args(ta), siptag_contact) ||
+    tl_find(ta_args(ta), siptag_contact_str);
 
   if (have_to && (nea = su_home_new(sizeof(nea_t)))) {
     su_home_t      *home = nea->nea_home;
@@ -145,7 +145,7 @@ nea_t *nea_create(nta_agent_t *agent,
     nea->nea_callback = no_callback;
     nea->nea_context = context;
 
-    if (!have_from) 
+    if (!have_from)
       from = sip_from_create(home, (url_string_t*)m->m_url);
     else
       from = NULL;
@@ -155,7 +155,7 @@ nea_t *nea_create(nta_agent_t *agent,
                             ta_tags(ta));
 
     /* Get and remove Expires header from tag list */
-    tl_gets(nea->nea_args, 
+    tl_gets(nea->nea_args,
            SIPTAG_EXPIRES_REF(expires),
            SIPTAG_EXPIRES_STR_REF(expires_str),
            SIPTAG_TO_REF(to),
@@ -175,8 +175,8 @@ nea_t *nea_create(nta_agent_t *agent,
     else
       nea->nea_expires = sip_expires_create(home, EXPIRES_DEFAULT);
 
-    tl_tremove(nea->nea_args, 
-              SIPTAG_EXPIRES(0), 
+    tl_tremove(nea->nea_args,
+              SIPTAG_EXPIRES(0),
               SIPTAG_EXPIRES_STR(0),
               TAG_END());
 
@@ -189,7 +189,7 @@ nea_t *nea_create(nta_agent_t *agent,
 
     if (nea->nea_timer) {
       /* Create leg for NOTIFY requests */
-      nea->nea_leg = nta_leg_tcreate(nea->nea_agent, 
+      nea->nea_leg = nta_leg_tcreate(nea->nea_agent,
                                     process_nea_request, nea,
                                     TAG_IF(!have_from, SIPTAG_FROM(from)),
                                     TAG_NEXT(nea->nea_args));
@@ -208,7 +208,7 @@ nea_t *nea_create(nta_agent_t *agent,
 
     if (!nea->nea_leg ||
        !nea->nea_oreq ||
-       !nea->nea_timer) 
+       !nea->nea_timer)
       nea_destroy(nea), nea = NULL;
   }
 
@@ -217,7 +217,7 @@ nea_t *nea_create(nta_agent_t *agent,
 }
 
 
-int nea_update(nea_t *nea, 
+int nea_update(nea_t *nea,
               tag_type_t tag,
               tag_value_t value,
               ...)
@@ -234,22 +234,22 @@ int nea_update(nea_t *nea,
   /* XXX - hack, previous request still waiting for response */
   if (!nea->nea_leg || nea->nea_oreq)
     return -1;
-    
+
   ta_start(ta, tag, value);
-  
+
   tl_gets(ta_args(ta),
          SIPTAG_CONTENT_TYPE_REF(ct),
          SIPTAG_CONTENT_TYPE_STR_REF(cts),
          SIPTAG_PAYLOAD_REF(pl),
          SIPTAG_EXPIRES_REF(expires),
          TAG_NULL());
-  
+
   if (!pl || (!ct && !cts)) {
     ta_end(ta);
     return -1;
   }
 
-  tl_tremove(nea->nea_args, 
+  tl_tremove(nea->nea_args,
             SIPTAG_CONTENT_TYPE(0),
             SIPTAG_CONTENT_TYPE_STR(0),
             SIPTAG_PAYLOAD(0),
@@ -268,17 +268,17 @@ int nea_update(nea_t *nea,
                                       response_to_subscribe, nea,
                                       NULL,
                                       SIP_METHOD_SUBSCRIBE,
-                                      NULL, 
+                                      NULL,
                                       SIPTAG_TO(nea->nea_to),
                                       SIPTAG_PAYLOAD(pl),
-                                      TAG_IF(ct, SIPTAG_CONTENT_TYPE(ct)), 
+                                      TAG_IF(ct, SIPTAG_CONTENT_TYPE(ct)),
                                       TAG_IF(cts, SIPTAG_CONTENT_TYPE_STR(cts)),
                                       SIPTAG_EXPIRES(nea->nea_expires),
                                       TAG_NEXT(nea->nea_args));
 
   ta_end(ta);
 
-  if (!nea->nea_oreq) 
+  if (!nea->nea_oreq)
     return -1;
 
   return 0;
@@ -329,16 +329,16 @@ void nea_destroy(nea_t *nea)
 
 
 /* Function called by NTA to handle incoming requests belonging to the leg */
-int process_nea_request(nea_t *nea, 
+int process_nea_request(nea_t *nea,
                        nta_leg_t *leg,
-                       nta_incoming_t *ireq, 
+                       nta_incoming_t *ireq,
                        sip_t const *sip)
 {
 
   switch (sip->sip_request->rq_method) {
   case sip_method_notify:
     return handle_notify(nea, leg, ireq, sip);
-  case sip_method_ack:  
+  case sip_method_ack:
     return 400;
   default:
     nta_incoming_treply(ireq, SIP_405_METHOD_NOT_ALLOWED,
@@ -370,12 +370,12 @@ int response_to_subscribe(nea_t *nea,
     sip_time_t now = sip_now();
     if (!nea->nea_notify_received) {
       nea->nea_deadline = now +
-       sip_contact_expires(NULL, sip->sip_expires, sip->sip_date, 
+       sip_contact_expires(NULL, sip->sip_expires, sip->sip_date,
                            EXPIRES_DEFAULT, now);
       if (sip->sip_to->a_tag && !nea->nea_dialog) {
        nea->nea_dialog = 1;
        nta_leg_rtag(nea->nea_leg, sip->sip_to->a_tag);
-       nta_leg_client_route(nea->nea_leg, 
+       nta_leg_client_route(nea->nea_leg,
                             sip->sip_record_route, sip->sip_contact);
       }
     }
@@ -432,14 +432,14 @@ int response_to_subscribe(nea_t *nea,
   if (nea->nea_oreq || !error) {
     su_time_t now = su_now();
     now.tv_sec = nea->nea_deadline;
-    su_timer_set_at(nea->nea_timer, 
-                   nea_expires_renew, 
+    su_timer_set_at(nea->nea_timer,
+                   nea_expires_renew,
                    nea,
                    now);
   }
   else
     nea->nea_callback(nea, nea->nea_context, NULL);
-    
+
   return 0;
 }
 
@@ -454,16 +454,16 @@ int response_to_unsubscribe(nea_t *nea,
 
   if (status >= 200)
     nta_outgoing_destroy(orq), nea->nea_oreq = NULL;
-  if (status >= 300) 
+  if (status >= 300)
     nea->nea_callback(nea, nea->nea_context, NULL);
 
   return 0;
 }
 
 /** handle notifications */
-int handle_notify(nea_t *nea, 
+int handle_notify(nea_t *nea,
                  nta_leg_t *leg,
-                 nta_incoming_t *irq, 
+                 nta_incoming_t *irq,
                  sip_t const *sip)
 {
   sip_subscription_state_t *ss = sip->sip_subscription_state;
@@ -475,9 +475,9 @@ int handle_notify(nea_t *nea,
 
     if (ss == NULL)
       phrase = "NOTIFY Has No Subscription-State Header";
-    else if (sip->sip_event == NULL) 
+    else if (sip->sip_event == NULL)
       phrase = "Event Header Missing";
-      
+
     if (phrase) {
       nta_incoming_treply(irq, 400, phrase, TAG_END());
       nta_incoming_destroy(irq);
@@ -511,7 +511,7 @@ int handle_notify(nea_t *nea,
   if (!nea->nea_dialog) {
     nea->nea_dialog = 1;
     nta_leg_rtag(nea->nea_leg, sip->sip_from->a_tag);
-    nta_leg_server_route(nea->nea_leg, 
+    nta_leg_server_route(nea->nea_leg,
                         sip->sip_record_route, sip->sip_contact);
   }
 
@@ -541,9 +541,9 @@ int handle_notify(nea_t *nea,
       return 200;
     }
   }
-  else if (strcasecmp(ss->ss_substate, "pending") == 0) 
+  else if (strcasecmp(ss->ss_substate, "pending") == 0)
     nea->nea_state = nea_pending;
-  else if (strcasecmp(ss->ss_substate, "active") == 0) 
+  else if (strcasecmp(ss->ss_substate, "active") == 0)
     nea->nea_state = nea_active;
   else
     nea->nea_state = nea_extended;
@@ -557,8 +557,8 @@ int handle_notify(nea_t *nea,
   {
     su_time_t now = su_now();
     now.tv_sec = nea->nea_deadline;
-    su_timer_set_at(nea->nea_timer, 
-                   nea_expires_renew, 
+    su_timer_set_at(nea->nea_timer,
+                   nea_expires_renew,
                    nea,
                    now);
   }
@@ -574,7 +574,7 @@ void nea_expires_renew(su_root_magic_t *magic,
 
   /* re-subscribe if expires soon */
   if (nea->nea_state == nea_terminated ||
-      nea->nea_deadline == 0 || 
+      nea->nea_deadline == 0 ||
       nea->nea_deadline > now + NEA_TIMER_DELTA)
     return;
 
@@ -592,6 +592,6 @@ void nea_expires_renew(su_root_magic_t *magic,
                         NULL,
                         SIPTAG_EXPIRES(nea->nea_expires),
                         TAG_NEXT(nea->nea_args));
-    
+
   return;
 }
index bd49828d754ea3a4ae7edecda4dcb3f0ecf0c20e..04013f5ea2fe4d8905500572b76e457d52559f7a 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- c -*- */
 
 /**@MODULEPAGE "nea" - SIP Events Module
- * 
+ *
  * @section nea_meta Module Meta Information
  *
  * Sofia Event API provides an interface to different events used in SIP
@@ -40,9 +40,9 @@
  * {
  *   presentity_t *pr = su_home_clone(p->p_home, sizeof (*pr));
  *   ...
- *   pr->pr_nes = 
+ *   pr->pr_nes =
  *     nea_server_create(agent, root,
- *                    m->m_url, 
+ *                    m->m_url,
  *                    MAX_SUBSCRIBERS,
  *                    event_callback, pr,
  *                    SIPTAG_CONTACT(m),
@@ -51,7 +51,7 @@
  * ...
  * }
  * @endcode
- * 
+ *
  * @section nea_event_create Creating Events
  *
  * Next, events are created. The function nea_event_create () defines
@@ -65,7 +65,7 @@
  * #define XPIDF_MIME_TYPE "application/xpidf+xml"
  * #define PIDF_MIME_TYPE "application/cpim-pidf+xml"
 
- * ne = nea_event_create(pr->pr_nes, presence_callback, ep, 
+ * ne = nea_event_create(pr->pr_nes, presence_callback, ep,
  *                    PRESENCE_PACKAGE, NULL,
  *                    PIDF_MIME_TYPE,
  *                    PIDF_MIME_TYPE "," XPIDF_MIME_TYPE);
  *
  * After the update, subscribers of the event are notified (with SIP
  * NOTIFY) of the changed payload with nea_server_update ().
- * 
+ *
  * @code
  * nea_server_update(pr->pr_nes, home, event, 1,
  *                SIPTAG_CONTENT_TYPE(ct),
  *                SIPTAG_PAYLOAD(pl),
  *                TAG_END());
+
  * nea_server_notify(pr->pr_nes, event);
  * @endcode
- * 
+ *
  * Obtaining the event's payload and removing it is presented in the
  * example below. The event is defined as a part of the @a package_t
  * structure. Function nea_payloads_get() is used to return a payload
index 38c024a6fe1353f40aa2457c9a44c984d0939903..9128ba1c78d494a3656ecb69c279b8204d0bc25e 100644 (file)
@@ -66,7 +66,7 @@
  *
  * The NEA_DEBUG environment variable is used to determine the debug
  * logging level for @b nea module. The default level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, nea_log, SOFIA_DEBUG
  */
 extern char const NEA_DEBUG[];
@@ -75,8 +75,8 @@ extern char const NEA_DEBUG[];
 #define SU_DEBUG 3
 #endif
 
-/**Debug log for @b nea module. 
- * 
+/**Debug log for @b nea module.
+ *
  * The nea_log is the log object used by @b nea module. The level of
  * #nea_log is set using #NEA_DEBUG environment variable.
  */
index 66268d9e6b324bf185fbad149046400d1937d779..d9e0ad6cde0988d89bf4c8278dffb57e794829a2 100644 (file)
@@ -25,7 +25,7 @@
 /**@internal
  * @file nea_event.c
  * @brief Default MIME type for certain events.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Thu Dec 11 20:28:46 2003 ppessi
index 92de8664ae01ac7d150595823fbae8e4df778465..b726954f809af8d8d20ae085ecf68aae0ea416f3 100644 (file)
@@ -71,7 +71,7 @@ struct nea_server_s {
   su_home_t                 nes_home[1];
   su_root_t                *nes_root;
   su_timer_t               *nes_timer;
-  
+
   nta_agent_t              *nes_agent;
   nta_leg_t                *nes_leg;
 
@@ -106,8 +106,8 @@ struct nea_server_s {
   nea_new_event_f          *nes_callback;
   nea_smagic_t             *nes_context;
 
-  /** Events.  
-   * Each subscriber will be added to one of these. */ 
+  /** Events.
+   * Each subscriber will be added to one of these. */
   nea_event_t              *nes_events;
 };
 
@@ -178,11 +178,11 @@ struct nea_event_view_s
 struct nea_sub_s {
   nea_sub_t        *s_next;
   nea_sub_t       **s_prev;
-  
+
   nta_leg_t        *s_leg;
   nta_incoming_t   *s_irq;
   nta_outgoing_t   *s_oreq;
-  
+
   nea_server_t     *s_nes;
 
   sip_contact_t    *s_local;   /**< Local contact */
@@ -204,7 +204,7 @@ struct nea_sub_s {
   unsigned          s_reported :1 ; /**< Made watcher report upon un-SUBSCRIBE */
 
   unsigned          s_processing : 1;
-  unsigned          s_rejected : 1; 
+  unsigned          s_rejected : 1;
   unsigned          s_pending_flush : 1;
   unsigned          s_garbage : 1;
   unsigned          s_fake : 1; /**< Do not send real information to user */
@@ -242,7 +242,7 @@ static void nea_sub_destroy(nea_sub_t *s);
 static
 int nea_server_callback(nea_sub_t *nes_as_sub,
                        nta_leg_t *leg,
-                       nta_incoming_t *irq, 
+                       nta_incoming_t *irq,
                        sip_t const *sip);
 
 static int nea_sub_process_incoming(nea_sub_t *s,
@@ -255,9 +255,9 @@ static int nea_sub_process_subscribe(nea_sub_t *s,
                                     nta_incoming_t *irq,
                                     sip_t const *sip);
 
-static int nea_sub_notify(nea_server_t *nes, 
-                         nea_sub_t *s, 
-                         sip_time_t now, 
+static int nea_sub_notify(nea_server_t *nes,
+                         nea_sub_t *s,
+                         sip_time_t now,
                          tag_type_t tag, tag_value_t value, ...);
 
 static int response_to_notify(nea_sub_t *s,
@@ -268,8 +268,8 @@ static void nes_event_timer(nea_server_t *nes,
                            su_timer_t *timer,
                            su_timer_arg_t *arg);
 
-static int nea_view_queue(nea_server_t *nes, 
-                         nea_event_view_t *evv, 
+static int nea_view_queue(nea_server_t *nes,
+                         nea_event_view_t *evv,
                          nea_event_queue_t *evq);
 
 /** Assign an event view to subscriber. */
@@ -283,7 +283,7 @@ void nea_sub_assign_view(nea_sub_t *s, nea_event_view_t *evv)
   s->s_throttle = evv->evv_throttle;
 }
 
-su_inline 
+su_inline
 void nea_subnode_init(nea_subnode_t *sn, nea_sub_t *s, sip_time_t now)
 {
   sn->sn_state = s->s_state;
@@ -312,18 +312,18 @@ void nea_subnode_init(nea_subnode_t *sn, nea_sub_t *s, sip_time_t now)
  * The function nea_server_create() initializes an event server object and
  * registers it with @b nta. An event server object takes care of all events
  * for a particular URI (@em eventity).
- * 
+ *
  * @param agent       pointer to an @b nta agent object
  * @param root        pointer to an @b root object
  * @param url         url of the server to be created
  * @param max_subs    maximum number of subscriptions
- * @param callback    authorization function, 
+ * @param callback    authorization function,
  *                    or @c NULL if no authorization is required
  * @param context     server context (pointer to application data)
  * @param tag, value, ... optional list of tag parameters
  *
  * @TAGS
- * The function nea_server_create() takes the following tag values as its 
+ * The function nea_server_create() takes the following tag values as its
  * arguments:
  * <dl>
  *
@@ -339,26 +339,26 @@ void nea_subnode_init(nea_subnode_t *sn, nea_sub_t *s, sip_time_t now)
  *
  * <dt>NEATAG_MINSUB()
  * <dd>Minimum duration of a subscription.
- * 
+ *
  * <dt>NEATAG_THROTTLE()
  * <dd>Default value for event throttle (by default, 5 seconds).
  * Throttle determines the minimum interval betweeen notifications. Note
  * that the notification indicating that the subscription has terminated
  * will be sent regardless of throttle.
- * 
+ *
  * The default throttle value is used if the subscriber does not include
  * a throttle parameter in @ref sip_event "Event" header of SUBSCRIBE request.
- * 
+ *
  * <dt>NEATAG_MINTHROTTLE()
  * <dd>Minimum allowed throttle value (by default, 5 seconds).
- * 
+ *
  * <dt>NEATAG_EVENTLIST()
  * <dd>If true, the subscribers must support eventlists. If SIPTAG_REQUIRE()
  * is given, it must contain the "eventlist" feature.
  *
  * <dt>NEATAG_DIALOG()
  * <dd>Give an optional NTA destination leg to event server.
- * 
+ *
  * <dt>SIPTAG_REQUIRE()/SIPTAG_REQUIRE_STR()
  * <dd>The @b Require header for the event server. The subscribers must
  * indicate support the specified features.
@@ -384,8 +384,8 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
   char const *contact_str = NULL;
   char const *server_str = NULL;
   char const *rq_str = NULL;
-  unsigned 
-    min_expires = 15 * 60, 
+  unsigned
+    min_expires = 15 * 60,
     expires = NEA_DEFAULT_EXPIRES,
     max_expires = 24 * 60 * 60;
   nta_leg_t *leg = NONE;
@@ -397,7 +397,7 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
 
     ta_start(ta, tag, value);
 
-    tl_gets(ta_args(ta), 
+    tl_gets(ta_args(ta),
            SIPTAG_CONTACT_REF(contact),
            SIPTAG_CONTACT_STR_REF(contact_str),
            SIPTAG_ALLOW_EVENTS_REF(allow_events),
@@ -428,7 +428,7 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
     SU_DEBUG_5(("nea_server_create(): invalid expiration range\n"));
     return NULL;
   }
-  
+
   nes = su_home_new(sizeof(nea_server_t));
 
   if (nes) {
@@ -453,10 +453,10 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
 
     nes->nes_allow_methods = sip_allow_make(home, "SUBSCRIBE");
 
-    nes->nes_server = 
-      su_sprintf(home, "%s%snea/" NEA_VERSION_STR " %s", 
+    nes->nes_server =
+      su_sprintf(home, "%s%snea/" NEA_VERSION_STR " %s",
                 server_str ? server_str : "",
-                server_str ? " " : "", 
+                server_str ? " " : "",
                 nta_agent_version(agent));
 
     if (contact)
@@ -471,15 +471,15 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
       if (leg != NULL)
        nta_leg_bind(leg, nea_server_callback, (nea_sub_t*)nes);
     } else {
-      nes->nes_leg = nta_leg_tcreate(agent, 
-                                    nea_server_callback, 
-                                    (nea_sub_t*)nes, 
+      nes->nes_leg = nta_leg_tcreate(agent,
+                                    nea_server_callback,
+                                    (nea_sub_t*)nes,
                                     NTATAG_NO_DIALOG(1),
                                     NTATAG_METHOD("SUBSCRIBE"),
                                     URLTAG_URL(url),
                                     TAG_END());
     }
-                                    
+
     nes->nes_eventlist = eventlist; /* Every event is a list */
     if (eventlist && rq == NULL && rq_str == NULL)
       rq_str = "eventlist";
@@ -489,9 +489,9 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
     else if (rq_str)
       nes->nes_require = sip_require_make(nes->nes_home, rq_str);
 
-    nes->nes_timer = su_timer_create(su_root_task(nes->nes_root), 
+    nes->nes_timer = su_timer_create(su_root_task(nes->nes_root),
                                     nes->nes_min_throttle
-                                    ? 500L * nes->nes_min_throttle 
+                                    ? 500L * nes->nes_min_throttle
                                     : 500L);
 
     if (nes->nes_allow_events &&
@@ -515,8 +515,8 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
 
 /** Invoke the new event callback.
  *
- * The function nes_event_callback() calls the callback provided by the 
- * application using the notifier object. 
+ * The function nes_event_callback() calls the callback provided by the
+ * application using the notifier object.
  *
  * @param nes pointer to notifier object
  * @param ev  pointer to event view
@@ -528,9 +528,9 @@ nea_server_t *nea_server_create(nta_agent_t *agent,
  * has been destroyed by the callback function, 0 otherwise.
  */
 static
-int nes_new_event_callback(nea_server_t *nes, 
-                          nea_event_t **ev_p, 
-                          nea_event_view_t **view_p, 
+int nes_new_event_callback(nea_server_t *nes,
+                          nea_event_t **ev_p,
+                          nea_event_view_t **view_p,
                           nta_incoming_t *irq,
                           sip_t const *sip)
 {
@@ -556,7 +556,7 @@ int nea_server_shutdown(nea_server_t *nes,
     SU_DEBUG_5(("nea_server_shutdown(%p) while in callback\n", (void *)nes));
     return 100;
   }
-  
+
   SU_DEBUG_5(("nea_server_shutdown(%p)\n", (void *)nes));
 
   in_callback = nes->nes_in_callback; nes->nes_in_callback = 1;
@@ -567,16 +567,16 @@ int nea_server_shutdown(nea_server_t *nes,
     if (s->s_pending_flush)
       continue;
     if (s->s_oreq == NULL)
-      nea_sub_auth(s, nea_terminated, 
+      nea_sub_auth(s, nea_terminated,
                   TAG_IF(retry_after, NEATAG_REASON("probation")),
                   TAG_IF(!retry_after, NEATAG_REASON("deactivated")),
                   TAG_IF(retry_after, NEATAG_RETRY_AFTER(retry_after)),
                   TAG_END());
     else
       status = 180;
-  }    
+  }
 
-  nes->nes_in_callback = in_callback;   
+  nes->nes_in_callback = in_callback;
 
   return 200;
 }
@@ -591,16 +591,16 @@ void nea_server_destroy(nea_server_t *nes)
     nes->nes_pending_destroy = 1;
     return;
   }
-  
+
   SU_DEBUG_5(("nea_server_destroy(%p)\n", (void *)nes));
-  
+
   nta_leg_destroy(nes->nes_leg), nes->nes_leg = NULL;
-  
+
   while (nes->nes_subscribers)
     nea_sub_destroy(nes->nes_subscribers);
-  
+
   su_timer_destroy(nes->nes_timer), nes->nes_timer = NULL;
-  
+
   su_home_unref(nes->nes_home);
 }
 
@@ -611,10 +611,10 @@ void nea_server_destroy(nea_server_t *nes)
  * A nea event server has typed content that is delivered to the
  * subscribers. Different content types are each assigned a separate primary
  * view. There can be also primary views with "fake" content, content
- * delivered to politely blocked subscribers. 
+ * delivered to politely blocked subscribers.
  *
  * In addition to primary views, there can be secondary views, views
- * assigned to a single subscriber only. 
+ * assigned to a single subscriber only.
  *
  * @TAGS
  * The following tagged arguments are accepted:
@@ -629,7 +629,7 @@ void nea_server_destroy(nea_server_t *nes)
  * <dt>NEATAG_FAKE(fak)
  * <dd>If @a fake is true, 'fake' view is updated.
  *
- * <dt>NEATAG_VIEW(view) 
+ * <dt>NEATAG_VIEW(view)
  * <dd>If included in tagged arguments, @a view is * updated. Used when
  * updating secondary view.
  *
@@ -642,8 +642,8 @@ void nea_server_destroy(nea_server_t *nes)
  * <dd>Application-provided @a context pointer.
  * The @a context pointer is returned by nea_view_magic() function.
  *
- * <dt>NEATAG_RELIABLE(reliable) 
- * <dd>The @a reliable flag determines how overlapping updates are handled. 
+ * <dt>NEATAG_RELIABLE(reliable)
+ * <dd>The @a reliable flag determines how overlapping updates are handled.
  * If @a reliable is true, all updates are delivered to the subscribers.
  *
  * <dt>NEATAG_THROTTLE(throttl)
@@ -651,10 +651,10 @@ void nea_server_destroy(nea_server_t *nes)
  * determines the minimum interval in seconds betweeen notifications. Note
  * that the notification indicating that the subscription has terminated
  * will be sent regardless of throttle.
- * 
+ *
  * The default throttle value is used if the subscriber does not include
  * a throttle parameter in @ref sip_event "Event" header of SUBSCRIBE request.
- * 
+ *
  * <dt>NEATAG_MINTHROTTLE()
  * <dd>Minimum allowed throttle value for updated event view.
  *
@@ -684,7 +684,7 @@ int nea_server_update(nea_server_t *nes,
          NEATAG_FAKE_REF(fake),
          NEATAG_VIEW_REF(evv),
          TAG_NULL());
-  
+
   updated = nea_view_update(nes, ev, &evv, 0, fake, ta_tags(ta));
 
   ta_end(ta);
@@ -733,7 +733,7 @@ int nea_view_update(nea_server_t *nes,
          NEATAG_THROTTLE_REF(throttle),
          NEATAG_MINTHROTTLE_REF(min_throttle),
          TAG_NULL());
-  
+
   ta_end(ta);
 
   if (min_throttle < throttle)
@@ -754,7 +754,7 @@ int nea_view_update(nea_server_t *nes,
     for (i = 0; (evv = ev->ev_views[i]); i++)
       if (str0casecmp(cts, evv->evv_content_type->c_type) == 0)
        break;
-    
+
     if (private && evv == NULL) /* No private view without primary view. */
       return -1;
 
@@ -762,7 +762,7 @@ int nea_view_update(nea_server_t *nes,
       return -1;
 
     primary_p = eevv = ev->ev_views + i;
-    
+
     /* Search for fakeness/eventlist/private view */
     if (evv && (private || evv->evv_private || evv->evv_fake != (unsigned)fake)) {
       for (eevv = &evv->evv_next; (evv = *eevv); eevv = &evv->evv_next) {
@@ -773,7 +773,7 @@ int nea_view_update(nea_server_t *nes,
       }
     }
   }
-   
+
   /* New event view, allocate and link to chain */
   if (!evv) {
     sip_content_type_t *new_ct;
@@ -781,20 +781,20 @@ int nea_view_update(nea_server_t *nes,
     evv = su_zalloc(home, sizeof (*evv));
     if (!evv)
       return -1;
-    
+
     new_pl = pl ? sip_payload_dup(home, pl)
       : sip_payload_make(home, pls);
-    
-    new_ct = ct ? sip_content_type_dup(home, ct) 
+
+    new_ct = ct ? sip_content_type_dup(home, ct)
       : sip_content_type_make(home, cts);
-    
+
     if ((!new_pl && pl) || !new_ct) {
       su_free(home, evv); su_free(home, new_pl);
       return -1;
     }
 
     *evvp = *eevv = evv;
-      
+
     evv->evv_primary = *primary_p;
     evv->evv_private = private != 0;
     evv->evv_fake = fake != 0;
@@ -808,13 +808,13 @@ int nea_view_update(nea_server_t *nes,
     assert(evv->evv_content_type);
   }
   else {
-    if (pl && 
-       evv->evv_payload && 
+    if (pl &&
+       evv->evv_payload &&
        evv->evv_payload->pl_len == pl->pl_len &&
        memcmp(evv->evv_payload->pl_data, pl->pl_data, pl->pl_len) == 0)
       return 0;
-    if (!pl && pls && evv->evv_payload && 
-       evv->evv_payload->pl_len == strlen(pls) && 
+    if (!pl && pls && evv->evv_payload &&
+       evv->evv_payload->pl_len == strlen(pls) &&
        memcmp(evv->evv_payload->pl_data, pls, evv->evv_payload->pl_len) == 0)
       return 0;
     if (!pl && !pls && !evv->evv_payload)
@@ -826,7 +826,7 @@ int nea_view_update(nea_server_t *nes,
 
     if (!new_pl && (pl || pls))
       return -1;
-    
+
     evv->evv_payload = new_pl;
   }
 
@@ -861,7 +861,7 @@ nea_event_view_t *nea_view_create(nea_server_t *nes,
   ta_start(ta, tag, value);
 
   nea_view_update(nes, ev, &evv, 1, 0, ta_tags(ta));
-                        
+
   ta_end(ta);
 
   return evv;
@@ -935,8 +935,8 @@ sip_content_type_t const *nea_view_content_type(nea_event_view_t const *evv)
 
 /** Queue an old notification if needed. */
 static
-int nea_view_queue(nea_server_t *nes, 
-                  nea_event_view_t *evv, 
+int nea_view_queue(nea_server_t *nes,
+                  nea_event_view_t *evv,
                   nea_event_queue_t *evq)
 {
   nea_sub_t *s = NULL;
@@ -953,7 +953,7 @@ int nea_view_queue(nea_server_t *nes,
        continue;
       break;                   /* This  */
     }
-  
+
   if (s) {
     nea_event_queue_t *evq0 = su_alloc(nes->nes_home, sizeof *evq);
 
@@ -963,7 +963,7 @@ int nea_view_queue(nea_server_t *nes,
     *evq0 = *evq, evq = evq0;
 
     /* evq should be copy of old head but with changed payload  */
-    assert(evq->evq_next == evv->evv_head->evq_next); 
+    assert(evq->evq_next == evv->evv_head->evq_next);
 
     evv->evv_head->evq_next = evq;     /* insert to the queue */
 
@@ -977,7 +977,7 @@ int nea_view_queue(nea_server_t *nes,
 
 /** Remove old unneeded notifications. */
 static
-int nea_view_dequeue(nea_server_t *nes, 
+int nea_view_dequeue(nea_server_t *nes,
                     nea_event_t *ev)
 {
   int i;
@@ -1011,7 +1011,7 @@ int nea_view_dequeue(nea_server_t *nes,
 
 /** Notify watchers.
  *
- * @return 
+ * @return
  * The function nea_server_notify() returns number of subscribers that the
  * notification could be sent, or -1 upon an error.
  */
@@ -1045,11 +1045,11 @@ int nea_server_notify(nea_server_t *nes, nea_event_t *ev)
     if (ev == NULL)
       for (ev = nes->nes_events; ev; ev = ev->ev_next) {
        nea_view_dequeue(nes, ev);
-       SU_DEBUG_3(("nea_server(): notified %u, throttling at %u\n", 
+       SU_DEBUG_3(("nea_server(): notified %u, throttling at %u\n",
                    notified, ev->ev_throttling));
       }
     else {
-      SU_DEBUG_3(("nea_server(): notified %u, throttling at %u\n", 
+      SU_DEBUG_3(("nea_server(): notified %u, throttling at %u\n",
                  notified, ev->ev_throttling));
       nea_view_dequeue(nes, ev);
     }
@@ -1087,7 +1087,7 @@ void nea_server_flush(nea_server_t *nes, nea_event_t *event)
        nea_sub_destroy(*ss);
        continue;
       }
-    } 
+    }
     ss = &((*ss)->s_next);
   }
 }
@@ -1127,7 +1127,7 @@ nea_sub_t *nea_sub_create(nea_server_t *nes)
     nes->nes_subscribers = s;
 
     /* Copy default values */
-    s->s_throttle = nes->nes_throttle; 
+    s->s_throttle = nes->nes_throttle;
   }
 
   return s;
@@ -1180,9 +1180,9 @@ void nea_sub_destroy(nea_sub_t *s)
     su_free(home, del->s_local), del->s_local = NULL;
     su_free(home, del->s_remote), del->s_remote = NULL;
 
-    if (del->s_oreq) 
+    if (del->s_oreq)
       nta_outgoing_destroy(del->s_oreq), del->s_oreq = NULL;
-    if (del->s_leg) 
+    if (del->s_leg)
       nta_leg_destroy(del->s_leg), del->s_leg = NULL;
     if (del->s_from)
       su_free(home, del->s_from), del->s_from = NULL;
@@ -1198,14 +1198,14 @@ void nea_sub_destroy(nea_sub_t *s)
 nea_event_t *nea_event_create(nea_server_t *nes,
                              nea_watcher_f *callback,
                              nea_emagic_t *context,
-                             char const *name, 
+                             char const *name,
                              char const *subname,
                              char const *default_content_type,
                              char const *accept)
 {
-  return nea_event_tcreate(nes, callback, context, 
-                          name, subname, 
-                          SIPTAG_CONTENT_TYPE_STR(default_content_type), 
+  return nea_event_tcreate(nes, callback, context,
+                          name, subname,
+                          SIPTAG_CONTENT_TYPE_STR(default_content_type),
                           SIPTAG_ACCEPT_STR(accept),
                           TAG_END());
 }
@@ -1214,7 +1214,7 @@ nea_event_t *nea_event_create(nea_server_t *nes,
 nea_event_t *nea_event_tcreate(nea_server_t *nes,
                               nea_watcher_f *callback,
                               nea_emagic_t *context,
-                              char const *name, 
+                              char const *name,
                               char const *subname,
                               tag_type_t tag, tag_value_t value, ...)
 {
@@ -1253,7 +1253,7 @@ nea_event_t *nea_event_tcreate(nea_server_t *nes,
     sip_supported_t const *k = NULL;
     sip_require_t const *rq = NULL;
     char const *ct_str = NULL, *ac_str = NULL, *k_str = NULL, *rq_str = NULL;
-    
+
     unsigned throttle = nes->nes_throttle, min_throttle = nes->nes_min_throttle;
     int eventlist = nes->nes_eventlist;
 
@@ -1274,11 +1274,11 @@ nea_event_t *nea_event_tcreate(nea_server_t *nes,
 
     ev->ev_callback = callback;
     ev->ev_magic = context;
-    ev->ev_event = sip_event_format(nes->nes_home, "%s%s%s", 
-                                   name, 
-                                   subname ? "." : "", 
+    ev->ev_event = sip_event_format(nes->nes_home, "%s%s%s",
+                                   name,
+                                   subname ? "." : "",
                                    subname ? subname : "");
+
     ev->ev_reliable = reliable != 0;
     ev->ev_throttle = throttle;
     ev->ev_min_throttle = min_throttle;
@@ -1294,15 +1294,15 @@ nea_event_t *nea_event_tcreate(nea_server_t *nes,
 
     if (ev->ev_event) {
 #define sip_allow_events_find(k, i) sip_params_find(k->k_items, i)
-      if (!sip_allow_events_find(nes->nes_allow_events, 
+      if (!sip_allow_events_find(nes->nes_allow_events,
                                 ev->ev_event->o_type))
-       sip_allow_events_add(nes->nes_home, nes->nes_allow_events, 
+       sip_allow_events_add(nes->nes_home, nes->nes_allow_events,
                             ev->ev_event->o_type);
     }
 
     if (ct)
       ev->ev_default = sip_accept_make(nes->nes_home, ct->c_type);
-    else 
+    else
       ev->ev_default = sip_accept_make(nes->nes_home, ct_str);
 
     if (ac == NULL && ac_str == NULL)
@@ -1319,7 +1319,7 @@ nea_event_t *nea_event_tcreate(nea_server_t *nes,
       ev->ev_supported = sip_supported_make(nes->nes_home, k_str);
 
     ev->ev_prev = pev;
-    *pev = ev; 
+    *pev = ev;
   }
 
   ta_end(ta);
@@ -1370,8 +1370,8 @@ nta_incoming_t *nea_sub_get_request(nea_sub_t *sub)
 
 /** Invoke the event callback.
  *
- * The function nes_watcher_callback() calls the callback provided by the 
- * application using the notifier object. 
+ * The function nes_watcher_callback() calls the callback provided by the
+ * application using the notifier object.
  *
  * @param nes pointer to notifier object
  * @param ev  pointer to event view
@@ -1383,9 +1383,9 @@ nta_incoming_t *nea_sub_get_request(nea_sub_t *sub)
  * has been destroyed by the callback function, 0 otherwise.
  */
 static
-int nes_watcher_callback(nea_server_t *nes, 
-                        nea_event_t *ev, 
-                        nea_sub_t *s, 
+int nes_watcher_callback(nea_server_t *nes,
+                        nea_event_t *ev,
+                        nea_sub_t *s,
                         sip_t const *sip,
                         sip_time_t now)
 {
@@ -1395,7 +1395,7 @@ int nes_watcher_callback(nea_server_t *nes,
       nea_subnode_t sn[1];
 
       nea_subnode_init(sn, s, now);
-      
+
       if (sn->sn_expires == 0  || sn->sn_state == nea_terminated)
        s->s_reported = 1;
 
@@ -1405,12 +1405,12 @@ int nes_watcher_callback(nea_server_t *nes,
 
     if (nes->nes_in_list)
       return 0;
-    
+
     if (nes->nes_pending_destroy) {
       nea_server_destroy(nes);
       return -2;
     }
-    
+
     if (sip == NULL && nes->nes_pending_flush) {
       int flushed = s->s_pending_flush;
       nea_server_pending_flush(nes);
@@ -1429,18 +1429,18 @@ int nes_watcher_callback(nea_server_t *nes,
  *
  * The function nea_server_add() is called when the notifier receives a
  * SUBSCRIBE request without existing event dialog.
- * 
+ *
  * @param nes pointer to notifier
- * @param local_target optional contact header 
+ * @param local_target optional contact header
  * @param msg pointer to request message
  * @param sip pointer to SIP view to request message
  *
- * @return 
+ * @return
  * The function nea_server_add() returns 0 if successful, -1 upon an
  * error.
- *  
+ *
  */
-int nea_server_add(nea_server_t *nes, 
+int nea_server_add(nea_server_t *nes,
                   sip_contact_t const *local_target,
                   msg_t *msg, sip_t *sip)
 {
@@ -1480,7 +1480,7 @@ int nea_server_add(nea_server_t *nes,
 static
 int nea_server_callback(nea_sub_t *nes_as_sub,
                        nta_leg_t *leg,
-                       nta_incoming_t *irq, 
+                       nta_incoming_t *irq,
                        sip_t const *sip)
 {
   return nea_server_add_irq((nea_server_t *)nes_as_sub, leg, NULL, irq, sip);
@@ -1490,7 +1490,7 @@ int nea_server_callback(nea_sub_t *nes_as_sub,
 int nea_server_add_irq(nea_server_t *nes,
                       nta_leg_t *leg,
                       sip_contact_t const *local_target,
-                      nta_incoming_t *irq, 
+                      nta_incoming_t *irq,
                       sip_t const *sip)
 {
   nea_sub_t *s = nea_sub_create(nes);
@@ -1506,10 +1506,10 @@ int nea_server_add_irq(nea_server_t *nes,
 
   if (leg == NULL || leg == nes->nes_leg) {
     url_t target[1];
-    
+
     *target = *local_target->m_url;
 
-    s->s_leg = nta_leg_tcreate(nes->nes_agent, nea_sub_process_incoming, s, 
+    s->s_leg = nta_leg_tcreate(nes->nes_agent, nea_sub_process_incoming, s,
                               SIPTAG_FROM(sip->sip_to),
                               SIPTAG_TO(sip->sip_from),
                               SIPTAG_CALL_ID(sip->sip_call_id),
@@ -1519,7 +1519,7 @@ int nea_server_add_irq(nea_server_t *nes,
   else {
     nta_leg_bind(s->s_leg = leg, nea_sub_process_incoming, s);
   }
-  
+
   if (s->s_leg) {
     if (sip->sip_to->a_tag == NULL) {
       nta_leg_tag(s->s_leg, NULL);
@@ -1568,7 +1568,7 @@ int nea_sub_process_incoming(nea_sub_t *s,
     break;
 
   default:
-    nta_incoming_treply(irq, 
+    nta_incoming_treply(irq,
                        retval = SIP_405_METHOD_NOT_ALLOWED,
                        SIPTAG_ALLOW_STR("SUBSCRIBE"),
                        TAG_END());
@@ -1579,7 +1579,7 @@ int nea_sub_process_incoming(nea_sub_t *s,
 
   if (s->s_irq)
     nta_incoming_destroy(irq), s->s_irq = NULL;
-  
+
   if (s->s_pending_flush || s->s_state == nea_embryonic)
     nea_sub_destroy(s);
 
@@ -1624,7 +1624,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
   int once, what, supported_eventlist, require_eventlist;
 
   if (sip->sip_payload && !sip->sip_content_type) {
-    nta_incoming_treply(irq, 400, "Missing Content-Type", 
+    nta_incoming_treply(irq, 400, "Missing Content-Type",
                        SIPTAG_SERVER_STR(nes->nes_server),
                        SIPTAG_ALLOW_EVENTS(nes->nes_allow_events),
                        SIPTAG_ALLOW(nes->nes_allow_methods),
@@ -1632,16 +1632,16 @@ int nea_sub_process_subscribe(nea_sub_t *s,
     return 0;
   }
 
-  if (sip->sip_expires && 
-      sip->sip_expires->ex_delta > 0 && 
+  if (sip->sip_expires &&
+      sip->sip_expires->ex_delta > 0 &&
       sip->sip_expires->ex_delta < nes->nes_min_expires) {
-    sip_min_expires_t me[1]; 
+    sip_min_expires_t me[1];
 
     sip_min_expires_init(me);
 
     me->me_delta = nes->nes_min_expires;
 
-    nta_incoming_treply(irq, 423, "Subscription Interval Too Small", 
+    nta_incoming_treply(irq, 423, "Subscription Interval Too Small",
                        SIPTAG_ACCEPT(accept),
                        SIPTAG_MIN_EXPIRES(me),
                        SIPTAG_SERVER_STR(nes->nes_server),
@@ -1653,13 +1653,13 @@ int nea_sub_process_subscribe(nea_sub_t *s,
 
   /* Check features */
   if (nes->nes_require) {
-    unsupported = sip_has_unsupported2(nes->nes_home, 
+    unsupported = sip_has_unsupported2(nes->nes_home,
                                       sip->sip_supported,
                                       sip->sip_require,
                                       nes->nes_require);
 
     if (unsupported) {
-      nta_incoming_treply(irq, SIP_421_EXTENSION_REQUIRED, 
+      nta_incoming_treply(irq, SIP_421_EXTENSION_REQUIRED,
                          SIPTAG_REQUIRE(nes->nes_require),
                          SIPTAG_UNSUPPORTED(unsupported),
                          SIPTAG_SERVER_STR(nes->nes_server),
@@ -1676,12 +1676,12 @@ int nea_sub_process_subscribe(nea_sub_t *s,
   require_eventlist = sip_has_feature(sip->sip_require, "eventlist");
   supported_eventlist = supported_eventlist || require_eventlist;
 
-  if (s->s_id && (!sip->sip_event || 
+  if (s->s_id && (!sip->sip_event ||
                  str0cmp(s->s_id->o_type, sip->sip_event->o_type) != 0 ||
                  str0cmp(s->s_id->o_id, sip->sip_event->o_id))) {
     /* Multiple subscriptions per dialog are not supported. */
-    return nta_incoming_treply(irq, 501, 
-                              "Multiple subscriptions not implemented", 
+    return nta_incoming_treply(irq, 501,
+                              "Multiple subscriptions not implemented",
                               SIPTAG_SERVER_STR(nes->nes_server),
                               TAG_NULL());
   }
@@ -1709,13 +1709,13 @@ int nea_sub_process_subscribe(nea_sub_t *s,
 
     if (!ev && !require_eventlist)
       ev = ev_maybe;
-          
+
     if (ev || once)
       break;
 
     /* Ask the application either to
-       1) add a new event or assing us an event/payload (0), 
-       2) take care of transaction (positive), or 
+       1) add a new event or assing us an event/payload (0),
+       2) take care of transaction (positive), or
        3) drop request (negative).
     */
     if ((what = nes_new_event_callback(nes, &ev, &evv, irq, sip)) < 0)
@@ -1727,7 +1727,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
   }
 
   if (ev_maybe == NULL && ev == NULL) {
-    nta_incoming_treply(irq, SIP_489_BAD_EVENT, 
+    nta_incoming_treply(irq, SIP_489_BAD_EVENT,
                        SIPTAG_SERVER_STR(nes->nes_server),
                        SIPTAG_ALLOW_EVENTS(nes->nes_allow_events),
                        SIPTAG_ALLOW(nes->nes_allow_methods),
@@ -1739,7 +1739,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
     unsupported = sip_has_unsupported(nes->nes_home, ev->ev_supported,
                                      sip->sip_require);
 
-    nta_incoming_treply(irq, SIP_420_BAD_EXTENSION, 
+    nta_incoming_treply(irq, SIP_420_BAD_EXTENSION,
                        SIPTAG_UNSUPPORTED(unsupported),
                        SIPTAG_REQUIRE(ev->ev_require),
                        SIPTAG_SUPPORTED(ev->ev_supported),
@@ -1775,12 +1775,12 @@ int nea_sub_process_subscribe(nea_sub_t *s,
          /* Sort the accept list by Q values */
          for (a = a0, accept = NULL; a; a = a_next) {
            a_next = a->ac_next;
-           
-           for (aa = (sip_accept_t **)&accept; 
-                *aa && sip_q_value((*aa)->ac_q) >= sip_q_value(a->ac_q); 
+
+           for (aa = (sip_accept_t **)&accept;
+                *aa && sip_q_value((*aa)->ac_q) >= sip_q_value(a->ac_q);
                 aa = &(*aa)->ac_next)
              ;
-           
+
            a->ac_next = *aa; *aa = a;  /* Insert */
          }
        }
@@ -1795,11 +1795,11 @@ int nea_sub_process_subscribe(nea_sub_t *s,
 
       if (ac->ac_type == NULL || ac->ac_subtype == NULL)
        continue;
-      
+
       /* Check all supported content types v. accept */
       for (i = 0; (evv = ev->ev_views[i]); i++) {
        assert(evv->evv_content_type && evv->evv_content_type->c_type);
-       
+
        if (strcmp(ac->ac_type, "*/*") == 0)
          break;
 
@@ -1807,7 +1807,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
 
        if ((strcasecmp(ac->ac_type, type) == 0) ||
            (strcasecmp(ac->ac_subtype, "*") == 0 &&
-            strncasecmp(ac->ac_type, type, 
+            strncasecmp(ac->ac_type, type,
                         ac->ac_subtype - ac->ac_type) == 0)) {
          if (evv_maybe == NULL)
            evv_maybe = evv;
@@ -1820,17 +1820,17 @@ int nea_sub_process_subscribe(nea_sub_t *s,
 
     /* Free the sorted Accept list */
     for (a = a0; a; a = a_next)
-      a_next = a->ac_next, su_free(home, a); 
+      a_next = a->ac_next, su_free(home, a);
 
     if (!evv)
       evv = evv_maybe;
-  
+
     if (evv || once)
       break;
 
     /* Ask the application either to
-       1) add a new event view or assign us an event view (0), 
-       2) take care of transaction (positive), or 
+       1) add a new event view or assign us an event view (0),
+       2) take care of transaction (positive), or
        3) drop request (negative).
     */
     if ((what = nes_new_event_callback(nes, &ev, &evv, irq, sip)) < 0)
@@ -1846,7 +1846,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
                ev->ev_event->o_type, SIP_406_NOT_ACCEPTABLE));
 
     /* There is no media acceptable to watcher */
-    return nta_incoming_treply(irq, SIP_406_NOT_ACCEPTABLE, 
+    return nta_incoming_treply(irq, SIP_406_NOT_ACCEPTABLE,
                               SIPTAG_ACCEPT(ev->ev_accept),
                               SIPTAG_SERVER_STR(nes->nes_server),
                               SIPTAG_ALLOW_EVENTS(nes->nes_allow_events),
@@ -1859,7 +1859,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
     evv = s->s_view;
 
   /* Set throttle */
-  if (sip->sip_event && 
+  if (sip->sip_event &&
       (throttle = sip_params_find(sip->sip_event->o_params, "throttle="))) {
     proposed_throttle = strtoul(throttle, NULL, 10);
 
@@ -1902,7 +1902,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
   s->s_updated = evv->evv_updated - 1;  /* Force notify */
 
   if (nes->nes_202_before_notify) {
-    nta_incoming_treply(irq, SIP_202_ACCEPTED, 
+    nta_incoming_treply(irq, SIP_202_ACCEPTED,
                        SIPTAG_SERVER_STR(nes->nes_server),
                        SIPTAG_ALLOW_EVENTS(nes->nes_allow_events),
                        SIPTAG_ALLOW(nes->nes_allow_methods),
@@ -1923,8 +1923,8 @@ int nea_sub_process_subscribe(nea_sub_t *s,
     return -1;
   }
 
-  
-  
+
+
   evv = s->s_view;  /* Callback can change event view */
 
   if (s->s_state == nea_embryonic)
@@ -1935,11 +1935,11 @@ int nea_sub_process_subscribe(nea_sub_t *s,
 
   if (irq) {
     if (s->s_rejected)
-      nta_incoming_treply(irq, SIP_403_FORBIDDEN, 
+      nta_incoming_treply(irq, SIP_403_FORBIDDEN,
                          SIPTAG_SERVER_STR(nes->nes_server),
                          TAG_END());
     else if (s->s_state == nea_active)
-      nta_incoming_treply(irq, SIP_200_OK, 
+      nta_incoming_treply(irq, SIP_200_OK,
                          SIPTAG_REQUIRE(ev->ev_require),
                          SIPTAG_SUPPORTED(ev->ev_supported),
                          SIPTAG_EXPIRES(expires),
@@ -1949,7 +1949,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
                          SIPTAG_ALLOW(nes->nes_allow_methods),
                          TAG_END());
     else
-      nta_incoming_treply(irq, SIP_202_ACCEPTED, 
+      nta_incoming_treply(irq, SIP_202_ACCEPTED,
                          SIPTAG_REQUIRE(ev->ev_require),
                          SIPTAG_SUPPORTED(ev->ev_supported),
                          SIPTAG_EXPIRES(expires),
@@ -1964,7 +1964,7 @@ int nea_sub_process_subscribe(nea_sub_t *s,
 }
 
 /* ----------------------------------------------------------------- */
-/**Notify subscriber 
+/**Notify subscriber
  *
  * The function nea_sub_notify() sends a notification to the subscriber. The
  * event type is specified by subscriber event, payload type and payload in
@@ -1973,12 +1973,12 @@ int nea_sub_process_subscribe(nea_sub_t *s,
  *
  * @param nes pointer to the notifier object
  * @param s   pointer to the subscription object
- * @param now current SIP time (if 0, no body is sent, 
+ * @param now current SIP time (if 0, no body is sent,
  *            but updated Subscription-State header only
  * @param tag,value,... tag list
  *
  */
-int nea_sub_notify(nea_server_t *nes, nea_sub_t *s, 
+int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
                   sip_time_t now,
                   tag_type_t tag, tag_value_t value, ...)
 {
@@ -1999,7 +1999,7 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
 
   assert(s->s_view); assert(ev);
 
-  if (suppress && s->s_view->evv_updated == s->s_updated) 
+  if (suppress && s->s_view->evv_updated == s->s_updated)
     return 0;
 
   if (now == 0)
@@ -2007,7 +2007,7 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
 
   if (s->s_notified + s->s_throttle > now &&
       /* Do not throttle state termination notification */
-      substate != nea_terminated && 
+      substate != nea_terminated &&
       (long)(s->s_expires - now) > 0) {
     if (ev->ev_throttling > s->s_updated && !s->s_fake)
       ev->ev_throttling = s->s_updated;
@@ -2034,7 +2034,7 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
 
     sip_subscription_state_init(ss);
 
-    tl_gets(ta_args(ta), 
+    tl_gets(ta_args(ta),
            NEATAG_REASON_REF(reason),
            NEATAG_FAKE_REF(fake), /* XXX - semantics??? */
            NEATAG_RETRY_AFTER_REF(retry_after),
@@ -2042,10 +2042,10 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
 
     if (substate == nea_terminated) {
       if (reason)
-       snprintf(reason_buf, sizeof(reason_buf), 
+       snprintf(reason_buf, sizeof(reason_buf),
                 "reason=%s", reason), params[i++] = reason_buf;
       if (retry_after != (unsigned)-1)
-       snprintf(retry_after_buf, sizeof(retry_after_buf), 
+       snprintf(retry_after_buf, sizeof(retry_after_buf),
                 "retry-after=%u", retry_after), params[i++] = retry_after_buf;
     }
     else if ((long)(s->s_expires - now) <= 0) {
@@ -2065,10 +2065,10 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
     case nea_pending:  ss->ss_substate = "pending"; break;
     case nea_active:   ss->ss_substate = "active"; break;
     case nea_terminated: ss->ss_substate = "terminated"; break;
-      /* Do not send notifys for embryonic subscriptions */      
+      /* Do not send notifys for embryonic subscriptions */
     case nea_embryonic:
       ta_end(ta);
-      return 0; 
+      return 0;
     }
 
     callback = substate != nea_terminated ? response_to_notify : NULL;
@@ -2082,9 +2082,9 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
 
     n_evq = evq->evq_payload ? evq : evv->evv_primary->evv_head;
 
-    s->s_oreq = 
-      nta_outgoing_tcreate(s->s_leg, 
-                          callback, s, NULL, 
+    s->s_oreq =
+      nta_outgoing_tcreate(s->s_leg,
+                          callback, s, NULL,
                           SIP_METHOD_NOTIFY, NULL,
                           SIPTAG_SUBSCRIPTION_STATE(ss),
                           SIPTAG_REQUIRE(ev->ev_require),
@@ -2092,11 +2092,11 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
                           SIPTAG_USER_AGENT_STR(nes->nes_server),
                           SIPTAG_CONTACT(s->s_local),
                           SIPTAG_EVENT(s->s_id),
-                          TAG_IF(!suppress, 
+                          TAG_IF(!suppress,
                                  SIPTAG_CONTENT_TYPE(n_evq->evq_content_type)),
                           TAG_IF(!suppress,
                                  SIPTAG_PAYLOAD(n_evq->evq_payload)),
-                          ta_tags(ta)); 
+                          ta_tags(ta));
 
 
     notified = s->s_oreq != 0;
@@ -2123,8 +2123,8 @@ int nea_sub_notify(nea_server_t *nes, nea_sub_t *s,
 
 /* ----------------------------------------------------------------- */
 /**Process responses to the NOTIFY.
- * 
- * The response_to_notify() processes the responses to the NOTIFY request. 
+ *
+ * The response_to_notify() processes the responses to the NOTIFY request.
  * If there was an error with delivering the NOTIFY, the subscription is
  * considered terminated.
  *
@@ -2172,7 +2172,7 @@ int response_to_notify(nea_sub_t *s,
  *
  * @param nes notifier
  * @param ev  event
- * 
+ *
  * The function nea_server_active() returns number of active subscribers.
  */
 int nea_server_active(nea_server_t *nes, nea_event_t const *ev)
@@ -2182,7 +2182,7 @@ int nea_server_active(nea_server_t *nes, nea_event_t const *ev)
 
   /* Count the number of subscribers watching this event */
   for (s = nes->nes_subscribers; s ; s = s->s_next)
-    if (!s->s_pending_flush && s->s_state == nea_active 
+    if (!s->s_pending_flush && s->s_state == nea_active
        && (ev == NULL || ev == s->s_event))
       n++;
 
@@ -2198,7 +2198,7 @@ int nea_server_active(nea_server_t *nes, nea_event_t const *ev)
  *
  * @param nes notifier
  * @param ev  event view
- * 
+ *
  * The function nea_server_active() returns number of active subscribers.
  */
 int nea_server_non_embryonic(nea_server_t *nes, nea_event_t const *ev)
@@ -2208,7 +2208,7 @@ int nea_server_non_embryonic(nea_server_t *nes, nea_event_t const *ev)
 
   /* Count the number of subscribers watching this event */
   for (s = nes->nes_subscribers; s ; s = s->s_next)
-    if (!s->s_pending_flush && s->s_state != nea_embryonic 
+    if (!s->s_pending_flush && s->s_state != nea_embryonic
        && (ev == NULL || ev == s->s_event))
       n++;
 
@@ -2248,7 +2248,7 @@ int nea_sub_version(nea_sub_t *s, unsigned version)
  * @retval 0 if successful
  * @retval -1 upon an error
  */
-int nea_sub_auth(nea_sub_t *s, 
+int nea_sub_auth(nea_sub_t *s,
                 nea_state_t state,
                 tag_type_t tag, tag_value_t value, ...)
 {
@@ -2289,9 +2289,9 @@ int nea_sub_auth(nea_sub_t *s,
   }
 
   tl_gets(ta_args(ta), NEATAG_REASON_REF(reason), TAG_END());
-  
+
   rejected = reason && strcasecmp(reason, "rejected") == 0;
-  
+
   if (state == nea_terminated && embryonic && rejected && s->s_irq)
     retval = 0, s->s_rejected = 1;
   else
@@ -2303,7 +2303,7 @@ int nea_sub_auth(nea_sub_t *s,
 }
 
 /** Obtain a list of subscribers */
-nea_subnode_t const **nea_server_get_subscribers(nea_server_t *nes, 
+nea_subnode_t const **nea_server_get_subscribers(nea_server_t *nes,
                                                 nea_event_t const *ev)
 {
   nea_sub_t *s;
@@ -2315,13 +2315,13 @@ nea_subnode_t const **nea_server_get_subscribers(nea_server_t *nes,
   if (n == 0)
     return NULL;
 
-  sn_list = su_zalloc(nes->nes_home, 
+  sn_list = su_zalloc(nes->nes_home,
                      (n + 1) * sizeof(sn) + n * sizeof(*sn));
   if (sn_list) {
     sn = (nea_subnode_t *)(sn_list + n + 1);
 
     for (i = 0, s = nes->nes_subscribers; s; s = s->s_next) {
-      if (!s->s_pending_flush && s->s_state != nea_embryonic 
+      if (!s->s_pending_flush && s->s_state != nea_embryonic
          && (ev == NULL || ev == s->s_event)) {
        assert(i < n);
        nea_subnode_init(sn, s, now);
@@ -2338,7 +2338,7 @@ nea_subnode_t const **nea_server_get_subscribers(nea_server_t *nes,
 }
 
 /** Free a list of subscriptions. */
-void nea_server_free_subscribers(nea_server_t *nes, 
+void nea_server_free_subscribers(nea_server_t *nes,
                                 nea_subnode_t const **sn_list)
 {
   if (sn_list) {
index 5e6f30801b1b5044ba834b4f95a362d9ed328ff4..f8c37e822c00dd1f9908a60a4081285753e553c1 100644 (file)
@@ -67,19 +67,19 @@ typedef struct nea_event_s      nea_event_t;
 /** Event view. */
 typedef struct nea_event_view_s nea_event_view_t;
 
-#ifndef NEA_SMAGIC_T 
+#ifndef NEA_SMAGIC_T
 #define NEA_SMAGIC_T            struct nea_smagic_t
 #endif
 /** NEA server context */
 typedef NEA_SMAGIC_T nea_smagic_t;
 
-#ifndef NEA_EMAGIC_T 
+#ifndef NEA_EMAGIC_T
 #define NEA_EMAGIC_T            struct nea_emagic_t
 #endif
 /** NEA server event context */
 typedef NEA_EMAGIC_T nea_emagic_t;
 
-#ifndef NEA_EVMAGIC_T 
+#ifndef NEA_EVMAGIC_T
 #define NEA_EVMAGIC_T           struct nea_evmagic_t
 #endif
 /** Event view context */
@@ -88,7 +88,7 @@ typedef NEA_EVMAGIC_T nea_evmagic_t;
 /** Description of subscription */
 typedef struct nea_subnode_t {
   nea_state_t          sn_state;               /**< Subscription state */
-  unsigned             sn_fake;                /**< True if subscriber is given 
+  unsigned             sn_fake;                /**< True if subscriber is given
                                         *   fake contents.
                                         */
   unsigned             sn_eventlist;    /**< Subscriber supports eventlist */
@@ -98,7 +98,7 @@ typedef struct nea_subnode_t {
   sip_contact_t const *sn_contact;             /**< Contact of subscriber */
 
   /** Content-Type of SUBSCRIBE body (filter). */
-  sip_content_type_t const *sn_content_type; 
+  sip_content_type_t const *sn_content_type;
   sip_payload_t const *sn_payload;      /**< Body of subscribe*/
 
   unsigned             sn_expires;             /**< When subscription expires */
@@ -123,7 +123,7 @@ typedef struct nea_payloads_s   nea_payloads_t;
  *
  * @retval 1 application takes care of responding to request
  * @retval 0 application has added new event or payload format
- * @retval -1 nea server rejects request 
+ * @retval -1 nea server rejects request
  */
 typedef int (nea_new_event_f)(nea_smagic_t *context,
                              nea_server_t *nes,
@@ -166,7 +166,7 @@ SOFIAPUBFUN
 int nea_server_add_irq(nea_server_t *nes,
                       nta_leg_t *leg,
                       sip_contact_t const *local_target,
-                      nta_incoming_t *irq, 
+                      nta_incoming_t *irq,
                       sip_t const *sip);
 
 /** QAUTH callback function type.
@@ -189,7 +189,7 @@ SOFIAPUBFUN
 nea_event_t *nea_event_create(nea_server_t *nes,
                              nea_watcher_f *callback,
                              nea_emagic_t *context,
-                             char const *name, 
+                             char const *name,
                              char const *subname,
                              char const *default_content_type,
                              char const *accept);
@@ -199,7 +199,7 @@ SOFIAPUBFUN
 nea_event_t *nea_event_tcreate(nea_server_t *nes,
                               nea_watcher_f *callback,
                               nea_emagic_t *context,
-                              char const *name, 
+                              char const *name,
                               char const *subname,
                               tag_type_t, tag_value_t, ...);
 
@@ -215,10 +215,10 @@ SOFIAPUBFUN int nea_server_active(nea_server_t *nes, nea_event_t const *ev);
 /** Get number of (non-embryonic) subscribers. */
 int nea_server_non_embryonic(nea_server_t *nes, nea_event_t const *ev);
 
-/** Obtain a list of subscriptions. 
+/** Obtain a list of subscriptions.
  */
 SOFIAPUBFUN
-nea_subnode_t const **nea_server_get_subscribers(nea_server_t *nes, 
+nea_subnode_t const **nea_server_get_subscribers(nea_server_t *nes,
                                                 nea_event_t const *ev);
 
 /** Free a list of subscriptions. */
@@ -227,12 +227,12 @@ void nea_server_free_subscribers(nea_server_t *nes, nea_subnode_t const **);
 
 /** Notify subscribers */
 SOFIAPUBFUN
-int nea_server_notify(nea_server_t *nes, 
+int nea_server_notify(nea_server_t *nes,
                      nea_event_t *ev);
 
 /** Notify a subscriber */
 SOFIAPUBFUN
-int nea_server_notify_one(nea_server_t *nes, 
+int nea_server_notify_one(nea_server_t *nes,
                          nea_event_t *ev,
                          nea_sub_t *ns);
 
@@ -257,12 +257,12 @@ SOFIAPUBFUN unsigned nea_sub_pending(nea_sub_t const *);
 #if 0
 /** Do a remote qauth.
  *
- * The function nea_server_qauth() is given as q_callback pointer 
+ * The function nea_server_qauth() is given as q_callback pointer
  * to nea_server_create() if remote authentication from url is desired.
  */
-void nea_server_qauth(nea_server_t *nes, 
+void nea_server_qauth(nea_server_t *nes,
                      nea_emagic_t *context,
-                     nea_sub_t *subscriber, 
+                     nea_sub_t *subscriber,
                      sip_t const *sip);
 #endif
 
@@ -329,7 +329,7 @@ SOFIAPUBVAR tag_typedef_t neatag_sub_ref;
 /** NEA Event Watcher */
 typedef struct nea_s     nea_t;
 
-#ifndef NEA_MAGIC_T 
+#ifndef NEA_MAGIC_T
 #define NEA_MAGIC_T struct nea_magic_t
 #endif
 
@@ -337,7 +337,7 @@ typedef struct nea_s     nea_t;
 typedef NEA_MAGIC_T          nea_magic_t;
 
 /** Event notification callback type.
- * 
+ *
  * This callback is called also when initial or refresh subscribe transaction
  * completes with the transaction result in @a sip.
  */
@@ -360,7 +360,7 @@ nea_t *nea_create(nta_agent_t *agent,
 
 /** Update SUBSCRIBE payload (filter rules) */
 SOFIAPUBFUN
-int nea_update(nea_t *nea, 
+int nea_update(nea_t *nea,
               tag_type_t tag,
               tag_value_t value,
               ...);
index 5a061087b3619c81af73dcaf64de5a136b380703..8b3ec0b51110687b82f2fc6ec07b86fe726abcb0 100644 (file)
@@ -1,7 +1,7 @@
 PROJECT_NAME         = "nta"
 OUTPUT_DIRECTORY     = ../docs/html/nta
 
-INPUT               = @srcdir@/nta.docs @srcdir@/sofia-sip @srcdir@ . 
+INPUT               = @srcdir@/nta.docs @srcdir@/sofia-sip @srcdir@ .
 
 @INCLUDE_PATH = . @srcdir@
 @INCLUDE = ../docs/Doxyfile.conf
index 364823c6ab1579f49842cbbc52ef43e65d02e016..e36906a04d58ddcd65648ba9bbe99f7733d91efa 100644 (file)
@@ -27,7 +27,7 @@ check_PROGRAMS =      test_nta_api test_nta portbind
 dist_noinst_SCRIPTS =  run_test_nta_api run_test_nta
 
 TESTS =                        run_test_nta_api run_test_nta
-TESTS_ENVIRONMENT =    $(SHELL) 
+TESTS_ENVIRONMENT =    $(SHELL)
 
 # ----------------------------------------------------------------------
 # Rules for building the targets
@@ -37,7 +37,7 @@ BUILT_SOURCES =               nta_tag_ref.c
 nobase_include_sofia_HEADERS = \
                        sofia-sip/nta.h sofia-sip/nta_stateless.h \
                        sofia-sip/nta_tport.h sofia-sip/nta_tag.h \
-                       sofia-sip/sl_utils.h 
+                       sofia-sip/sl_utils.h
 
 libnta_la_SOURCES =    nta.c nta_check.c nta_tag.c nta_tag_ref.c \
                        nta_internal.h \
@@ -68,7 +68,7 @@ MOSTLYCLEANFILES +=   .test[0-9]*
 
 EXTRA_DIST =           nta.docs sl_utils.docs \
                        agent.pem cafile.pem \
-                       invite.msc $(BUILT_SOURCES) 
+                       invite.msc $(BUILT_SOURCES)
 
 # ----------------------------------------------------------------------
 # Sofia specific rules
index 587c99dee2a14f08f3f3374ce8ff90bacf38bc1a..1a83c856f11b759227cafd746f72a35338fa8702 100644 (file)
@@ -86,14 +86,14 @@ Agent     |             
  |        |nta_leg_destroy            |          |
  |        |---------------------------|--------->|
  |        |             Â¦             |          X
- |        X             Â¦             |          
+ |        X             Â¦             |
 \f
 
 User Agent Server Accepting a Call
 ----------------------------------
 
                     APP Â¦ NTA
-User                   Â¦            NTA 
+User                   Â¦            NTA
 Agent                  Â¦           agent
  |                      Â¦             |                INVITE
  |                     Â¦             |<----------------------
index e5ebdcf00cbf55f62ac0522be8ba09d8c605784b..e6f91563445d9283f7064ac8596888e70ffc6dc5 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@CFILE nta.c
  * @brief Sofia SIP Transaction API implementation
- * 
+ *
  * This source file has been divided into sections as follows:
  * 1) agent
  * 2) tport handling
@@ -37,9 +37,9 @@
  * 9) resolving URLs for client transactions
  * 10) 100rel reliable responses (reliable)
  * 11) SigComp handling and public transport interface
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Jun 13 02:57:51 2000 ppessi
  */
 
@@ -135,8 +135,8 @@ static msg_t *nta_msg_create_for_transport(nta_agent_t *agent, int flags,
                                           tport_t const *tport,
                                           tp_client_t *via);
 
-static int complete_response(msg_t *response, 
-                            int status, char const *phrase, 
+static int complete_response(msg_t *response,
+                            int status, char const *phrase,
                             msg_t *request);
 
 static int mreply(nta_agent_t *agent,
@@ -208,10 +208,10 @@ static int incoming_callback(nta_leg_t *leg, nta_incoming_t *irq, sip_t *sip);
 static void incoming_free(nta_incoming_t *irq);
 su_inline void incoming_cut_off(nta_incoming_t *irq);
 su_inline void incoming_reclaim(nta_incoming_t *irq);
-static void incoming_queue_init(incoming_queue_t *, 
+static void incoming_queue_init(incoming_queue_t *,
                                unsigned timeout);
-static void incoming_queue_adjust(nta_agent_t *sa, 
-                                 incoming_queue_t *queue, 
+static void incoming_queue_adjust(nta_agent_t *sa,
+                                 incoming_queue_t *queue,
                                  unsigned timeout);
 
 static nta_incoming_t *incoming_find(nta_agent_t const *agent,
@@ -252,10 +252,10 @@ static nta_outgoing_t *outgoing_create(nta_agent_t *agent,
                                       tp_name_t const *tpn,
                                       msg_t *msg,
                                       tag_type_t tag, tag_value_t value, ...);
-static void outgoing_queue_init(outgoing_queue_t *, 
+static void outgoing_queue_init(outgoing_queue_t *,
                                unsigned timeout);
-static void outgoing_queue_adjust(nta_agent_t *sa, 
-                                 outgoing_queue_t *queue, 
+static void outgoing_queue_adjust(nta_agent_t *sa,
+                                 outgoing_queue_t *queue,
                                  unsigned timeout);
 static void outgoing_free(nta_outgoing_t *orq);
 su_inline void outgoing_cut_off(nta_outgoing_t *orq);
@@ -290,7 +290,7 @@ union sm_arg_u {
  *
  * The NTA_DEBUG environment variable is used to determine the default
  * debug logging level. The normal level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, #su_log_global, #SOFIA_DEBUG
  */
 #ifdef DOXYGEN
@@ -301,8 +301,8 @@ extern char const NTA_DEBUG[]; /* dummy declaration for Doxygen */
 #define SU_DEBUG 3
 #endif
 
-/**Debug log for @b nta module. 
- * 
+/**Debug log for @b nta module.
+ *
  * The nta_log is the log object used by @b nta module. The level of
  * nta_log is set using #NTA_DEBUG environment variable.
  */
@@ -354,8 +354,8 @@ su_log_t nta_log[] = { SU_LOG_INIT("nta", "NTA_DEBUG", SU_DEBUG) };
  * NTATAG_DEBUG_DROP_PROB(), NTATAG_DEFAULT_PROXY(),
  * NTATAG_EXTRA_100(), NTATAG_GRAYLIST(),
  * NTATAG_MAXSIZE(), NTATAG_MAX_FORWARDS(), NTATAG_MERGE_482(), NTATAG_MCLASS()
- * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(), 
- * NTATAG_REL100(), 
+ * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(),
+ * NTATAG_REL100(),
  * NTATAG_SERVER_RPORT(),
  * NTATAG_SIPFLAGS(),
  * NTATAG_SIP_T1X64(), NTATAG_SIP_T1(), NTATAG_SIP_T2(), NTATAG_SIP_T4(),
@@ -368,9 +368,9 @@ su_log_t nta_log[] = { SU_LOG_INIT("nta", "NTA_DEBUG", SU_DEBUG) };
  * @note The value from following tags are stored, but they currently do nothing:
  * NTATAG_SIGCOMP_ALGORITHM(), NTATAG_SIGCOMP_OPTIONS(), NTATAG_SMIME()
  *
- * @note It is possible to provide @c (url_string_t*)-1 as @a contact_url. 
+ * @note It is possible to provide @c (url_string_t*)-1 as @a contact_url.
  * In that case, no server sockets are bound.
- * 
+ *
  * @retval handle to the agent when successful,
  * @retval NULL upon an error.
  *
@@ -399,15 +399,15 @@ nta_agent_t *nta_agent_create(su_root_t *root,
     agent->sa_flags = MSG_DO_CANONIC;
 
     agent->sa_maxsize         = 2 * 1024 * 1024; /* 2 MB */
-    agent->sa_bad_req_mask    = 
+    agent->sa_bad_req_mask    =
       /*
-       * Bit-wise not of these - what is left is suitable for UAs with 
-       * 100rel, timer, events, publish 
+       * Bit-wise not of these - what is left is suitable for UAs with
+       * 100rel, timer, events, publish
        */
-      (unsigned) ~(sip_mask_response | sip_mask_proxy | sip_mask_registrar | 
+      (unsigned) ~(sip_mask_response | sip_mask_proxy | sip_mask_registrar |
                   sip_mask_pref | sip_mask_privacy);
-    agent->sa_bad_resp_mask   = 
-      (unsigned) ~(sip_mask_request | sip_mask_proxy | sip_mask_registrar | 
+    agent->sa_bad_resp_mask   =
+      (unsigned) ~(sip_mask_request | sip_mask_proxy | sip_mask_registrar |
                   sip_mask_pref | sip_mask_privacy);
     agent->sa_t1             = NTA_SIP_T1;
     agent->sa_t2             = NTA_SIP_T2;
@@ -445,14 +445,14 @@ nta_agent_t *nta_agent_create(su_root_t *root,
       agent->sa_mclass = sip_default_mclass();
 
     agent->sa_in.re_t1 = &agent->sa_in.re_list;
-    
+
     incoming_queue_init(agent->sa_in.proceeding, 0);
     incoming_queue_init(agent->sa_in.preliminary, agent->sa_t1x64); /* P1 */
     incoming_queue_init(agent->sa_in.inv_completed, agent->sa_t1x64); /* H */
     incoming_queue_init(agent->sa_in.inv_confirmed, agent->sa_t4); /* I */
     incoming_queue_init(agent->sa_in.completed, agent->sa_t1x64); /* J */
     incoming_queue_init(agent->sa_in.terminated, 0);
-    incoming_queue_init(agent->sa_in.final_failed, 0); 
+    incoming_queue_init(agent->sa_in.final_failed, 0);
 
     agent->sa_out.re_t1 = &agent->sa_out.re_list;
 
@@ -460,7 +460,7 @@ nta_agent_t *nta_agent_create(su_root_t *root,
     outgoing_queue_init(agent->sa_out.resolving, 0);
     outgoing_queue_init(agent->sa_out.trying, agent->sa_t1x64); /* F */
     outgoing_queue_init(agent->sa_out.completed, agent->sa_t4); /* K */
-    outgoing_queue_init(agent->sa_out.terminated, 0); 
+    outgoing_queue_init(agent->sa_out.terminated, 0);
     /* Special queues (states) for outgoing INVITE transactions */
     outgoing_queue_init(agent->sa_out.inv_calling, agent->sa_t1x64); /* B */
     timer_c = (agent->sa_use_timer_c || !agent->sa_is_a_uas)
@@ -547,7 +547,7 @@ void nta_agent_destroy(nta_agent_t *agent)
 
     for (i = 0, lht = agent->sa_defaults; i < lht->lht_size; i++) {
       if ((leg = lht->lht_table[i])) {
-       SU_DEBUG_3(("%s: destroying leg for <" 
+       SU_DEBUG_3(("%s: destroying leg for <"
                    URL_PRINT_FORMAT ">\n",
                    __func__, URL_PRINT_ARGS(leg->leg_url)));
        leg_free(agent, leg);
@@ -851,7 +851,7 @@ uint32_t set_timeout(nta_agent_t *agent, uint32_t offset)
     now = agent->sa_now, ms = agent->sa_millisec;
   else
     now = su_now(), ms = su_time_ms(now);
-  
+
   next = ms + offset; if (next == 0) next = 1;
 
   if (agent->sa_in_timer)      /* Currently executing timer */
@@ -863,8 +863,8 @@ uint32_t set_timeout(nta_agent_t *agent, uint32_t offset)
       SU_DEBUG_9(("nta: timer %s to %ld ms\n", "shortened", (long)offset));
     else
       SU_DEBUG_9(("nta: timer %s to %ld ms\n", "set", (long)offset));
-      
-    su_timer_set_at(agent->sa_timer, agent_timer, agent, 
+
+    su_timer_set_at(agent->sa_timer, agent_timer, agent,
                    add_milliseconds(now, offset));
     agent->sa_next = next;
   }
@@ -879,7 +879,7 @@ su_time_t agent_now(nta_agent_t const *agent)
 {
   if (agent && agent->sa_millisec != 0)
     return agent->sa_now;
-  else 
+  else
     return su_now();
 }
 
@@ -891,7 +891,7 @@ int agent_launch_terminator(nta_agent_t *agent)
 #ifdef TPTAG_THRPSIZE
   if (agent->sa_tport_threadpool) {
     su_home_threadsafe(agent->sa_home);
-    return su_clone_start(agent->sa_root, 
+    return su_clone_start(agent->sa_root,
                          agent->sa_terminator,
                          NULL,
                          NULL,
@@ -916,7 +916,7 @@ void agent_kill_terminator(nta_agent_t *agent)
  * NTA keeps transactions alive, does NTA apply proxy or user-agent logic to
  * INVITE transactions, or how the @Via headers are generated.
  *
- * @note 
+ * @note
  * Setting the parameters NTATAG_MAXSIZE(), NTATAG_UDP_MTU(), NTATAG_MAX_PROCEEDING(),
  * NTATAG_SIP_T1X64(), NTATAG_SIP_T1(), NTATAG_SIP_T2(), NTATAG_SIP_T4() to
  * 0 selects the default value.
@@ -928,8 +928,8 @@ void agent_kill_terminator(nta_agent_t *agent)
  * NTATAG_DEBUG_DROP_PROB(), NTATAG_DEFAULT_PROXY(),
  * NTATAG_EXTRA_100(), NTATAG_GRAYLIST(),
  * NTATAG_MAXSIZE(), NTATAG_MAX_FORWARDS(), NTATAG_MERGE_482(), NTATAG_MCLASS()
- * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(), 
- * NTATAG_REL100(), 
+ * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(),
+ * NTATAG_REL100(),
  * NTATAG_SERVER_RPORT(),
  * NTATAG_SIPFLAGS(),
  * NTATAG_SIP_T1X64(), NTATAG_SIP_T1(), NTATAG_SIP_T2(), NTATAG_SIP_T4(),
@@ -1220,7 +1220,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
   return n;
 }
 
-static 
+static
 void agent_set_udp_params(nta_agent_t *self, usize_t udp_mtu)
 {
   tport_t *tp;
@@ -1243,23 +1243,23 @@ void agent_set_udp_params(nta_agent_t *self, usize_t udp_mtu)
  * INVITE transactions, or how the @Via headers are generated.
  *
  * @TAGS
- * NTATAG_ALIASES_REF(), NTATAG_BLACKLIST_REF(), 
+ * NTATAG_ALIASES_REF(), NTATAG_BLACKLIST_REF(),
  * NTATAG_CANCEL_2543_REF(), NTATAG_CANCEL_487_REF(),
- * NTATAG_CLIENT_RPORT_REF(), NTATAG_CONTACT_REF(), 
+ * NTATAG_CLIENT_RPORT_REF(), NTATAG_CONTACT_REF(),
  * NTATAG_DEBUG_DROP_PROB_REF(), NTATAG_DEFAULT_PROXY_REF(),
  * NTATAG_EXTRA_100_REF(), NTATAG_GRAYLIST_REF(),
  * NTATAG_MAXSIZE_REF(), NTATAG_MAX_FORWARDS_REF(), NTATAG_MCLASS_REF(),
  * NTATAG_MERGE_482_REF(), NTATAG_MAX_PROCEEDING_REF(),
  * NTATAG_PASS_100_REF(), NTATAG_PASS_408_REF(), NTATAG_PRELOAD_REF(),
  * NTATAG_PROGRESS_REF(),
- * NTATAG_REL100_REF(), 
- * NTATAG_SERVER_RPORT_REF(), 
+ * NTATAG_REL100_REF(),
+ * NTATAG_SERVER_RPORT_REF(),
  * NTATAG_SIGCOMP_ALGORITHM_REF(), NTATAG_SIGCOMP_OPTIONS_REF(),
  * NTATAG_SIPFLAGS_REF(),
  * NTATAG_SIP_T1_REF(), NTATAG_SIP_T1X64_REF(), NTATAG_SIP_T2_REF(),
  * NTATAG_SIP_T4_REF(), NTATAG_SMIME_REF(), NTATAG_STATELESS_REF(),
  * NTATAG_TAG_3261_REF(), NTATAG_TIMEOUT_408_REF(), NTATAG_TIMER_C_REF(),
- * NTATAG_UA_REF(), NTATAG_UDP_MTU_REF(), NTATAG_USER_VIA_REF(), 
+ * NTATAG_UA_REF(), NTATAG_UDP_MTU_REF(), NTATAG_USER_VIA_REF(),
  * NTATAG_USE_NAPTR_REF(), NTATAG_USE_SRV_REF(),
  * and NTATAG_USE_TIMESTAMP_REF().
  *
@@ -1366,7 +1366,7 @@ int agent_get_params(nta_agent_t *agent, tagi_t *tags)
  * NTATAG_S_SENT_REQUEST_REF(),
  * NTATAG_S_SENT_RESPONSE_REF(),
  * NTATAG_S_SERVER_TR_REF(),
- * NTATAG_S_TOUT_REQUEST_REF(), 
+ * NTATAG_S_TOUT_REQUEST_REF(),
  * NTATAG_S_TOUT_RESPONSE_REF(),
  * NTATAG_S_TRLESS_200_REF(),
  * NTATAG_S_TRLESS_REQUEST_REF(),
@@ -1459,7 +1459,7 @@ static char const *stateful_branch(su_home_t *home, nta_agent_t *sa)
   /* XXX - use a cryptographically safe func here? */
   sa->sa_branch += NTA_BRANCH_PRIME;
 
-  msg_random_token(branch, sizeof(branch) - 1, 
+  msg_random_token(branch, sizeof(branch) - 1,
                   &sa->sa_branch, sizeof(sa->sa_branch));
 
   return su_sprintf(home, "branch=z9hG4bK%s", branch);
@@ -1469,13 +1469,13 @@ static char const *stateful_branch(su_home_t *home, nta_agent_t *sa)
 
 /**
  * Calculate branch value for stateless operation.
- * 
+ *
  * XXX - should include HMAC of previous @Via line.
  */
 static
-char const *stateless_branch(nta_agent_t *sa, 
+char const *stateless_branch(nta_agent_t *sa,
                             msg_t *msg,
-                            sip_t const *sip, 
+                            sip_t const *sip,
                             tp_name_t const *tpn)
 {
   su_md5_t md5[1];
@@ -1542,7 +1542,7 @@ static void agent_update_tport(nta_agent_t *agent, tport_t *);
 /**For each transport, we have name used by tport module, SRV prefixes used
  * for resolving, and NAPTR service/conversion.
  */
-static 
+static
 struct sipdns_tport {
   char name[6];                        /**< Named used by tport module */
   char port[6];                        /**< Default port number */
@@ -1678,14 +1678,14 @@ int nta_agent_add_tport(nta_agent_t *self,
   if (url->url_type == url_sip) {
     tpn->tpn_proto = "*";
     tports = tports_sip;
-    if (!tpn->tpn_port || !tpn->tpn_port[0]) 
+    if (!tpn->tpn_port || !tpn->tpn_port[0])
       tpn->tpn_port = SIP_DEFAULT_SERV;
   }
   else {
     assert(url->url_type == url_sips);
     tpn->tpn_proto = "*";
     tports = tports_sips;
-    if (!tpn->tpn_port || !tpn->tpn_port[0]) 
+    if (!tpn->tpn_port || !tpn->tpn_port[0])
       tpn->tpn_port = SIPS_DEFAULT_SERV;
   }
 
@@ -1712,8 +1712,8 @@ int nta_agent_add_tport(nta_agent_t *self,
     if (url_param(url->url_params, "comp", comp, sizeof(comp)) > 0)
       tpn->tpn_comp = comp;
 
-    if (tpn->tpn_comp && 
-       (nta_compressor_vtable == NULL || 
+    if (tpn->tpn_comp &&
+       (nta_compressor_vtable == NULL ||
         strcasecmp(tpn->tpn_comp, nta_compressor_vtable->ncv_name) != 0)) {
       SU_DEBUG_1(("nta(%p): comp=%s not supported for " URL_PRINT_FORMAT "\n",
                  (void *)self, tpn->tpn_comp, URL_PRINT_ARGS(url)));
@@ -1781,7 +1781,7 @@ int nta_agent_add_tport(nta_agent_t *self,
 static
 int agent_create_master_transport(nta_agent_t *self, tagi_t *tags)
 {
-  self->sa_tports = 
+  self->sa_tports =
     tport_tcreate(self, nta_agent_class, self->sa_root,
                  TPTAG_SDWN_ERROR(0),
                  TPTAG_IDLE(1800000),
@@ -1872,14 +1872,14 @@ int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr)
        maddr = 0;
        port = 0;
       }
-       
+
       if (strncasecmp(tpn->tpn_proto, "tls", 3)
          ? port == SIP_DEFAULT_PORT
          : port == SIPS_DEFAULT_PORT)
        port = 0;
 
       snprintf(sport, sizeof sport, ":%u", port);
-      
+
       comp = tpn->tpn_comp;
 
       SU_DEBUG_9(("nta: agent_init_via: "
@@ -1933,7 +1933,7 @@ int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr)
 
     while (via->v_next && via->v_next->v_common->h_data == tp)
       via = via->v_next, new_via = new_via->v_next, dup_via = dup_via->v_next;
-    
+
     via = via->v_next;
     /* Break the link in via list between transports */
     vv = &new_via->v_next, new_via = *vv, *vv = NULL;
@@ -1952,7 +1952,7 @@ int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr)
     agent_set_udp_params(self, self->sa_udp_mtu);
 
   v = self->sa_vias;
-  self->sa_vias = new_vias; 
+  self->sa_vias = new_vias;
   msg_header_free(self->sa_home, (void *)v);
 
   v = self->sa_public_vias;
@@ -2003,7 +2003,7 @@ int agent_init_contact(nta_agent_t *self)
 
   v2 = v1->v_next;
 
-  if (v2 && 
+  if (v2 &&
       strcasecmp(v1->v_host, v2->v_host) == 0 &&
       str0casecmp(v1->v_port, v2->v_port) == 0) {
     char const *p1 = v1->v_protocol, *p2 = v2->v_protocol;
@@ -2017,7 +2017,7 @@ int agent_init_contact(nta_agent_t *self)
       tp = NULL;
   }
 
-  self->sa_contact = 
+  self->sa_contact =
     sip_contact_create_from_via_with_transport(self->sa_home, v1, NULL, tp);
 
   if (!self->sa_contact)
@@ -2038,7 +2038,7 @@ sip_via_t const *agent_tport_via(tport_t *tport)
 
 /** Insert @Via to a request message */
 static
-int outgoing_insert_via(nta_outgoing_t *orq, 
+int outgoing_insert_via(nta_outgoing_t *orq,
                        sip_via_t const *via)
 {
   nta_agent_t *self = orq->orq_agent;
@@ -2062,7 +2062,7 @@ int outgoing_insert_via(nta_outgoing_t *orq,
   else
     return -1;
 
-  if (!v->v_rport && 
+  if (!v->v_rport &&
       ((self->sa_rport && v->v_protocol == sip_transport_udp) ||
        (self->sa_tcp_rport && v->v_protocol == sip_transport_tcp)))
     msg_header_add_param(msg_home(msg), v->v_common, "rport");
@@ -2089,7 +2089,7 @@ int outgoing_insert_via(nta_outgoing_t *orq,
 
   if ((!user_via ||
        /* Replace port in user Via only if we use udp and no rport */
-       (v->v_protocol == sip_transport_udp && !v->v_rport && 
+       (v->v_protocol == sip_transport_udp && !v->v_rport &&
        !orq->orq_stateless)) &&
       via->v_port != v->v_port &&
       str0cmp(via->v_port, v->v_port))
@@ -2101,7 +2101,7 @@ int outgoing_insert_via(nta_outgoing_t *orq,
   return 0;
 }
 
-/** Get destination name from @Via. 
+/** Get destination name from @Via.
  *
  * If @a using_rport is non-null, try rport.
  * If *using_rport is non-zero, try rport even if <protocol> is not UDP.
@@ -2149,7 +2149,7 @@ int nta_tpn_by_url(su_home_t *home,
     return -1;
   }
 
-  if (url->url_type != url_sip && 
+  if (url->url_type != url_sip &&
       url->url_type != url_sips &&
       url->url_type != url_im &&
       url->url_type != url_pres) {
@@ -2215,7 +2215,7 @@ static void agent_update_tport(nta_agent_t *self, tport_t *tport)
   }
   else {
     /* XXX - we should do something else? */
-    SU_DEBUG_3(("%s(%p): %s\n", "nta", (void *)self, 
+    SU_DEBUG_3(("%s(%p): %s\n", "nta", (void *)self,
                "transport address updated"));
   }
 }
@@ -2288,7 +2288,7 @@ void agent_recv_request(nta_agent_t *agent,
 
   if (agent->sa_drop_prob && !tport_is_reliable(tport)) {
     if ((unsigned)su_randint(0, 1000) < agent->sa_drop_prob) {
-      SU_DEBUG_5(("nta: %s (%u) is %s\n", 
+      SU_DEBUG_5(("nta: %s (%u) is %s\n",
                  method_name, cseq, "dropped simulating packet loss"));
       agent->sa_stats->as_drop_request++;
       msg_destroy(msg);
@@ -2299,16 +2299,16 @@ void agent_recv_request(nta_agent_t *agent,
   stream = tport_is_stream(tport);
 
   /* Try to use compression on reverse direction if @Via has comp=sigcomp  */
-  if (stream && 
+  if (stream &&
       sip->sip_via && sip->sip_via->v_comp &&
       tport_can_send_sigcomp(tport) &&
-      tport_name(tport)->tpn_comp == NULL && 
+      tport_name(tport)->tpn_comp == NULL &&
       tport_has_compression(tport_parent(tport), sip->sip_via->v_comp)) {
     tport_set_compression(tport, sip->sip_via->v_comp);
   }
 
   if (sip->sip_flags & MSG_FLG_TOOLARGE) {
-    SU_DEBUG_5(("nta: %s (%u) is %s\n", 
+    SU_DEBUG_5(("nta: %s (%u) is %s\n",
                method_name, cseq, sip_413_Request_too_large));
     agent->sa_stats->as_bad_request++;
     mreply(agent, NULL, SIP_413_REQUEST_TOO_LARGE, msg,
@@ -2325,11 +2325,11 @@ void agent_recv_request(nta_agent_t *agent,
     errors = sip->sip_error != NULL;
 
   if (errors ||
-      (sip->sip_flags & MSG_FLG_ERROR) /* Fatal error */ || 
+      (sip->sip_flags & MSG_FLG_ERROR) /* Fatal error */ ||
       (insane = (sip_sanity_check(sip) < 0))) {
     sip_header_t const *h;
     char const *badname = NULL, *phrase;
-    
+
     agent->sa_stats->as_bad_message++;
     agent->sa_stats->as_bad_request++;
 
@@ -2342,12 +2342,12 @@ void agent_recv_request(nta_agent_t *agent,
 
       if (h->sh_class == sip_error_class)
        bad = h->sh_error->er_name;
-      else 
+      else
        bad = h->sh_class->hc_name;
 
       if (bad)
        SU_DEBUG_5(("nta: %s has bad %s header\n", method_name, bad));
-      
+
       if (!badname)
        badname = bad;
     }
@@ -2363,7 +2363,7 @@ void agent_recv_request(nta_agent_t *agent,
        phrase = sip_400_Bad_request;
 
       SU_DEBUG_5(("nta: %s (%u) is %s\n", method_name, cseq, phrase));
-       
+
       mreply(agent, reply, 400, phrase, msg,
             tport, 1, stream, NULL,
             TAG_END());
@@ -2400,7 +2400,7 @@ void agent_recv_request(nta_agent_t *agent,
   }
 
   /* First, try existing incoming requests */
-  irq = incoming_find(agent, sip, sip->sip_via, 
+  irq = incoming_find(agent, sip, sip->sip_via,
                      agent->sa_merge_482 &&
                      !sip->sip_to->a_tag &&
                      method != sip_method_ack
@@ -2442,7 +2442,7 @@ void agent_recv_request(nta_agent_t *agent,
     if (rel) {
       SU_DEBUG_5(("nta: %s (%u) is going to %s (%u)\n",
                  method_name, cseq,
-                 rel->rel_irq->irq_cseq->cs_method_name, 
+                 rel->rel_irq->irq_cseq->cs_method_name,
                  rel->rel_irq->irq_cseq->cs_seq));
       reliable_recv(rel, msg, sip, tport);
       return;
@@ -2453,10 +2453,10 @@ void agent_recv_request(nta_agent_t *agent,
   url->url_params = NULL;
   agent_aliases(agent, url, tport); /* canonize urls */
 
-  if ((leg = leg_find(agent, 
-                     method_name, url, 
+  if ((leg = leg_find(agent,
+                     method_name, url,
                      sip->sip_call_id,
-                     sip->sip_from->a_tag, 
+                     sip->sip_from->a_tag,
                      sip->sip_to->a_tag))) {
     /* Try existing dialog */
     SU_DEBUG_5(("nta: %s (%u) %s\n",
@@ -2490,14 +2490,14 @@ void agent_recv_request(nta_agent_t *agent,
   else if (agent->sa_callback) {
     /* Stateless processing for request */
     agent->sa_stats->as_trless_request++;
-    SU_DEBUG_5(("nta: %s (%u) %s\n", 
+    SU_DEBUG_5(("nta: %s (%u) %s\n",
                method_name, cseq, "to message callback"));
     (void)agent->sa_callback(agent->sa_magic, agent, msg, sip);
   }
   else {
     agent->sa_stats->as_trless_request++;
     SU_DEBUG_5(("nta: %s (%u) %s\n",
-               method_name, cseq, 
+               method_name, cseq,
                "not processed by application: returning 501"));
     if (method != sip_method_ack)
       mreply(agent, NULL, SIP_501_NOT_IMPLEMENTED, msg,
@@ -2569,7 +2569,7 @@ int agent_check_request_via(nta_agent_t *agent,
       hostport[rlen] = '\0';
     }
 
-    msg_header_replace_param(msg_home(msg), v->v_common, 
+    msg_header_replace_param(msg_home(msg), v->v_common,
                             su_strdup(msg_home(msg), received));
     SU_DEBUG_5(("nta: Via check: %s\n", received));
   }
@@ -2580,7 +2580,7 @@ int agent_check_request_via(nta_agent_t *agent,
   else if (v->v_rport) {
     rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port));
     msg_header_replace_param(msg_home(msg), v->v_common, rport);
-  } 
+  }
   else if (tport_is_tcp(tport)) {
     rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port));
     msg_header_replace_param(msg_home(msg), v->v_common, rport);
@@ -2588,12 +2588,12 @@ int agent_check_request_via(nta_agent_t *agent,
   else if (agent->sa_server_rport == 2) {
     rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port));
     msg_header_replace_param(msg_home(msg), v->v_common, rport);
-  } 
+  }
 
   return 0;
 }
 
-/** @internal Handle aliases of local node. 
+/** @internal Handle aliases of local node.
  *
  * Return true if @a url is modified.
  */
@@ -2687,7 +2687,7 @@ void agent_recv_response(nta_agent_t *agent,
   agent->sa_stats->as_recv_msg++;
   agent->sa_stats->as_recv_response++;
 
-  SU_DEBUG_5(("nta: received %03d %s for %s (%u)\n", 
+  SU_DEBUG_5(("nta: received %03d %s for %s (%u)\n",
              status, phrase, method, cseq));
 
   if (agent->sa_drop_prob && !tport_is_reliable(tport)) {
@@ -2705,7 +2705,7 @@ void agent_recv_response(nta_agent_t *agent,
   else
     errors = sip->sip_error != NULL;
 
-  if (errors || 
+  if (errors ||
       sip_sanity_check(sip) < 0) {
     sip_header_t const *h;
 
@@ -2750,7 +2750,7 @@ void agent_recv_response(nta_agent_t *agent,
   /* XXX - should check if msg should be discarded based on via? */
 
   if ((orq = outgoing_find(agent, msg, sip, sip->sip_via))) {
-    SU_DEBUG_5(("nta: %03d %s %s\n", 
+    SU_DEBUG_5(("nta: %03d %s %s\n",
                status, phrase, "is going to a transaction"));
     if (outgoing_recv(orq, status, msg, sip) == 0)
       return;
@@ -2759,7 +2759,7 @@ void agent_recv_response(nta_agent_t *agent,
   agent->sa_stats->as_trless_response++;
 
   if ((orq = agent->sa_default_outgoing)) {
-    SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, 
+    SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase,
                "to the default transaction"));
     outgoing_default_recv(orq, status, msg, sip);
     return;
@@ -2778,7 +2778,7 @@ void agent_recv_response(nta_agent_t *agent,
       && 200 <= sip->sip_status->st_status
       && sip->sip_status->st_status < 300
       /* Exactly one Via header, belonging to us */
-      && sip->sip_via && !sip->sip_via->v_next 
+      && sip->sip_via && !sip->sip_via->v_next
       && agent_has_via(agent, sip->sip_via)) {
     agent->sa_stats->as_trless_200++;
 #if nomore /* sf.net bug #1750691. Let UAS to cope with it. */
@@ -2867,7 +2867,7 @@ void nta_msg_discard(nta_agent_t *agent, msg_t *msg)
 /** Check if the headers are from response generated locally by NTA. */
 int  nta_sip_is_internal(sip_t const *sip)
 {
-  return 
+  return
     sip == NULL                /* No message generated */
     || (sip->sip_flags & NTA_INTERNAL_MSG) == NTA_INTERNAL_MSG;
 }
@@ -2878,7 +2878,7 @@ int nta_msg_is_internal(msg_t const *msg)
   return msg_get_flags(msg, NTA_INTERNAL_MSG) == NTA_INTERNAL_MSG;
 }
 
-/** Check if the message is internally generated by NTA. 
+/** Check if the message is internally generated by NTA.
  *
  * @deprecated Use nta_msg_is_internal() instead
  */
@@ -2887,7 +2887,7 @@ int  nta_is_internal_msg(msg_t const *msg) { return nta_msg_is_internal(msg); }
 /* ====================================================================== */
 /* 5) Stateless operation */
 
-/**Forward a request or response message. 
+/**Forward a request or response message.
  *
  * @note
  * The ownership of @a msg is taken over by the function even if the
@@ -2907,8 +2907,8 @@ int nta_msg_tsend(nta_agent_t *agent, msg_t *msg, url_string_t const *u,
     return -1;
   }
 
-  what = 
-    sip->sip_status ? "nta_msg_tsend(response)" : 
+  what =
+    sip->sip_status ? "nta_msg_tsend(response)" :
     sip->sip_request ? "nta_msg_tsend(request)" :
     "nta_msg_tsend()";
 
@@ -2932,7 +2932,7 @@ int nta_msg_tsend(nta_agent_t *agent, msg_t *msg, url_string_t const *u,
            /* NTATAG_INCOMPLETE_REF(incomplete), */
            TAG_END());
 
-    if (!sip->sip_separator && 
+    if (!sip->sip_separator &&
        !(sip->sip_separator = sip_separator_create(msg_home(msg))))
       SU_DEBUG_3(("%s: cannot create sip_separator\n", what));
     else if (msg_serialize(msg, (msg_pub_t *)sip) != 0)
@@ -2967,7 +2967,7 @@ int nta_msg_tsend(nta_agent_t *agent, msg_t *msg, url_string_t const *u,
   }
   else {
     /* Send request */
-    if (outgoing_create(agent, NULL, NULL, u, NULL, msg_ref_create(msg), 
+    if (outgoing_create(agent, NULL, NULL, u, NULL, msg_ref_create(msg),
                        NTATAG_STATELESS(1),
                        ta_tags(ta)))
       retval = 0;
@@ -3127,7 +3127,7 @@ int mreply(nta_agent_t *agent,
       }
     }
 
-    if (tport_tsend(tport, reply, tpn, 
+    if (tport_tsend(tport, reply, tpn,
                    IF_SIGCOMP_TPTAG_COMPARTMENT(cc)
                    TPTAG_MTU(INT_MAX),
                    TPTAG_SDWN_AFTER(sdwn_after),
@@ -3151,8 +3151,8 @@ int mreply(nta_agent_t *agent,
 
 /** Add headers from the request to the response message. */
 static
-int complete_response(msg_t *response, 
-                     int status, char const *phrase, 
+int complete_response(msg_t *response,
+                     int status, char const *phrase,
                      msg_t *request)
 {
   su_home_t *home = msg_home(response);
@@ -3173,7 +3173,7 @@ int complete_response(msg_t *response,
   if (!response_sip->sip_to)
     response_sip->sip_to = sip_to_dup(home, request_sip->sip_to);
   if (!response_sip->sip_call_id)
-    response_sip->sip_call_id = 
+    response_sip->sip_call_id =
       sip_call_id_dup(home, request_sip->sip_call_id);
   if (!response_sip->sip_cseq)
     response_sip->sip_cseq = sip_cseq_dup(home, request_sip->sip_cseq);
@@ -3252,7 +3252,7 @@ int nta_msg_ackbye(nta_agent_t *agent, msg_t *msg)
     /* Append r-uri */
     *sip_route_init(r0)->r_url = *ruri->us_url;
     r->r_next = sip_route_dup(home, r0);
-    
+
     /* Use topmost route as request-uri */
     ruri = (url_string_t const *)route->r_url;
     route = route->r_next;
@@ -3292,7 +3292,7 @@ int nta_msg_ackbye(nta_agent_t *agent, msg_t *msg)
   else
     msg_header_insert(bmsg, (msg_pub_t *)bsip, (msg_header_t *)rq);
 
-  if (!(bye = nta_outgoing_mcreate(agent, NULL, NULL, NULL, bmsg, 
+  if (!(bye = nta_outgoing_mcreate(agent, NULL, NULL, NULL, bmsg,
                                   NTATAG_STATELESS(1),
                                   TAG_END())))
     goto err;
@@ -3374,7 +3374,7 @@ int nta_msg_request_complete(msg_t *msg,
     request_uri = (url_string_t *)sip->sip_request->rq_url;
 
   to = sip->sip_to ? sip->sip_to : leg->leg_remote;
-  
+
   if (!request_uri && to) {
     if (method != sip_method_register)
       request_uri = (url_string_t *)to->a_url;
@@ -3391,7 +3391,7 @@ int nta_msg_request_complete(msg_t *msg,
 
   if (method || method_name) {
     sip_request_t *rq = sip->sip_request;
-    int use_headers = 
+    int use_headers =
       request_uri == original || (url_t *)request_uri == rq->rq_url;
 
     if (!rq
@@ -3406,11 +3406,11 @@ int nta_msg_request_complete(msg_t *msg,
        return -1;
     }
 
-    /* @RFC3261 table 1 (page 152): 
-     * Req-URI cannot contain method parameter or headers 
+    /* @RFC3261 table 1 (page 152):
+     * Req-URI cannot contain method parameter or headers
      */
     if (rq->rq_url->url_params) {
-      rq->rq_url->url_params = 
+      rq->rq_url->url_params =
        url_strip_param_string((char *)rq->rq_url->url_params, "method");
       sip_fragment_clear(rq->rq_common);
     }
@@ -3466,10 +3466,10 @@ int nta_msg_request_complete(msg_t *msg,
   method_name = sip->sip_request->rq_method_name;
 
   if (!leg->leg_id && sip->sip_cseq)
-    seq = sip->sip_cseq->cs_seq; 
+    seq = sip->sip_cseq->cs_seq;
   else if (method == sip_method_ack || method == sip_method_cancel)
     /* Dangerous - we may do PRACK/UPDATE meanwhile */
-    seq = sip->sip_cseq ? sip->sip_cseq->cs_seq : leg->leg_seq; 
+    seq = sip->sip_cseq ? sip->sip_cseq->cs_seq : leg->leg_seq;
   else if (leg->leg_seq)
     seq = ++leg->leg_seq;
   else if (sip->sip_cseq) /* Obtain initial value from existing CSeq header */
@@ -3484,10 +3484,10 @@ int nta_msg_request_complete(msg_t *msg,
       sip->sip_call_id = sip_call_id_create(home, NULL);
   }
 
-  if ((!sip->sip_cseq || 
+  if ((!sip->sip_cseq ||
        seq != sip->sip_cseq->cs_seq ||
        method != sip->sip_cseq->cs_method ||
-       (method == sip_method_unknown && 
+       (method == sip_method_unknown &&
        strcmp(method_name, sip->sip_cseq->cs_method_name) != 0)) &&
       (!(cseq = sip_cseq_create(home, seq, method, method_name)) ||
        msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)cseq) < 0))
@@ -3576,7 +3576,7 @@ hash_value_t hash_istring(char const *, char const *, hash_value_t);
  *     nta_leg_client_route(), nta_leg_server_route(),
  *     nta_leg_destroy(), nta_outgoing_tcreate(), and nta_request_f().
  *
- * @TAGS 
+ * @TAGS
  * NTATAG_NO_DIALOG(), NTATAG_STATELESS(), NTATAG_METHOD(),
  * URLTAG_URL(), SIPTAG_CALL_ID(), SIPTAG_CALL_ID_STR(), SIPTAG_FROM(),
  * SIPTAG_FROM_STR(), SIPTAG_TO(), SIPTAG_TO_STR(), SIPTAG_ROUTE(),
@@ -3648,7 +3648,7 @@ nta_leg_t *nta_leg_tcreate(nta_agent_t *agent,
 
   if (from) {
     /* Now this is kludge */
-    leg->leg_local_is_to = sip_is_to((sip_header_t*)from); 
+    leg->leg_local_is_to = sip_is_to((sip_header_t*)from);
     leg->leg_local = sip_to_dup(home, from);
   }
   else if (from_str)
@@ -3682,7 +3682,7 @@ nta_leg_t *nta_leg_tcreate(nta_agent_t *agent,
     url_t *changed = url_hdup(home, url);
     su_free(home, url);
     url = changed;
-  }    
+  }
 
   leg->leg_rseq = rseq;
   leg->leg_seq = seq;
@@ -3716,7 +3716,7 @@ nta_leg_t *nta_leg_tcreate(nta_agent_t *agent,
        what = "Missing local dialog address";
       else if (leg->leg_local)
        what = "Missing remote dialog address";
-      else 
+      else
        what = "Missing dialog addresses";
       goto err;
     }
@@ -3909,7 +3909,7 @@ void nta_leg_bind(nta_leg_t *leg,
  * @param leg leg to be tagged
  * @param tag tag to be added (if NULL, a tag generated by @b NTA is added)
  *
- * @return 
+ * @return
  * Pointer to tag if successful, NULL otherwise.
  */
 char const *nta_leg_tag(nta_leg_t *leg, char const *tag)
@@ -3920,7 +3920,7 @@ char const *nta_leg_tag(nta_leg_t *leg, char const *tag)
   if (tag && strchr(tag, '='))
     tag = strchr(tag, '=') + 1;
 
-  /* If there already is a tag, 
+  /* If there already is a tag,
      return NULL if it does not match with new one */
   if (leg->leg_local->a_tag) {
     if (!tag && str0casecmp(tag, leg->leg_local->a_tag))
@@ -3928,7 +3928,7 @@ char const *nta_leg_tag(nta_leg_t *leg, char const *tag)
     else
       return leg->leg_local->a_tag;
   }
-  
+
   if (tag) {
     if (sip_to_tag(leg->leg_home, leg->leg_local, tag) < 0)
       return NULL;
@@ -3957,12 +3957,12 @@ char const *nta_leg_get_tag(nta_leg_t const *leg)
 
 /** Add a remote tag to the leg.
  *
- * @note No remote tag is ever generated. 
+ * @note No remote tag is ever generated.
  *
  * @param leg leg to be tagged
  * @param tag tag to be added (@b must be non-NULL)
  *
- * @return 
+ * @return
  * Pointer to tag if successful, NULL otherwise.
  */
 char const *nta_leg_rtag(nta_leg_t *leg, char const *tag)
@@ -3975,7 +3975,7 @@ char const *nta_leg_rtag(nta_leg_t *leg, char const *tag)
 
   if (leg && leg->leg_remote)
     return leg->leg_remote->a_tag;
-  else 
+  else
     return NULL;
 }
 
@@ -4023,8 +4023,8 @@ int nta_leg_server_route(nta_leg_t *leg,
 }
 
 /** Return route components. */
-int nta_leg_get_route(nta_leg_t *leg, 
-                     sip_route_t const **return_route, 
+int nta_leg_get_route(nta_leg_t *leg,
+                     sip_route_t const **return_route,
                      sip_contact_t const **return_target)
 {
   if (!leg)
@@ -4054,12 +4054,12 @@ sip_replaces_t *nta_leg_make_replaces(nta_leg_t *leg,
     return NULL;
   if (!leg->leg_dialog || !leg->leg_local || !leg->leg_remote || !leg->leg_id)
     return NULL;
-  
+
   from_tag = leg->leg_local->a_tag; if (!from_tag) from_tag = "0";
   to_tag = leg->leg_remote->a_tag; if (!to_tag) to_tag = "0";
 
   return sip_replaces_format(home, "%s;from-tag=%s;to-tag=%s%s",
-                            leg->leg_id->i_id, from_tag, to_tag, 
+                            leg->leg_id->i_id, from_tag, to_tag,
                             early_only ? ";early-only" : "");
 }
 
@@ -4257,8 +4257,8 @@ int addr_cmp(url_t const *a, url_t const *b)
  * @param request_uri  if non-NULL, and there is destination URI
  *                     associated with the dialog, these URIs must match
  * @param call_id      if non-NULL, must match with @CallID header contents
- * @param remote_tag   if there is remote tag 
- *                     associated with dialog, @a remote_tag must match 
+ * @param remote_tag   if there is remote tag
+ *                     associated with dialog, @a remote_tag must match
  * @param remote_uri   ignored
  * @param local_tag    if non-NULL and there is local tag associated with leg,
  *                     it must math
@@ -4290,7 +4290,7 @@ nta_leg_t *nta_leg_by_dialog(nta_agent_t const *agent,
   else if (URL_IS_STRING(request_uri)) {
     /* accept a string as URL */
     to_be_freed = url = url_hdup(NULL, request_uri);
-  } 
+  }
   else {
     *url0 = *request_uri, url = url0;
   }
@@ -4305,10 +4305,10 @@ nta_leg_t *nta_leg_by_dialog(nta_agent_t const *agent,
   if (local_tag && local_tag[0] == '\0')
     local_tag = NULL;
 
-  leg = leg_find(agent, 
-                NULL, url, 
-                call_id, 
-                remote_tag, 
+  leg = leg_find(agent,
+                NULL, url,
+                call_id,
+                remote_tag,
                 local_tag);
 
   if (to_be_freed) su_free(NULL, to_be_freed);
@@ -4581,8 +4581,8 @@ leg_callback_default(nta_leg_magic_t *magic,
 HTABLE_BODIES_WITH(incoming_htable, iht, nta_incoming_t, HTABLE_HASH_IRQ,
                   size_t, hash_value_t);
 
-static void incoming_insert(nta_agent_t *agent, 
-                           incoming_queue_t *queue, 
+static void incoming_insert(nta_agent_t *agent,
+                           incoming_queue_t *queue,
                            nta_incoming_t *irq);
 
 su_inline int incoming_is_queued(nta_incoming_t const *irq);
@@ -4602,14 +4602,14 @@ su_inline nta_incoming_t
 su_inline int incoming_final_failed(nta_incoming_t *irq, msg_t *);
 static void incoming_retransmit_reply(nta_incoming_t *irq, tport_t *tport);
 
-/** Create a default server transaction. 
+/** Create a default server transaction.
  *
  * The default server transaction is used by a proxy to forward responses
  * statelessly.
  *
  * @param agent pointer to agent object
  *
- * @retval pointer to default server transaction object 
+ * @retval pointer to default server transaction object
  * @retval NULL if failed
  */
 nta_incoming_t *nta_incoming_default(nta_agent_t *agent)
@@ -4639,11 +4639,11 @@ nta_incoming_t *nta_incoming_default(nta_agent_t *agent)
 
   irq->irq_default = 1;
   agent->sa_default_incoming = irq;
-    
+
   return irq;
 }
 
-/** Create a server transaction. 
+/** Create a server transaction.
  *
  * Create a server transaction for a request message. This function is used
  * when an element processing requests statelessly wants to process a
@@ -4660,10 +4660,10 @@ nta_incoming_t *nta_incoming_default(nta_agent_t *agent)
  * function fails.
  *
  * @TAGS
- * @TAG NTATAG_TPORT() specifies the transport used to receive the request 
+ * @TAG NTATAG_TPORT() specifies the transport used to receive the request
  *      and also default transport for sending the response.
  *
- * @retval nta_incoming_t pointer to the newly created server transaction 
+ * @retval nta_incoming_t pointer to the newly created server transaction
  * @retval NULL if failed
  */
 nta_incoming_t *nta_incoming_create(nta_agent_t *agent,
@@ -4690,9 +4690,9 @@ nta_incoming_t *nta_incoming_create(nta_agent_t *agent,
     return msg_destroy(msg), NULL;
 
   ta_start(ta, tag, value);
-  
-  tl_gets(ta_args(ta), 
-         NTATAG_TPORT_REF(tport), 
+
+  tl_gets(ta_args(ta),
+         NTATAG_TPORT_REF(tport),
          TAG_END());
   ta_end(ta);
 
@@ -4727,7 +4727,7 @@ nta_incoming_t *incoming_create(nta_agent_t *agent,
     incoming_queue_t *queue;
     sip_method_t method = sip->sip_request->rq_method;
 
-    irq->irq_request = msg; 
+    irq->irq_request = msg;
     irq->irq_home = home = msg_home(msg_ref_create(msg));
     irq->irq_agent = agent;
 
@@ -4751,7 +4751,7 @@ nta_incoming_t *incoming_create(nta_agent_t *agent,
     case sip_method_publish:
       break;
     default:
-      irq->irq_record_route = 
+      irq->irq_record_route =
        sip_record_route_copy(home, sip->sip_record_route);
     }
     irq->irq_branch  = sip->sip_via->v_branch;
@@ -4807,7 +4807,7 @@ nta_incoming_t *incoming_create(nta_agent_t *agent,
       else {
        queue = agent->sa_in.completed; /* Timer J */
       }
-    } 
+    }
     else {
       queue = agent->sa_in.proceeding;
        /* RFC 4320 (nit-actions-03):
@@ -4822,7 +4822,7 @@ nta_incoming_t *incoming_create(nta_agent_t *agent,
    period of time in which Timer E reaches T2 had this been a UDP hop is
    one reasonable compromise.
 
-        */     
+        */
       if (agent->sa_extra_100 && irq->irq_reliable_tp)
        incoming_set_timer(irq, agent->sa_t2 / 2); /* T2 / 2 */
 
@@ -4841,7 +4841,7 @@ nta_incoming_t *incoming_create(nta_agent_t *agent,
  * Insert incoming transaction to hash table.
  */
 static void
-incoming_insert(nta_agent_t *agent, 
+incoming_insert(nta_agent_t *agent,
                incoming_queue_t *queue,
                nta_incoming_t *irq)
 {
@@ -4867,8 +4867,8 @@ int incoming_callback(nta_leg_t *leg, nta_incoming_t *irq, sip_t *sip)
   char const *method_name = sip->sip_request->rq_method_name;
 
   /* RFC-3261 section 12.2.2 (page 76) */
-  if (leg->leg_dialog && 
-      irq->irq_agent->sa_is_a_uas && 
+  if (leg->leg_dialog &&
+      irq->irq_agent->sa_is_a_uas &&
       method != sip_method_ack) {
     uint32_t seq = sip->sip_cseq->cs_seq;
 
@@ -4920,8 +4920,8 @@ incoming_queue_init(incoming_queue_t *queue, unsigned timeout)
 
 /** Change the timeout value of a queue */
 static void
-incoming_queue_adjust(nta_agent_t *sa, 
-                     incoming_queue_t *queue, 
+incoming_queue_adjust(nta_agent_t *sa,
+                     incoming_queue_t *queue,
                      uint32_t timeout)
 {
   nta_incoming_t *irq;
@@ -4950,13 +4950,13 @@ int incoming_is_queued(nta_incoming_t const *irq)
 }
 
 /** @internal
- * Insert an incoming transaction into a queue. 
+ * Insert an incoming transaction into a queue.
  *
  * Insert a server transaction into a queue, and sets the corresponding
  * timeout at the same time.
  */
 su_inline
-void incoming_queue(incoming_queue_t *queue, 
+void incoming_queue(incoming_queue_t *queue,
                    nta_incoming_t *irq)
 {
   if (irq->irq_queue == queue) {
@@ -4972,7 +4972,7 @@ void incoming_queue(incoming_queue_t *queue,
   irq->irq_timeout = set_timeout(irq->irq_agent, queue->q_timeout);
 
   irq->irq_queue = queue;
-  irq->irq_prev = queue->q_tail; 
+  irq->irq_prev = queue->q_tail;
   *queue->q_tail = irq;
   queue->q_tail = &irq->irq_next;
   queue->q_length++;
@@ -5003,7 +5003,7 @@ su_inline
 void incoming_set_timer(nta_incoming_t *irq, uint32_t interval)
 {
   nta_incoming_t **rq;
-  
+
   assert(irq);
 
   if (interval == 0) {
@@ -5012,7 +5012,7 @@ void incoming_set_timer(nta_incoming_t *irq, uint32_t interval)
   }
 
   if (irq->irq_rprev) {
-    if ((*irq->irq_rprev = irq->irq_rnext)) 
+    if ((*irq->irq_rprev = irq->irq_rnext))
       irq->irq_rnext->irq_rprev = irq->irq_rprev;
     if (irq->irq_agent->sa_in.re_t1 == &irq->irq_rnext)
       irq->irq_agent->sa_in.re_t1 = irq->irq_rprev;
@@ -5044,12 +5044,12 @@ su_inline
 void incoming_reset_timer(nta_incoming_t *irq)
 {
   if (irq->irq_rprev) {
-    if ((*irq->irq_rprev = irq->irq_rnext)) 
+    if ((*irq->irq_rprev = irq->irq_rnext))
       irq->irq_rnext->irq_rprev = irq->irq_rprev;
     if (irq->irq_agent->sa_in.re_t1 == &irq->irq_rnext)
       irq->irq_agent->sa_in.re_t1 = irq->irq_rprev;
     irq->irq_agent->sa_in.re_length--;
-  } 
+  }
 
   irq->irq_interval = 0, irq->irq_retry = 0;
   irq->irq_rnext = NULL, irq->irq_rprev = NULL;
@@ -5121,11 +5121,11 @@ void incoming_reclaim(nta_incoming_t *irq)
 
   su_free(home, irq);
 
-  msg_destroy((msg_t *)home); 
+  msg_destroy((msg_t *)home);
 }
 
 /** Queue request to be freed */
-su_inline 
+su_inline
 void incoming_free_queue(incoming_queue_t *q, nta_incoming_t *irq)
 {
   incoming_cut_off(irq);
@@ -5133,7 +5133,7 @@ void incoming_free_queue(incoming_queue_t *q, nta_incoming_t *irq)
 }
 
 /** Reclaim memory used by queue of requests */
-static 
+static
 void incoming_reclaim_queued(su_root_magic_t *rm,
                             su_msg_r msg,
                             union sm_arg_u *u)
@@ -5322,7 +5322,7 @@ nta_incoming_magic_t *nta_incoming_magic(nta_incoming_t *irq,
   return irq && irq->irq_callback == callback ? irq->irq_magic : NULL;
 }
 
-/** When received. 
+/** When received.
  *
  * Return timestamp from the reception of the initial request.
  *
@@ -5395,15 +5395,15 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,
       continue;
 
     if (is_uas_ack &&
-       irq->irq_method == sip_method_invite && 
+       irq->irq_method == sip_method_invite &&
        200 <= irq->irq_status && irq->irq_status < 300 &&
        str0casecmp(irq->irq_tag, to->a_tag) == 0) {
       *return_ack = irq;
-      return NULL;             
+      return NULL;
     }
 
     if (magic_branch) {
-      /* RFC3261 17.2.3: 
+      /* RFC3261 17.2.3:
        *
        * The request matches a transaction if branch and sent-by in topmost
        * the method of the request matches the one that created the
@@ -5415,8 +5415,8 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,
          strcasecmp(irq->irq_via->v_branch + 7, magic_branch) == 0 &&
          strcasecmp(irq->irq_via->v_host, v->v_host) == 0 &&
          str0cmp(irq->irq_via->v_port, v->v_port) == 0) {
-       if (irq->irq_method == cseq->cs_method && 
-           strcmp(irq->irq_cseq->cs_method_name, 
+       if (irq->irq_method == cseq->cs_method &&
+           strcmp(irq->irq_cseq->cs_method_name,
                   cseq->cs_method_name) == 0)
          return irq;
        if (return_ack && irq->irq_method == sip_method_invite)
@@ -5428,8 +5428,8 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,
     else {
       /* No magic branch */
 
-      /* INVITE request matches a transaction if 
-        the Request-URI, To tag, From tag, Call-ID, CSeq, and 
+      /* INVITE request matches a transaction if
+        the Request-URI, To tag, From tag, Call-ID, CSeq, and
         top Via header match */
 
       /* From tag, Call-ID, and CSeq number has been matched above */
@@ -5445,7 +5445,7 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,
       else {
        /* Match CSeq */
        if (irq->irq_method == cseq->cs_method &&
-           strcmp(irq->irq_cseq->cs_method_name, 
+           strcmp(irq->irq_cseq->cs_method_name,
                   cseq->cs_method_name) == 0) {
          /* Match To tag  */
          if (!str0casecmp(irq->irq_to->a_tag, to->a_tag))
@@ -5462,12 +5462,12 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,
        else if (return_cancel && irq->irq_method != sip_method_ack)
          return *return_cancel = irq, NULL;
       }
-    }    
+    }
 
     /* RFC3261 - section 8.2.2.2 Merged Requests */
     if (return_merge) {
-      if (irq->irq_cseq->cs_method == cseq->cs_method && 
-         strcmp(irq->irq_cseq->cs_method_name, 
+      if (irq->irq_cseq->cs_method == cseq->cs_method &&
+         strcmp(irq->irq_cseq->cs_method_name,
                 cseq->cs_method_name) == 0)
        *return_merge = irq, return_merge = NULL;
     }
@@ -5478,7 +5478,7 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,
 
 /** Process retransmitted requests. */
 su_inline
-int 
+int
 incoming_recv(nta_incoming_t *irq, msg_t *msg, sip_t *sip, tport_t *tport)
 {
   nta_agent_t *agent = irq->irq_agent;
@@ -5543,7 +5543,7 @@ int incoming_ack(nta_incoming_t *irq, msg_t *msg, sip_t *sip, tport_t *tport)
   } else if (irq->irq_queue == agent->sa_in.proceeding ||
             irq->irq_queue == agent->sa_in.preliminary)
     return -1;
-  else 
+  else
     assert(irq->irq_queue == agent->sa_in.inv_confirmed ||
           irq->irq_queue == agent->sa_in.terminated);
 
@@ -5560,7 +5560,7 @@ int incoming_cancel(nta_incoming_t *irq, msg_t *msg, sip_t *sip,
   nta_agent_t *agent = irq->irq_agent;
 
   /* According to the RFC 3261, this INVITE has been destroyed */
-  if (irq->irq_method == sip_method_invite && 
+  if (irq->irq_method == sip_method_invite &&
       200 <= irq->irq_status && irq->irq_status < 300) {
     mreply(agent, NULL, SIP_481_NO_TRANSACTION, msg,
           tport, 0, 0, NULL,
@@ -5600,7 +5600,7 @@ int incoming_cancel(nta_incoming_t *irq, msg_t *msg, sip_t *sip,
 
 /** Merge request */
 static
-void request_merge(nta_agent_t *agent, 
+void request_merge(nta_agent_t *agent,
                   msg_t *msg, sip_t *sip, tport_t *tport,
                   char const *to_tag)
 {
@@ -5671,7 +5671,7 @@ int nta_incoming_set_params(nta_incoming_t *irq,
                            tag_type_t tag, tag_value_t value, ...)
 {
   int retval = -1;
-  
+
   if (irq) {
     ta_list ta;
     ta_start(ta, tag, value);
@@ -5698,15 +5698,15 @@ int incoming_set_params(nta_incoming_t *irq, tagi_t const *tags)
     return retval;
 
   for (t = tags; t; t = tl_next(t)) {
-    tag_type_t tt = t->t_tag; 
+    tag_type_t tt = t->t_tag;
 
-    if (ntatag_comp == tt) 
+    if (ntatag_comp == tt)
       comp = (char const *)t->t_value, retval++;
 
     else if (ntatag_sigcomp_close == tt)
       irq->irq_sigcomp_zap = t->t_value != 0, retval++;
 
-    else if (tptag_compartment == tt) 
+    else if (tptag_compartment == tt)
       cc = (void *)t->t_value, retval++;
   }
 
@@ -5725,7 +5725,7 @@ int incoming_set_params(nta_incoming_t *irq, tagi_t const *tags)
     irq->irq_tpn->tpn_comp = NULL;
   }
 
-  return retval; 
+  return retval;
 }
 
 su_inline
@@ -5735,17 +5735,17 @@ int incoming_set_compartment(nta_incoming_t *irq, tport_t *tport, msg_t *msg,
   if (!nta_compressor_vtable)
     return 0;
 
-  if (irq->irq_cc == NULL 
+  if (irq->irq_cc == NULL
       || irq->irq_tpn->tpn_comp
       || tport_delivered_with_comp(tport, msg, NULL) != -1) {
     struct sigcomp_compartment *cc;
 
     cc = agent_compression_compartment(irq->irq_agent, tport, irq->irq_tpn,
                                       create_if_needed);
-    
+
     if (cc)
       agent_accept_compressed(irq->irq_agent, msg, cc);
-    
+
     irq->irq_cc = cc;
   }
 
@@ -5753,7 +5753,7 @@ int incoming_set_compartment(nta_incoming_t *irq, tport_t *tport, msg_t *msg,
 }
 
 /** Add essential headers to the response message */
-static int nta_incoming_response_headers(nta_incoming_t *irq, 
+static int nta_incoming_response_headers(nta_incoming_t *irq,
                                         msg_t *msg,
                                         sip_t *sip)
 {
@@ -5789,13 +5789,13 @@ static int nta_incoming_response_headers(nta_incoming_t *irq,
  * @param tag,value,... taged argument list
  *
  * Generate status structure based on @a status and @a phrase.
- * Add essential headers to the response message: 
- * @From, @To, @CallID, @CSeq, @Via, and optionally 
+ * Add essential headers to the response message:
+ * @From, @To, @CallID, @CSeq, @Via, and optionally
  * @RecordRoute.
  */
 int nta_incoming_complete_response(nta_incoming_t *irq,
                                   msg_t *msg,
-                                  int status, 
+                                  int status,
                                   char const *phrase,
                                   tag_type_t tag, tag_value_t value, ...)
 {
@@ -5866,7 +5866,7 @@ msg_t *nta_incoming_create_response(nta_incoming_t *irq,
     if (nta_incoming_response_headers(irq, msg, sip) < 0)
       msg_destroy(msg), msg = NULL;
   }
-  
+
   return msg;
 }
 
@@ -5932,7 +5932,7 @@ int nta_incoming_treply(nta_incoming_t *irq,
  * @retval 0 when succesful
  * @retval -1 upon an error
  */
-int nta_incoming_mreply(nta_incoming_t *irq, msg_t *msg) 
+int nta_incoming_mreply(nta_incoming_t *irq, msg_t *msg)
 {
   sip_t *sip = sip_object(msg);
 
@@ -5998,12 +5998,12 @@ int incoming_reply(nta_incoming_t *irq, msg_t *msg, sip_t *sip)
   int retry_without_rport = 0;
   tp_name_t *tpn, default_tpn[1];
 
-  if (status == 408 && 
-      irq->irq_method != sip_method_invite && 
+  if (status == 408 &&
+      irq->irq_method != sip_method_invite &&
       !agent->sa_pass_408 &&
       !irq->irq_default) {
     /* RFC 4320 nit-actions-03 Action 2:
-       
+
    A transaction-stateful SIP element MUST NOT send a response with
    Status-Code of 408 to a non-INVITE request.  As a consequence, an
    element that can not respond before the transaction expires will not
@@ -6063,7 +6063,7 @@ int incoming_reply(nta_incoming_t *irq, msg_t *msg, sip_t *sip)
        SU_DEBUG_5(("%s: tport_tsend: %s%s\n",
                    __func__, su_strerror(err),
                    err == EPIPE ? "(retrying)" : ""));
-       
+
        if (err != EPIPE && err != ECONNREFUSED)
          break;
        tport_decref(&irq->irq_tport);
@@ -6099,13 +6099,13 @@ int incoming_reply(nta_incoming_t *irq, msg_t *msg, sip_t *sip)
 
     if (status < 200) {
       queue = agent->sa_in.proceeding;
-      
-      if (irq->irq_method == sip_method_invite && status > 100 && 
+
+      if (irq->irq_method == sip_method_invite && status > 100 &&
          agent->sa_progress != UINT_MAX && agent->sa_is_a_uas) {
        /* Retransmit preliminary responses in regular intervals */
        incoming_set_timer(irq, agent->sa_progress); /* N2 */
       }
-    } 
+    }
     else {
       irq->irq_completed = 1;
 
@@ -6126,7 +6126,7 @@ int incoming_reply(nta_incoming_t *irq, msg_t *msg, sip_t *sip)
        tport_decref(&irq->irq_tport);
       }
       else if (status >= 300 || agent->sa_is_a_uas) {
-       if (status < 300 || !irq->irq_reliable_tp) 
+       if (status < 300 || !irq->irq_reliable_tp)
          incoming_set_timer(irq, agent->sa_t1); /* G */
        queue = agent->sa_in.inv_completed; /* H */
       }
@@ -6175,7 +6175,7 @@ int incoming_reply(nta_incoming_t *irq, msg_t *msg, sip_t *sip)
   }
 
   /* We could not send final response. */
-  return incoming_final_failed(irq, msg); 
+  return incoming_final_failed(irq, msg);
 }
 
 
@@ -6213,20 +6213,20 @@ void incoming_retransmit_reply(nta_incoming_t *irq, tport_t *tport)
     msg = reliable_response(irq);
   else
     msg = irq->irq_response;
-  
+
   if (msg && tport) {
     irq->irq_retries++;
 
     if (irq->irq_retries == 2 && irq->irq_tpn->tpn_comp) {
       irq->irq_tpn->tpn_comp = NULL;
-      
+
       if (irq->irq_cc) {
        agent_close_compressor(irq->irq_agent, irq->irq_cc);
        nta_compartment_decref(&irq->irq_cc);
       }
     }
 
-    tport = tport_tsend(tport, msg, irq->irq_tpn, 
+    tport = tport_tsend(tport, msg, irq->irq_tpn,
                        IF_SIGCOMP_TPTAG_COMPARTMENT(irq->irq_cc)
                        TPTAG_MTU(INT_MAX), TAG_END());
     irq->irq_agent->sa_stats->as_sent_msg++;
@@ -6263,11 +6263,11 @@ static void incoming_timer(nta_agent_t *sa)
   uint32_t now = sa->sa_millisec;
   nta_incoming_t *irq, *irq_next;
   size_t retransmitted = 0, timeout = 0, terminated = 0, destroyed = 0;
-  size_t unconfirmed = 
-    sa->sa_in.inv_completed->q_length + 
+  size_t unconfirmed =
+    sa->sa_in.inv_completed->q_length +
     sa->sa_in.preliminary->q_length;
-  size_t unterminated = 
-    sa->sa_in.inv_confirmed->q_length + 
+  size_t unterminated =
+    sa->sa_in.inv_confirmed->q_length +
     sa->sa_in.completed->q_length;
   size_t total = sa->sa_incoming->iht_used;
 
@@ -6297,7 +6297,7 @@ static void incoming_timer(nta_agent_t *sa)
        incoming_set_timer(irq, 2U * irq->irq_interval); /* G */
       else
        incoming_set_timer(irq, sa->sa_t2); /* G */
-    } 
+    }
     else if (irq->irq_method == sip_method_invite && irq->irq_status >= 100) {
       if (irq->irq_queue == sa->sa_in.preliminary) {
        /* Timer P1 - PRACK timer */
@@ -6352,7 +6352,7 @@ static void incoming_timer(nta_agent_t *sa)
   }
 
   /* Timeouts.
-   * For each state the request is in, there is always a queue of its own 
+   * For each state the request is in, there is always a queue of its own
    */
   while ((irq = sa->sa_in.preliminary->q_head)) {
     assert(irq->irq_status < 200);
@@ -6379,7 +6379,7 @@ static void incoming_timer(nta_agent_t *sa)
     assert(irq->irq_method == sip_method_invite);
 
     if ((int32_t)(irq->irq_timeout - now) > 0 ||
-       timeout >= timer_max_timeout || 
+       timeout >= timer_max_timeout ||
        terminated >= timer_max_terminate)
       break;
 
@@ -6390,7 +6390,7 @@ static void incoming_timer(nta_agent_t *sa)
     irq->irq_terminated = 1;
     incoming_reset_timer(irq);
     if (!irq->irq_destroyed) {
-      timeout++; 
+      timeout++;
       incoming_queue(sa->sa_in.terminated, irq);
       /* report timeout error to user */
       incoming_call_callback(irq, NULL, NULL);
@@ -6399,7 +6399,7 @@ static void incoming_timer(nta_agent_t *sa)
       terminated++;
       incoming_free_queue(rq, irq);
     }
-  } 
+  }
 
   while ((irq = sa->sa_in.inv_confirmed->q_head)) {
     assert(irq->irq_timeout);
@@ -6409,7 +6409,7 @@ static void incoming_timer(nta_agent_t *sa)
     if ((int32_t)(irq->irq_timeout - now) > 0 ||
        terminated >= timer_max_terminate)
       break;
-    
+
     /* Timer I */
     SU_DEBUG_5(("nta: timer %s fired, %s %u response\n",
                "I", "terminate", irq->irq_status));
@@ -6460,9 +6460,9 @@ static void incoming_timer(nta_agent_t *sa)
                MOD_ZU"/"MOD_ZU" tout, "
                MOD_ZU"/"MOD_ZU" term, "
                MOD_ZU"/"MOD_ZU" free\n",
-               retransmitted, unconfirmed, 
+               retransmitted, unconfirmed,
                timeout, unconfirmed,
-               terminated, unterminated, 
+               terminated, unterminated,
                destroyed, total));
 }
 
@@ -6486,8 +6486,8 @@ size_t incoming_mass_destroy(nta_agent_t *sa, incoming_queue_t *q)
 
       if (su_msg_send(m) == SU_SUCCESS)
        q->q_length = 0;
-    }    
-  } 
+    }
+  }
 
   if (q->q_length > 0)
     incoming_reclaim_queued(NULL, NULL, (void *)q);
@@ -6513,25 +6513,25 @@ static void outgoing_try_tcp_instead(nta_outgoing_t *orq);
 static void outgoing_try_udp_instead(nta_outgoing_t *orq);
 static void outgoing_tport_error(nta_agent_t *agent, nta_outgoing_t *orq,
                                 tport_t *tp, msg_t *msg, int error);
-static void outgoing_print_tport_error(nta_outgoing_t *orq, 
+static void outgoing_print_tport_error(nta_outgoing_t *orq,
                                       int level, char *todo,
                                       tp_name_t const *, msg_t *, int error);
 static void outgoing_insert(nta_agent_t *sa, nta_outgoing_t *orq);
 static void outgoing_destroy(nta_outgoing_t *orq);
 su_inline int outgoing_is_queued(nta_outgoing_t const *orq);
-su_inline void outgoing_queue(outgoing_queue_t *queue, 
+su_inline void outgoing_queue(outgoing_queue_t *queue,
                                  nta_outgoing_t *orq);
 su_inline void outgoing_remove(nta_outgoing_t *orq);
 su_inline void outgoing_set_timer(nta_outgoing_t *orq, uint32_t interval);
 su_inline void outgoing_reset_timer(nta_outgoing_t *orq);
-static size_t outgoing_timer_dk(outgoing_queue_t *q, 
-                               char const *timer, 
+static size_t outgoing_timer_dk(outgoing_queue_t *q,
+                               char const *timer,
                                uint32_t now);
-static size_t outgoing_timer_bf(outgoing_queue_t *q, 
-                               char const *timer, 
+static size_t outgoing_timer_bf(outgoing_queue_t *q,
+                               char const *timer,
                                uint32_t now);
-static size_t outgoing_timer_c(outgoing_queue_t *q, 
-                              char const *timer, 
+static size_t outgoing_timer_c(outgoing_queue_t *q,
+                              char const *timer,
                               uint32_t now);
 
 static void outgoing_ack(nta_outgoing_t *orq, sip_t *sip);
@@ -6563,13 +6563,13 @@ static int outgoing_other_destinations(nta_outgoing_t const *orq);
 static int outgoing_try_another(nta_outgoing_t *orq);
 #else
 #define outgoing_other_destinations(orq) (0)
-#define outgoing_try_another(orq) (0) 
+#define outgoing_try_another(orq) (0)
 #endif
 
 /** Create a default outgoing transaction.
  *
  * The default outgoing transaction is used when agent receives responses
- * not belonging to any transaction. 
+ * not belonging to any transaction.
  *
  * @sa nta_leg_default(), nta_incoming_default().
  */
@@ -6588,7 +6588,7 @@ nta_outgoing_t *nta_outgoing_default(nta_agent_t *agent,
   orq = su_zalloc(agent->sa_home, sizeof *orq);
   if (!orq)
     return NULL;
-    
+
   orq->orq_agent     = agent;
   orq->orq_callback  = callback;
   orq->orq_magic     = magic;
@@ -6637,7 +6637,7 @@ nta_outgoing_t *nta_outgoing_default(nta_agent_t *agent,
  * NTATAG_STATELESS(), NTATAG_DELAY_SENDING(), NTATAG_BRANCH_KEY(),
  * NTATAG_ACK_BRANCH(), NTATAG_DEFAULT_PROXY(), NTATAG_PASS_100(),
  * NTATAG_USE_TIMESTAMP(), NTATAG_USER_VIA(), TPTAG_IDENT(), NTATAG_TPORT(). All
- * SIP tags from <sofia-sip/sip_tag.h> can be used to manipulate the request message. 
+ * SIP tags from <sofia-sip/sip_tag.h> can be used to manipulate the request message.
  * SIP tags after SIPTAG_END() are ignored, however.
  */
 nta_outgoing_t *nta_outgoing_tcreate(nta_leg_t *leg,
@@ -6710,7 +6710,7 @@ nta_outgoing_t *nta_outgoing_tcreate(nta_leg_t *leg,
  * Returns a pointer to newly created outgoing transaction object if
  * successful, and NULL otherwise.
  *
- * @note The caller is responsible for destroying the request message @a msg 
+ * @note The caller is responsible for destroying the request message @a msg
  * upon failure.
  *
  * @note If NTATAG_STATELESS(1) tag is given and the @a callback is NULL,
@@ -6725,7 +6725,7 @@ nta_outgoing_t *nta_outgoing_tcreate(nta_leg_t *leg,
  * NTATAG_STATELESS(), NTATAG_DELAY_SENDING(), NTATAG_BRANCH_KEY(),
  * NTATAG_ACK_BRANCH(), NTATAG_DEFAULT_PROXY(), NTATAG_PASS_100(),
  * NTATAG_USE_TIMESTAMP(), NTATAG_USER_VIA(), TPTAG_IDENT(), NTATAG_TPORT(). All
- * SIP tags from <sofia-sip/sip_tag.h> can be used to manipulate the request message. 
+ * SIP tags from <sofia-sip/sip_tag.h> can be used to manipulate the request message.
  * SIP tags after SIPTAG_END() are ignored, however.
  */
 nta_outgoing_t *nta_outgoing_mcreate(nta_agent_t *agent,
@@ -6836,8 +6836,8 @@ nta_outgoing_t *nta_outgoing_tcancel(nta_outgoing_t *orq,
 
   ta_start(ta, tag, value);
 
-  tl_gets(ta_args(ta), 
-         NTATAG_CANCEL_408_REF(cancel_408), 
+  tl_gets(ta_args(ta),
+         NTATAG_CANCEL_408_REF(cancel_408),
          NTATAG_CANCEL_2543_REF(cancel_2543),
          TAG_END());
 
@@ -6848,7 +6848,7 @@ nta_outgoing_t *nta_outgoing_tcancel(nta_outgoing_t *orq,
 
   ta_end(ta);
 
-  if ((cancel_2543 || cancel_408) && 
+  if ((cancel_2543 || cancel_408) &&
       !orq->orq_stateless && !orq->orq_destroyed)
     outgoing_reply(orq, SIP_487_REQUEST_CANCELLED, 1);
 
@@ -6880,7 +6880,7 @@ nta_outgoing_t *nta_outgoing_tcancel(nta_outgoing_t *orq,
  *
  * @param orq       outgoing client transaction
  * @param callback  callback function (may be NULL)
- * @param magic     application context pointer 
+ * @param magic     application context pointer
  *                  (given as argument to @a callback)
  *
  * @NEW_1_12_9
@@ -6912,7 +6912,7 @@ void nta_outgoing_destroy(nta_outgoing_t *orq)
     return;
 
   if (orq->orq_destroyed) {
-    SU_DEBUG_1(("%s(%p): %s\n", "nta_outgoing_destroy", (void *)orq, 
+    SU_DEBUG_1(("%s(%p): %s\n", "nta_outgoing_destroy", (void *)orq,
                "already destroyed"));
     return;
   }
@@ -6948,7 +6948,7 @@ char const *nta_outgoing_method_name(nta_outgoing_t const *orq)
  */
 uint32_t nta_outgoing_cseq(nta_outgoing_t const *orq)
 {
-  return orq != NULL && orq != NONE && orq->orq_cseq 
+  return orq != NULL && orq != NONE && orq->orq_cseq
     ? orq->orq_cseq->cs_seq : 0;
 }
 
@@ -6958,7 +6958,7 @@ uint32_t nta_outgoing_cseq(nta_outgoing_t const *orq)
 int nta_outgoing_status(nta_outgoing_t const *orq)
 {
   /* Return 500 Internal server error for invalid handles. */
-  return orq != NULL && orq != NONE ? orq->orq_status : 500; 
+  return orq != NULL && orq != NONE ? orq->orq_status : 500;
 }
 
 /** Get the RTT delay measured using @Timestamp header. */
@@ -7028,7 +7028,7 @@ msg_t *nta_outgoing_getrequest(nta_outgoing_t *orq)
  * @param route_url   optional URL used to route transaction requests
  * @param msg         request message
  * @param tpn         (optional) transport name
- * @param msg         request message to 
+ * @param msg         request message to
  * @param tag, value, ... tagged arguments
  *
  * @return
@@ -7106,24 +7106,24 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
 
   /* tl_gets() is a bit too slow here... */
   for (t = ta_args(ta); t; t = tl_next(t)) {
-    tag_type_t tt = t->t_tag; 
-
-    if (ntatag_stateless == tt) 
-      stateless = t->t_value != 0; 
-    else if (ntatag_delay_sending == tt) 
-      delay_sending = t->t_value != 0; 
-    else if (ntatag_branch_key == tt) 
-      branch = (void *)t->t_value; 
-    else if (ntatag_pass_100 == tt) 
-      pass_100 = t->t_value != 0; 
-    else if (ntatag_use_timestamp == tt) 
-      use_timestamp = t->t_value != 0; 
-    else if (ntatag_user_via == tt) 
-      user_via = t->t_value != 0; 
-    else if (ntatag_ack_branch == tt) 
-      ack_branch = (void *)t->t_value; 
-    else if (ntatag_default_proxy == tt) 
-      route_url = (void *)t->t_value; 
+    tag_type_t tt = t->t_tag;
+
+    if (ntatag_stateless == tt)
+      stateless = t->t_value != 0;
+    else if (ntatag_delay_sending == tt)
+      delay_sending = t->t_value != 0;
+    else if (ntatag_branch_key == tt)
+      branch = (void *)t->t_value;
+    else if (ntatag_pass_100 == tt)
+      pass_100 = t->t_value != 0;
+    else if (ntatag_use_timestamp == tt)
+      use_timestamp = t->t_value != 0;
+    else if (ntatag_user_via == tt)
+      user_via = t->t_value != 0;
+    else if (ntatag_ack_branch == tt)
+      ack_branch = (void *)t->t_value;
+    else if (ntatag_default_proxy == tt)
+      route_url = (void *)t->t_value;
     else if (tptag_ident == tt)
       tp_ident = (void *)t->t_value;
     else if (ntatag_comp == tt)
@@ -7182,7 +7182,7 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
     invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port, route_url);
 
     if (override_tport) {      /* Use transport protocol name from transport  */
-      if (strcmp(orq->orq_tpn->tpn_proto, "*") == 0) 
+      if (strcmp(orq->orq_tpn->tpn_proto, "*") == 0)
        orq->orq_tpn->tpn_proto = tport_name(override_tport)->tpn_proto;
     }
 
@@ -7244,7 +7244,7 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
        orq->orq_branch = su_strdup(home, ack_branch);
       else
        orq->orq_branch = su_sprintf(home, "branch=%s", ack_branch);
-    } 
+    }
     else if (!stateless && agent->sa_is_a_uas) {
       /*
        * ACK redirect further 2XX messages to it.
@@ -7252,14 +7252,14 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
        * Use orq_branch from INVITE, but put a different branch in topmost Via.
        */
       nta_outgoing_t *invite = outgoing_find(agent, msg, sip, NULL);
-      
+
       if (invite) {
        sip_t const *inv = sip_object(invite->orq_request);
 
        orq->orq_branch = su_strdup(home, invite->orq_branch);
 
        /* @RFC3261 section 13.2.2.4 -
-        * The ACK MUST contain the same credentials as the INVITE. 
+        * The ACK MUST contain the same credentials as the INVITE.
         */
        if (!sip->sip_proxy_authorization && !sip->sip_authorization) {
          if (inv->sip_proxy_authorization)
@@ -7297,7 +7297,7 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
   agent->sa_stats->as_client_tr++;
   orq->orq_hash = NTA_HASH(sip->sip_call_id, sip->sip_cseq->cs_seq);
 
-  if (orq->orq_user_tport) 
+  if (orq->orq_user_tport)
     outgoing_send_via(orq, override_tport);
   else if (resolved)
     outgoing_prepare_send(orq);
@@ -7306,14 +7306,14 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent,
     outgoing_resolve(orq);
 #endif
 
-  if (stateless && 
-      orq->orq_status >= 200 && 
+  if (stateless &&
+      orq->orq_status >= 200 &&
       callback == outgoing_default_cb) {
     void *retval;
 
-    if (orq->orq_status < 300) 
+    if (orq->orq_status < 300)
       retval = (void *)-1;     /* NONE */
-    else 
+    else
       retval = NULL, orq->orq_request = NULL;
 
     outgoing_free(orq);
@@ -7365,7 +7365,7 @@ outgoing_prepare_send(nta_outgoing_t *orq)
     outgoing_reply(orq, 503, "No transport", 1);
   }
 }
-  
+
 /** Send request using given transport */
 static void
 outgoing_send_via(nta_outgoing_t *orq, tport_t *tp)
@@ -7471,7 +7471,7 @@ outgoing_send(nta_outgoing_t *orq, int retransmit)
       cc = orq->orq_cc, orq->orq_cc = NULL;
     }
     else {
-      cc = agent_compression_compartment(agent, orq->orq_tport, tpn, 
+      cc = agent_compression_compartment(agent, orq->orq_tport, tpn,
                                         orq->orq_sigcomp_new);
     }
 
@@ -7484,7 +7484,7 @@ outgoing_send(nta_outgoing_t *orq, int retransmit)
       orq->orq_pending = 0;
     }
 
-    tp = tport_tsend(orq->orq_tport, msg, tpn, 
+    tp = tport_tsend(orq->orq_tport, msg, tpn,
                     tag, value,
                     IF_SIGCOMP_TPTAG_COMPARTMENT(cc)
                     TAG_NEXT(orq->orq_tags));
@@ -7542,7 +7542,7 @@ outgoing_send(nta_outgoing_t *orq, int retransmit)
 
   if (orq->orq_pending) {
     assert(orq->orq_tport);
-    tport_release(orq->orq_tport, orq->orq_pending, 
+    tport_release(orq->orq_tport, orq->orq_pending,
                  orq->orq_request, NULL, orq, 0);
     orq->orq_pending = 0;
   }
@@ -7553,7 +7553,7 @@ outgoing_send(nta_outgoing_t *orq, int retransmit)
   }
 
   if (orq->orq_method != sip_method_ack) {
-    orq->orq_pending = tport_pend(tp, orq->orq_request, 
+    orq->orq_pending = tport_pend(tp, orq->orq_request,
                                  outgoing_tport_error, orq);
     if (orq->orq_pending < 0)
       orq->orq_pending = 0;
@@ -7636,7 +7636,7 @@ outgoing_try_udp_instead(nta_outgoing_t *orq)
   *tpn = *orq->orq_tpn;
   tpn->tpn_proto = "udp";
   orq->orq_try_udp_instead = 1;
-  
+
   tp = tport_by_name(orq->orq_agent->sa_tports, tpn);
   if (tp && tp != orq->orq_tport) {
     sip_t *sip = sip_object(orq->orq_request);
@@ -7663,14 +7663,14 @@ outgoing_tport_error(nta_agent_t *agent, nta_outgoing_t *orq,
 
   if (orq->orq_pending) {
     assert(orq->orq_tport);
-    tport_release(orq->orq_tport, orq->orq_pending, orq->orq_request, 
+    tport_release(orq->orq_tport, orq->orq_pending, orq->orq_request,
                  NULL, orq, 0);
     orq->orq_pending = 0;
   }
 
   if (error == EPIPE && orq->orq_retries++ == 0) {
     /* XXX - we should retry only if the transport is not newly created */
-    outgoing_print_tport_error(orq, 5, "retrying once after ", 
+    outgoing_print_tport_error(orq, 5, "retrying once after ",
                               tpn, msg, error);
     outgoing_send(orq, 1);
     return;
@@ -7678,7 +7678,7 @@ outgoing_tport_error(nta_agent_t *agent, nta_outgoing_t *orq,
   else if (error == ECONNREFUSED && orq->orq_try_tcp_instead) {
     /* RFC3261, 18.1.1 */
     if (strcasecmp(tpn->tpn_proto, "tcp") == 0 && msg_size(msg) <= 65535) {
-      outgoing_print_tport_error(orq, 5, "retrying with UDP after ", 
+      outgoing_print_tport_error(orq, 5, "retrying with UDP after ",
                                 tpn, msg, error);
       outgoing_try_udp_instead(orq);
       outgoing_remove(orq);    /* Reset state - this is no resend! */
@@ -7688,7 +7688,7 @@ outgoing_tport_error(nta_agent_t *agent, nta_outgoing_t *orq,
   }
 
   if (outgoing_other_destinations(orq)) {
-    outgoing_print_tport_error(orq, 5, "trying alternative server after ", 
+    outgoing_print_tport_error(orq, 5, "trying alternative server after ",
                               tpn, msg, error);
     outgoing_try_another(orq);
     return;
@@ -7707,11 +7707,11 @@ outgoing_print_tport_error(nta_outgoing_t *orq, int level, char *todo,
   su_sockaddr_t const *su = msg_addr(msg);
   char addr[SU_ADDRSIZE];
 
-  su_llog(nta_log, level, 
+  su_llog(nta_log, level,
          "nta: %s (%u): %s%s (%u) with %s/[%s]:%u\n",
          orq->orq_method_name, orq->orq_cseq->cs_seq,
-         todo, su_strerror(error), error, 
-         tpn->tpn_proto, 
+         todo, su_strerror(error), error,
+         tpn->tpn_proto,
          su_inet_ntop(su->su_family, SU_ADDR(su), addr, sizeof(addr)),
          htons(su->su_port));
 }
@@ -7791,8 +7791,8 @@ outgoing_queue_init(outgoing_queue_t *queue, unsigned timeout)
 
 /** Change the timeout value of a queue */
 static void
-outgoing_queue_adjust(nta_agent_t *sa, 
-                     outgoing_queue_t *queue, 
+outgoing_queue_adjust(nta_agent_t *sa,
+                     outgoing_queue_t *queue,
                      unsigned timeout)
 {
   nta_outgoing_t *orq;
@@ -7822,13 +7822,13 @@ int outgoing_is_queued(nta_outgoing_t const *orq)
 }
 
 /** @internal
- * Insert an outgoing transaction into a queue. 
+ * Insert an outgoing transaction into a queue.
  *
  * Insert a client transaction into a queue and set the corresponding
  * timeout at the same time.
  */
 su_inline
-void outgoing_queue(outgoing_queue_t *queue, 
+void outgoing_queue(outgoing_queue_t *queue,
                    nta_outgoing_t *orq)
 {
   if (orq->orq_queue == queue) {
@@ -7845,7 +7845,7 @@ void outgoing_queue(outgoing_queue_t *queue,
   orq->orq_timeout = set_timeout(orq->orq_agent, queue->q_timeout);
 
   orq->orq_queue = queue;
-  orq->orq_prev = queue->q_tail; 
+  orq->orq_prev = queue->q_tail;
   *queue->q_tail = orq;
   queue->q_tail = &orq->orq_next;
   queue->q_length++;
@@ -7880,7 +7880,7 @@ su_inline
 void outgoing_set_timer(nta_outgoing_t *orq, uint32_t interval)
 {
   nta_outgoing_t **rq;
-  
+
   assert(orq);
 
   if (interval == 0) {
@@ -7890,7 +7890,7 @@ void outgoing_set_timer(nta_outgoing_t *orq, uint32_t interval)
 
   if (orq->orq_rprev) {
     /* Remove transaction from retry dequeue, re-insert it later. */
-    if ((*orq->orq_rprev = orq->orq_rnext)) 
+    if ((*orq->orq_rprev = orq->orq_rnext))
       orq->orq_rnext->orq_rprev = orq->orq_rprev;
     if (orq->orq_agent->sa_out.re_t1 == &orq->orq_rnext)
       orq->orq_agent->sa_out.re_t1 = orq->orq_rprev;
@@ -7923,12 +7923,12 @@ su_inline
 void outgoing_reset_timer(nta_outgoing_t *orq)
 {
   if (orq->orq_rprev) {
-    if ((*orq->orq_rprev = orq->orq_rnext)) 
+    if ((*orq->orq_rprev = orq->orq_rnext))
       orq->orq_rnext->orq_rprev = orq->orq_rprev;
     if (orq->orq_agent->sa_out.re_t1 == &orq->orq_rnext)
       orq->orq_agent->sa_out.re_t1 = orq->orq_rprev;
     orq->orq_agent->sa_out.re_length--;
-  } 
+  }
 
   orq->orq_interval = 0, orq->orq_retry = 0;
   orq->orq_rnext = NULL, orq->orq_rprev = NULL;
@@ -7963,7 +7963,7 @@ void outgoing_cut_off(nta_outgoing_t *orq)
   outgoing_reset_timer(orq);
 
   if (orq->orq_pending) {
-    tport_release(orq->orq_tport, orq->orq_pending, 
+    tport_release(orq->orq_tport, orq->orq_pending,
                  orq->orq_request, NULL, orq, 0);
   }
   orq->orq_pending = 0;
@@ -7989,12 +7989,12 @@ void outgoing_reclaim(nta_outgoing_t *orq)
 #if HAVE_SOFIA_SRESOLV
   if (orq->orq_resolver)
     outgoing_destroy_resolver(orq);
-#endif  
+#endif
   su_free(orq->orq_agent->sa_home, orq);
 }
 
 /** Queue request to be freed */
-su_inline 
+su_inline
 void outgoing_free_queue(outgoing_queue_t *q, nta_outgoing_t *orq)
 {
   outgoing_cut_off(orq);
@@ -8002,7 +8002,7 @@ void outgoing_free_queue(outgoing_queue_t *q, nta_outgoing_t *orq)
 }
 
 /** Reclaim memory used by queue of requests */
-static 
+static
 void outgoing_reclaim_queued(su_root_magic_t *rm,
                             su_msg_r msg,
                             union sm_arg_u *u)
@@ -8050,7 +8050,7 @@ void outgoing_destroy(nta_outgoing_t *orq)
   }
 }
 
-/** @internal Outgoing transaction timer routine. 
+/** @internal Outgoing transaction timer routine.
  *
  */
 static void outgoing_timer(nta_agent_t *sa)
@@ -8061,9 +8061,9 @@ static void outgoing_timer(nta_agent_t *sa)
   size_t retransmitted = 0, terminated = 0, timeout = 0, destroyed;
   size_t total = sa->sa_outgoing->oht_used;
   size_t trying = sa->sa_out.re_length;
-  size_t pending = sa->sa_out.trying->q_length + 
+  size_t pending = sa->sa_out.trying->q_length +
     sa->sa_out.inv_calling->q_length;
-  size_t completed = sa->sa_out.completed->q_length + 
+  size_t completed = sa->sa_out.completed->q_length +
     sa->sa_out.inv_completed->q_length;
 
   outgoing_queue_init(sa->sa_out.free = rq, 0);
@@ -8082,7 +8082,7 @@ static void outgoing_timer(nta_agent_t *sa)
         * Timer N3: try to use UDP if trying to send via TCP
         * but no connection is established within SIP T4
         */
-       SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n", "N3", 
+       SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n", "N3",
                    "try UDP instead", orq->orq_method_name, orq->orq_cseq->cs_seq));
        outgoing_try_udp_instead(orq);
       }
@@ -8128,7 +8128,7 @@ static void outgoing_timer(nta_agent_t *sa)
                MOD_ZU"/"MOD_ZU" free\n",
                retransmitted, trying,
                timeout, pending,
-               terminated, completed, 
+               terminated, completed,
                destroyed, total));
   }
 }
@@ -8163,8 +8163,8 @@ void outgoing_trying(nta_outgoing_t *orq)
 
 /** Handle timers B and F */
 static
-size_t outgoing_timer_bf(outgoing_queue_t *q, 
-                        char const *timer, 
+size_t outgoing_timer_bf(outgoing_queue_t *q,
+                        char const *timer,
                         uint32_t now)
 {
   nta_outgoing_t *orq;
@@ -8176,9 +8176,9 @@ size_t outgoing_timer_bf(outgoing_queue_t *q,
       break;
 
     timeout++;
-    
+
     SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n",
-               timer, 
+               timer,
                orq->orq_method != sip_method_ack ? "timeout" : "terminating",
                orq->orq_method_name, orq->orq_cseq->cs_seq));
 
@@ -8195,8 +8195,8 @@ size_t outgoing_timer_bf(outgoing_queue_t *q,
 
 /** Handle timer C */
 static
-size_t outgoing_timer_c(outgoing_queue_t *q, 
-                       char const *timer, 
+size_t outgoing_timer_c(outgoing_queue_t *q,
+                       char const *timer,
                        uint32_t now)
 {
   nta_outgoing_t *orq;
@@ -8210,9 +8210,9 @@ size_t outgoing_timer_c(outgoing_queue_t *q,
       break;
 
     timeout++;
-    
+
     SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n",
-               timer, "CANCEL and timeout", 
+               timer, "CANCEL and timeout",
                orq->orq_method_name, orq->orq_cseq->cs_seq));
 
     nta_outgoing_tcancel(orq, NULL, NULL, TAG_NULL());
@@ -8246,7 +8246,7 @@ void outgoing_timeout(nta_outgoing_t *orq, uint32_t now)
     outgoing_timeout(cancel, now);
 }
 
-/** Complete a client transaction. 
+/** Complete a client transaction.
  *
  * @return True if transaction was free()d.
  */
@@ -8273,8 +8273,8 @@ int outgoing_complete(nta_outgoing_t *orq)
 
 /** Handle timers D and K */
 static
-size_t outgoing_timer_dk(outgoing_queue_t *q, 
-                        char const *timer, 
+size_t outgoing_timer_dk(outgoing_queue_t *q,
+                        char const *timer,
                         uint32_t now)
 {
   nta_outgoing_t *orq;
@@ -8292,7 +8292,7 @@ size_t outgoing_timer_dk(outgoing_queue_t *q,
 
     outgoing_terminate(orq);
   }
-  
+
   return terminated;
 }
 
@@ -8336,10 +8336,10 @@ size_t outgoing_mass_destroy(nta_agent_t *sa, outgoing_queue_t *q)
 
       if (su_msg_send(m) == SU_SUCCESS)
        q->q_length = 0;
-    }    
+    }
   }
-  
-  if (q->q_length) 
+
+  if (q->q_length)
     outgoing_reclaim_queued(NULL, NULL, (void*)q);
 
   return destroyed;
@@ -8349,7 +8349,7 @@ size_t outgoing_mass_destroy(nta_agent_t *sa, outgoing_queue_t *q)
  *
  * Return an outgoing request object based on a message and the @Via line
  * given as argument. This function is used when doing loop checking: if we
- * have sent the request and it has been routed back to us. 
+ * have sent the request and it has been routed back to us.
  *
  * @param agent
  * @param msg
@@ -8474,7 +8474,7 @@ int outgoing_recv(nta_outgoing_t *orq,
     else
       outgoing_reply(cancel, SIP_481_NO_TRANSACTION, 0);
 
-    if (status < 300 && orq->orq_destroyed && 
+    if (status < 300 && orq->orq_destroyed &&
        orq->orq_method == sip_method_invite) {
       outgoing_terminate(orq);      /* We can now kill transaction */
       if (status == 100) {
@@ -8486,7 +8486,7 @@ int outgoing_recv(nta_outgoing_t *orq,
   }
 
   if (orq->orq_pending) {
-    tport_release(orq->orq_tport, orq->orq_pending, orq->orq_request, 
+    tport_release(orq->orq_tport, orq->orq_pending, orq->orq_request,
                  msg, orq, status < 200);
     if (status >= 200)
       orq->orq_pending = 0;
@@ -8561,16 +8561,16 @@ int outgoing_recv(nta_outgoing_t *orq,
 
       if (status < 200) {
        /* @RFC3261 17.1.2.1:
-        * retransmissions continue for unreliable transports, 
-        * but at an interval of T2 
+        * retransmissions continue for unreliable transports,
+        * but at an interval of T2
         */
        if (!orq->orq_reliable)
          outgoing_set_timer(orq, sa->sa_t2);
-      } 
+      }
       else if (!outgoing_complete(orq)) {
        if (orq->orq_sigcomp_zap && orq->orq_tport && orq->orq_cc)
          agent_zap_compressor(orq->orq_agent, orq->orq_cc);
-      } 
+      }
       else /* outgoing_complete */ {
        msg_destroy(msg);
        return 0;
@@ -8772,7 +8772,7 @@ msg_t *outgoing_ackmsg(nta_outgoing_t *orq, sip_method_t m, char const *mname,
   if (tags) {
     sip_add_tl(msg, sip, TAG_NEXT(tags));
     /* Bug sf.net # 173323:
-     * Ensure that request-URI, topmost Via, From, To, Call-ID, CSeq, 
+     * Ensure that request-URI, topmost Via, From, To, Call-ID, CSeq,
      * Max-Forward, Route, Accept-Contact, Reject-Contact and
      * Request-Disposition are copied from original request
      */
@@ -8846,7 +8846,7 @@ int outgoing_reply(nta_outgoing_t *orq, int status, char const *phrase,
   assert(status == 202 || status >= 400);
 
   if (orq->orq_pending)
-    tport_release(orq->orq_tport, orq->orq_pending, 
+    tport_release(orq->orq_tport, orq->orq_pending,
                  orq->orq_request, NULL, orq, 0);
   orq->orq_pending = 0;
 
@@ -8861,7 +8861,7 @@ int outgoing_reply(nta_outgoing_t *orq, int status, char const *phrase,
       outgoing_trying(orq);    /* Timer F */
     return 0;
   }
-    
+
   if (orq->orq_destroyed) {
     if (orq->orq_status < 200)
       orq->orq_status = status;
@@ -8873,7 +8873,7 @@ int outgoing_reply(nta_outgoing_t *orq, int status, char const *phrase,
     ;
   else if (orq->orq_queue == NULL ||
           orq->orq_queue == orq->orq_agent->sa_out.resolving ||
-          orq->orq_queue == orq->orq_agent->sa_out.delayed) 
+          orq->orq_queue == orq->orq_agent->sa_out.delayed)
     outgoing_trying(orq);
 
   /** Insert a dummy Via header */
@@ -8886,7 +8886,7 @@ int outgoing_reply(nta_outgoing_t *orq, int status, char const *phrase,
   if (!orq->orq_stateless &&
       !(orq->orq_callback == outgoing_default_cb) &&
       !(status == 408 &&
-       orq->orq_method != sip_method_invite && 
+       orq->orq_method != sip_method_invite &&
        !orq->orq_agent->sa_timeout_408)) {
     char const *to_tag;
 
@@ -8895,7 +8895,7 @@ int outgoing_reply(nta_outgoing_t *orq, int status, char const *phrase,
     if (complete_response(msg, status, phrase, orq->orq_request) < 0) {
       assert(!"complete message");
       return -1;
-    } 
+    }
 
     sip = sip_object(msg); assert(sip->sip_flags & NTA_INTERNAL_MSG);
     to_tag = nta_agent_newtag(msg_home(msg), "tag=%s", agent);
@@ -9010,8 +9010,8 @@ struct sipdns_resolver
 
   uint16_t sr_a_aaaa1, sr_a_aaaa2;     /**< Order of A and/or AAAA queries. */
 
-  unsigned 
-    sr_use_naptr:1, 
+  unsigned
+    sr_use_naptr:1,
     sr_use_srv:1,
     sr_use_a_aaaa:1;
 };
@@ -9033,7 +9033,7 @@ struct sipdns_query
 
 static int outgoing_resolve_next(nta_outgoing_t *orq);
 static int outgoing_resolving(nta_outgoing_t *orq);
-static int outgoing_resolving_error(nta_outgoing_t *, 
+static int outgoing_resolving_error(nta_outgoing_t *,
                                    int status, char const *phrase);
 static void outgoing_graylist(nta_outgoing_t *orq, struct sipdns_query *sq);
 static int outgoing_query_naptr(nta_outgoing_t *orq, char const *domain);
@@ -9080,7 +9080,7 @@ outgoing_resolve(nta_outgoing_t *orq)
   if (!sr) {
     outgoing_resolving_error(orq, SIP_500_INTERNAL_SERVER_ERROR);
     return;
-  } 
+  }
 
   *sr->sr_tpn = *orq->orq_tpn;
   sr->sr_use_srv = orq->orq_agent->sa_use_srv;
@@ -9097,7 +9097,7 @@ outgoing_resolve(nta_outgoing_t *orq)
      an attempt should fail, based on the definition of failure in Section
      4.3, the next SHOULD be tried, and if that should fail, the next
      SHOULD be tried, and so on.
-     
+
      This is a change from RFC 2543.  Previously, if the port was
      explicit, but with a value of 5060, SRV records were used.  Now, A
      or AAAA records will be used.
@@ -9130,7 +9130,7 @@ outgoing_resolve(nta_outgoing_t *orq)
        if (strcasecmp(tpn->tpn_proto, sipdns_tports[j].name) == 0)
          break;
 
-      assert(j < SIPDNS_TRANSPORTS); 
+      assert(j < SIPDNS_TRANSPORTS);
       if (j == SIPDNS_TRANSPORTS)
        /* Someone added transport but did not update sipdns_tports */
        continue;
@@ -9142,7 +9142,7 @@ outgoing_resolve(nta_outgoing_t *orq)
       sr->sr_tports[i] = sipdns_tports + j;
 
       if (strcmp(tpname, "*")) /* Looking for only one transport */
-       break;  
+       break;
     }
 
     /* Nothing found */
@@ -9168,7 +9168,7 @@ outgoing_resolve(nta_outgoing_t *orq)
   case nta_res_ip4_only:
     sr->sr_a_aaaa1 = sres_type_a, sr->sr_a_aaaa2 = sres_type_a;
     break;
-  }    
+  }
 
   outgoing_resolve_next(orq);
 }
@@ -9219,7 +9219,7 @@ outgoing_resolve_next(nta_outgoing_t *orq)
     outgoing_make_a_aaaa_query(orq);   /* A/AAAA */
   else
     return outgoing_resolving_error(orq, SIPDNS_503_ERROR);
-  
+
   return 1;
 }
 
@@ -9232,7 +9232,7 @@ outgoing_other_destinations(nta_outgoing_t const *orq)
   if (!sr)
     return 0;
 
-  if (sr->sr_use_a_aaaa || sr->sr_use_srv || sr->sr_use_naptr) 
+  if (sr->sr_use_a_aaaa || sr->sr_use_srv || sr->sr_use_naptr)
     return 1;
 
   if (sr->sr_results && sr->sr_results[1])
@@ -9264,7 +9264,7 @@ outgoing_try_another(nta_outgoing_t *orq)
   else if (orq->orq_agent->sa_graylist == 0)
     /* PP: priority hacking disabled */
     ;
-  /* NetModule hack: 
+  /* NetModule hack:
    * Move server that did not work to end of queue in sres cache
    *
    * the next request does not try to use the server that is currently down
@@ -9296,18 +9296,18 @@ static void outgoing_graylist(nta_outgoing_t *orq, struct sipdns_query *sq)
 
   /* Don't know how to graylist but SRV records */
   if (sq->sq_otype != sres_type_srv)
-    return;                    
+    return;
 
   SU_DEBUG_5(("nta: graylisting %s:%s;transport=%s\n", target, sq->sq_port, proto));
 
-  for (sq = sr->sr_head; sq; sq = sq->sq_next) 
+  for (sq = sr->sr_head; sq; sq = sq->sq_next)
     if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
       maxprio = sq->sq_priority;
 
   for (sq = sr->sr_done; sq; sq = sq->sq_next)
     if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
       maxprio = sq->sq_priority;
-  
+
   for (sq = sr->sr_done; sq; sq = sq->sq_next) {
     int modified;
 
@@ -9316,8 +9316,8 @@ static void outgoing_graylist(nta_outgoing_t *orq, struct sipdns_query *sq)
 
     /* modify the SRV record(s) corresponding to the latest A/AAAA record */
     modified = sres_set_cached_srv_priority(
-      orq->orq_agent->sa_resolver, 
-      sq->sq_domain, 
+      orq->orq_agent->sa_resolver,
+      sq->sq_domain,
       target,
       sq->sq_port[0] ? (uint16_t)strtoul(sq->sq_port, NULL, 10) : 0,
       orq->orq_agent->sa_graylist,
@@ -9335,7 +9335,7 @@ static void outgoing_graylist(nta_outgoing_t *orq, struct sipdns_query *sq)
 su_inline void outgoing_cancel_resolver(nta_outgoing_t *orq)
 {
   struct sipdns_resolver *sr = orq->orq_resolver;
-  
+
   assert(orq->orq_resolver);
 
   if (sr->sr_query)    /* Cancel resolver query */
@@ -9362,12 +9362,12 @@ static
 int outgoing_resolving(nta_outgoing_t *orq)
 {
   struct sipdns_resolver *sr = orq->orq_resolver;
-  
+
   assert(orq->orq_resolver);
 
   if (!sr->sr_query) {
     return outgoing_resolving_error(orq, SIPDNS_503_ERROR);
-  } 
+  }
   else {
     outgoing_queue(orq->orq_agent->sa_out.resolving, orq);
     return 0;
@@ -9375,8 +9375,8 @@ int outgoing_resolving(nta_outgoing_t *orq)
 }
 
 /** Return 503 response */
-static 
-int outgoing_resolving_error(nta_outgoing_t *orq, int status, char const *phrase) 
+static
+int outgoing_resolving_error(nta_outgoing_t *orq, int status, char const *phrase)
 {
   orq->orq_resolved = 1;
   outgoing_reply(orq, status, phrase, 0);
@@ -9390,10 +9390,10 @@ int outgoing_make_srv_query(nta_outgoing_t *orq)
   struct sipdns_resolver *sr = orq->orq_resolver;
   su_home_t *home = msg_home(orq->orq_request);
   struct sipdns_query *sq;
-  char const *host; 
+  char const *host;
   int i;
   size_t hlen;
+
   sr->sr_use_srv = 0;
 
   host = sr->sr_tpn->tpn_host;
@@ -9553,19 +9553,19 @@ void outgoing_answer_naptr(sres_context_t *orq,
       break;
 
     /* Check if NAPTR matches our target */
-    if (strncasecmp(na->na_services, "SIP+", 4) && 
+    if (strncasecmp(na->na_services, "SIP+", 4) &&
        strncasecmp(na->na_services, "SIPS+", 5))
       /* Not a SIP/SIPS service */
       continue;
 
     /* Use NAPTR results, don't try extra SRV/A/AAAA records */
-    sr->sr_use_srv = 0, sr->sr_use_a_aaaa = 0;         
-    
+    sr->sr_use_srv = 0, sr->sr_use_a_aaaa = 0;
+
     /* Check if we have a transport mathing with service */
     for (j = 0; sr->sr_tports[j]; j++) {
       /*
-       * Syntax of services is actually more complicated 
-       * but comparing the values in the transport list 
+       * Syntax of services is actually more complicated
+       * but comparing the values in the transport list
        * match with those values that make any sense
        */
       if (strcasecmp(na->na_services, sr->sr_tports[j]->service) != 0)
@@ -9587,7 +9587,7 @@ void outgoing_answer_naptr(sres_context_t *orq,
     if (!sr->sr_tports[j])
       continue;
 
-    /* OK, we found matching NAPTR */ 
+    /* OK, we found matching NAPTR */
     order = na->na_order;
 
     /*
@@ -9608,7 +9608,7 @@ void outgoing_answer_naptr(sres_context_t *orq,
     if (sq == NULL)
       continue;
 
-    *tail = sq, tail = &sq->sq_next;    
+    *tail = sq, tail = &sq->sq_next;
     sq->sq_otype = sres_type_naptr;
     sq->sq_priority = na->na_prefer;
     sq->sq_weight = j;
@@ -9619,7 +9619,7 @@ void outgoing_answer_naptr(sres_context_t *orq,
 
   sres_free_answers(orq->orq_agent->sa_resolver, answers);
 
-  /* RFC2915: 
+  /* RFC2915:
      Preference [...] specifies the order in which NAPTR
      records with equal "order" values SHOULD be processed, low
      numbers being processed before high numbers. */
@@ -9646,7 +9646,7 @@ void outgoing_answer_naptr(sres_context_t *orq,
 
 /* Query SRV records */
 static
-int outgoing_query_srv(nta_outgoing_t *orq, 
+int outgoing_query_srv(nta_outgoing_t *orq,
                       struct sipdns_query *sq)
 {
   struct sipdns_resolver *sr = orq->orq_resolver;
@@ -9689,7 +9689,7 @@ outgoing_answer_srv(sres_context_t *orq, sres_query_t *q,
 
   sr->sr_query = NULL;
 
-  sq0 = sr->sr_current; 
+  sq0 = sr->sr_current;
   assert(sq0 && sq0->sq_type == sres_type_srv);
   assert(sq0->sq_domain); assert(sq0->sq_proto);
 
@@ -9761,8 +9761,8 @@ outgoing_answer_srv(sres_context_t *orq, sres_query_t *q,
   }
 
   /* This is not needed anymore (?) */
-  sr->sr_current = NULL; 
-  sq0->sq_next = sr->sr_done; sr->sr_done = sq0; 
+  sr->sr_current = NULL;
+  sq0->sq_next = sr->sr_done; sr->sr_done = sq0;
 
   outgoing_resolve_next(orq);
 }
@@ -9782,7 +9782,7 @@ int outgoing_query_aaaa(nta_outgoing_t *orq, struct sipdns_query *sq)
                                sres_type_aaaa, sq->sq_domain);
 
   SU_DEBUG_5(("nta: for \"%s\" query \"%s\" %s%s\n",
-              orq->orq_tpn->tpn_host, sq->sq_domain, "AAAA", 
+              orq->orq_tpn->tpn_host, sq->sq_domain, "AAAA",
               answers ? " (cached)" : ""));
 
   if (answers) {
@@ -9836,7 +9836,7 @@ void outgoing_answer_aaaa(sres_context_t *orq, sres_query_t *q,
     su_inet_ntop(AF_INET6, &aaaa->aaaa_addr, addr, sizeof(addr));
 
     if (j == 0)
-      SU_DEBUG_5(("nta(%p): %s IN AAAA %s\n", (void *)orq, 
+      SU_DEBUG_5(("nta(%p): %s IN AAAA %s\n", (void *)orq,
                  aaaa->aaaa_record->r_name, addr));
     else
       SU_DEBUG_5(("nta(%p):  AAAA %s\n", (void *)orq, addr));
@@ -9949,11 +9949,11 @@ outgoing_query_results(nta_outgoing_t *orq,
                sq->sq_domain, sq->sq_type == sres_type_a ? "A" : "AAAA"));
 
     /*
-     * Three possible policies: 
+     * Three possible policies:
      * 1) try each host for AAAA/A, then A/AAAA
      * 2) try everything first for AAAA/A, then everything for A/AAAA
      * 3) try one SRV record results for AAAA/A, then for A/AAAA,
-     *    then next SRV record 
+     *    then next SRV record
      */
 
     /* We use now policy #1 */
@@ -9968,7 +9968,7 @@ outgoing_query_results(nta_outgoing_t *orq,
       outgoing_graylist(orq, sq);
   }
 
-  if (rlen > 1) 
+  if (rlen > 1)
     sr->sr_results = results;
   else
     sr->sr_current = NULL;
@@ -10047,7 +10047,7 @@ nta_reliable_t *nta_reliable_treply(nta_incoming_t *irq,
 
   ta_start(ta, tag, value);
 
-  if (0 > nta_incoming_complete_response(irq, msg, status, phrase, 
+  if (0 > nta_incoming_complete_response(irq, msg, status, phrase,
                                         ta_tags(ta)))
     msg_destroy(msg);
   else if (!(retval = reliable_mreply(irq, callback, rmagic, msg, sip)))
@@ -10060,7 +10060,7 @@ nta_reliable_t *nta_reliable_treply(nta_incoming_t *irq,
 
 /** Respond reliably with @a msg.
  *
- * @note 
+ * @note
  * The stack takes over the ownership of @a msg. (It is destroyed even if
  * sending the response fails.)
  *
@@ -10105,7 +10105,7 @@ nta_reliable_t *reliable_mreply(nta_incoming_t *irq,
   nta_agent_t *agent;
 
   agent = irq->irq_agent;
-  
+
   if (callback == NULL)
     callback = nta_reliable_destroyed;
 
@@ -10176,7 +10176,7 @@ int reliable_send(nta_incoming_t *irq,
 
   incoming_queue(sa->sa_in.preliminary, irq); /* P1 */
   incoming_set_timer(irq, sa->sa_t1); /* P2 */
-  
+
   return 0;
 }
 
@@ -10260,7 +10260,7 @@ nta_reliable_t *reliable_find(nta_agent_t const *agent,
 
       /* Found matching INVITE */
       for (rel = irq->irq_reliable; rel; rel = rel->rel_next)
-       if (rel->rel_rseq == rack->ra_response) 
+       if (rel->rel_rseq == rack->ra_response)
          return (nta_reliable_t  *)rel;
 
       return NULL;
@@ -10311,7 +10311,7 @@ int reliable_recv(nta_reliable_t *rel, msg_t *msg, sip_t *sip, tport_t *tp)
     }
     nta_incoming_treply(pr_irq, status, "OK", TAG_END());
     nta_incoming_destroy(pr_irq);
-  } 
+  }
 
   /* If there are queued unsent reliable responses, send them all. */
   while (irq->irq_reliable && irq->irq_reliable->rel_rseq == 0) {
@@ -10327,7 +10327,7 @@ int reliable_recv(nta_reliable_t *rel, msg_t *msg, sip_t *sip, tport_t *tp)
       if (reliable_send(irq, rel, msg_ref_create(msg), sip) < 0) {
        assert(!"send reliable response");
       }
-    } 
+    }
     else {
       /*
        * XXX
@@ -10388,8 +10388,8 @@ void reliable_timeout(nta_incoming_t *irq, int timeout)
  *  process incoming PRACK requests
  */
 int nta_reliable_leg_prack(nta_reliable_magic_t *magic,
-                          nta_reliable_t *rel, 
-                          nta_incoming_t *irq, 
+                          nta_reliable_t *rel,
+                          nta_incoming_t *irq,
                           sip_t const *sip)
 {
   nta_agent_t *agent;
@@ -10398,7 +10398,7 @@ int nta_reliable_leg_prack(nta_reliable_magic_t *magic,
   url_t url[1];
   int retval;
 
-  if (irq == NULL || sip == NULL || rel == NULL || 
+  if (irq == NULL || sip == NULL || rel == NULL ||
       sip_object(irq->irq_request) != sip)
     return 500;
 
@@ -10407,14 +10407,14 @@ int nta_reliable_leg_prack(nta_reliable_magic_t *magic,
   *url = *sip->sip_request->rq_url; url->url_params = NULL;
   agent_aliases(agent, url, irq->irq_tport); /* canonize urls */
 
-  if ((leg = leg_find(irq->irq_agent, 
-                     method_name, url, 
+  if ((leg = leg_find(irq->irq_agent,
+                     method_name, url,
                      sip->sip_call_id,
-                     sip->sip_from->a_tag,  
+                     sip->sip_from->a_tag,
                      sip->sip_to->a_tag))) {
     /* Use existing dialog */
     SU_DEBUG_5(("nta: %s (%u) %s\n",
-               method_name, sip->sip_cseq->cs_seq, 
+               method_name, sip->sip_cseq->cs_seq,
                "PRACK processed by default callback, too"));
     retval = leg->leg_callback(leg->leg_magic, leg, irq, sip);
   }
@@ -10578,9 +10578,9 @@ nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
   tagged->orq_response     = msg_ref_create(orq->orq_response);
   tagged->orq_cancel       = NULL;
 
-  tagged->orq_pending = tport_pend(orq->orq_tport, 
-                                  orq->orq_request, 
-                                  outgoing_tport_error, 
+  tagged->orq_pending = tport_pend(orq->orq_tport,
+                                  orq->orq_request,
+                                  outgoing_tport_error,
                                   tagged);
   if (tagged->orq_pending < 0)
     tagged->orq_pending = 0;
@@ -10654,7 +10654,7 @@ nta_outgoing_t *nta_outgoing_prack(nta_leg_t *leg,
                  __func__, resp->sip_status->st_status));
       return NULL;
     }
-    
+
     if (!resp->sip_rseq) {
       SU_DEBUG_1(("%s: %u response missing RSeq\n",
                __func__, resp->sip_status->st_status));
@@ -10706,7 +10706,7 @@ nta_outgoing_t *nta_outgoing_prack(nta_leg_t *leg,
       sip_route_init(r0)->r_url[0] = resp->sip_contact->m_url[0];
       route = sip_route_dup(home, r0);
     }
-    
+
     /* Reverse record route */
     if (resp->sip_record_route) {
       sip_route_t *r, *r_next;
@@ -10740,7 +10740,7 @@ nta_outgoing_t *nta_outgoing_prack(nta_leg_t *leg,
     ;
   else if (route && sip_add_dup(msg, sip, (sip_header_t *)route) < 0)
     ;
-  else if (!sip->sip_rack) 
+  else if (!sip->sip_rack)
     SU_DEBUG_1(("%s: RAck header missing\n", __func__));
   else if (nta_msg_request_complete(msg, leg,
                                    SIP_METHOD_PRACK,
@@ -10768,7 +10768,7 @@ uint32_t nta_outgoing_rseq(nta_outgoing_t const *orq)
   return orq ? orq->orq_rseq : 0;
 }
 
-/** Set @RSeq value stored with client transaction. 
+/** Set @RSeq value stored with client transaction.
  *
  * @return 0 if rseq was set successfully
  * @return -1 if rseq is invalid or orq is NULL.
@@ -10776,7 +10776,7 @@ uint32_t nta_outgoing_rseq(nta_outgoing_t const *orq)
 int nta_outgoing_setrseq(nta_outgoing_t *orq, uint32_t rseq)
 {
   if (orq && orq->orq_rseq <= rseq) {
-    orq->orq_rseq = rseq;      
+    orq->orq_rseq = rseq;
     return 0;
   }
 
@@ -10841,7 +10841,7 @@ void nta_agent_deinit_sigcomp(nta_agent_t *sa)
 struct sigcomp_compartment *
 nta_incoming_compartment(nta_incoming_t *irq)
 {
-  if (nta_compressor_vtable && irq && irq->irq_cc) 
+  if (nta_compressor_vtable && irq && irq->irq_cc)
     return nta_compressor_vtable->ncv_compartment_ref(irq->irq_cc);
   else
     return NULL;
@@ -10860,7 +10860,7 @@ nta_outgoing_transport(nta_outgoing_t *orq)
 struct sigcomp_compartment *
 nta_outgoing_compartment(nta_outgoing_t *orq)
 {
-  if (nta_compressor_vtable && orq && orq->orq_cc) 
+  if (nta_compressor_vtable && orq && orq->orq_cc)
     return nta_compressor_vtable->ncv_compartment_ref(orq->orq_cc);
   else
     return NULL;
@@ -10879,7 +10879,7 @@ nta_compartment_ref(struct sigcomp_compartment *cc)
 void
 nta_compartment_decref(struct sigcomp_compartment **pcc)
 {
-  if (nta_compressor_vtable && pcc && *pcc) 
+  if (nta_compressor_vtable && pcc && *pcc)
     nta_compressor_vtable->ncv_compartment_unref(*pcc), *pcc = NULL;
 }
 
@@ -10887,7 +10887,7 @@ nta_compartment_decref(struct sigcomp_compartment **pcc)
 /** Get compartment for connection, create it when needed. */
 static
 struct sigcomp_compartment *
-agent_compression_compartment(nta_agent_t *sa, 
+agent_compression_compartment(nta_agent_t *sa,
                              tport_t *tp,
                              tp_name_t const *tpn,
                              int new_if_needed)
@@ -10979,24 +10979,24 @@ int nta_agent_close_tports(nta_agent_t *agent)
   for (i = oht->oht_size; i-- > 0;)
     /* while */ if (oht->oht_table[i]) {
       nta_outgoing_t *orq = oht->oht_table[i];
-      
+
       if (orq->orq_pending && orq->orq_tport)
-       tport_release(orq->orq_tport, orq->orq_pending, orq->orq_request, 
+       tport_release(orq->orq_tport, orq->orq_pending, orq->orq_request,
                      NULL, orq, 0);
-      
+
       orq->orq_pending = 0;
       tport_unref(orq->orq_tport), orq->orq_tport = NULL;
     }
-  
-  
+
+
   for (i = iht->iht_size; i-- > 0;)
     /* while */ if (iht->iht_table[i]) {
       nta_incoming_t *irq = iht->iht_table[i];
       tport_unref(irq->irq_tport), irq->irq_tport = NULL;
-    }  
-  
+    }
+
   tport_destroy(agent->sa_tports), agent->sa_tports = NULL;
-  
+
   msg_header_free(agent->sa_home, (void *)agent->sa_vias);
   agent->sa_vias = NULL;
   msg_header_free(agent->sa_home, (void *)agent->sa_public_vias);
index f82d6980cba577b70bfd7b6fba4bcebfd148e809..f3fe03c723007a779bd4829eb5d7cf4ea8b642dd 100644 (file)
  * @LICENSE LGPL
  *
  * @section nta_objects NTA Objects
- * 
+ *
  * The NTA deals with a few kinds of objects: @e agent (#nta_agent_t), @e
  * call @e legs (#nta_leg_t), @e outgoing @e client @e requests
  * (#nta_outgoing_t), and @e incoming @e server @e requests
  * (#nta_incoming_t).
- * 
+ *
  * NTA also uses SIP message objects #msg_t and #sip_t for handling
  * messages, as defined in <sofia-sip/msg.h> and <sofia-sip/sip.h>,
  * respectively. The various SIP headers are also defined in
  * <sofia-sip/sip.h>.
- * 
+ *
  * @section nta_agent_t Creating an NTA Agent
- * 
+ *
  * Most of the SIP entities, like @e user @e agent or @e proxy, consist of a
  * SIP server and a SIP client working together.  The NTA provides a simple
  * interface to SIP server and client with the #nta_agent_t objects.
- * 
+ *
  * The #nta_agent_t object is created by calling nta_agent_create(). The
  * object listens for incoming connections, receives messages, parses them,
  * and pass them to the application. It also takes care of resolving the
  * domain names and sending the messages.
- * 
+ *
  * The agent needs a #su_root_t object to schedule its execution. A root
  * object is used to wait for the network events, schedule the timer
  * routines, and pass messages asyncronously. A root object can be created
  * own thread, or its main loop can be executed by an application thread by
  * calling the function su_root_run(). The main loop can be terminated by
  * calling the function su_root_break().
- * 
+ *
  * A simple agent could be created as follows:
  * @code
  *  registrar->reg_root = su_root_create(NULL);
- * 
+ *
  *  if (registrar->reg_root) {
  *    registrar->reg_agent = nta_agent_create(registrar->reg_root,
  *                                            (url_string_t*)argv[1],
  *                                            NULL,
  *                                            NULL,
  *                                            NULL);
- * 
+ *
  *    if (registrar->reg_agent) {
  *      su_root_run(registrar->reg_root);
  *      nta_agent_destroy(registrar->reg_agent);
  *    }
- * 
+ *
  *    su_root_destroy(registrar->reg_root);
  *  }
  * @endcode
- * 
+ *
  * @section nta_server SIP Server Action
- * 
+ *
  * A SIP server responds to the transactions sent by a client. The SIP
  * server can operate in two modes; it can be stateless or stateful. This
  * section describes how a stateful SIP server uses NTA.
- * 
+ *
  * @subsection nta_leg_t The NTA Legs
- * 
+ *
  * A leg is required for stateful transaction processing.  A default
  * leg is created like this:
  * @code
  * default_leg = nta_leg_tcreate(agent, process_requests, context,
- *                               URLTAG_URL(url), 
+ *                               URLTAG_URL(url),
  *                               NTATAG_NO_DIALOG(1),
  *                               TAG_END());
- * @endcode                           
- * 
+ * @endcode
+ *
  * The @a url parameter is used to specify which URLs match to the leg. If
  * it is given, only requests with requestURI matching are processed by the
  * leg. The nta_leg_tcreate() is a @ref tagarg "tagarg" function, taking a
  * tagged argument list as its arguments.
- * 
+ *
  * Other, ordinary legs can be used to match incoming requests with existing
  * dialogs, calls or transaction contexts, or to provide outgoing requests
  * with consistent headers. When a call leg is created, it is provided with
  * @From and @To headers, and optionally with other headers like
  * @CallID, @Route, or @CSeq.
- * 
+ *
  * A new call leg can be created as follows:
  * @code
  * call_leg = nta_leg_tcreate(agent,
  *                            process_call_requests, call_context,
  *                            SIPTAG_CALL_ID(sip->sip_call_id),
- *                            SIPTAG_TO(sip->sip_from),   
+ *                            SIPTAG_TO(sip->sip_from),
  *                            SIPTAG_FROM(sip->sip_to),
  *                            TAG_END());
  * @endcode
  * @note An existing leg can be used in any direction, however.  If the leg
  * was created for an incoming INVITE transaction, it is also possible to
  * use the leg for an outgoing BYE transaction.
- * 
+ *
  * @subsection nta_leg_tag Tagging the Call Leg
- * 
+ *
  * All the SIP UAS elements are required to tag the @To header in their
  * final responses. The function nta_leg_tag() adds a tag to the leg's local
  * address. Local address is used as the @To header in the reply messages,
  *   if (!nta_leg_tag(leg, nta_incoming_tag(irq, NULL)))
  *    nta_incoming_treply(irq, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
  * @endcode
- * 
+ *
  * @subsection nta_incoming_t Incoming Transactions
- * 
+ *
  * An incoming transaction object (nta_incoming_t) is created by NTA for
  * each unique incoming request message. When NTA has created the incoming
- * transaction object, it invokes the callback function provided with 
- * nta_leg_tcreate().  
- * 
+ * transaction object, it invokes the callback function provided with
+ * nta_leg_tcreate().
+ *
  * The simplest way to reply to the request is to return a valid status code
  * from the callback function. Valid status codes are in range of 100 to
  * 699, inclusive.  If no automatic response is desired, the callback
  * function should return 0.
- * 
+ *
  * @note If the status code is final, the incoming transaction object will
  * be destroyed immediately after the callback function returns. It can not
  * be used afterwards.
- * 
+ *
  * @note It is not possible to respond with a 2xx status code to an incoming
  * INVITE transaction by returning the status code from the callback.
- * 
+ *
  * Valid return values for callback function are as follows:
  * @li 0, 100 .. 699 for requests other than INVITE, and
  * @li 0, 100 .. 199, 300..699 for INVITE requests.
- * 
+ *
  * All other return codes are interpreted as 500, that is, a @e 500 @e
  * Internal @e Server @e Error reply message is sent back to the client and
  * the request is immediately destroyed.
- * 
+ *
  * The simple registrar/redirect server may have a incoming request callback
  * as follows:
  * @code
  *                    sip_t const *sip)
  * {
  *   sip_contact_t *m;
- * 
+ *
  *   switch (sip->sip_request->rq_method) {
  *   case sip_method_register:
  *     return registrar_add(server, leg, reply, sip);
- * 
+ *
  *   case sip_method_ack:
  *     return 500;
- * 
+ *
  *   case sip_method_cancel:
  *     return 200;
- * 
+ *
  *   default:
  *     if (registrar_find(server, sip->sip_request->rq_url, &m) {
- *       nta_incoming_treply(irq, SIP_302_MOVED_TEMPORARILY, 
+ *       nta_incoming_treply(irq, SIP_302_MOVED_TEMPORARILY,
  *                           SIPTAG_CONTACT(m), TAG_END());
  *       return 302;
  *     }
  *   }
  * }
  * @endcode
- * 
+ *
  * The default reply message will contain the status line with default
  * phrase, then @Via, @To, @From, @CallID, @CSeq, and @ContentLength headers.
  * If a more complex response message is required, the application should
- * respond using the function nta_incoming_treply(): 
+ * respond using the function nta_incoming_treply():
  * @code
- * nta_incoming_treply(reply, SIP_200_OK, 
+ * nta_incoming_treply(reply, SIP_200_OK,
  *                     SIPTAG_CONTACT(contact),
  *                     SIPTAG_CONTENT_TYPE_STR("application/sdp"),
  *                     SIPTAG_PAYLOAD(sdp),
  *                     TAG_END());
  * @endcode
- * 
+ *
  * The nta_incoming_treply() is a @ref tagarg "tagarg" function, taking a
  * tagged argument list as its argument.
- * 
+ *
  * @note It is possible to send provisional replies (containing 1xx status
  * codes) several times with nta_incoming_treply(), but only one final
  * reply (containing status codes 2xx..6xx) can be sent. However, with
  * INVITE requests, a proxy can send a final 2xx reply even after an error
  * reply (3xx..6xx).
- * 
+ *
  * @section nta_100rel Reliable Provisional Responses - "100rel"
- * 
+ *
  * The <A href="../specs/rfc3262.txt"><B>100rel</B></A> SIP extension
  * provides reliable provisional responses, provisional responses that are
  * retransmitted until a special acknowledgement request, PRACK, is
  * received. In addition the PRACK method, the extension defines two
  * headers, @RSeq and @RAck, that are used to identify different
  * response messages. PRACK method is usable on INVITE requests only.
- * 
+ *
  * Using reliable responses is negotiated using the "100rel" option tag. The
  * UAC (party sending the INVITE) can include the option tag to the
  * @Supported or @Require header. In the first case, the UAC just
  * functions nta_reliable_treply() or nta_reliable_mreply(). These functions
  * return a pointer to a special object, nta_reliable_t, that is used to
  * keep track of unacknowledged responses and respond to the the PRACK
- * acknowledgement request. 
- * 
+ * acknowledgement request.
+ *
  * Both the functions nta_reliable_treply () and nta_reliable_mreply() take
  * a callback funtion pointer and an application context pointer as their
- * arguments. The callback function is similar to the leg callback function. 
+ * arguments. The callback function is similar to the leg callback function.
  * The callback is invoked when a corresponding PRACK request is received,
  * or when there is a timeout.
  *
  * nta_incoming_treply()/nta_incoming_mreply() functions, the @b nta creates
  * a reliable response object for each provisional response in behalf of
  * application. As the application can not provide a PRACK callback function
- * to @b nta, the PRACK requests are not delivered to the application. 
+ * to @b nta, the PRACK requests are not delivered to the application.
  *
  * @subsection early_dialog UAC Receives a Reliable Response
  *
  * early @e dialog with the UAS. In another view, a reliable response is
  * used to establish the early dialog. UAC establishes a leg object for the
  * early dialog by calling nta_leg_tcreate() with the parameters derived
- * from the response message. 
+ * from the response message.
  *
  * @code
  * int invite_callback(call_t *call,
  *                 sip_t const *sip)
  * {
  *   int status = sip->sip_status->st_status;
- * 
- *   if (!call->has_dialog && 
+ *
+ *   if (!call->has_dialog &&
  *       (status >= 200 || (status > 100 && sip->sip_rseq))) {
- *     nta_leg_t *early = 
+ *     nta_leg_t *early =
  *       nta_leg_tcreate(call->nta_agent, mid_dialog_request, call,
  *                   SIPTAG_TO(sip->sip_to),
  *                   SIPTAG_FROM(sip->sip_from),
  *                   SIPTAG_CALL_ID(sip->sip_call_id),
  *                   SIPTAG_CSEQ(sip->sip_cseq),
  *                   TAG_END());
- * 
- *     nta_leg_client_route(early, 
+ *
+ *     nta_leg_client_route(early,
  *                      sip->sip_record_route,
  *                      sip->sip_contact);
- * 
+ *
  *     fork = call_fork(call, leg = early);
- * 
+ *
  *     if (!fork) {
  *       handle error;
  *     }
  *     call = fork;
- *   }                                
+ *   }
  * @endcode
- * 
+ *
  * The original dialog object and client transaction object are used to
  * process other call forks. For instance, if the early dialog is
  * established with an announcement server it will never lead to an fully
  * transaction object by calling nta_outgoing_prack()
  *
  * @section nta_client SIP Client Action
- * 
+ *
  * A SIP client initiates the transactions. In some cases, a SIP client is
  * also required to invoke additional transactions, like @b ACK or @b
  * CANCEL, to finalize the original transaction. This section describes how
  * a SIP client uses NTA to make transactions.
- * 
+ *
  * @subsection client_nta_leg_t Creating the Call Leg
- * 
+ *
  * If the client does not have a suitable call leg, it must create it by
  * calling the function nta_leg_tcreate():
  * @code
  *                                SIPTAG_TO(to),
  *                                TAG_END());
  * @endcode
- * 
+ *
  * The @p callback function and @p context pointer are used for incoming
  * transactions, and they may be @c NULL if no such transactions are
  * expected.  If the callback is @c NULL, NTA responds to incoming
  * transactions with status @e 403 @e Forbidden.
- * 
+ *
  * The @a call_id may be @c NULL or left out. In that case, NTA generates a
  * new call ID.
- * 
+ *
  * The @a from and @a to are used in outgoing transactions. They are also
  * used to select which incoming messages belong to this leg.
  *
  *
  * The additional parameters (after @a to) are included in outgoing messages
  * using this leg. Currently, only @c SIPTAG_ROUTE() is supported.
- * 
+ *
  * @note Additional tagged parameters are ignored.
- * 
+ *
  * @subsection nta_outgoing_t Outgoing requests
- * 
+ *
  * The outgoing request is created and sent by nta_outgoing_tcreate(). It
  * can be used as follows:
  * @code
  *                             SIPTAG_CONTACT(my_contact),
  *                             TAG_END());
  * @endcode
- * 
+ *
  * NTA invokes the callback function response_to_register() each time a
  * provisional answer is received, and when a final answer is received.
- * 
+ *
  * @note There may be multiple final answers to the INVITE request.
- * 
+ *
  * If NTA does not receive answer in timely manner, it will generate a
- * @e 408 @e Timeout response and hand that back to the application. 
- * 
+ * @e 408 @e Timeout response and hand that back to the application.
+ *
  * @note After a provisional answer to the INVITE request, no timeout will
  * occur inside NTA.  Application must itself timeout the INVITE
  * transactions if any answer has been received.
- * 
+ *
  * The request can be destroyed with NTA function nta_outgoing_destroy().
  * If no final answer has been received, the request is cancelled when it is
  * destroyed, too.  The application can also cancel the outgoing request by
  * calling nta_outgoing_cancel().
- * 
+ *
  * @subsection nta_ack Acknowledging Answers to INVITE
- * 
+ *
  * The final answers to the INVITE request must be acknowledged. NTA takes
  * care of acknowledging automatically the 3xx..6xx answers; the appliction
  * must explicitly create a separate acknowledge transaction to final 2xx
- * answers. 
- * 
+ * answers.
+ *
  * The final answer can be acknowledged like this:
  * @code
  *  url = sip->sip_contact ? sip->sip_contact->m_url : original_url;
  *                             SIPTAG_PAYLOAD(sdp),
  *                             TAG_END());
  * @endcode
- * 
- * @note The ACK transaction should be sent to the @Contact specified in the 
- * 2xx reply.  
- * 
+ *
+ * @note The ACK transaction should be sent to the @Contact specified in the
+ * 2xx reply.
+ *
  * <a name="nta_register_f"></a>
  * @section nta_stateless_callback Stateless Processing of SIP Messages
  *
  * parsed contents (@a sip) the callback function gets the
  * application-specific context pointer (in this case, @a registrar) and a
  * pointer to the NTA agent (@a agent) as its arguments:
- * 
- * @code 
+ *
+ * @code
  * int process_message(nta_agent_context_t *registrar,
  *                    nta_agent_t *agent,
  *                    msg_t *msg,
  *                    sip_t *sip);
  * @endcode
- * 
+ *
  * The application has three functions that can be used to process the
  * messages in stateless manner:
  * @li nta_msg_discard() ignores and destroys the message,
  * @li nta_msg_tsend() forwards a request or response message, and
  * @li nta_msg_treply() replies to a request message in a stateless way.
- * 
+ *
  * Additionally, it is possible to process a request message statefully with
  * nta_incoming_create().
  *
  * The functionality of the stateless callback function can vary greatly,
  * depending the purpose of the application. An user-agent, a proxy or a
  * registrar/redirect server each have very different callback functions.
- * 
+ *
  * A simple redirect server could have a message callback function as
  * follows.
  *
  * {
  *   sip_contact_t *m;
  *   sip_unsupported_t *u;
- * 
+ *
  * @endcode
  *
  * The incoming response messages are simply ignored. The @b ACK requests can
  * safely be discarded, too, because the redirect server keeps no state.
- * 
+ *
  * @code
  *   if (!sip->sip_request || sip->sip_request->rq_method == sip_method_ack) {
- *     nta_msg_discard(agent, msg); 
+ *     nta_msg_discard(agent, msg);
  *     return 0;
  *   }
  * @endcode
  * @code
  *   u = sip_unsupported(msg_home(msg), sip->sip_require, r->r_supported);
  *   if (u) {
- *     nta_msg_treply(agent, msg, SIP_420_BAD_EXTENSION, 
+ *     nta_msg_treply(agent, msg, SIP_420_BAD_EXTENSION,
  *                    SIPTAG_SUPPORTED(r->r_supported),
  *                    SIPTAG_UNSUPPORTED(u),
  *                    TAG_END());
  *   }
  * @endcode
  *
- *  All other requests are answered normally with a 302 response. 
+ *  All other requests are answered normally with a 302 response.
  *  The location service is
  *  searched for the request uri, and if a matching address was found, a
  *  list of active bindings is returned to the client.
  * @code
  *   m = location_find(redirect, sip->sip_request->rq_url);
  *   if (m) {
- *     nta_msg_treply(agent, msg, SIP_302_MOVED_TEMPORARILY, 
+ *     nta_msg_treply(agent, msg, SIP_302_MOVED_TEMPORARILY,
  *                    SIPTAG_CONTACT(m),
  *                    TAG_END());
- *   } 
+ *   }
  * @endcode
  *
  *   Otherwise, @e 404 @e Not @e Found is sent:
  *   else {
  *     nta_msg_treply(agent, msg, SIP_404_NOT_FOUND, TAG_END());
  *   }
- * 
+ *
  *   return 0;
  * }
  * @endcode
- * 
+ *
  */
 
 /**@page internal NTA Semantics and Internal Data Flows
- * 
+ *
  * NTA implements simple state machines at transaction level. The figure
  * below illustrates how a message is processed by NTA.
- * 
- * @image html nta-receiving-message.gif "NTA processing incoming messages." 
- * @image latex nta-receiving-message.eps "NTA processing incoming messages." 
- * 
- * 
+ *
+ * @image html nta-receiving-message.gif "NTA processing incoming messages."
+ * @image latex nta-receiving-message.eps "NTA processing incoming messages."
+ *
+ *
  */
 
 int invite_callback(call_t *call,
@@ -538,9 +538,9 @@ int invite_callback(call_t *call,
   int status = sip->sip_status->st_status;
   nta_leg_t *leg = call->leg;
 
-  if (!call->has_dialog && 
+  if (!call->has_dialog &&
       (status >= 200 || (status > 100 && sip->sip_rseq))) {
-    nta_leg_t *early = 
+    nta_leg_t *early =
       nta_leg_tcreate(call->nta_agent, mid_dialog_request, call,
                      SIPTAG_TO(sip->sip_to),
                      SIPTAG_FROM(sip->sip_from),
@@ -548,7 +548,7 @@ int invite_callback(call_t *call,
                      SIPTAG_CSEQ(sip->sip_cseq),
                      TAG_END());
 
-    nta_leg_client_route(early, 
+    nta_leg_client_route(early,
                         sip->sip_record_route,
                         sip->sip_contact);
 
@@ -558,16 +558,16 @@ int invite_callback(call_t *call,
       handle error;
     }
     call = fork;
-  }                                   
-  
+  }
+
   if (status > 100 && status < 200 && sip->sip_rseq) {
-    nta_outgoing_t *prack = 
+    nta_outgoing_t *prack =
       nta_outgoing_prack(leg, orq, NULL, NULL, NULL,
-                        sip, 
+                        sip,
                         TAG_END());
     nta_outgoing_destroy(prack);
     return 0;
   }
-  
+
   ...
 }
index ba3fc44044f27e97c9f0fe71ee811d39c6f9da39..b5e97d2426e22a865a8690aa09b921ae655814b3 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef NTA_INTERNAL_H
 /** Defined when <nta_internal.h> has been included. */
-#define NTA_INTERNAL_H 
+#define NTA_INTERNAL_H
 
 /**@internal @file nta_internal.h
  *
@@ -562,13 +562,13 @@ typedef struct
   int ncv_size;
   char const *ncv_name;
 
-  nta_compressor_t *(*ncv_init_agent)(nta_agent_t *sa, 
+  nta_compressor_t *(*ncv_init_agent)(nta_agent_t *sa,
                                     char const * const *options);
 
   void (*ncv_deinit_agent)(nta_agent_t *sa, nta_compressor_t *);
 
   struct sigcomp_compartment *(*ncv_compartment)(nta_agent_t *sa,
-                                                tport_t *tport, 
+                                                tport_t *tport,
                                                 nta_compressor_t *msc,
                                                 tp_name_t const *tpn,
                                                 char const * const *options,
@@ -589,7 +589,7 @@ typedef struct
     (struct sigcomp_compartment *);
 
   void (*ncv_compartment_unref)(struct sigcomp_compartment *);
+
 } nta_compressor_vtable_t;
 
 extern nta_compressor_vtable_t *nta_compressor_vtable;
index d054a8795d6333fe4f4721f10445b661099333ac..e5d25ca2af940d91cf8667d9112ad452b649c9a1 100644 (file)
@@ -25,7 +25,7 @@
 /**@CFILE nta_tag.c
  * @brief Tags for Nokia SIP Transaction API
  *
- * @note This file is used to automatically generate 
+ * @note This file is used to automatically generate
  * nta_tag_ref.c and nta_tag_dll.c
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -51,7 +51,7 @@ tag_typedef_t ntatag_any = NSTAG_TYPEDEF(*);
 
 /**@def NTATAG_MCLASS(x)
  *
- * Message class used by NTA. 
+ * Message class used by NTA.
  *
  * The nta can use a custom or extended parser created with
  * msg_mclass_clone().
@@ -76,15 +76,15 @@ tag_typedef_t ntatag_mclass = PTRTAG_TYPEDEF(mclass);
 
 /**@def NTATAG_BAD_REQ_MASK(x)
  *
- * Mask for bad request messages. 
- * 
+ * Mask for bad request messages.
+ *
  * If an incoming request has erroneous headers matching with the mask, nta
- * automatically returns a 400 Bad Message response to them. 
+ * automatically returns a 400 Bad Message response to them.
  *
  * If mask ~0U (all bits set) is specified, all requests with any bad header
  * are dropped. By default only the requests with bad headers essential for
  * request processing or proxying are dropped.
- * 
+ *
  * @par Used with
  *    nua_create(), nua_set_params(),
  *    nta_agent_create(), nta_agent_set_params()
@@ -104,22 +104,22 @@ tag_typedef_t ntatag_mclass = PTRTAG_TYPEDEF(mclass);
  *   @ContentEncoding, @Supported, @Contact, @Require, @RecordRoute, @RAck,
  *   @RSeq, @Event, @Expires, @SubscriptionState, @SessionExpires,
  *   @MinSE, @SIPETag, and @SIPIfMatch.
- *  
+ *
  * @sa enum #sip_bad_mask, NTATAG_BAD_RESP_MASK()
  */
 tag_typedef_t ntatag_bad_req_mask = UINTTAG_TYPEDEF(bad_req_mask);
 
 /**@def NTATAG_BAD_RESP_MASK(x)
  *
- * Mask for bad response messages. 
- * 
+ * Mask for bad response messages.
+ *
  * If an incoming response has erroneous headers matching with the mask, nta
- * drops the response message. 
+ * drops the response message.
  *
  * If mask ~0U (all bits set) is specified, all responses with any bad header
  * are dropped. By default only the responses with bad headers essential for
  * response processing or proxying are dropped.
- * 
+ *
  * @par Used with
  *    nua_create(), nua_set_params(),
  *    nta_agent_create(), nta_agent_set_params()
@@ -139,7 +139,7 @@ tag_typedef_t ntatag_bad_req_mask = UINTTAG_TYPEDEF(bad_req_mask);
  * - @ref sip_status \"status line\"", @From, @To, @CSeq, @CallID,
  *   @ContentLength, @Via, @ContentType, @ContentDisposition,
  *   @ContentEncoding, @Supported, @Contact, @Require, @RecordRoute, @RAck,
- *   @RSeq, @Event, @Expires, @SubscriptionState, @SessionExpires, 
+ *   @RSeq, @Event, @Expires, @SubscriptionState, @SessionExpires,
  *   @MinSE, @SIPETag, and @SIPIfMatch.
  */
 tag_typedef_t ntatag_bad_resp_mask = UINTTAG_TYPEDEF(bad_resp_mask);
@@ -183,9 +183,9 @@ tag_typedef_t ntatag_contact = SIPHDRTAG_NAMED_TYPEDEF(contact, contact);
  */
 tag_typedef_t ntatag_target = SIPHDRTAG_NAMED_TYPEDEF(target, contact);
 
-/** @def NTATAG_ALIASES(x) 
+/** @def NTATAG_ALIASES(x)
  *
- * Aliases used by NTA. 
+ * Aliases used by NTA.
  * @deprecated
  */
 tag_typedef_t ntatag_aliases = SIPHDRTAG_NAMED_TYPEDEF(aliases, contact);
@@ -208,7 +208,7 @@ tag_typedef_t ntatag_aliases = SIPHDRTAG_NAMED_TYPEDEF(aliases, contact);
  *
  * @par Default Value
  *    - None (i.e., all requests methods match with the leg)
- * 
+ *
  */
 tag_typedef_t ntatag_method = STRTAG_TYPEDEF(method);
 
@@ -230,7 +230,7 @@ tag_typedef_t ntatag_method = STRTAG_TYPEDEF(method);
  *    string
  *
  * @par Value
- * - The "branch" ID to to insert into topmost @Via header of the 
+ * - The "branch" ID to to insert into topmost @Via header of the
  *   request to be sent
  *
  * @par Default Value
@@ -244,7 +244,7 @@ tag_typedef_t ntatag_branch_key = STRTAG_TYPEDEF(branch_key);
 
 /**@def NTATAG_ACK_BRANCH(x)
  *
- * Branch of the transaction to ACK. 
+ * Branch of the transaction to ACK.
  *
  * When creating a ACK transaction, the application should provide the
  * branch parameter from the original transaction to the stack. The ACK
@@ -269,7 +269,7 @@ tag_typedef_t ntatag_ack_branch = STRTAG_TYPEDEF(ack_branch);
 
 /**@def NTATAG_COMP(x)
  *
- * Compression algorithm. 
+ * Compression algorithm.
  *
  * Set compression algorithm for request as described in @RFC3486.
  *
@@ -302,7 +302,7 @@ tag_typedef_t ntatag_comp = CSTRTAG_TYPEDEF(comp);
 
 /**@def NTATAG_MSG(x)
  *
- * Pass a SIP message to treply()/tcreate() functions. 
+ * Pass a SIP message to treply()/tcreate() functions.
  *
  * @par Used with
  *    nta_outgoing_tcreate(), nta_incoming_treply()
@@ -327,7 +327,7 @@ tag_typedef_t ntatag_msg = PTRTAG_TYPEDEF(msg);
  * or response message(s).
  *
  * @par Used with
- *    nta_outgoing_tcreate(), nta_outgoing_mcreate(), nta_outgoing_tcancel(), 
+ *    nta_outgoing_tcreate(), nta_outgoing_mcreate(), nta_outgoing_tcancel(),
  *    nta_incoming_create(), nta_msg_tsend(), nta_msg_mreply()
  *
  * @par Parameter type
@@ -345,9 +345,9 @@ tag_typedef_t ntatag_tport = PTRTAG_TYPEDEF(tport);
 
 /**@def NTATAG_SMIME(x)
  *
- * Provide S/MIME context to NTA. 
+ * Provide S/MIME context to NTA.
  *
- * @todo S/MIME is not implemented. 
+ * @todo S/MIME is not implemented.
  */
 tag_typedef_t ntatag_smime = PTRTAG_TYPEDEF(smime);
 
@@ -367,7 +367,7 @@ tag_typedef_t ntatag_smime = PTRTAG_TYPEDEF(smime);
  *   - uint32_t
  *
  * @par Values
- *    - Remote command sequence number 
+ *    - Remote command sequence number
  *
  * @par Default Value
  *    - Initially 0, then determined by the received requests
@@ -377,7 +377,7 @@ tag_typedef_t ntatag_remote_cseq = UINTTAG_TYPEDEF(remote_cseq);
 
 /**@def NTATAG_MAXSIZE(x)
  *
- * Maximum size of incoming message. 
+ * Maximum size of incoming message.
  *
  * If the size of an incoming request message would exceed the
  * given limit, the stack will automatically respond with <i>413 Request
@@ -388,7 +388,7 @@ tag_typedef_t ntatag_remote_cseq = UINTTAG_TYPEDEF(remote_cseq);
  *    nta_agent_create(), nta_agent_set_params()
  *
  * @par Parameter type
- *    - #usize_t 
+ *    - #usize_t
  *
  * @par Values
  *    - Maximum acceptable size of an incoming request message.
@@ -402,10 +402,10 @@ tag_typedef_t ntatag_maxsize = USIZETAG_TYPEDEF(maxsize);
 
 /**@def NTATAG_MAX_PROCEEDING(x)
  *
- * Maximum size of proceeding queue. 
+ * Maximum size of proceeding queue.
  *
  * If the size of the proceedng message queue would exceed the
- * given limit, the stack will automatically respond with <i>503 
+ * given limit, the stack will automatically respond with <i>503
  * Service Unavailable</i>.
  *
  * @par Used with
@@ -413,7 +413,7 @@ tag_typedef_t ntatag_maxsize = USIZETAG_TYPEDEF(maxsize);
  *    nta_agent_create(), nta_agent_set_params()
  *
  * @par Parameter type
- *    - #usize_t 
+ *    - #usize_t
  *
  * @par Values
  *    - Maximum acceptable size of a queue (size_t).
@@ -423,7 +423,7 @@ tag_typedef_t ntatag_max_proceeding = USIZETAG_TYPEDEF(max_proceeding);
 
 /**@def NTATAG_UDP_MTU(x)
  *
- * Maximum size of outgoing UDP request. 
+ * Maximum size of outgoing UDP request.
  *
  * The maximum UDP request size is used to control use of UDP with overtly
  * large messages. The IETF requires that the SIP requests over 1300 bytes
@@ -450,7 +450,7 @@ tag_typedef_t ntatag_udp_mtu = UINTTAG_TYPEDEF(udp_mtu);
 
 /**@def NTATAG_MAX_FORWARDS(x)
  *
- * Default value for @MaxForwards header. 
+ * Default value for @MaxForwards header.
  *
  * The default value of @MaxForwards header added to the requests. The
  * initial value recommended by @RFC3261 is 70, but usually SIP proxies use
@@ -475,7 +475,7 @@ tag_typedef_t ntatag_max_forwards = UINTTAG_TYPEDEF(max_forwards);
 
 /**@def NTATAG_SIP_T1(x)
  *
- * Initial retransmission interval (in milliseconds) 
+ * Initial retransmission interval (in milliseconds)
  *
  * Set the T1 retransmission interval used by the SIP transaction engine. The
  * T1 is the initial duration used by request retransmission timers A and E
@@ -489,7 +489,7 @@ tag_typedef_t ntatag_max_forwards = UINTTAG_TYPEDEF(max_forwards);
  *    unsigned int
  *
  * @par Values
- *    - Value of SIP T1 in milliseconds 
+ *    - Value of SIP T1 in milliseconds
  *
  * @par Default Value
  *    - #NTA_SIP_T1 or 500 (milliseconds)
@@ -500,13 +500,13 @@ tag_typedef_t ntatag_sip_t1 = UINTTAG_TYPEDEF(sip_t1);
 
 /**@def NTATAG_SIP_T1X64(x)
  *
- * Transaction timeout (defaults to T1 * 64). 
+ * Transaction timeout (defaults to T1 * 64).
  *
  * Set the T1x64  timeout value used by the SIP transaction engine. The T1x64 is
- * duration used for timers B, F, H, and J (UDP) by the SIP transaction engine. 
+ * duration used for timers B, F, H, and J (UDP) by the SIP transaction engine.
  * The timeout value T1x64 can be adjusted separately from the initial
  * retransmission interval T1, which is set with NTATAG_SIP_T1().
- * 
+ *
  * The default value for T1x64 is 64 times value of T1, or 32000 milliseconds.
  *
  * @par Used with
@@ -529,11 +529,11 @@ tag_typedef_t ntatag_sip_t1x64 = UINTTAG_TYPEDEF(sip_t1x64);
 
 /**@def NTATAG_SIP_T2(x)
  *
- * Maximum retransmission interval (in milliseconds) 
+ * Maximum retransmission interval (in milliseconds)
  *
  * Set the maximum retransmission interval used by the SIP transaction
  * engine. The T2 is the maximum duration used for the timers E (UDP) and G
- * by the SIP transaction engine. Note that the timer A is not capped by T2. 
+ * by the SIP transaction engine. Note that the timer A is not capped by T2.
  * Retransmission interval of INVITE requests grows exponentially until the
  * timer B fires.
  *
@@ -545,7 +545,7 @@ tag_typedef_t ntatag_sip_t1x64 = UINTTAG_TYPEDEF(sip_t1x64);
  *    unsigned int
  *
  * @par Values
- *    - Value of SIP T2 in milliseconds 
+ *    - Value of SIP T2 in milliseconds
  *
  * @par Default Value
  *    - #NTA_SIP_T2 or 4000 (milliseconds)
@@ -556,7 +556,7 @@ tag_typedef_t ntatag_sip_t2 = UINTTAG_TYPEDEF(sip_t2);
 
 /**@def NTATAG_SIP_T4(x)
  *
- * Transaction lifetime (in milliseconds) 
+ * Transaction lifetime (in milliseconds)
  *
  * Set the lifetime for completed transactions used by the SIP transaction
  * engine. A completed transaction is kept around for the duration of T4 in
@@ -696,11 +696,11 @@ tag_typedef_t ntatag_blacklist = UINTTAG_TYPEDEF(blacklist);
 
 /**@def NTATAG_DEBUG_DROP_PROB(x)
  *
- * Packet drop probability for debugging. 
+ * Packet drop probability for debugging.
  *
  * The packet drop probability parameter is useful mainly for debugging
  * purposes. The stack drops an incoming message received over an unreliable
- * transport (such as UDP) with the given probability. The range is in 0 .. 
+ * transport (such as UDP) with the given probability. The range is in 0 ..
  * 1000, 500 means p=0.5.
  *
  * @par Used with
@@ -733,7 +733,7 @@ tag_typedef_t ntatag_debug_drop_prob = UINTTAG_TYPEDEF(debug_drop_prob);
  *    nta_agent_add_tport()
  *
  * @par Parameter type
- *    string 
+ *    string
  *
  * @par Values
  *    - semicolon-separated parameter-value pairs, passed to the SigComp plugin
@@ -771,7 +771,7 @@ tag_typedef_t ntatag_sigcomp_close = BOOLTAG_TYPEDEF(sigcomp_close);
 
 /**@def NTATAG_SIGCOMP_AWARE(x)
  *
- * Indicate that the application is SigComp-aware. 
+ * Indicate that the application is SigComp-aware.
  *
  * @note This tag is has no effect without a SigComp plugin.
  *
@@ -794,7 +794,7 @@ tag_typedef_t ntatag_sigcomp_aware = BOOLTAG_TYPEDEF(sigcomp_aware);
 
 /**@def NTATAG_SIGCOMP_ALGORITHM(x)
  *
- * Specify SigComp algorithm.  
+ * Specify SigComp algorithm.
  *
  * @note This tag is has no effect without a SigComp plugin.
  *
@@ -804,7 +804,7 @@ tag_typedef_t ntatag_sigcomp_aware = BOOLTAG_TYPEDEF(sigcomp_aware);
  *    nta_agent_add_tport()
  *
  * @par Parameter type
- *    string 
+ *    string
  *
  * @par Values
  *    - opaque string passed to the SigComp plugin
@@ -827,7 +827,7 @@ tag_typedef_t ntatag_sigcomp_algorithm = STRTAG_TYPEDEF(sigcomp_algorithm);
  * - silently discard duplicate final responses to INVITE
  * - retransmit preliminary responses (101..199) to INVITE request in regular
  *   intervals ("timer N2")
- * - retransmit 2XX response to INVITE request with exponential intervals 
+ * - retransmit 2XX response to INVITE request with exponential intervals
  * - handle ACK sent in 2XX response to an INVITE using the
  *   #nta_ack_cancel_f callback bound to #nta_incoming_t with
  *   nta_incoming_bind()
@@ -844,12 +844,12 @@ tag_typedef_t ntatag_sigcomp_algorithm = STRTAG_TYPEDEF(sigcomp_algorithm);
  *          or false (zero or NULL pointer)
  *
  * @par Values
- *    - true - act as an UA 
- *    - false - act as an proxy 
+ *    - true - act as an UA
+ *    - false - act as an proxy
  *
  * @par Default Value
  *    - 0 (false)
- *    
+ *
  * @sa NTATAG_MERGE_482()
  */
 tag_typedef_t ntatag_ua = BOOLTAG_TYPEDEF(ua);
@@ -964,7 +964,7 @@ tag_typedef_t ntatag_pass_100 = BOOLTAG_TYPEDEF(pass_100);
  * to a request within half of the SIP T2 (the default value for T2 is 4000
  * milliseconds, so the extra <i>100 Trying</i> would be sent after 2 seconds).
  *
- * @par Used with      
+ * @par Used with
  *    nua_create(), nua_set_params(),
  *    nta_agent_create(), nta_agent_set_params()
  *
@@ -985,7 +985,7 @@ tag_typedef_t ntatag_extra_100 = BOOLTAG_TYPEDEF(extra_100);
 
 /**@def NTATAG_TIMEOUT_408(x)
  *
- * Generate "408 Request Timeout" response when request times out. 
+ * Generate "408 Request Timeout" response when request times out.
  *
  * This tag is used to prevent stack from generating extra 408 response
  * messages to non-INVITE requests upon timeout. As per recommended by
@@ -1013,12 +1013,12 @@ tag_typedef_t ntatag_timeout_408 = BOOLTAG_TYPEDEF(timeout_408);
 
 /**@def NTATAG_PASS_408(x)
  *
- * Pass "408 Request Timeout" responses to the client. 
+ * Pass "408 Request Timeout" responses to the client.
  *
  * As per recommended by @RFC4320, the <i>408 Request Timeout</i> responses
  * to non-INVITE transaction are not sent over the network to the client by
  * default. The application can ask stack to pass the 408 responses with
- * NTATAG_PASS_408(1). 
+ * NTATAG_PASS_408(1).
  *
  * Note that unlike NTATAG_PASS_100(), this tags changes the way server side
  * works.
@@ -1032,7 +1032,7 @@ tag_typedef_t ntatag_timeout_408 = BOOLTAG_TYPEDEF(timeout_408);
  *          or false (zero or NULL pointer)
  *
  * @par Values
- *    - true - pass superfluous 408 responses 
+ *    - true - pass superfluous 408 responses
  *    - false - discard superfluous 408 responses
  *
  * @sa @RFC4320, NTATAG_EXTRA_100(), NTATAG_TIMEOUT_408()
@@ -1042,7 +1042,7 @@ tag_typedef_t ntatag_pass_408 = BOOLTAG_TYPEDEF(pass_408);
 
 /**@def NTATAG_MERGE_482(x)
  *
- * Merge requests, send 482 to other requests. 
+ * Merge requests, send 482 to other requests.
  *
  * If an User-Agent receives a duplicate request with same @CallID, @CSeq,
  * @From tag but different topmost @Via header (see @RFC3261 section 8.2.2.2
@@ -1111,7 +1111,7 @@ tag_typedef_t ntatag_cancel_2543 = BOOLTAG_TYPEDEF(cancel_2543);
 
 /**@def NTATAG_CANCEL_408(x)
  *
- * Do not send a CANCEL but just timeout the request. 
+ * Do not send a CANCEL but just timeout the request.
  *
  * Calling nta_outgoing_tcancel() with this tag set marks request as
  * canceled but does not actually send a CANCEL request. If
@@ -1142,7 +1142,7 @@ tag_typedef_t ntatag_cancel_408 = BOOLTAG_TYPEDEF(cancel_408);
  * Terminated</i> response to the client after returning from the
  * #nta_incoming_f callback bound to the transaction with
  * nta_incoming_bind()
- * 
+ *
  * The application can delay sending the response to the original request
  * when NTATAG_CANCEL_408(0) is used. This is useful, for instance, with a
  * proxy that forwards the CANCEL downstream and the forwards the response
@@ -1166,7 +1166,7 @@ tag_typedef_t ntatag_cancel_487 = BOOLTAG_TYPEDEF(cancel_487);
 
 /**@def NTATAG_TAG_3261(x)
  *
- * When responding to requests, use unique tags. 
+ * When responding to requests, use unique tags.
  *
  * If set the UA would generate an unique @From/@To tag for all dialogs. If
  * unset UA would reuse same tag in order to make it easier to re-establish
@@ -1190,7 +1190,7 @@ tag_typedef_t ntatag_tag_3261 = BOOLTAG_TYPEDEF(tag_3261);
 
 /**@def NTATAG_REL100(x)
  *
- * Include rel100 in INVITE requests. 
+ * Include rel100 in INVITE requests.
  *
  * Include feature tag "100rel" in @Supported header of the INVITE requests.
  *
@@ -1217,14 +1217,14 @@ tag_typedef_t ntatag_no_dialog = BOOLTAG_TYPEDEF(no_dialog);
 
 /**@def NTATAG_USE_TIMESTAMP(x)
  *
- * Use @Timestamp header. 
+ * Use @Timestamp header.
  *
  * If set, a @Timestamp header would be added to stateful requests. The
  * header can be used to calculate the roundtrip transport latency between
  * client and server.
  *
  * @par Used with
- *    nua_create(), 
+ *    nua_create(),
  *    nta_agent_create(),
  *    nta_agent_set_params(),
  *    nta_outgoing_mcreate(), nta_outgoing_tcreate(),
@@ -1244,14 +1244,14 @@ tag_typedef_t ntatag_use_timestamp = BOOLTAG_TYPEDEF(use_timestamp);
 
 /**@def NTATAG_SIPFLAGS(x)
  *
- * Set SIP parser flags. 
+ * Set SIP parser flags.
  *
  * The SIP parser flags affect how the messages are parsed and the result
  * presented to the application. They also control encoding of messages.
  * The most important flags are as follows:
- * - MSG_FLG_COMPACT - use compact form 
+ * - MSG_FLG_COMPACT - use compact form
  *                     (single-letter header names, minimum whitespace)
- * - MSG_FLG_EXTRACT_COPY - cache printable copy of headers when parsing. 
+ * - MSG_FLG_EXTRACT_COPY - cache printable copy of headers when parsing.
  *   Using this flag can speed up proxy processing considerably. It is
  *   implied when the parsed messages are logged (because #TPORT_LOG
  *   environment variable is set, or TPTAG_LOG() is used.
@@ -1261,7 +1261,7 @@ tag_typedef_t ntatag_use_timestamp = BOOLTAG_TYPEDEF(use_timestamp);
  *    nta_agent_create(), nta_agent_set_params()
  *
  * @par Parameter type
- *    unsigned int 
+ *    unsigned int
  *
  * @par Values
  *    - Bitwise OR of SIP parser flags (enum #msg_flg_user)
@@ -1272,13 +1272,13 @@ tag_typedef_t ntatag_sipflags = UINTTAG_TYPEDEF(sipflags);
 
 /**@def NTATAG_CLIENT_RPORT(x)
  *
- * Enable client-side "rport". 
+ * Enable client-side "rport".
  *
  * This tag controls @RFC3581 support on client side. The "rport" parameter
  * is used when the response has to be routed symmetrically through a NAT box.
  *
  * The client-side support involves just adding the "rport" parameter to the topmost
- * @Via header before the request is sent. 
+ * @Via header before the request is sent.
  *
  * @note By default, the client "rport" is disabled when nta is used, and
  * enabled when nua is used.
@@ -1340,7 +1340,7 @@ tag_typedef_t ntatag_server_rport = INTTAG_TYPEDEF(server_rport);
 
 /**@def NTATAG_TCP_RPORT(x)
  *
- * Use rport with TCP, too. 
+ * Use rport with TCP, too.
  *
  * @par Used with
  *    nua_create(), nua_set_params(),
@@ -1351,7 +1351,7 @@ tag_typedef_t ntatag_server_rport = INTTAG_TYPEDEF(server_rport);
  *          or false (zero or NULL pointer)
  *
  * @par Values
- *    - true - include rport parameter in the TCP via line on client side 
+ *    - true - include rport parameter in the TCP via line on client side
  *    - false - do not include rport parameter in the TCP via line on client side
  *
  * @sa @RFC3581, NTATAG_CLIENT_RPORT(), NTATAG_SERVER_RPORT(), @Via
@@ -1360,12 +1360,12 @@ tag_typedef_t ntatag_tcp_rport = BOOLTAG_TYPEDEF(tcp_rport);
 
 /**@def NTATAG_PRELOAD(x)
  *
- * Preload by N bytes. 
+ * Preload by N bytes.
  *
  * When the memory block is allocated for an incoming request by the stack,
  * the stack can allocate some extra memory for the parser in addition to
- * the memory used by the actual message contents. 
- * 
+ * the memory used by the actual message contents.
+ *
  * While wasting some memory, this can speed up parsing considerably.
  * Recommended amount of preloading per packet is 1500 bytes.
  *
@@ -1385,7 +1385,7 @@ tag_typedef_t ntatag_preload = UINTTAG_TYPEDEF(preload);
 
 /**@def NTATAG_USE_NAPTR(x)
  *
- * If true, try to use NAPTR records when resolving. 
+ * If true, try to use NAPTR records when resolving.
  *
  * The application can disable NTA from using NAPTR records when resolving
  * SIP URIs.
@@ -1433,7 +1433,7 @@ tag_typedef_t ntatag_use_srv = BOOLTAG_TYPEDEF(srv);
 
 /**@def NTATAG_RSEQ(x)
  *
- * @RSeq value for nta_outgoing_prack(). 
+ * @RSeq value for nta_outgoing_prack().
  *
  * @par Used with
  *    nta_outgoing_prack()
@@ -1576,7 +1576,7 @@ tag_typedef_t ntatag_s_recv_response =    USIZETAG_TYPEDEF(s_recv_response);
  *
  * Return number of bad SIP messages that has been received.
  *
- * @sa nta_agent_get_stats(), NTATAG_S_RECV_MSG_REF(), 
+ * @sa nta_agent_get_stats(), NTATAG_S_RECV_MSG_REF(),
  * NTATAG_S_BAD_REQUEST_REF(), NTATAG_S_BAD_RESPONSE_REF().
  */
 tag_typedef_t ntatag_s_bad_message =      USIZETAG_TYPEDEF(s_bad_message);
@@ -1612,7 +1612,7 @@ tag_typedef_t ntatag_s_bad_response =     USIZETAG_TYPEDEF(s_bad_response);
  *
  * @sa nta_agent_get_stats(), NTATAG_DEBUG_DROP_PROB(),
  * NTATAG_S_DROP_RESPONSE_REF()
- * 
+ *
  * @note The value was not calculated before @VERSION_1_12_7.
  */
 tag_typedef_t ntatag_s_drop_request =     USIZETAG_TYPEDEF(s_drop_request);
@@ -1626,7 +1626,7 @@ tag_typedef_t ntatag_s_drop_request =     USIZETAG_TYPEDEF(s_drop_request);
  *
  * @sa nta_agent_get_stats(), NTATAG_DEBUG_DROP_PROB(),
  * NTATAG_S_DROP_REQUEST_REF()
- * 
+ *
  * @note The value was not calculated before @VERSION_1_12_7.
  */
 tag_typedef_t ntatag_s_drop_response =    USIZETAG_TYPEDEF(s_drop_response);
@@ -1651,7 +1651,7 @@ tag_typedef_t ntatag_s_client_tr =        USIZETAG_TYPEDEF(s_client_tr);
  *
  * Get number of server transactions created.
  *
- * Return number of server transactions created. 
+ * Return number of server transactions created.
  *
  * @sa nta_agent_get_stats(), NTATAG_S_RECV_RESPONSE_REF(),
  * NTATAG_S_CLIENT_TR_REF(), NTATAG_S_DIALOG_TR_REF(),
index 7a2f6aa1d889e0dfdf499fdb038ed9fadf502da9..1e14eb63239817ec5796740d863ffcd733cfb5c5 100644 (file)
@@ -24,9 +24,9 @@
 
 /**@internal @file portbind.c
  * @brief Bind a socket to an UDP/TCP port and return the port number
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Mar 25 12:12:25 2004 ppessi
  */
 
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
     else if (strcmp(opt, "4") == 0)
       o_ip4 = 0;
 #endif
-    else 
+    else
       usage(1);
   }
 
@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
     names[N] = pent->p_name, protos[N] = pent->p_proto, types[N++] = SOCK_RAW;
   }
 
-  if (o_tcp) 
+  if (o_tcp)
     names[N] = "TCP", protos[N] = IPPROTO_TCP, types[N++] = SOCK_STREAM;
   if (o_udp)
     names[N] = "UDP", protos[N] = IPPROTO_UDP, types[N++] = SOCK_DGRAM;
@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
 #endif
 
     if (s == INVALID_SOCKET) {
-      fprintf(stderr, "%s: socket(AF_INET%s, 0, %s): %s\n", 
+      fprintf(stderr, "%s: socket(AF_INET%s, 0, %s): %s\n",
              name, af == AF_INET ? "" : "6", names[n], strerror(errno));
       exit(1);
     }
@@ -212,7 +212,7 @@ int main(int argc, char *argv[])
          continue;
        }
       }
-       
+
       fprintf(stderr, "%s: bind(%s): %s\n", name, o_port, strerror(errno));
       exit(1);
     }
@@ -221,7 +221,7 @@ int main(int argc, char *argv[])
       struct sockaddr_storage ss[1];
       struct sockaddr *sa = (void *)ss;
       struct sockaddr_in *sin = (void *)ss;
-      
+
       salen = sizeof *ss;
       if (getsockname(s, sa, &salen) == -1) {
        fprintf(stderr, "%s: getsockname(): %s\n", name, strerror(errno));
index cfff3f99a3f63aa295764037390ae1cca1251630..8e5ded7c64be36e630a344d5574fb1865633735a 100644 (file)
@@ -70,7 +70,7 @@ port=$(./portbind $v6flag $((port + 1))) down=$port
 port=$(./portbind $v6flag $((port + 1))) bind=$port
 port=$(./portbind $v6flag $((port + 1))) contact=$port
 
-# Disable IPv6 resolver for now 
+# Disable IPv6 resolver for now
 if false && eval $ipv6 ; then
     listen="listen-on-v6 port $bind { any; };"
     ns=$me6
@@ -151,11 +151,11 @@ na      NAPTR 20 15 "a" "SIP+D2T" "" a2
 ; No sensible NAPTR match (and we get 503)
 na503   NAPTR 20 15 "S" "SIP+D2F" "" a2
 
-; No SIP NAPTR match 
+; No SIP NAPTR match
 nona   NAPTR 20 15 "S" "ZIP+D2U" "" a2
 _sip._udp.nona   SRV 1 10 $contact ip4
 
-; No SIP SRV match 
+; No SIP SRV match
 nosrv  NAPTR 20 1 "s" "SIP+D2U" "" _sip._udp.nosrv
         NAPTR 20 2 "s" "SIP+D2U" "" _sip._udp.srv
 
@@ -189,7 +189,7 @@ EOF
 named -f -c $namedfile &
 pid=$!
 while ! test -r $pidfile && kill -0 $!
-do 
+do
     sleep 1
 done
 
index 0f17cb0ae0edec6b610b52366a36e668e35fa313..4385e08f633dd004b6d51019e201a634462fe3e6 100644 (file)
  *
  */
 
-/**@ingroup sl_utils 
+/**@ingroup sl_utils
  * @CFILE sl_read_payload.c
  *
  * @brief Functions for reading SIP message payload from a file.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Thu Sep  5 00:44:34 2002 ppessi
  */
 
@@ -112,10 +112,10 @@ sip_payload_t *sl_fread_payload(su_home_t *home, FILE *f)
 
   if (buf == NULL) {
     perror(who);
-    su_free(home, pl); 
+    su_free(home, pl);
     return NULL;
   }
-  
+
   if (used < size)
     buf[used] = '\0';
 
index 61ea5a1e5fb0899b7ca91eff607600d9c9d0c5d1..6511aa615622100083fedd00279e77af0e129a60 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- c -*- */
 
 /**@defgroup sl_utils SIP Library Utilities - "sl_utils"
- * 
+ *
  * SIP library utilities provide some simple utility functions for printing
  * and managing SIP headers or messages.
  *
index 16cf81cb9198761d186ab8d04bf65ec650fd5535..b5eef4295929f9b36542861e059cadcd0c4228a9 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@ingroup sl_utils
  *
- * @CFILE sl_utils_log.c  
+ * @CFILE sl_utils_log.c
  * @brief Implementation of SIP library utility logging functions.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -45,7 +45,7 @@
 #include <sofia-sip/sip_header.h>
 #include "sofia-sip/sl_utils.h"
 
-/**Log a SIP message. 
+/**Log a SIP message.
  *
  * The function sl_message_log() logs shorthand information identifying
  * the SIP message to the given @a log at level @a level.  The shorthand
@@ -60,8 +60,8 @@
  */
 void sl_sip_log(su_log_t *log,
                int level,
-               char const *prefix, 
-               sip_t const *sip, 
+               char const *prefix,
+               sip_t const *sip,
                int details)
 {
   sip_cseq_t const *cs = sip->sip_cseq;
@@ -70,7 +70,7 @@ void sl_sip_log(su_log_t *log,
     log = su_log_default;
 
   assert(cs);
-  
+
   if (sip->sip_request) {
     su_llog(log, level,
            "%s%s "URL_FORMAT_STRING" (CSeq %d %s)\n",
@@ -114,19 +114,19 @@ void sl_sip_log(su_log_t *log,
     sl_to_log(log, level, "\tTo: %s\n", sip->sip_to);
 }
 
-/**Log a @From header. 
+/**Log a @From header.
  *
  * The function sl_from_log() logs the contents of @a from header to
  * the output @a log.  The @a fmt specifies the output format, where %s
  * is replaced with header contents. If @a fmt is @c NULL, only the header
  * contents are logged.
- * 
+ *
  * @param log      output log
  * @param level    logging level of output
- * @param fmt      output format 
+ * @param fmt      output format
  * @param from     @From header
  */
-void sl_from_log(su_log_t *log, int level, 
+void sl_from_log(su_log_t *log, int level,
                 char const *fmt, sip_from_t const *from)
 {
   sip_addr_t a[1];
@@ -137,7 +137,7 @@ void sl_from_log(su_log_t *log, int level,
   memcpy(a, from, sizeof a);
   a->a_params = NULL;
   if (!a->a_display) a->a_display = "";
-    
+
   sl_header_log(log, level, fmt, (sip_header_t *)a);
 }
 
@@ -147,10 +147,10 @@ void sl_from_log(su_log_t *log, int level,
  * log @a log with given @a level.  The @a fmt specifies the output format,
  * where %s is replaced with header contents. If @a fmt is @c NULL, only the
  * header contents are logged.
- * 
+ *
  * @param log      output log
  * @param level    logging level of output
- * @param fmt      output format 
+ * @param fmt      output format
  * @param to       @To header
  */
 void sl_to_log(su_log_t *log, int level, char const *fmt, sip_to_t const *to)
@@ -158,51 +158,51 @@ void sl_to_log(su_log_t *log, int level, char const *fmt, sip_to_t const *to)
   sl_from_log(log, level, fmt, (sip_from_t const *)to);
 }
 
-/**Log a @Contact header. 
+/**Log a @Contact header.
  *
  * The function sl_contact_log() logs the contents of @a contact header
  * to the log @a log with given @a level.  The @a fmt specifies the output
  * format, where %s is replaced with header contents. If @a fmt is @c NULL,
  * only the header contents are logged.
- * 
+ *
  * @param log      output log
  * @param level    logging level of output
- * @param fmt      output format 
+ * @param fmt      output format
  * @param contact  @Contact header
  */
-void sl_contact_log(su_log_t *log, int level, 
+void sl_contact_log(su_log_t *log, int level,
                     char const *fmt, sip_contact_t const *m)
 {
   sl_from_log(log, level, fmt, (sip_from_t const *)m);
 }
 
-/**Log an @Allow header(s). 
+/**Log an @Allow header(s).
  *
  * The function sl_allow_log() logs the contents of @a allow header to
  * the log @a log with given @a level.  The @a fmt specifies the output
  * format, where %s is replaced with header contents. If @a fmt is @c NULL,
  * only the header contents are logged.
- * 
+ *
  * @param log      output log
  * @param level    logging level of output
- * @param fmt      output format 
+ * @param fmt      output format
  * @param allow    @Allow header
  *
  */
-void sl_allow_log(su_log_t *log, int level, 
+void sl_allow_log(su_log_t *log, int level,
                  char const *fmt, sip_allow_t const *allow)
 {
   sl_header_log(log, level, fmt, (sip_header_t *)allow);
 }
 
 
-/**Log a @Via header. 
+/**Log a @Via header.
  *
  * The function sl_via_log() logs the contents of @a via header to
  * the @a log.  The @a fmt specifies the output format, where %s
  * is replaced with header contents. If @a fmt is @c NULL, only the header
  * contents are logged.
- * 
+ *
  * @param log  output log
  * @param fmt  format used when logging
  * @param v    via header
@@ -213,21 +213,21 @@ void sl_via_log(su_log_t *log, int level, char const *fmt, sip_via_t const *v)
 }
 
 
-/**Log message payload. 
+/**Log message payload.
  *
  * The function sl_payload_log() logs the contents of @a payload object
  * to the output @a log.  Each line in the payload is prepended with the
  * @a prefix.  If @a prefix is @c NULL, only the header contents are logged.
  * For each line in payload, only first 70 charactes are logged, rest is
  * replaced with "...".
- * 
+ *
  * @param log      output log
  * @param level    logging level of output
- * @param prefix   prefix appended to each payload line 
+ * @param prefix   prefix appended to each payload line
  * @param pl       payload object
  */
-void sl_payload_log(su_log_t *log, int level, 
-                   char const *prefix, 
+void sl_payload_log(su_log_t *log, int level,
+                   char const *prefix,
                    sip_payload_t const *pl)
 {
   char *s = pl->pl_data, *end = pl->pl_data + pl->pl_len;
@@ -252,14 +252,14 @@ void sl_payload_log(su_log_t *log, int level,
   }
 }
 
-/** Log a header. 
+/** Log a header.
  *
  * Logs the contents of an header to the output @a stream. The @a fmt
- * specifies the output format, where %s is replaced with header contents. 
+ * specifies the output format, where %s is replaced with header contents.
  * If @a fmt is @c NULL, only the header contents are logged.
- * 
+ *
  * @param stream   output stream
- * @param fmt      output format 
+ * @param fmt      output format
  * @param h        a SIP header object
  */
 void sl_header_log(su_log_t *log, int level, char const *fmt,
@@ -275,7 +275,7 @@ void sl_header_log(su_log_t *log, int level, char const *fmt,
   if ((size_t)len >= sizeof b) {
     s = malloc(len + 1); if (!s) return;
     sip_header_field_e(s, len + 1, h, 0);
-  }    
+  }
   s[len] = '\0';
 
   if (fmt == NULL)
index f999832c5679f26e2aa76cb10b07029748f25007..1b5b5a0b8b79667beef8596c9ae78f6ddc69d88e 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@ingroup sl_utils
  *
- * @CFILE sl_utils_print.c  
+ * @CFILE sl_utils_print.c
  * @brief Implementation of SIP library utility print functions.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -42,7 +42,7 @@
 #include <sofia-sip/sip_header.h>
 #include "sofia-sip/sl_utils.h"
 
-/**Print a SIP message. 
+/**Print a SIP message.
  *
  * The function sl_message_log() prints shorthand information identifying
  * the SIP message to the given output @a stream.  The shorthand information
@@ -54,7 +54,7 @@
  * @param sip      message to be logged.
  * @param details  flag specifying if detailed output is desired.
  */
-void sl_message_log(FILE *stream, 
+void sl_message_log(FILE *stream,
                    char const *prefix, sip_t const *sip, int details)
 {
   sip_cseq_t const *cs = sip->sip_cseq;
@@ -63,7 +63,7 @@ void sl_message_log(FILE *stream,
     stream = stdout;
 
   assert(cs);
-  
+
   if (sip->sip_request) {
     fprintf(stream,
            "%s%s "URL_FORMAT_STRING" (CSeq %d %s)\n",
@@ -100,18 +100,18 @@ void sl_message_log(FILE *stream,
     sl_to_print(stream, "\tTo: %s\n", sip->sip_to);
 }
 
-/** Print @From header. 
+/** Print @From header.
  *
  * The function sl_from_print() prints the contents of @a from header to
  * the output @a stream.  The @a fmt specifies the output format, where %s
  * is replaced with header contents. If @a fmt is @c NULL, only the header
  * contents are printed.
- * 
+ *
  * @param stream   output stream
- * @param fmt      output format 
+ * @param fmt      output format
  * @param from     header object
- * 
- * @return 
+ *
+ * @return
  * The function sl_from_print() returns number of bytes printed,
  * or -1 upon an error.
  */
@@ -125,7 +125,7 @@ issize_t sl_from_print(FILE *stream, char const *fmt, sip_from_t const *from)
   memcpy(a, from, sizeof a);
   a->a_params = NULL;
   if (!a->a_display) a->a_display = "";
-    
+
   return sl_header_print(stream, fmt, (sip_header_t *)a);
 }
 
@@ -135,12 +135,12 @@ issize_t sl_from_print(FILE *stream, char const *fmt, sip_from_t const *from)
  * the output @a stream.  The @a fmt specifies the output format, where %s
  * is replaced with header contents. If @a fmt is @c NULL, only the header
  * contents are printed.
- * 
+ *
  * @param stream   output stream
- * @param fmt      output format 
+ * @param fmt      output format
  * @param to       header object
- * 
- * @return 
+ *
+ * @return
  * The function sl_to_print() returns number of bytes printed,
  * or -1 upon an error.
  */
@@ -149,18 +149,18 @@ issize_t sl_to_print(FILE *stream, char const *fmt, sip_to_t const *to)
   return sl_from_print(stream, fmt, (sip_from_t const *)to);
 }
 
-/** Print @Contact header. 
+/** Print @Contact header.
  *
  * The function sl_contact_print() prints the contents of @a contact
  * header to the output @a stream.  The @a fmt specifies the output format,
  * where %s is replaced with header contents. If @a fmt is @c NULL, only the
  * header contents are printed.
- * 
+ *
  * @param stream   output stream
- * @param fmt      output format 
+ * @param fmt      output format
  * @param contact  header object
- * 
- * @return 
+ *
+ * @return
  * The function sl_contact_print() returns number of bytes printed,
  * or -1 upon an error.
 */
@@ -170,18 +170,18 @@ issize_t sl_contact_print(FILE *stream, char const *fmt,
   return sl_from_print(stream, fmt, (sip_from_t const *)m);
 }
 
-/** Print @Allow header(s). 
+/** Print @Allow header(s).
  *
  * The function sl_allow_print() prints the contents of @a allow header to
  * the output @a stream.  The @a fmt specifies the output format, where %s
  * is replaced with header contents. If @a fmt is @c NULL, only the header
  * contents are printed.
- * 
+ *
  * @param stream   output stream
- * @param fmt      output format 
+ * @param fmt      output format
  * @param allow    header object
- * 
- * @return 
+ *
+ * @return
  * The function sl_allow_print() returns number of bytes printed,
  * or -1 upon an error.
 */
@@ -193,25 +193,25 @@ issize_t sl_allow_print(FILE *stream,
 }
 
 
-/** Print message payload. 
+/** Print message payload.
  *
  * The function sl_payload_print() prints the contents of @a payload
  * object to the output @a stream.  The @a fmt specifies the output format,
  * where %s is replaced with header contents. If @a fmt is @c NULL, only the
  * header contents are printed.
- * 
+ *
  * @param stream   output stream
- * @param prefix   prefix appended to each payload line 
+ * @param prefix   prefix appended to each payload line
  * @param pl       payload object
- * 
- * @return 
+ *
+ * @return
  * The function sl_payload_print() returns number of bytes printed,
  * or -1 upon an error.
 */
 issize_t sl_payload_print(FILE *stream, char const *prefix, sip_payload_t const *pl)
 {
   char *s = pl->pl_data, *end = pl->pl_data + pl->pl_len;
-  size_t n, total = 0, crlf = 1; 
+  size_t n, total = 0, crlf = 1;
 
   while (s < end && *s != '\0') {
     n = strncspn(s, end - s, "\r\n");
@@ -228,18 +228,18 @@ issize_t sl_payload_print(FILE *stream, char const *prefix, sip_payload_t const
   return (issize_t)total;
 }
 
-/** Print @Via header. 
+/** Print @Via header.
  *
  * The function sl_via_print() prints the contents of @a via header to
  * the output @a stream.  The @a fmt specifies the output format, where %s
  * is replaced with header contents. If @a fmt is @c NULL, only the header
  * contents are printed.
- * 
+ *
  * @param stream   output stream
- * @param fmt      output format 
+ * @param fmt      output format
  * @param v        header object
- * 
- * @return 
+ *
+ * @return
  * The function sl_via_print() returns number of bytes printed,
  * or -1 upon an error.
  */
@@ -257,17 +257,17 @@ issize_t sl_via_print(FILE *stream, char const *fmt, sip_via_t const *v)
   return -1;
 }
 
-/** Print a header. 
+/** Print a header.
  *
  * Prints the contents of an header to the output @a stream. The @a fmt
- * specifies the output format, where %s is replaced with header contents. 
+ * specifies the output format, where %s is replaced with header contents.
  * If @a fmt is @c NULL, only the header contents are printed.
- * 
+ *
  * @param stream   output stream
- * @param fmt      output format 
+ * @param fmt      output format
  * @param v        header object
- * 
- * @return 
+ *
+ * @return
  * Number of bytes logged, or -1 upon an error.
  */
 issize_t sl_header_print(FILE *stream, char const *fmt, sip_header_t const *h)
@@ -282,7 +282,7 @@ issize_t sl_header_print(FILE *stream, char const *fmt, sip_header_t const *h)
   if ((size_t)len >= sizeof b) {
     s = malloc(len + 1); if (!s) return -1;
     sip_header_field_e(s, len + 1, h, 0);
-  }    
+  }
   s[len] = '\0';
 
   if (fmt != NULL && strcmp(fmt, "%s") != 0)
@@ -292,6 +292,6 @@ issize_t sl_header_print(FILE *stream, char const *fmt, sip_header_t const *h)
 
   if (s != b)
     free(s);
-  
+
   return len;
 }
index 39a4c73219e976016554607055818e1ce6de3ff6..edd2ec63cb25c628cedf1e853d6deb0ce5555eb5 100644 (file)
@@ -48,7 +48,7 @@
 SOFIA_BEGIN_DECLS
 
 /* ----------------------------------------------------------------------
- * 1) Types 
+ * 1) Types
  */
 
 /** NTA agent */
@@ -95,7 +95,7 @@ typedef NTA_OUTGOING_MAGIC_T  nta_outgoing_magic_t;
 typedef NTA_INCOMING_MAGIC_T  nta_incoming_magic_t;
 
 /* ----------------------------------------------------------------------
- * 2) Constants 
+ * 2) Constants
  */
 
 /** NTA API version number */
@@ -122,7 +122,7 @@ typedef int nta_message_f(nta_agent_magic_t *context,
                          msg_t *msg,
                          sip_t *sip);
 
-SOFIAPUBFUN 
+SOFIAPUBFUN
 nta_agent_t *nta_agent_create(su_root_t *root,
                              url_string_t const *name,
                              nta_message_f *callback,
@@ -148,12 +148,12 @@ SOFIAPUBFUN sip_via_t *nta_agent_public_via(nta_agent_t const *a);
 SOFIAPUBFUN char const *nta_agent_newtag(su_home_t *,
                                         char const *fmt, nta_agent_t *);
 
-SOFIAPUBFUN int nta_agent_set_params(nta_agent_t *agent, 
+SOFIAPUBFUN int nta_agent_set_params(nta_agent_t *agent,
                                     tag_type_t tag, tag_value_t value, ...);
-SOFIAPUBFUN int nta_agent_get_params(nta_agent_t *agent, 
+SOFIAPUBFUN int nta_agent_get_params(nta_agent_t *agent,
                                     tag_type_t tag, tag_value_t value, ...);
 
-SOFIAPUBFUN int nta_agent_get_stats(nta_agent_t *agent, 
+SOFIAPUBFUN int nta_agent_get_stats(nta_agent_t *agent,
                                    tag_type_t tag, tag_value_t value, ...);
 
 /* ----------------------------------------------------------------------
@@ -164,9 +164,9 @@ SOFIAPUBFUN msg_t *nta_msg_create(nta_agent_t *self, int flags);
 
 SOFIAPUBFUN int nta_msg_complete(msg_t *msg);
 
-SOFIAPUBFUN int nta_msg_request_complete(msg_t *msg, 
-                                        nta_leg_t *leg, 
-                                        sip_method_t method, 
+SOFIAPUBFUN int nta_msg_request_complete(msg_t *msg,
+                                        nta_leg_t *leg,
+                                        sip_method_t method,
                                         char const *method_name,
                                         url_string_t const *req_url);
 
@@ -176,13 +176,13 @@ SOFIAPUBFUN int nta_sip_is_internal(sip_t const *sip);
 /* ----------------------------------------------------------------------
  * 5) Leg-level prototypes
  */
-typedef int nta_request_f(nta_leg_magic_t *lmagic, 
+typedef int nta_request_f(nta_leg_magic_t *lmagic,
                          nta_leg_t *leg,
-                         nta_incoming_t *irq, 
+                         nta_incoming_t *irq,
                          sip_t const *sip);
 
-SOFIAPUBFUN 
-nta_leg_t *nta_leg_tcreate(nta_agent_t *agent,  
+SOFIAPUBFUN
+nta_leg_t *nta_leg_tcreate(nta_agent_t *agent,
                           nta_request_f *req_callback,
                           nta_leg_magic_t *magic,
                           tag_type_t tag, tag_value_t value, ...);
@@ -217,18 +217,18 @@ SOFIAPUBFUN uint32_t nta_leg_get_seq(nta_leg_t const *leg);
 SOFIAPUBFUN uint32_t nta_leg_get_rseq(nta_leg_t const *leg);
 
 /** Set UAC route. */
-SOFIAPUBFUN int nta_leg_client_route(nta_leg_t *leg, 
-                                    sip_record_route_t const *route, 
+SOFIAPUBFUN int nta_leg_client_route(nta_leg_t *leg,
+                                    sip_record_route_t const *route,
                                     sip_contact_t const *contact);
 
 /** Set UAS route */
-SOFIAPUBFUN int nta_leg_server_route(nta_leg_t *leg, 
-                                    sip_record_route_t const *route, 
+SOFIAPUBFUN int nta_leg_server_route(nta_leg_t *leg,
+                                    sip_record_route_t const *route,
                                     sip_contact_t const *contact);
 
 /** Get route */
-SOFIAPUBFUN int nta_leg_get_route(nta_leg_t *leg, 
-                                 sip_route_t const **return_route, 
+SOFIAPUBFUN int nta_leg_get_route(nta_leg_t *leg,
+                                 sip_route_t const **return_route,
                                  sip_contact_t const **return_target);
 
 /** Get leg by destination */
@@ -237,7 +237,7 @@ SOFIAPUBFUN nta_leg_t *nta_leg_by_uri(nta_agent_t const *,
 
 /** Get leg by dialog */
 SOFIAPUBFUN
-nta_leg_t *nta_leg_by_dialog(nta_agent_t const *agent, 
+nta_leg_t *nta_leg_by_dialog(nta_agent_t const *agent,
                             url_t const *request_uri,
                             sip_call_id_t const *call_id,
                             char const *from_tag,
@@ -258,7 +258,7 @@ SOFIAPUBFUN
 nta_leg_t *nta_leg_by_call_id(nta_agent_t *sa, const char *call_id);
 
 /* ----------------------------------------------------------------------
- * 6) Prototypes for incoming transactions 
+ * 6) Prototypes for incoming transactions
  */
 
 SOFIAPUBFUN
@@ -271,19 +271,19 @@ nta_incoming_t *nta_incoming_create(nta_agent_t *agent,
 SOFIAPUBFUN nta_incoming_t *nta_incoming_default(nta_agent_t *agent);
 
 typedef int nta_ack_cancel_f(nta_incoming_magic_t *imagic,
-                            nta_incoming_t *irq, 
+                            nta_incoming_t *irq,
                             sip_t const *sip);
 
-SOFIAPUBFUN void nta_incoming_bind(nta_incoming_t *irq, 
+SOFIAPUBFUN void nta_incoming_bind(nta_incoming_t *irq,
                                   nta_ack_cancel_f *callback,
                                   nta_incoming_magic_t *imagic);
 
 SOFIAPUBFUN
-nta_incoming_magic_t *nta_incoming_magic(nta_incoming_t *irq, 
+nta_incoming_magic_t *nta_incoming_magic(nta_incoming_t *irq,
                                         nta_ack_cancel_f *callback);
 
 SOFIAPUBFUN
-nta_incoming_t *nta_incoming_find(nta_agent_t const *agent, 
+nta_incoming_t *nta_incoming_find(nta_agent_t const *agent,
                                  sip_t const *sip,
                                  sip_via_t const *v);
 
@@ -307,7 +307,7 @@ SOFIAPUBFUN msg_t *nta_incoming_getresponse(nta_incoming_t *irq);
 SOFIAPUBFUN
 int nta_incoming_complete_response(nta_incoming_t *irq,
                                   msg_t *msg,
-                                  int status, 
+                                  int status,
                                   char const *phrase,
                                   tag_type_t tag, tag_value_t value, ...);
 
@@ -315,8 +315,8 @@ SOFIAPUBFUN
 msg_t *nta_incoming_create_response(nta_incoming_t *irq, int status, char const *phrase);
 
 SOFIAPUBFUN
-int nta_incoming_treply(nta_incoming_t *ireq, 
-                       int status, char const *phrase, 
+int nta_incoming_treply(nta_incoming_t *ireq,
+                       int status, char const *phrase,
                        tag_type_t tag, tag_value_t value, ...);
 
 SOFIAPUBFUN int nta_incoming_mreply(nta_incoming_t *irq, msg_t *msg);
@@ -378,7 +378,7 @@ SOFIAPUBFUN
 nta_outgoing_t *nta_outgoing_mcreate(nta_agent_t *agent,
                                     nta_response_f *callback,
                                     nta_outgoing_magic_t *magic,
-                                    url_string_t const *route_url, 
+                                    url_string_t const *route_url,
                                     msg_t *msg,
                                     tag_type_t tag, tag_value_t value, ...);
 
@@ -405,7 +405,7 @@ SOFIAPUBFUN msg_t *nta_outgoing_getresponse(nta_outgoing_t *orq);
 SOFIAPUBFUN msg_t *nta_outgoing_getrequest(nta_outgoing_t *orq);
 
 SOFIAPUBFUN
-nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq, 
+nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
                                    nta_response_f *callback,
                                    nta_outgoing_magic_t *magic,
                                    char const *to_tag,
@@ -414,7 +414,7 @@ nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
 SOFIAPUBFUN int nta_outgoing_cancel(nta_outgoing_t *);
 
 SOFIAPUBFUN
-nta_outgoing_t *nta_outgoing_tcancel(nta_outgoing_t *orq, 
+nta_outgoing_t *nta_outgoing_tcancel(nta_outgoing_t *orq,
                                     nta_response_f *callback,
                                     nta_outgoing_magic_t *magic,
                                     tag_type_t, tag_value_t, ...);
@@ -424,7 +424,7 @@ SOFIAPUBFUN void nta_outgoing_destroy(nta_outgoing_t *);
 SOFIAPUBFUN
 nta_outgoing_t *nta_outgoing_find(nta_agent_t const *sa,
                                  msg_t const *msg,
-                                 sip_t const *sip, 
+                                 sip_t const *sip,
                                  sip_via_t const *v);
 
 SOFIAPUBFUN int nta_tport_keepalive(nta_outgoing_t *orq);
@@ -464,19 +464,19 @@ typedef NTA_RELIABLE_MAGIC_T  nta_reliable_magic_t;
 
 typedef int nta_prack_f(nta_reliable_magic_t *rmagic,
                        nta_reliable_t *rel,
-                       nta_incoming_t *prack, 
+                       nta_incoming_t *prack,
                        sip_t const *sip);
 
 SOFIAPUBFUN
 nta_reliable_t *nta_reliable_treply(nta_incoming_t *ireq,
                                    nta_prack_f *callback,
                                    nta_reliable_magic_t *rmagic,
-                                   int status, char const *phrase, 
-                                   tag_type_t tag, 
+                                   int status, char const *phrase,
+                                   tag_type_t tag,
                                    tag_value_t value, ...);
 
 SOFIAPUBFUN
-nta_reliable_t *nta_reliable_mreply(nta_incoming_t *irq, 
+nta_reliable_t *nta_reliable_mreply(nta_incoming_t *irq,
                                    nta_prack_f *callback,
                                    nta_reliable_magic_t *rmagic,
                                    msg_t *msg);
index a4fc8bea6bcd0c62624f49a33843f79e7c6e3211..48ee5252756f6b7c15f84563521aab13819c3cee 100644 (file)
@@ -24,9 +24,9 @@
 
 #ifndef NTA_STATELESS_H
 /** Defined when <sofia-sip/nta_stateless.h> has been included. */
-#define NTA_STATELESS_H 
+#define NTA_STATELESS_H
 
-/**@file sofia-sip/nta_stateless.h   
+/**@file sofia-sip/nta_stateless.h
  * @brief NTA functions for stateless SIP processing.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -46,18 +46,18 @@ SOFIA_BEGIN_DECLS
  *                           sip_t *sip);
  *
  * Callback for incoming messages.
- * 
+ *
  * The typedef nta_message_f() defines prototype for the callback functions
  * invoked by NTA when it has received an incoming message that will be
  * processed statelessly.
- * 
+ *
  * The application can either discard the message by calling
  * nta_msg_discard(), forward it by calling nta_msg_tsend() or reply to the
  * message by calling nta_msg_treply(). When application wants to process a
  * request statefully, it passes the message to a leg with the function
  * nta_leg_stateful(). A new leg can be created by calling the function
  * nta_leg_tcreate().
- * 
+ *
  * @par Prototype
  * @code
  * int message_callback(nta_agent_magic_t *context,
@@ -65,7 +65,7 @@ SOFIA_BEGIN_DECLS
  *                      msg_t *msg,
  *                      sip_t *sip);
  * @endcode
- * 
+ *
  * @param context agent context
  * @param agent   agent handle
  * @param msg     received message
@@ -90,7 +90,7 @@ int nta_msg_mreply(nta_agent_t *agent,
 
 /** Reply to a request message. */
 SOFIAPUBFUN
-int nta_msg_treply(nta_agent_t *self, 
+int nta_msg_treply(nta_agent_t *self,
                   msg_t *msg,
                   int status, char const *phrase,
                   tag_type_t tag, tag_value_t value, ...);
index b1eb0b42fb85a77bcecfa2760afa921947a65fa1..d14aa5c34e0032a28f3aa4d7789ff785010443eb 100644 (file)
@@ -26,7 +26,7 @@
 /** Defined when <sofia-sip/nta_tag.h> has been included. */
 #define NTA_TAG_H
 
-/**@file sofia-sip/nta_tag.h   
+/**@file sofia-sip/nta_tag.h
  * @brief NTA tags
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -142,7 +142,7 @@ NTA_DLL extern tag_typedef_t ntatag_smime;
 
 NTA_DLL extern tag_typedef_t ntatag_smime_ref;
 #define NTATAG_SMIME_REF(x) ntatag_smime_ref, tag_ptr_vr(&(x), (x))
+
 NTA_DLL extern tag_typedef_t ntatag_maxsize;
 #define NTATAG_MAXSIZE(x) ntatag_maxsize, tag_usize_v((x))
 
@@ -341,13 +341,13 @@ NTA_DLL extern tag_typedef_t ntatag_rel100;
 
 NTA_DLL extern tag_typedef_t ntatag_rel100_ref;
 #define NTATAG_REL100_REF(x) ntatag_rel100_ref, tag_bool_vr(&(x))
+
 NTA_DLL extern tag_typedef_t ntatag_sipflags;
 #define NTATAG_SIPFLAGS(x)     ntatag_sipflags, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sipflags_ref;
 #define NTATAG_SIPFLAGS_REF(x) ntatag_sipflags_ref, tag_uint_vr(&(x))
+
 NTA_DLL extern tag_typedef_t ntatag_client_rport;
 #define NTATAG_CLIENT_RPORT(x) ntatag_client_rport, tag_bool_v((x))
 
index 704fb2b3369e20948e885fcca8afb37affd61b1c..3d3a105990ff77cf19b50c1eda1e0f53fc722d8c 100644 (file)
 /**
  * @file sofia-sip/nta_tport.h
  * @brief Transport and SigComp handling
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Oct  7 20:04:39 2004 ppessi
- * 
+ *
  */
 
 #ifndef NTA_H
index cdef936fbd88a1575bc91b27a235a369271f4bca..18cca431d1bc7d13b15550f7a0739f5ad58cf799 100644 (file)
 
 #ifndef SL_UTILS_H
 /** Defined when <sofia-sip/sl_utils.h> has been included. */
-#define SL_UTILS_H 
+#define SL_UTILS_H
 
-/**@ingroup sl_utils 
- * 
+/**@ingroup sl_utils
+ *
  * @file sofia-sip/sl_utils.h @brief Prototypes for SIP helper functions.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -57,7 +57,7 @@ SOFIAPUBFUN sip_payload_t *sl_read_payload(su_home_t *home, char const *fname);
 SOFIAPUBFUN sip_payload_t *sl_fread_payload(su_home_t *home, FILE *);
 
 /* Printing functions */
-SOFIAPUBFUN void 
+SOFIAPUBFUN void
 sl_message_log(FILE *, char const *prefix, sip_t const *, int details);
 SOFIAPUBFUN issize_t
 sl_header_print(FILE *, char const *fmt, sip_header_t const *h),
@@ -69,7 +69,7 @@ sl_payload_print(FILE *, char const *prefix, sip_payload_t const *pl),
 sl_via_print(FILE *, char const *fmt, sip_via_t const *v);
 
 /* Logging functions */
-SOFIAPUBFUN void 
+SOFIAPUBFUN void
 sl_sip_log(su_log_t*, int lvl, char const *, sip_t const *, int details),
 sl_header_log(su_log_t *, int lvl, char const *, sip_header_t const *h),
 sl_from_log(su_log_t *, int lvl, char const *, sip_from_t const *from),
index 4fa9b077ab57af777f054d89491388911473552e..8f599bea8b0c38d3291546ae02ad467e44e86df3 100644 (file)
@@ -200,14 +200,14 @@ static int test_prack(agent_t *ag);
 static int test_fix_467(agent_t *ag);
 
 static int test_for_ack(agent_t *ag,
-                       nta_incoming_t *irq, 
+                       nta_incoming_t *irq,
                        sip_t const *sip);
 static int test_for_ack_or_timeout(agent_t *ag,
-                                  nta_incoming_t *irq, 
+                                  nta_incoming_t *irq,
                                   sip_t const *sip);
 
 static int wait_for_ack_or_cancel(agent_t *ag,
-                                 nta_incoming_t *irq, 
+                                 nta_incoming_t *irq,
                                  sip_t const *sip);
 
 int agent_callback(agent_t *ag,
@@ -218,14 +218,14 @@ int agent_callback(agent_t *ag,
   if (tstflags & tst_verbatim) {
     if (sip->sip_request) {
       printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-            name, __func__, sip->sip_request->rq_method_name, 
+            name, __func__, sip->sip_request->rq_method_name,
             URL_PRINT_ARGS(sip->sip_request->rq_url),
             sip->sip_request->rq_version);
     }
     else {
-      printf("%s: %s: %s %03d %s\n", name, __func__, 
-            sip->sip_status->st_version, 
-            sip->sip_status->st_status, 
+      printf("%s: %s: %s %03d %s\n", name, __func__,
+            sip->sip_status->st_version,
+            sip->sip_status->st_status,
             sip->sip_status->st_phrase);
     }
   }
@@ -245,14 +245,14 @@ void leg_match(agent_t *ag, nta_leg_t *leg, int always, char const *func)
 
   if (leg == ag->ag_default_leg)
     match = "ag_default_leg";
-  else if (leg == ag->ag_server_leg) 
+  else if (leg == ag->ag_server_leg)
     match = "ag_server_leg";
   else if (leg == ag->ag_alice_leg)
     match = "ag_alice_leg";
   else if (leg == ag->ag_bob_leg)
     match = "ag_bob_leg";
 
-  printf("%s: %s: %smatched with %s\n", name, func, 
+  printf("%s: %s: %smatched with %s\n", name, func,
         always ? "mis" : "", match);
 }
 
@@ -261,14 +261,14 @@ void leg_zap(agent_t *ag, nta_leg_t *leg)
 {
   if (leg == ag->ag_default_leg)
     ag->ag_default_leg = NULL;
-  else if (leg == ag->ag_server_leg) 
+  else if (leg == ag->ag_server_leg)
     ag->ag_server_leg = NULL;
   else if (leg == ag->ag_alice_leg)
     ag->ag_alice_leg = NULL;
   else if (leg == ag->ag_bob_leg)
     ag->ag_bob_leg = NULL;
-  else 
-    printf("%s:%u: %s: did not exist\n", 
+  else
+    printf("%s:%u: %s: did not exist\n",
           __FILE__, __LINE__, __func__);
 
   nta_leg_destroy(leg);
@@ -282,7 +282,7 @@ int leg_callback_200(agent_t *ag,
 {
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -320,7 +320,7 @@ int leg_callback_500(agent_t *ag,
 {
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -336,7 +336,7 @@ int new_leg_callback_200(agent_t *ag,
 {
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -407,9 +407,9 @@ int outgoing_callback(client_t *ctx,
 
   if (tstflags & tst_verbatim) {
     if (sip)
-      printf("%s: %s: response %s %03d %s\n", name, ctx->c_name, 
-            sip->sip_status->st_version, 
-            sip->sip_status->st_status, 
+      printf("%s: %s: response %s %03d %s\n", name, ctx->c_name,
+            sip->sip_status->st_version,
+            sip->sip_status->st_status,
             sip->sip_status->st_phrase);
     else
       printf("%s: %s: callback %03d\n", name, ctx->c_name,
@@ -439,7 +439,7 @@ int outgoing_callback(client_t *ctx,
 }
 
 /** Deinit client. Return nonzero if client checks failed. */
-static 
+static
 int client_deinit(client_t *c)
 {
   int errors = c->c_errors;
@@ -449,14 +449,14 @@ int client_deinit(client_t *c)
 
   if (c->c_orq) nta_outgoing_destroy(c->c_orq), c->c_orq = NULL;
 
-  c->c_errors = 0; 
+  c->c_errors = 0;
   c->c_status = 0;
 
   return errors;
 }
 
 
-static 
+static
 void nta_test_run(agent_t *ag)
 {
   for (ag->ag_running = 1; ag->ag_running;) {
@@ -469,7 +469,7 @@ void nta_test_run(agent_t *ag)
 
 
 /** Run client test. Return nonzero if client checks failed. */
-static 
+static
 int client_run_with(client_t *c, int expected, void (*runner)(client_t *c))
 {
   int resulting;
@@ -489,7 +489,7 @@ int client_run_with(client_t *c, int expected, void (*runner)(client_t *c))
   return 0;
 }
 
-static 
+static
 void until_final_received(client_t *c)
 {
   for (c->c_final = 0; !c->c_final; ) {
@@ -500,7 +500,7 @@ void until_final_received(client_t *c)
   }
 }
 
-static 
+static
 int client_run(client_t *c, int expected)
 {
   return client_run_with(c, expected, until_final_received);
@@ -519,13 +519,13 @@ void until_server_acked(client_t *c)
   }
 }
 
-static 
+static
 int client_run_until_acked(client_t *c, int expected)
 {
   return client_run_with(c, expected, until_server_acked);
 }
 
-void 
+void
 until_server_canceled(client_t *c)
 {
   agent_t *ag = c->c_ag;
@@ -538,7 +538,7 @@ until_server_canceled(client_t *c)
   }
 }
 
-static 
+static
 int client_run_until_canceled(client_t *c, int expected)
 {
   return client_run_with(c, expected, until_server_canceled);
@@ -552,7 +552,7 @@ int test_init(agent_t *ag, char const *resolv_conf)
   char const *contact = "sip:*:*;comp=sigcomp";
   su_sockaddr_t su;
   socklen_t sulen, sulen0;
-  su_socket_t s; 
+  su_socket_t s;
   int af, err = -1;
 
   BEGIN();
@@ -607,7 +607,7 @@ int test_init(agent_t *ag, char const *resolv_conf)
   }
   TEST_1(bind(s, &su.su_sa, sulen) < 0 ? (perror("bind"), 0) : 1);
   ag->ag_down_socket = s;
-  
+
   /* Create agent */
   ag->ag_agent = nta_agent_create(ag->ag_root,
                                  (url_string_t *)contact,
@@ -680,7 +680,7 @@ int test_init(agent_t *ag, char const *resolv_conf)
     TEST_1(ag->ag_alice = sip_from_dup(ag->ag_home, from));
   }
   {
-    char const data[] = 
+    char const data[] =
       "v=0\r\n"
       "o=- 425432 423412 IN IP4 127.0.0.1\r\n"
       "s= \r\n"
@@ -694,7 +694,7 @@ int test_init(agent_t *ag, char const *resolv_conf)
   {
     sip_contact_t *m;
 
-    ag->ag_aliases = 
+    ag->ag_aliases =
       sip_contact_make(ag->ag_home, "sip:127.0.0.1, sip:localhost, sip:[::1]");
     TEST_1(ag->ag_aliases);
     TEST_1(ag->ag_aliases->m_next);
@@ -709,43 +709,43 @@ int test_init(agent_t *ag, char const *resolv_conf)
     m->m_next = ag->ag_aliases;
     ag->ag_aliases = m;
 
-    err = nta_agent_set_params(ag->ag_agent, 
+    err = nta_agent_set_params(ag->ag_agent,
                               NTATAG_ALIASES(ag->ag_aliases),
                               NTATAG_REL100(1),
-                              NTATAG_UA(1), 
-                              NTATAG_MERGE_482(1), 
+                              NTATAG_UA(1),
+                              NTATAG_MERGE_482(1),
                               NTATAG_USE_NAPTR(1),
                               NTATAG_USE_SRV(1),
                               NTATAG_MAX_FORWARDS(20),
                               TAG_END());
     TEST(err, 7);
 
-    err = nta_agent_set_params(ag->ag_agent, 
+    err = nta_agent_set_params(ag->ag_agent,
                               NTATAG_ALIASES(ag->ag_aliases),
                               NTATAG_DEFAULT_PROXY("sip:127.0.0.1"),
                               TAG_END());
     TEST(err, 2);
 
-    err = nta_agent_set_params(ag->ag_agent, 
+    err = nta_agent_set_params(ag->ag_agent,
                               NTATAG_ALIASES(ag->ag_aliases),
                               NTATAG_DEFAULT_PROXY(NULL),
                               TAG_END());
     TEST(err, 2);
 
-    err = nta_agent_set_params(ag->ag_agent, 
+    err = nta_agent_set_params(ag->ag_agent,
                               NTATAG_DEFAULT_PROXY("tel:+35878008000"),
                               TAG_END());
     TEST(err, -1);
 
   }
-  
+
   {
     url_t url[1];
 
     /* Create the server leg */
     *url = *ag->ag_aliases->m_url;
     url->url_user = "%";
-    ag->ag_server_leg = nta_leg_tcreate(ag->ag_agent, 
+    ag->ag_server_leg = nta_leg_tcreate(ag->ag_agent,
                                        leg_callback_200,
                                        ag,
                                        NTATAG_NO_DIALOG(1),
@@ -755,14 +755,14 @@ int test_init(agent_t *ag, char const *resolv_conf)
   }
 
   END();
-}  
+}
 
 int test_reinit(agent_t *ag)
 {
   BEGIN();
   /* Create a new default leg */
   nta_leg_destroy(ag->ag_default_leg), ag->ag_default_leg = NULL;
-  TEST_1(ag->ag_default_leg = nta_leg_tcreate(ag->ag_agent, 
+  TEST_1(ag->ag_default_leg = nta_leg_tcreate(ag->ag_agent,
                                              leg_callback_200,
                                              ag,
                                              NTATAG_NO_DIALOG(1),
@@ -795,7 +795,7 @@ int test_deinit(agent_t *ag)
   free(ag->ag_mclass), ag->ag_mclass = NULL;
 
   END();
-}  
+}
 
 static
 int readfile(FILE *f, void **contents)
@@ -804,13 +804,13 @@ int readfile(FILE *f, void **contents)
   char *buffer = NULL;
   long size;
   size_t len;
-  
+
   /* Read whole file in */
   if (fseek(f, 0, SEEK_END) < 0 ||
       (size = ftell(f)) < 0 ||
       fseek(f, 0, SEEK_SET) < 0 ||
       (long)(len = (size_t)size) != size) {
-    fprintf(stderr, "%s: unable to determine file size (%s)\n", 
+    fprintf(stderr, "%s: unable to determine file size (%s)\n",
            __func__, strerror(errno));
     return -1;
   }
@@ -832,7 +832,7 @@ int readfile(FILE *f, void **contents)
 
 #if HAVE_DIRENT_H
 #include <dirent.h>
-#endif 
+#endif
 
 static int test_bad_messages(agent_t *ag)
 {
@@ -860,13 +860,13 @@ static int test_bad_messages(agent_t *ag)
   }
 
   if (dir == NULL) {
-    fprintf(stderr, "test_nta: cannot find sip torture messages\n"); 
-    fprintf(stderr, "test_nta: tried %s\n", name); 
+    fprintf(stderr, "test_nta: cannot find sip torture messages\n");
+    fprintf(stderr, "test_nta: tried %s\n", name);
   }
 
   offset = strlen(name);
 
-  TEST_1(ag->ag_default_leg = nta_leg_tcreate(ag->ag_agent, 
+  TEST_1(ag->ag_default_leg = nta_leg_tcreate(ag->ag_agent,
                                              leg_callback_500,
                                              ag,
                                              NTATAG_NO_DIALOG(1),
@@ -882,10 +882,10 @@ static int test_bad_messages(agent_t *ag)
   memset(hints, 0, sizeof hints);
   hints->ai_socktype = SOCK_DGRAM;
   hints->ai_protocol = IPPROTO_UDP;
-  
+
   TEST(su_getaddrinfo(host, port, hints, &ai), 0); TEST_1(ai);
   s = su_socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); TEST_1(s != -1);
-  memset(su, 0, sulen = ai->ai_addrlen); 
+  memset(su, 0, sulen = ai->ai_addrlen);
   su->su_len = sizeof su; su->su_family = ai->ai_family;
   TEST_1(bind(s, &su->su_sa, sulen) == 0);
   TEST_1(getsockname(s, &su->su_sa, &sulen) == 0);
@@ -945,7 +945,7 @@ static int test_bad_messages(agent_t *ag)
   END();
 }
 
-static unsigned char const code[] = 
+static unsigned char const code[] =
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 #include <sofia-sip/su_uniqueid.h>
@@ -957,7 +957,7 @@ sip_payload_t *test_payload(su_home_t *home, size_t size)
   if (pl) {
     size_t i;
     char *data = (char *)pl->pl_data;
-    
+
     for (i = 0; i < size; i++) {
       if ((i & 63) != 63)
        data[i] = code[su_randint(0, 63)];
@@ -969,15 +969,15 @@ sip_payload_t *test_payload(su_home_t *home, size_t size)
   return pl;
 }
 
-static 
+static
 int client_check_to_tag(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 {
-  if (sip) 
+  if (sip)
     TEST_1(sip->sip_to && sip->sip_to->a_tag);
   return 0;
 }
 
-static 
+static
 int check_magic_branch(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 {
   if (sip) {
@@ -1069,7 +1069,7 @@ int test_tports(agent_t *ag)
 
   url->url_params = "transport=udp";
 
-  TEST_1(nta_agent_add_tport(ag->ag_agent, (url_string_t *)url, 
+  TEST_1(nta_agent_add_tport(ag->ag_agent, (url_string_t *)url,
                             TAG_END()) == 0);
 
   TEST_1(v = nta_agent_via(ag->ag_agent));
@@ -1103,7 +1103,7 @@ int test_tports(agent_t *ag)
 
   {
     /* Test 0.1
-     * Send a message from default leg to default leg 
+     * Send a message from default leg to default leg
      */
     char const p_acid[] = "P-Access-Network-Info: IEEE-802.11g\n";
     url_t url[1];
@@ -1113,8 +1113,8 @@ int test_tports(agent_t *ag)
     url->url_params = NULL;
     ag->ag_expect_leg = ag->ag_default_leg;
 
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_default_leg, 
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_default_leg,
                           outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1144,15 +1144,15 @@ int test_tports(agent_t *ag)
     url_t url[1];
     sip_t *sip;
     client_t ctx[1] = {{ ag, "Test 0.1.2", check_via_without_sigcomp }};
-    
+
     *url = *ag->ag_contact->m_url;
     /* Test that method parameter is stripped and headers in query are used */
     url->url_params = "method=MESSAGE;user=IP";
     url->url_headers = "organization=United%20Testers";
     ag->ag_expect_leg = ag->ag_default_leg;
 
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_default_leg, 
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_default_leg,
                           outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1171,7 +1171,7 @@ int test_tports(agent_t *ag)
     TEST_1(sip->sip_organization);
     TEST_S(sip->sip_organization->g_string, "United Testers");
     TEST_S(sip->sip_request->rq_url->url_params, "user=IP");
-    
+
     nta_leg_bind(ag->ag_default_leg, leg_callback_200, ag);
   }
 
@@ -1195,7 +1195,7 @@ int test_tports(agent_t *ag)
 
     ag->ag_expect_leg = ag->ag_server_leg;
 
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1218,7 +1218,7 @@ int test_tports(agent_t *ag)
 
   /* Test 0.2
    * Send a message from Bob to Alice
-   * This time specify a TCP URI, and include a large payload 
+   * This time specify a TCP URI, and include a large payload
    * of 512 kB
    */
   if (tcp) {
@@ -1236,7 +1236,7 @@ int test_tports(agent_t *ag)
     TEST_1(pl = test_payload(ag->ag_home, size));
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_MESSAGE,
@@ -1257,16 +1257,16 @@ int test_tports(agent_t *ag)
   if (tcp_tport) {
     /* Test 0.2.1 - always use transport connection from NTATAG_TPORT()
      *
-     * Test bug reported by geaaru 
+     * Test bug reported by geaaru
      * - NTATAG_TPORT() is not used if NTATAG_DEFAULT_PROXY() is given
      */
     client_t ctx[1] = {{ ag, "Test 0.2.1", save_and_check_tcp }};
     url_t url[1];
     sip_payload_t *pl;
     tport_t *used_tport = NULL;
-    
+
     ctx->c_extra = &used_tport;
-    
+
     *url = *ag->ag_aliases->m_url;
     url->url_user = "alice";
 
@@ -1275,7 +1275,7 @@ int test_tports(agent_t *ag)
     TEST_1(pl = test_payload(ag->ag_home, 512));
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_MESSAGE,
@@ -1311,7 +1311,7 @@ int test_tports(agent_t *ag)
     url_t url[1];
     sip_payload_t *pl;
     tport_t *used_tport = NULL;
-    
+
     ctx->c_extra = &used_tport;
     TEST_1(tport_is_primary(tcp_tport));
 
@@ -1324,7 +1324,7 @@ int test_tports(agent_t *ag)
     url->url_params = NULL;    /* No sigcomp */
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           (url_string_t *)url,
                           SIP_METHOD_MESSAGE,
@@ -1363,7 +1363,7 @@ int test_tports(agent_t *ag)
     TEST_1(pl = test_payload(ag->ag_home, size));
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1395,7 +1395,7 @@ int test_tports(agent_t *ag)
     TEST_1(pl = test_payload(ag->ag_home, size));
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1436,7 +1436,7 @@ int test_tports(agent_t *ag)
 
     su_free(ag->ag_home, ag->ag_in_via), ag->ag_in_via = NULL;
 
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1474,7 +1474,7 @@ int test_tports(agent_t *ag)
     TEST_1(pl = test_payload(ag->ag_home, size));
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1495,7 +1495,7 @@ int test_tports(agent_t *ag)
 
   if (udp) {
     /* Test 0.6
-     * Send a message from default leg to server leg 
+     * Send a message from default leg to server leg
      * using a prefilled Via header
      */
     client_t ctx[1] = {{ ag, "Test 0.6", check_magic_branch }};
@@ -1505,19 +1505,19 @@ int test_tports(agent_t *ag)
     sip_via_init(via);
 
     via->v_protocol = sip_transport_udp;
-    
+
     via->v_host = ag->ag_contact->m_url->url_host;
     via->v_port = ag->ag_contact->m_url->url_port;
-    
+
     sip_via_add_param(ag->ag_home, via, "branch=MagicalBranch");
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_ALIASES(ag->ag_aliases),
                         NTATAG_USER_VIA(1),
                         TAG_END());
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1531,13 +1531,13 @@ int test_tports(agent_t *ag)
     TEST_1(!client_run(ctx, 200));
     TEST_P(ag->ag_latest_leg, ag->ag_server_leg);
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_USER_VIA(0),
                         TAG_END());
   }
 
   /* Test 0.7
-   * Send a message from Bob to Alice using SCTP 
+   * Send a message from Bob to Alice using SCTP
    */
   if (sctp) {
     url_t url[1];
@@ -1557,7 +1557,7 @@ int test_tports(agent_t *ag)
     TEST_1(pl = test_payload(ag->ag_home, size));
 
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1580,7 +1580,7 @@ int test_tports(agent_t *ag)
     usize_t size = 128 * 1024;
     client_t ctx[1] = {{ ag, "Test 0.8" }};
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_MAXSIZE(65536),
                         TAG_END());
 
@@ -1591,7 +1591,7 @@ int test_tports(agent_t *ag)
 
     ag->ag_expect_leg = ag->ag_server_leg;
     ag->ag_latest_leg = NULL;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1606,7 +1606,7 @@ int test_tports(agent_t *ag)
     TEST_1(!client_run(ctx, 413));
     TEST_P(ag->ag_latest_leg, NULL);
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_MAXSIZE(2 * 1024 * 1024),
                         TAG_END());
   }
@@ -1619,10 +1619,10 @@ int test_tports(agent_t *ag)
     printf("%s: starting MESSAGE timeout test, completing in 4 seconds\n",
           name);
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_TIMEOUT_408(1),
-                        NTATAG_SIP_T1(25), 
-                        NTATAG_SIP_T1X64(64 * 25), 
+                        NTATAG_SIP_T1(25),
+                        NTATAG_SIP_T1X64(64 * 25),
                         NTATAG_SIP_T2(8 * 25),
                         NTATAG_SIP_T4(10 * 25),
                         TAG_END());
@@ -1633,7 +1633,7 @@ int test_tports(agent_t *ag)
 
     ag->ag_expect_leg = ag->ag_server_leg;
     ag->ag_latest_leg = NULL;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1654,7 +1654,7 @@ int test_tports(agent_t *ag)
                         NTATAG_SIP_T4(NTA_SIP_T4),
                         TAG_END());
   }
-  
+
 
   END();
 }
@@ -1666,7 +1666,7 @@ int leg_callback_destroy(agent_t *ag,
 {
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -1685,7 +1685,7 @@ int leg_callback_save(agent_t *ag,
 {
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -1711,14 +1711,14 @@ int test_destroy_incoming(agent_t *ag)
     client_t ctx[1] = {{ ag, "Test 3.1" }};
 
     /* Test 3.1
-     * Check that when a incoming request is destroyed in callback, 
+     * Check that when a incoming request is destroyed in callback,
      * a 500 response is sent
      */
     ag->ag_expect_leg = ag->ag_default_leg;
     nta_leg_bind(ag->ag_default_leg, leg_callback_destroy, ag);
-    
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_default_leg, 
+
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_default_leg,
                           outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1738,9 +1738,9 @@ int test_destroy_incoming(agent_t *ag)
     client_t ctx[1] = {{ ag, "Test 3.2" }};
 
     nta_leg_bind(ag->ag_default_leg, leg_callback_save, ag);
-    
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_default_leg, 
+
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_default_leg,
                           outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1778,9 +1778,9 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
 
   nta_leg_bind(ag->ag_default_leg, leg_callback_200, ag);
 
-  nta_agent_set_params(ag->ag_agent, 
-                      NTATAG_SIP_T1(8 * 25), 
-                      NTATAG_SIP_T1X64(64 * 25), 
+  nta_agent_set_params(ag->ag_agent,
+                      NTATAG_SIP_T1(8 * 25),
+                      NTATAG_SIP_T1X64(64 * 25),
                       NTATAG_SIP_T4(10 * 25),
                       TAG_END());
 
@@ -1805,7 +1805,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
      */
     client_t ctx[1] = {{ ag, "Test 1.1" }};
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1826,7 +1826,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     client_t ctx[1] = {{ ag, "Test 1.2" }};
     url->url_host = "srv.example.org";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1847,7 +1847,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     client_t ctx[1] = {{ ag, "Test 1.3" }};
     url->url_host = "ipv.example.org";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1868,7 +1868,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     client_t ctx[1] = {{ ag, "Test 1.4.1" }};
     url->url_host = "down.example.org";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1890,7 +1890,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     client_t ctx[1] = {{ ag, "Test 1.4.2" }};
     url->url_host = "na503.example.org";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1911,7 +1911,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     client_t ctx[1] = {{ ag, "Test 1.4.3" }};
     url->url_host = "nona.example.org";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1934,7 +1934,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     client_t ctx[1] = {{ ag, "Test 1.4.4" }};
     url->url_host = "nosrv.example.org";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1949,7 +1949,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
   }
 
   {
-    /* Test 1.5.1 
+    /* Test 1.5.1
      * Send a message to sip:srv.example.org;transport=tcp
      * Test outgoing_make_srv_query()
      */
@@ -1957,7 +1957,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     url->url_host = "srv.example.org";
     url->url_params = "transport=tcp";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -1982,7 +1982,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     url->url_host = "srv.example.org";
     url->url_params = "transport=udp";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -2007,7 +2007,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     url->url_host = "srv2.example.org";
     url->url_params = "transport=udp";
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -2032,7 +2032,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     url->url_host = "srv.example.org";
     url->url_port = ag->ag_contact->m_url->url_port;
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -2056,7 +2056,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     url->url_host = "a.example.org";
     url->url_port = ag->ag_contact->m_url->url_port;
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -2081,7 +2081,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
 
     url->url_host = "na.example.org";
     ag->ag_expect_leg = ag->ag_default_leg;
-    TEST_1(ctx->c_orq = 
+    TEST_1(ctx->c_orq =
           nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                                ag->ag_obp,
                                SIP_METHOD_MESSAGE,
@@ -2106,7 +2106,7 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
     url->url_host = "down2.example.org";
     url->url_port = ag->ag_contact->m_url->url_port;
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -2142,15 +2142,15 @@ int test_routing(agent_t *ag)
 
   nta_leg_bind(ag->ag_default_leg, leg_callback_200, ag);
 
-  nta_agent_set_params(ag->ag_agent, 
+  nta_agent_set_params(ag->ag_agent,
                       NTATAG_MAXSIZE(2 * 1024 * 1024),
                       TAG_END());
 
   BEGIN();
 
   {
-    /* 
-     * Send a message from default leg to default leg 
+    /*
+     * Send a message from default leg to default leg
      *
      * We are now using url with an explicit port that does not match with
      * our own port number.
@@ -2162,7 +2162,7 @@ int test_routing(agent_t *ag)
     url2->url_port = "9";      /* discard service */
 
     ag->ag_expect_leg = ag->ag_default_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           (url_string_t *)url,
                           SIP_METHOD_MESSAGE,
@@ -2192,7 +2192,7 @@ int test_dialog(agent_t *ag)
    * Alice to Bob.
    */
 
-  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent, 
+  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent,
                                     leg_callback_200,
                                     ag,
                                     SIPTAG_FROM(ag->ag_alice),
@@ -2208,7 +2208,7 @@ int test_dialog(agent_t *ag)
 
     /* Send message from Alice to Bob establishing the dialog */
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_alice_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_MESSAGE,
@@ -2231,7 +2231,7 @@ int test_dialog(agent_t *ag)
 
 
     ag->ag_expect_leg = ag->ag_alice_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_bob_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_MESSAGE,
@@ -2246,7 +2246,7 @@ int test_dialog(agent_t *ag)
     /* Send again message from Alice to Bob */
     client_t ctx[1] = {{ ag, "Test 2.3" }};
     ag->ag_expect_leg = ag->ag_bob_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_alice_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_MESSAGE,
@@ -2256,14 +2256,14 @@ int test_dialog(agent_t *ag)
     TEST_1(!client_run(ctx, 200));
     TEST_P(ag->ag_latest_leg, ag->ag_bob_leg);
   }
-  
+
   {
     /* Send message from Bob to Alice
-     * This time, however, specify request URI 
+     * This time, however, specify request URI
      */
     client_t ctx[1] = {{ ag, "Test 2.4" }};
     ag->ag_expect_leg = ag->ag_alice_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_bob_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_MESSAGE,
@@ -2289,7 +2289,7 @@ static ssize_t recv_udp(agent_t *ag, void *b, size_t size)
   ssize_t n;
 
   memset(b, 0, size);
-  
+
   for (;;) {
     su_root_step(ag->ag_root, 10L);
     if (su_wait(ag->ag_sink_wait, 1, 0) == 0) {
@@ -2306,14 +2306,14 @@ int test_merging(agent_t *ag)
   BEGIN();
 
   /*
-   * Test merging: send two messages with same 
+   * Test merging: send two messages with same
    * from tag/call-id/cseq number to nta,
    * expect 200 and 408.
    */
 
   char const rfc3261prefix[] = "z9hG4bK";
 
-  char const template[] = 
+  char const template[] =
     "%s " URL_PRINT_FORMAT " SIP/2.0\r\n"
     "Via: SIP/2.0/UDP 127.0.0.1:%s;branch=%s.%p\r\n"
     "Via: SIP/2.0/TCP fake.address.for.via.example.net;branch=z9hG4bK.%p\r\n"
@@ -2357,9 +2357,9 @@ int test_merging(agent_t *ag)
 
     *u1 = *ag->ag_m_bob->m_url;
     snprintf(m1, sizeof m1,
-            template, 
+            template,
             "MESSAGE", URL_PRINT_ARGS(u1),
-            /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m1, 
+            /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m1,
             /* 2nd Via */ (void *)ag,
             /* CSeq */ 13, "MESSAGE",
             /* Call-ID */ (void *)ag,
@@ -2370,7 +2370,7 @@ int test_merging(agent_t *ag)
     *u2 = *ag->ag_m_bob->m_url;
 
     snprintf(m2, sizeof m2,
-            template, 
+            template,
             "MESSAGE", URL_PRINT_ARGS(u2),
             /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m2,
             /* 2nd Via */ (void *)ag,
@@ -2398,7 +2398,7 @@ int test_merging(agent_t *ag)
 
   {
     /*
-     * Check that request with same call-id, cseq and from-tag 
+     * Check that request with same call-id, cseq and from-tag
      * are not merged if the method is different.
      */
     nta_leg_bind(ag->ag_server_leg, leg_callback_200, ag);
@@ -2407,9 +2407,9 @@ int test_merging(agent_t *ag)
 
     *u1 = *ag->ag_m_bob->m_url;
     snprintf(m1, sizeof m1,
-            template, 
+            template,
             "MESSAGE", URL_PRINT_ARGS(u1),
-            /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m1, 
+            /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m1,
             /* 2nd Via */ (void *)ag,
             /* CSeq */ 14, "MESSAGE",
             /* Call-ID */ (void *)ag,
@@ -2420,7 +2420,7 @@ int test_merging(agent_t *ag)
     *u2 = *ag->ag_m_bob->m_url;
 
     snprintf(m2, sizeof m2,
-            template, 
+            template,
             "OPTIONS", URL_PRINT_ARGS(u2),
             /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m2,
             /* 2nd Via */ (void *)ag,
@@ -2450,9 +2450,9 @@ int test_merging(agent_t *ag)
     /* test with rfc2543 */
 
     snprintf(m1, sizeof m1,
-            template, 
+            template,
             "MASSAGE", URL_PRINT_ARGS(u1),
-            /* Via */ ag->ag_sink_port, "0.", (void *)0, 
+            /* Via */ ag->ag_sink_port, "0.", (void *)0,
             /* 2nd Via */ (void *)ag,
             /* CSeq */ 14, "MASSAGE",
             /* Call-ID */ (void *)(ag + 1),
@@ -2463,7 +2463,7 @@ int test_merging(agent_t *ag)
     u2->url_user = "bob+2";
 
     snprintf(m2, sizeof m2,
-            template, 
+            template,
             "MASSAGE", URL_PRINT_ARGS(u2),
             /* Via */ ag->ag_sink_port, "0.", (void *)0,
             /* 2nd Via */ (void *)ag,
@@ -2493,9 +2493,9 @@ int test_merging(agent_t *ag)
     /* test with to-tag */
 
     snprintf(m1, sizeof m1,
-            template, 
+            template,
             "MESSAGE", URL_PRINT_ARGS(u1),
-            /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m1, 
+            /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m1,
             /* 2nd Via */ (void *)ag,
             /* CSeq */ 15, "MESSAGE",
             /* Call-ID */ (void *)(ag + 2),
@@ -2506,7 +2506,7 @@ int test_merging(agent_t *ag)
     u2->url_user = "bob+2";
 
     snprintf(m2, sizeof m2,
-            template, 
+            template,
             "MESSAGE", URL_PRINT_ARGS(u2),
             /* Via */ ag->ag_sink_port, rfc3261prefix, (void *)m2,
             /* 2nd Via */ (void *)ag,
@@ -2536,9 +2536,9 @@ int test_merging(agent_t *ag)
     /* test with rfc2543 and to-tag */
 
     snprintf(m1, sizeof m1,
-            template, 
+            template,
             "MESSAGE", URL_PRINT_ARGS(u1),
-            /* Via */ ag->ag_sink_port, "0.", (void *)0, 
+            /* Via */ ag->ag_sink_port, "0.", (void *)0,
             /* 2nd Via */ (void *)ag,
             /* CSeq */ 15, "MESSAGE",
             /* Call-ID */ (void *)(ag + 2),
@@ -2547,7 +2547,7 @@ int test_merging(agent_t *ag)
     l1 = strlen(m1);
 
     snprintf(m2, sizeof m2,
-            template, 
+            template,
             "MESSAGE", URL_PRINT_ARGS(u2),
             /* Via */ ag->ag_sink_port, "0.", (void *)0,
             /* 2nd Via */ (void *)ag,
@@ -2575,7 +2575,7 @@ int test_merging(agent_t *ag)
 
   {
     /* test INVITE/CANCEL with rfc2543 */
-    char const template2[] = 
+    char const template2[] =
       "%s " URL_PRINT_FORMAT " SIP/2.0\r\n"
       "Via: SIP/2.0/UDP 127.0.0.1:%s;x-kuik=%p\r\n"
       "CSeq: %u %s\r\n"
@@ -2588,9 +2588,9 @@ int test_merging(agent_t *ag)
     nta_leg_bind(ag->ag_server_leg, new_leg_callback_180, ag);
 
     snprintf(m1, sizeof m1,
-            template2, 
+            template2,
             "INVITE", URL_PRINT_ARGS(u1),
-            /* Via */ ag->ag_sink_port, m1, 
+            /* Via */ ag->ag_sink_port, m1,
             /* CSeq */ 15, "INVITE",
             /* Call-ID */ (void *)(ag + 2),
             /* From tag */ "2.6.1",
@@ -2606,7 +2606,7 @@ int test_merging(agent_t *ag)
     nta_incoming_bind(ag->ag_irq, wait_for_ack_or_cancel, ag);
 
     snprintf(m2, sizeof m2,
-            template2, 
+            template2,
             "CANCEL", URL_PRINT_ARGS(u1),
             /* Via */ ag->ag_sink_port, m1,
             /* CSeq */ 15, "CANCEL",
@@ -2629,7 +2629,7 @@ int test_merging(agent_t *ag)
     TEST_1(nta_incoming_status(ag->ag_irq) == 487);
 
     snprintf(m2, sizeof m2,
-            template2, 
+            template2,
             "ACK", URL_PRINT_ARGS(u1),
             /* Via */ ag->ag_sink_port, m1,
             /* CSeq */ 15, "ACK",
@@ -2651,7 +2651,7 @@ int test_merging(agent_t *ag)
 
 static
 int wait_for_ack_or_cancel(agent_t *ag,
-                          nta_incoming_t *irq, 
+                          nta_incoming_t *irq,
                           sip_t const *sip)
 {
   sip_method_t method;
@@ -2671,7 +2671,7 @@ int wait_for_ack_or_cancel(agent_t *ag,
     ag->ag_irq = NULL;
     ag->ag_running = 0;
   }
-  
+
   return 0;
 }
 
@@ -2681,7 +2681,7 @@ int wait_for_ack_or_cancel(agent_t *ag,
 
 static
 int test_for_ack(agent_t *ag,
-                nta_incoming_t *irq, 
+                nta_incoming_t *irq,
                 sip_t const *sip)
 {
   sip_method_t method;
@@ -2695,7 +2695,7 @@ int test_for_ack(agent_t *ag,
   ag->ag_irq = NULL;
 
   TEST(method, sip_method_ack);
-  
+
   ag->ag_running = 0;
 
   END();
@@ -2709,13 +2709,13 @@ int test_for_prack(agent_t *ag,
 {
   sip_method_t method = sip ? sip->sip_request->rq_method : sip_method_unknown;
 
-  nta_incoming_treply(ag->ag_irq, 
-                     SIP_200_OK, 
+  nta_incoming_treply(ag->ag_irq,
+                     SIP_200_OK,
                      SIPTAG_CONTACT(ag->ag_m_alice),
                      TAG_END());
 
   TEST(method, sip_method_prack);
-                    
+
   return 200;
 }
 
@@ -2728,7 +2728,7 @@ int alice_leg_callback(agent_t *ag,
 
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -2752,11 +2752,11 @@ int alice_leg_callback(agent_t *ag,
     nta_incoming_bind(irq, test_for_ack, ag);
     nta_incoming_treply(irq, SIP_100_TRYING, TAG_END());
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_DEBUG_DROP_PROB(ag->ag_drop),
                         TAG_END());
 
-    ag->ag_reliable = 
+    ag->ag_reliable =
       nta_reliable_treply(irq,
                          NULL, NULL,
                          SIP_183_SESSION_PROGRESS,
@@ -2765,14 +2765,14 @@ int alice_leg_callback(agent_t *ag,
                          SIPTAG_CONTACT(ag->ag_m_alice),
                          TAG_END());
     TEST_1(ag->ag_reliable);
-    ag->ag_reliable = 
+    ag->ag_reliable =
       nta_reliable_treply(irq,
                          NULL, NULL,
                          184, "Next",
                          SIPTAG_CONTACT(ag->ag_m_alice),
                          TAG_END());
     TEST_1(ag->ag_reliable);
-    ag->ag_reliable = 
+    ag->ag_reliable =
       nta_reliable_treply(irq,
                          test_for_prack, ag,
                          185, "Last",
@@ -2781,7 +2781,7 @@ int alice_leg_callback(agent_t *ag,
     TEST_1(ag->ag_reliable);
     ag->ag_irq = irq;
     return 0;
-  } 
+  }
 
   if (sip->sip_request->rq_method == sip_method_bye) {
     leg_zap(ag, leg);
@@ -2802,7 +2802,7 @@ int bob_leg_callback(agent_t *ag,
 
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -2834,15 +2834,15 @@ int bob_leg_callback(agent_t *ag,
     TEST_1(nta_leg_tag(ag->ag_bob_leg, NULL));
     TEST_1(nta_leg_get_tag(ag->ag_bob_leg));
     TEST_1(nta_incoming_tag(irq, nta_leg_get_tag(ag->ag_bob_leg)));
-    TEST(nta_leg_server_route(ag->ag_bob_leg, 
-                             sip->sip_record_route, 
+    TEST(nta_leg_server_route(ag->ag_bob_leg,
+                             sip->sip_record_route,
                              sip->sip_contact), 0);
   }
 
   if (sip->sip_request->rq_method != sip_method_invite) {
     return 200;
   } else {
-    nta_incoming_bind(irq, test_for_ack, ag); 
+    nta_incoming_bind(irq, test_for_ack, ag);
 #if 1
     nta_incoming_treply(irq,
                        SIP_180_RINGING,
@@ -2877,7 +2877,7 @@ int invite_client_deinit(client_t *c)
   return 0;
 }
 
-static 
+static
 int check_prack_sending(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 {
   agent_t *ag = ctx->c_ag;
@@ -2888,10 +2888,10 @@ int check_prack_sending(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
       nta_outgoing_t *prack = NULL;
 
       TEST_1(sip->sip_rseq);
-      
+
       prack = nta_outgoing_prack(ag->ag_call_leg, orq, NULL, NULL,
                                 NULL,
-                                sip, 
+                                sip,
                                 TAG_END());
       nta_outgoing_destroy(prack);
       TEST_1(prack != NULL);
@@ -2901,7 +2901,7 @@ int check_prack_sending(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 }
 
 
-static 
+static
 int check_leg_tagging(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 {
   agent_t *ag = ctx->c_ag;
@@ -2909,8 +2909,8 @@ int check_leg_tagging(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 
   if (200 <= status && status < 300) {
     TEST_1(nta_leg_rtag(ag->ag_call_leg, sip->sip_to->a_tag));
-    
-    TEST(nta_leg_client_route(ag->ag_call_leg, 
+
+    TEST(nta_leg_client_route(ag->ag_call_leg,
                              sip->sip_record_route,
                              sip->sip_contact), 0);
   }
@@ -2919,7 +2919,7 @@ int check_leg_tagging(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 }
 
 
-static 
+static
 int check_tu_ack(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 {
   agent_t *ag = ctx->c_ag;
@@ -2946,7 +2946,7 @@ int check_final_error(client_t *ctx, nta_outgoing_t *orq, sip_t const *sip)
 {
   agent_t *ag = ctx->c_ag;
   int status = ctx->c_status;
-  
+
   if (status >= 300)
     ag->ag_call_leg = NULL;
 
@@ -3006,21 +3006,21 @@ int test_call(agent_t *ag)
      *
      * Alice sends a INVITE to Bob, then Bob sends 200 Ok.
      */
-    ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent, 
+    ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent,
                                       alice_leg_callback,
                                       ag,
                                       SIPTAG_FROM(ag->ag_alice),
                                       SIPTAG_TO(ag->ag_bob),
                                       TAG_END());
     TEST_1(ag->ag_alice_leg);
-  
+
     TEST_1(nta_leg_tag(ag->ag_alice_leg, NULL));
     nta_leg_bind(ag->ag_server_leg, bob_leg_callback, ag);
-  
+
     /* Send INVITE */
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg, 
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg,
                           outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_INVITE,
@@ -3036,7 +3036,7 @@ int test_call(agent_t *ag)
     TEST_1(ctx->c_orq);
     /* Try to CANCEL it immediately */
     TEST_1(nta_outgoing_cancel(ctx->c_orq) == 0);
-    /* As Bob immediately answers INVITE with 200 Ok, 
+    /* As Bob immediately answers INVITE with 200 Ok,
        cancel should be answered with 481 and 200 Ok is returned to INVITE. */
     TEST_1(!client_run(ctx, 200));
 
@@ -3068,8 +3068,8 @@ int test_call(agent_t *ag)
      * waits for PRACKs, then sends 200, waits for ACK.
      */
     ag->ag_expect_leg = ag->ag_alice_leg;
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_bob_leg, 
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_bob_leg,
                           outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_INVITE,
@@ -3087,13 +3087,13 @@ int test_call(agent_t *ag)
   {
     client_t ctx[1] = {{ ag, "Hangup" }};
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_DEBUG_DROP_PROB(0),
                         TAG_END());
 
     /* Send BYE from Bob to Alice */
     old_leg = ag->ag_expect_leg = ag->ag_alice_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_bob_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_BYE,
@@ -3121,7 +3121,7 @@ int test_call(agent_t *ag)
 /* Test early dialogs, PRACK */
 
 int test_for_ack_or_timeout(agent_t *ag,
-                           nta_incoming_t *irq, 
+                           nta_incoming_t *irq,
                            sip_t const *sip)
 {
   BEGIN();
@@ -3159,7 +3159,7 @@ int bob_leg_callback2(agent_t *ag,
 
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -3188,16 +3188,16 @@ int bob_leg_callback2(agent_t *ag,
     TEST_1(nta_leg_tag(ag->ag_bob_leg, NULL));
     TEST_1(nta_leg_get_tag(ag->ag_bob_leg));
     TEST_1(nta_incoming_tag(irq, nta_leg_get_tag(ag->ag_bob_leg)));
-    TEST(nta_leg_server_route(ag->ag_bob_leg, 
-                             sip->sip_record_route, 
+    TEST(nta_leg_server_route(ag->ag_bob_leg,
+                             sip->sip_record_route,
                              sip->sip_contact), 0);
   }
 
   if (sip->sip_request->rq_method != sip_method_invite) {
     return 200;
-  } 
+  }
 
-  nta_incoming_bind(irq, test_for_ack_or_timeout, ag); 
+  nta_incoming_bind(irq, test_for_ack_or_timeout, ag);
   nta_incoming_treply(irq,
                      SIP_183_SESSION_PROGRESS,
                      SIPTAG_CONTENT_TYPE(ag->ag_content_type),
@@ -3225,7 +3225,7 @@ static
 int check_orq_tagging(client_t *ctx,
                      nta_outgoing_t *orq,
                      sip_t const *sip)
-{   
+{
   agent_t *ag = ctx->c_ag;
   int status = ctx->c_status;
   invite_client_t *ic = (invite_client_t *)ctx;
@@ -3235,21 +3235,21 @@ int check_orq_tagging(client_t *ctx,
     TEST_1(sip->sip_to->a_tag);
 
     TEST_1(orq == ctx->c_orq);
-  
+
     TEST_1(ic); TEST_1(ic->ic_orq == NULL);
     TEST_1(ic->ic_tag == NULL);
-  
+
     ic->ic_orq = orq;
     ic->ic_tag = su_strdup(ag->ag_home, sip->sip_to->a_tag); TEST_1(ic->ic_tag);
     ic->ic_tag_status = status;
-    
+
     TEST_S(nta_leg_rtag(ag->ag_call_leg, ic->ic_tag), ic->ic_tag);
-  
-    TEST(nta_leg_client_route(ag->ag_call_leg, 
+
+    TEST(nta_leg_client_route(ag->ag_call_leg,
                              sip->sip_record_route,
                              sip->sip_contact), 0);
-  
-    orq = nta_outgoing_tagged(orq, 
+
+    orq = nta_outgoing_tagged(orq,
                              outgoing_callback,
                              ctx,
                              ic->ic_tag,
@@ -3289,7 +3289,7 @@ static int process_prack(nta_reliable_magic_t *arg,
     return 200;
   }
   else if (ag->ag_irq) {
-    nta_incoming_treply(ag->ag_irq, 
+    nta_incoming_treply(ag->ag_irq,
                        504, "Reliable Response Timeout",
                        TAG_END());
     nta_incoming_destroy(ag->ag_irq);
@@ -3309,7 +3309,7 @@ int bob_leg_callback3(agent_t *ag,
 
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -3338,8 +3338,8 @@ int bob_leg_callback3(agent_t *ag,
     TEST_1(nta_leg_tag(ag->ag_bob_leg, NULL));
     TEST_1(nta_leg_get_tag(ag->ag_bob_leg));
     TEST_1(nta_incoming_tag(irq, nta_leg_get_tag(ag->ag_bob_leg)));
-    TEST(nta_leg_server_route(ag->ag_bob_leg, 
-                             sip->sip_record_route, 
+    TEST(nta_leg_server_route(ag->ag_bob_leg,
+                             sip->sip_record_route,
                              sip->sip_contact), 0);
   }
 
@@ -3388,7 +3388,7 @@ int test_prack(agent_t *ag)
 
     ag->ag_expect_leg = ag->ag_server_leg;
     ag->ag_latest_leg = NULL;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_PRACK,
@@ -3403,14 +3403,14 @@ int test_prack(agent_t *ag)
     TEST_P(ag->ag_latest_leg, NULL);
   }
 
-  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent, 
+  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent,
                                     alice_leg_callback,
                                     ag,
                                     SIPTAG_FROM(ag->ag_alice),
                                     SIPTAG_TO(ag->ag_bob),
                                     TAG_END());
   TEST_1(ag->ag_alice_leg);
-  
+
   TEST_1(nta_leg_tag(ag->ag_alice_leg, NULL));
 
   /* Send INVITE */
@@ -3421,8 +3421,8 @@ int test_prack(agent_t *ag)
 
     nta_leg_bind(ag->ag_server_leg, bob_leg_callback2, ag);
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg, 
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg,
                           outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_INVITE,
@@ -3447,7 +3447,7 @@ int test_prack(agent_t *ag)
 
     /* Send BYE from Bob to Alice */
     old_leg = ag->ag_expect_leg = ag->ag_alice_leg;
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_bob_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_BYE,
@@ -3469,14 +3469,14 @@ int test_prack(agent_t *ag)
   ag->ag_call_leg = NULL;
 
   /* Test CANCELing a call after receiving 100rel response */
-  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent, 
+  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent,
                                     alice_leg_callback,
                                     ag,
                                     SIPTAG_FROM(ag->ag_alice),
                                     SIPTAG_TO(ag->ag_bob),
                                     TAG_END());
   TEST_1(ag->ag_alice_leg);
-  
+
   TEST_1(nta_leg_tag(ag->ag_alice_leg, NULL));
 
   {
@@ -3490,8 +3490,8 @@ int test_prack(agent_t *ag)
     /* Send INVITE */
     nta_leg_bind(ag->ag_server_leg, bob_leg_callback3, ag);
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg, 
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg,
                           outgoing_callback, ctx,
                           ag->ag_obp,
                           SIP_METHOD_INVITE,
@@ -3515,20 +3515,20 @@ int test_prack(agent_t *ag)
   if (EXPENSIVE_CHECKS) {
     printf("%s: starting 100rel timeout test, test will complete in 4 seconds\n",
           name);
-  
+
     TEST(nta_agent_set_params(ag->ag_agent,
                              NTATAG_SIP_T1(25),
                              NTATAG_SIP_T1X64(64 * 25),
                              TAG_END()), 2);
 
-    ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent, 
+    ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent,
                                       alice_leg_callback,
                                       ag,
                                       SIPTAG_FROM(ag->ag_alice),
                                       SIPTAG_TO(ag->ag_bob),
                                       TAG_END());
     TEST_1(ag->ag_alice_leg);
-  
+
     TEST_1(nta_leg_tag(ag->ag_alice_leg, NULL));
 
     {
@@ -3536,15 +3536,15 @@ int test_prack(agent_t *ag)
        {{{{ ag, "Call 3",  NULL, checks_for_invite, invite_client_deinit }}}};
       client_t *ctx = ic->ic_client;
 
-      /* Send INVITE, 
+      /* Send INVITE,
        * send precious provisional response
-       * do not send PRACK, 
+       * do not send PRACK,
        * timeout (after 64 * t1 ~ 3.2 seconds),
        */
       nta_leg_bind(ag->ag_server_leg, bob_leg_callback2, ag);
       ag->ag_expect_leg = ag->ag_server_leg;
-      ctx->c_orq = 
-       nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg, 
+      ctx->c_orq =
+       nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg,
                             outgoing_callback, ctx,
                             ag->ag_obp,
                             SIP_METHOD_INVITE,
@@ -3556,7 +3556,7 @@ int test_prack(agent_t *ag)
                             SIPTAG_PAYLOAD(sdp),
                             TAG_END());
       TEST_1(ctx->c_orq);
-  
+
       nta_test_run(ag);
       TEST(ctx->c_status, 503);
       TEST_P(ctx->c_orq, NULL);
@@ -3564,16 +3564,16 @@ int test_prack(agent_t *ag)
       TEST_1(ag->ag_bob_leg == NULL);
     }
 
-    TEST(nta_agent_set_params(ag->ag_agent, 
-                             NTATAG_SIP_T1(500), 
-                             NTATAG_SIP_T1X64(64 * 500), 
+    TEST(nta_agent_set_params(ag->ag_agent,
+                             NTATAG_SIP_T1(500),
+                             NTATAG_SIP_T1X64(64 * 500),
                              TAG_END()), 2);
   }
 
   if (EXPENSIVE_CHECKS || 1) {
     /*
-     * client sends INVITE, 
-     * server sends provisional response, 
+     * client sends INVITE,
+     * server sends provisional response,
      * client PRACKs it,
      * client timeouts after timer C
      */
@@ -3584,12 +3584,12 @@ int test_prack(agent_t *ag)
 
     printf("%s: starting timer C, test will complete in 1 seconds\n",
           name);
-  
+
     TEST(nta_agent_set_params(ag->ag_agent,
                              NTATAG_TIMER_C(1000),
                              TAG_END()), 1);
 
-    TEST_1(ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent, 
+    TEST_1(ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent,
                                              alice_leg_callback,
                                              ag,
                                              SIPTAG_FROM(ag->ag_alice),
@@ -3599,8 +3599,8 @@ int test_prack(agent_t *ag)
 
     nta_leg_bind(ag->ag_server_leg, bob_leg_callback3, ag);
     ag->ag_expect_leg = ag->ag_server_leg;
-    TEST_1(ctx->c_orq = 
-          nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg, 
+    TEST_1(ctx->c_orq =
+          nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg,
                                outgoing_callback, ic->ic_client,
                                ag->ag_obp,
                                SIP_METHOD_INVITE,
@@ -3615,13 +3615,13 @@ int test_prack(agent_t *ag)
     /* Run until 1) server gets CANCEL and 2) client gets 408 */
     TEST_1(!client_run_until_canceled(ctx, 408));
 
-    TEST_1(ag->ag_canceled != 0); 
+    TEST_1(ag->ag_canceled != 0);
     TEST_P(ag->ag_latest_leg, ag->ag_server_leg);
     TEST_1(ag->ag_bob_leg);
     nta_leg_destroy(ag->ag_bob_leg), ag->ag_bob_leg = NULL;
 
     TEST(nta_agent_set_params(ag->ag_agent,
-                             NTATAG_TIMER_C(185 * 1000), 
+                             NTATAG_TIMER_C(185 * 1000),
                              TAG_END()), 1);
 
     nta_leg_destroy(ag->ag_bob_leg), ag->ag_bob_leg = NULL;
@@ -3641,7 +3641,7 @@ int alice_leg_callback2(agent_t *ag,
 
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -3665,10 +3665,10 @@ int alice_leg_callback2(agent_t *ag,
     nta_incoming_bind(irq, test_for_ack, ag);
     nta_incoming_treply(irq, SIP_100_TRYING, TAG_END());
 
-    nta_agent_set_params(ag->ag_agent, 
+    nta_agent_set_params(ag->ag_agent,
                         NTATAG_DEBUG_DROP_PROB(ag->ag_drop),
                         TAG_END());
-    ag->ag_reliable = 
+    ag->ag_reliable =
       nta_reliable_treply(irq,
                          NULL, NULL,
                          SIP_183_SESSION_PROGRESS,
@@ -3677,14 +3677,14 @@ int alice_leg_callback2(agent_t *ag,
                          SIPTAG_CONTACT(ag->ag_m_alice),
                          TAG_END());
     TEST_1(ag->ag_reliable);
-    ag->ag_reliable = 
+    ag->ag_reliable =
       nta_reliable_treply(irq,
                          NULL, NULL,
                          184, "Next",
                          SIPTAG_CONTACT(ag->ag_m_alice),
                          TAG_END());
     TEST_1(ag->ag_reliable);
-    ag->ag_reliable = 
+    ag->ag_reliable =
       nta_reliable_treply(irq,
                          NULL, NULL,
                          185, "Last",
@@ -3694,7 +3694,7 @@ int alice_leg_callback2(agent_t *ag,
     TEST(nta_incoming_treply(irq, SIP_200_OK, TAG_END()), 0);
     ag->ag_irq = irq;
     return 0;
-  } 
+  }
 
   if (sip->sip_request->rq_method == sip_method_bye) {
     leg_zap(ag, leg);
@@ -3721,14 +3721,14 @@ int test_fix_467(agent_t *ag)
 
   BEGIN();
 
-  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent, 
+  ag->ag_alice_leg = nta_leg_tcreate(ag->ag_agent,
                                     alice_leg_callback2,
                                     ag,
                                     SIPTAG_FROM(ag->ag_alice),
                                     SIPTAG_TO(ag->ag_bob),
                                     TAG_END());
   TEST_1(ag->ag_alice_leg);
-  
+
   TEST_1(nta_leg_tag(ag->ag_alice_leg, NULL));
   ag->ag_bob_leg = NULL;
 
@@ -3740,8 +3740,8 @@ int test_fix_467(agent_t *ag)
     /* Send INVITE */
     nta_leg_bind(ag->ag_server_leg, bob_leg_callback2, ag);
     ag->ag_expect_leg = ag->ag_server_leg;
-    ctx->c_orq = 
-      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg, 
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_call_leg = ag->ag_alice_leg,
                           outgoing_callback, ic->ic_client,
                           ag->ag_obp,
                           SIP_METHOD_INVITE,
@@ -3766,7 +3766,7 @@ int test_fix_467(agent_t *ag)
     client_t ctx[1] = {{ ag, "Hangup" }};
 
     /* Send BYE from Bob to Alice */
-    ctx->c_orq = 
+    ctx->c_orq =
       nta_outgoing_tcreate(ag->ag_bob_leg, outgoing_callback, ctx,
                           NULL,
                           SIP_METHOD_BYE,
@@ -3803,7 +3803,7 @@ static RETSIGTYPE sig_alarm(int s)
 #endif
 
 static
-char const nta_test_usage[] = 
+char const nta_test_usage[] =
   "usage: %s OPTIONS\n"
   "where OPTIONS are\n"
   "   -v | --verbose    be verbose\n"
@@ -3882,7 +3882,7 @@ int main(int argc, char *argv[])
 
       if (rest == NULL || *rest)
        usage(1);
-      
+
       su_log_set_level(nta_log, level);
       su_log_set_level(tport_log, level);
     }
@@ -3942,7 +3942,7 @@ int main(int argc, char *argv[])
   do { fflush(stdout);                                                 \
     if (retval && quit_on_single_failure) { su_deinit(); return retval; } \
   } while(0)
-  
+
   retval |= test_init(ag, argv[i]); SINGLE_FAILURE_CHECK();
   if (retval == 0) {
     retval |= test_bad_messages(ag); SINGLE_FAILURE_CHECK();
index 9862722abba7542d7bce148b585259c240d566f6..47a7b345bef8c4155c411634a647ac8e42b350d8 100644 (file)
@@ -143,14 +143,14 @@ struct agent_t {
 
 
 static int incoming_callback_1(agent_t *ag,
-                              nta_incoming_t *irq, 
+                              nta_incoming_t *irq,
                               sip_t const *sip)
 {
   return 0;
 }
 
 static int incoming_callback_2(agent_t *ag,
-                              nta_incoming_t *irq, 
+                              nta_incoming_t *irq,
                               sip_t const *sip)
 {
   return 0;
@@ -173,10 +173,10 @@ int leg_callback(agent_t *ag,
   BEGIN();
   msg_t *msg;
   char const *tag;
-  
+
   if (tstflags & tst_verbatim) {
     printf("%s: %s: %s " URL_PRINT_FORMAT " %s\n",
-          name, __func__, sip->sip_request->rq_method_name, 
+          name, __func__, sip->sip_request->rq_method_name,
           URL_PRINT_ARGS(sip->sip_request->rq_url),
           sip->sip_request->rq_version);
   }
@@ -188,7 +188,7 @@ int leg_callback(agent_t *ag,
   TEST_VOID(nta_incoming_bind(irq, incoming_callback_1, ag));
   TEST_P(nta_incoming_magic(irq, incoming_callback_1), ag);
   TEST_P(nta_incoming_magic(irq, incoming_callback_2), 0);
-  
+
   TEST_1(tag = nta_incoming_tag(irq, "tag=foofaa"));
   TEST_S(nta_incoming_gettag(irq), tag);
   TEST_S(tag, "foofaa");
@@ -199,9 +199,9 @@ int leg_callback(agent_t *ag,
   TEST_S(nta_incoming_method_name(irq), "MESSAGE");
   TEST_1(nta_incoming_url(irq) != NULL);
   TEST_1(nta_incoming_cseq(irq) != 0);
-  
+
   TEST(nta_incoming_set_params(irq, TAG_END()), 0);
-  
+
   TEST_1(msg = nta_incoming_getrequest(irq)); msg_destroy(msg);
   TEST_P(nta_incoming_getrequest_ackcancel(irq), NULL);
   TEST_P(nta_incoming_getresponse(irq), NULL);
@@ -225,9 +225,9 @@ int outgoing_callback(agent_t *ag,
   int status = sip->sip_status->st_status;
 
   if (tstflags & tst_verbatim) {
-    printf("%s: %s: %s %03d %s\n", name, __func__, 
-          sip->sip_status->st_version, 
-          sip->sip_status->st_status, 
+    printf("%s: %s: %s %03d %s\n", name, __func__,
+          sip->sip_status->st_version,
+          sip->sip_status->st_status,
           sip->sip_status->st_phrase);
   }
 
@@ -246,14 +246,14 @@ int outgoing_callback(agent_t *ag,
   TEST_S(nta_outgoing_method_name(orq), "MESSAGE");
   TEST(nta_outgoing_cseq(orq), sip->sip_cseq->cs_seq);
   TEST_1(nta_outgoing_delay(orq) < UINT_MAX);
-  
+
   TEST_1(msg = nta_outgoing_getresponse(orq));
   msg_destroy(msg);
-  
+
   TEST_1(msg = nta_outgoing_getrequest(orq));
   msg_destroy(msg);
 
-  nta_outgoing_destroy(orq);   
+  nta_outgoing_destroy(orq);
   /* Call it twice */
   nta_outgoing_destroy(orq);
 
@@ -262,7 +262,7 @@ int outgoing_callback(agent_t *ag,
   END();
 }
 
-void 
+void
 nta_test_run(agent_t *ag)
 {
   time_t now = time(NULL);
@@ -307,7 +307,7 @@ int api_test_init(agent_t *ag)
                                         NTATAG_PRELOAD(2048),
                                         TAG_END()));
   /* Create a default leg */
-  TEST_1(ag->ag_default_leg = nta_leg_tcreate(ag->ag_agent, 
+  TEST_1(ag->ag_default_leg = nta_leg_tcreate(ag->ag_agent,
                                             leg_callback,
                                             ag,
                                             NTATAG_NO_DIALOG(1),
@@ -352,7 +352,7 @@ int api_test_init(agent_t *ag)
   }
 
   {
-    char const data[] = 
+    char const data[] =
       "v=0\r\n"
       "o=- 425432 423412 IN IP4 127.0.0.1\r\n"
       "s= \r\n"
@@ -366,7 +366,7 @@ int api_test_init(agent_t *ag)
   {
     sip_contact_t *m;
 
-    ag->ag_aliases = 
+    ag->ag_aliases =
       sip_contact_make(ag->ag_home, "sip:127.0.0.1, sip:localhost, sip:[::1]");
     TEST_1(ag->ag_aliases);
     TEST_1(ag->ag_aliases->m_next);
@@ -381,38 +381,38 @@ int api_test_init(agent_t *ag)
     m->m_next = ag->ag_aliases;
     ag->ag_aliases = m;
 
-    TEST(nta_agent_set_params(ag->ag_agent, 
+    TEST(nta_agent_set_params(ag->ag_agent,
                              NTATAG_ALIASES(ag->ag_aliases),
                              NTATAG_REL100(1),
-                             NTATAG_UA(1), 
+                             NTATAG_UA(1),
                              NTATAG_USE_NAPTR(1),
                              NTATAG_USE_SRV(1),
                              TAG_END()),
         5);
 
-    TEST(nta_agent_set_params(ag->ag_agent, 
+    TEST(nta_agent_set_params(ag->ag_agent,
                              NTATAG_ALIASES(ag->ag_aliases),
                              NTATAG_DEFAULT_PROXY("sip:127.0.0.1"),
                              TAG_END()), 2);
 
-    TEST(nta_agent_set_params(ag->ag_agent, 
+    TEST(nta_agent_set_params(ag->ag_agent,
                              NTATAG_ALIASES(ag->ag_aliases),
                              NTATAG_DEFAULT_PROXY(NULL),
                              TAG_END()), 2);
 
-    TEST(nta_agent_set_params(ag->ag_agent, 
+    TEST(nta_agent_set_params(ag->ag_agent,
                              NTATAG_DEFAULT_PROXY("tel:+35878008000"),
                              TAG_END()), -1);
 
   }
-  
+
   {
     url_t url[1];
 
     /* Create the server leg */
     *url = *ag->ag_aliases->m_url;
     url->url_user = "%";
-    TEST_1(ag->ag_server_leg = nta_leg_tcreate(ag->ag_agent, 
+    TEST_1(ag->ag_server_leg = nta_leg_tcreate(ag->ag_agent,
                                               leg_callback,
                                               ag,
                                               NTATAG_NO_DIALOG(1),
@@ -421,7 +421,7 @@ int api_test_init(agent_t *ag)
   }
 
   END();
-}  
+}
 
 int api_test_deinit(agent_t *ag)
 {
@@ -443,7 +443,7 @@ int api_test_deinit(agent_t *ag)
   free(ag->ag_mclass), ag->ag_mclass = NULL;
 
   END();
-}  
+}
 
 static int api_test_destroy(agent_t *ag)
 {
@@ -468,12 +468,12 @@ static int api_test_destroy(agent_t *ag)
                                  NULL,
                                  NULL,
                                  TAG_END()));
-    TEST_1(leg = nta_leg_tcreate(nta, NULL, NULL, 
+    TEST_1(leg = nta_leg_tcreate(nta, NULL, NULL,
                                 NTATAG_NO_DIALOG(1),
                                 TAG_END()));
     /* This creates a delayed response message */
     orq = nta_outgoing_tcreate(leg, outgoing_callback, ag, NULL,
-                              SIP_METHOD_MESSAGE, 
+                              SIP_METHOD_MESSAGE,
                               URL_STRING_MAKE("sip:foo.bar;transport=none"),
                               SIPTAG_FROM_STR("<sip:bar.foo>"),
                               SIPTAG_TO_STR("<sip:foo.bar>"),
@@ -482,7 +482,7 @@ static int api_test_destroy(agent_t *ag)
 
     TEST_VOID(nta_outgoing_destroy(orq));
     TEST_VOID(nta_leg_destroy(leg));
-    TEST_VOID(nta_agent_destroy(nta)); 
+    TEST_VOID(nta_agent_destroy(nta));
   }
 
   TEST_VOID(su_root_destroy(root));
@@ -573,9 +573,9 @@ int api_test_params(agent_t *ag)
                            NTATAG_USE_NAPTR_REF(use_naptr),
                            NTATAG_USE_SRV_REF(use_srv),
                            NTATAG_USE_TIMESTAMP_REF(use_timestamp),
-                           TAG_END()), 
+                           TAG_END()),
        /* Number of parameters */ 33);
-  
+
   TEST_P(mclass, sip_default_mclass());
   TEST_P(aliases, NULL);
   TEST_1(contact != (void *)-1 && contact != NULL);
@@ -611,32 +611,32 @@ int api_test_params(agent_t *ag)
   TEST_1(use_timestamp != -1);
   TEST_1(user_via == 0);
 
-  TEST(nta_agent_set_params(NULL, 
+  TEST(nta_agent_set_params(NULL,
                            NTATAG_PRELOAD(2048),
                            TAG_END()), -1);
-  TEST(nta_agent_get_params(NULL, 
+  TEST(nta_agent_get_params(NULL,
                            NTATAG_PRELOAD_REF(preload),
                            TAG_END()), -1);
 
-  TEST(nta_agent_set_params(nta, 
+  TEST(nta_agent_set_params(nta,
                            NTATAG_PRELOAD(2048),
                            TAG_END()), 1);
-  TEST(nta_agent_get_params(nta, 
+  TEST(nta_agent_get_params(nta,
                            NTATAG_PRELOAD_REF(preload),
                            TAG_END()), 1);
   TEST(preload, 2048);
 
-  TEST(nta_agent_set_params(nta, 
+  TEST(nta_agent_set_params(nta,
                            NTATAG_SIGCOMP_OPTIONS("sip"),
                            TAG_END()), 1);
-  TEST(nta_agent_set_params(nta, 
+  TEST(nta_agent_set_params(nta,
                            NTATAG_SIGCOMP_OPTIONS(","),
                            TAG_END()), -1);
-  TEST(nta_agent_set_params(nta, 
+  TEST(nta_agent_set_params(nta,
                            NTATAG_SIGCOMP_OPTIONS("sip;dms=16384"),
                            TAG_END()), 1);
   s = NONE;
-  TEST(nta_agent_get_params(nta, 
+  TEST(nta_agent_get_params(nta,
                            NTATAG_SIGCOMP_OPTIONS_REF(s),
                            TAG_END()), 1);
   TEST_S(s, "sip;dms=16384");
@@ -767,7 +767,7 @@ int api_test_tport(agent_t *ag)
   TEST_1(m = nta_agent_contact(agent));
   TEST_S(m->m_url->url_params, "transport=tcp");
 
-  TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, 
+  TEST_1(nta_agent_add_tport(agent, (url_string_t *)url,
                             TPTAG_SERVER(0), TAG_END()) == 0);
   TEST_1(v = nta_agent_public_via(agent)); TEST_1(!v->v_next);
   TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
@@ -794,9 +794,9 @@ int api_test_tport(agent_t *ag)
 
   TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
-  TEST_1(v = nta_agent_via(agent)); 
+  TEST_1(v = nta_agent_via(agent));
   TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
-  TEST_1(v = v->v_next);  
+  TEST_1(v = v->v_next);
   TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
   TEST_1(m = nta_agent_contact(agent));
   TEST_1(!m->m_url->url_params);
@@ -806,7 +806,7 @@ int api_test_tport(agent_t *ag)
 
   TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
   TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
-  TEST_1(v = nta_agent_via(agent)); 
+  TEST_1(v = nta_agent_via(agent));
   TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
   TEST_1(v = v->v_next);
   TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
@@ -824,15 +824,15 @@ static int api_test_dialogs(agent_t *ag)
 #if 0
   {
     /* Test 0.1
-     * Send a message from default leg to default leg 
+     * Send a message from default leg to default leg
      */
     char const p_acid[] = "P-Access-Network-Info: IEEE-802.11g\n";
     msg_t *msg;
 
     ag->ag_expect_leg = ag->ag_default_leg;
 
-    TEST_1(ag->ag_orq = 
-         nta_outgoing_tcreate(ag->ag_default_leg, 
+    TEST_1(ag->ag_orq =
+         nta_outgoing_tcreate(ag->ag_default_leg,
                               outgoing_callback, ag,
                               ag->ag_obp,
                               SIP_METHOD_MESSAGE,
@@ -887,7 +887,7 @@ int outgoing_default(agent_t *ag,
   TEST_S(nta_outgoing_method_name(orq), "*");
   TEST(nta_outgoing_cseq(orq), 0);
   TEST_1(nta_outgoing_delay(orq) == UINT_MAX);
-  
+
   TEST_1(msg = nta_outgoing_getresponse(orq));
   if (ag->ag_response == NULL)
     ag->ag_response = msg;
@@ -916,7 +916,7 @@ static int api_test_default(agent_t *ag)
   TEST_VOID(nta_incoming_bind(irq, incoming_callback_1, ag));
   TEST_P(nta_incoming_magic(irq, incoming_callback_1), ag);
   TEST_P(nta_incoming_magic(irq, incoming_callback_2), 0);
-  
+
   TEST_P(nta_incoming_tag(irq, NULL), NULL);
   TEST_P(nta_incoming_gettag(irq), NULL);
 
@@ -929,18 +929,18 @@ static int api_test_default(agent_t *ag)
   TEST(nta_incoming_received(irq, &nano), nano / 1000000000);
 
   TEST(nta_incoming_set_params(irq, TAG_END()), 0);
-  
+
   TEST_P(nta_incoming_getrequest(irq), NULL);
   TEST_P(nta_incoming_getrequest_ackcancel(irq), NULL);
   TEST_P(nta_incoming_getresponse(irq), NULL);
-  
+
   TEST(nta_incoming_complete_response(irq, NULL, SIP_200_OK, TAG_END()), -1);
 
   TEST(nta_incoming_treply(irq, SIP_200_OK, TAG_END()), -1);
   TEST(nta_incoming_mreply(irq, NULL), -1);
-  
+
   TEST_VOID(nta_incoming_destroy(irq));
-  
+
   TEST_1(orq = nta_outgoing_default(nta, outgoing_default, ag));
 
   TEST(nta_outgoing_status(orq), 0);
@@ -960,7 +960,7 @@ static int api_test_default(agent_t *ag)
   TEST_P(nta_outgoing_tcancel(orq, NULL, NULL, TAG_END()), NULL);
 
   TEST_VOID(nta_outgoing_destroy(orq));
-  
+
   TEST_1(irq = nta_incoming_default(nta));
   TEST_1(orq = nta_outgoing_default(nta, outgoing_default, ag));
 
@@ -968,7 +968,7 @@ static int api_test_default(agent_t *ag)
   via->v_next = NULL;
 
   TEST_1(nta_incoming_treply
-        (irq, 
+        (irq,
          SIP_200_OK,
          SIPTAG_VIA(via),
          SIPTAG_CALL_ID_STR("oishciucnkrcoihciunskcisj"),
@@ -985,7 +985,7 @@ static int api_test_default(agent_t *ag)
 
   TEST_VOID(nta_outgoing_destroy(orq));
   TEST_VOID(nta_incoming_destroy(irq));
-  
+
   END();
 }
 
@@ -1054,7 +1054,7 @@ static int api_test_errors(agent_t *ag)
 
     TEST_1(msg = nta_msg_create(nta, 0));
     TEST(nta_msg_complete(msg), -1);
-    TEST(nta_msg_request_complete(msg, NULL, 
+    TEST(nta_msg_request_complete(msg, NULL,
                                  sip_method_unknown, "FOO", NULL), -1);
     TEST(nta_is_internal_msg(NULL), 0);
     TEST(nta_is_internal_msg(msg), 0);
@@ -1084,7 +1084,7 @@ static int api_test_errors(agent_t *ag)
 
   TEST_VOID(nta_incoming_bind(NULL, NULL, NULL));
   TEST_P(nta_incoming_magic(NULL, NULL), NULL);
-  
+
   TEST_P(nta_incoming_find(NULL, NULL, NULL), NULL);
   TEST_P(nta_incoming_find(nta, NULL, NULL), NULL);
 
@@ -1111,14 +1111,14 @@ static int api_test_errors(agent_t *ag)
   TEST(nta_incoming_mreply(NULL, NULL), -1);
 
   TEST_VOID(nta_incoming_destroy(NULL));
-  
-  TEST_P(nta_outgoing_tcreate(NULL, outgoing_callback, ag, 
+
+  TEST_P(nta_outgoing_tcreate(NULL, outgoing_callback, ag,
                            URL_STRING_MAKE("sip:localhost"),
                            SIP_METHOD_MESSAGE,
                            URL_STRING_MAKE("sip:localhost"),
                            TAG_END()), NULL);
 
-  TEST_P(nta_outgoing_mcreate(NULL, outgoing_callback, ag, 
+  TEST_P(nta_outgoing_mcreate(NULL, outgoing_callback, ag,
                            URL_STRING_MAKE("sip:localhost"),
                            NULL,
                            TAG_END()), NULL);
@@ -1166,7 +1166,7 @@ static int api_test_errors(agent_t *ag)
   TEST_P(nta_reliable_mreply(NULL, NULL, NULL, NULL), NULL);
   TEST_VOID(nta_reliable_destroy(NULL));
 
-  TEST_VOID(nta_agent_destroy(nta)); 
+  TEST_VOID(nta_agent_destroy(nta));
   TEST_VOID(su_root_destroy(root));
   TEST_VOID(su_home_deinit(home));
 
@@ -1196,17 +1196,17 @@ static int api_test_dialog_matching(agent_t *ag)
                                NULL,
                                TAG_END()));
 
-  TEST_1(dst = nta_leg_tcreate(nta, NULL, NULL, 
+  TEST_1(dst = nta_leg_tcreate(nta, NULL, NULL,
                                NTATAG_NO_DIALOG(1),
                                URLTAG_URL("sip:joe@localhost"),
                                TAG_END()));
 
-  TEST_1(defdst = nta_leg_tcreate(nta, NULL, NULL, 
+  TEST_1(defdst = nta_leg_tcreate(nta, NULL, NULL,
                                  NTATAG_NO_DIALOG(1),
                                  TAG_END()));
 
-  TEST_1(dialog1 = 
-        nta_leg_tcreate(nta, NULL, NULL, 
+  TEST_1(dialog1 =
+        nta_leg_tcreate(nta, NULL, NULL,
                         URLTAG_URL("sip:pc.al.us"),
                         SIPTAG_CALL_ID_STR("foobarbaz"),
                         /* local */
@@ -1219,8 +1219,8 @@ static int api_test_dialog_matching(agent_t *ag)
   TEST_1(a2 = sip_from_make(home, "<sip:joe.boy@al.us>;tag=al"));
   TEST_1(i = sip_call_id_make(home, "foobarbaz"));
 
-  TEST_1(dialog2 = 
-        nta_leg_tcreate(nta, NULL, NULL, 
+  TEST_1(dialog2 =
+        nta_leg_tcreate(nta, NULL, NULL,
                         SIPTAG_CALL_ID(i),
                         /* local */
                         SIPTAG_FROM(a2),
@@ -1228,81 +1228,81 @@ static int api_test_dialog_matching(agent_t *ag)
                         SIPTAG_TO(a1),
                         TAG_END()));
 
-  TEST_1(!nta_leg_by_dialog(nta, NULL, NULL, 
+  TEST_1(!nta_leg_by_dialog(nta, NULL, NULL,
                            a1->a_tag, a1->a_url, a2->a_tag, a2->a_url));
-  TEST_1(!nta_leg_by_dialog(NULL, NULL, i, 
+  TEST_1(!nta_leg_by_dialog(NULL, NULL, i,
                            a1->a_tag, a1->a_url, a2->a_tag, a2->a_url));
-  TEST_1(!nta_leg_by_dialog(nta, (void *)"sip:no.such.url", i, 
+  TEST_1(!nta_leg_by_dialog(nta, (void *)"sip:no.such.url", i,
                            a2->a_tag, a2->a_url, a1->a_tag, a1->a_url));
-  TEST_1(!nta_leg_by_dialog(nta, a2->a_url, i, 
+  TEST_1(!nta_leg_by_dialog(nta, a2->a_url, i,
                            a2->a_tag, a2->a_url, a1->a_tag, a1->a_url));
 
-  TEST_P(leg = nta_leg_by_dialog(nta, NULL, i, 
-                                /* local */ a1->a_tag, a1->a_url, 
+  TEST_P(leg = nta_leg_by_dialog(nta, NULL, i,
+                                /* local */ a1->a_tag, a1->a_url,
                                 /* remote */ a2->a_tag, a2->a_url),
         dialog2);
-  TEST_P(leg = nta_leg_by_dialog(nta, (void *)"sip:no.such.url", i, 
-                                /* local */ a1->a_tag, a1->a_url, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (void *)"sip:no.such.url", i,
+                                /* local */ a1->a_tag, a1->a_url,
                                 /* remote */ a2->a_tag, a2->a_url),
         dialog2);
-  TEST_P(leg = nta_leg_by_dialog(nta, a2->a_url, i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, a2->a_url, i,
                                 a1->a_tag, a1->a_url, a2->a_tag, a2->a_url),
         dialog2);
 
-  TEST_P(leg = nta_leg_by_dialog(nta, NULL, i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, NULL, i,
                                 a2->a_tag, a2->a_url, a1->a_tag, a1->a_url),
         dialog1);
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, a1->a_tag, a1->a_url),
         dialog1);
   /* local tag is required because there is tag */
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, "xyzzy", a1->a_url),
         NULL);
   /* local URI is ignored because we have tag */
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, a1->a_tag, a2->a_url),
         dialog1);
 
   /* remote tag is ignored because there is no tag */
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 "xyzzy", a2->a_url, a1->a_tag, a1->a_url),
         dialog1);
 #if nomore
   /* remote url is required */
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a1->a_url, a1->a_tag, a1->a_url),
         NULL);
 #endif
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, NULL, a1->a_tag, a1->a_url),
         dialog1);
 
   /* local url is used if there is no local tag */ /* XXX - not really */
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, NULL, NULL),
         NULL);
 
   nta_leg_tag(dialog1, "al");
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, a1->a_tag, a1->a_url),
         dialog1);
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, "xyzzy", a1->a_url),
         NULL);
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, a1->a_tag, a1->a_url),
         dialog1);
-  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i, 
+  TEST_P(leg = nta_leg_by_dialog(nta, (url_t *)"sip:pc.al.us", i,
                                 a2->a_tag, a2->a_url, NULL, a1->a_url),
         NULL);
-               
+
   nta_leg_destroy(defdst);
   nta_leg_destroy(dst);
   nta_leg_destroy(dialog1);
   nta_leg_destroy(dialog2);
-           
-  TEST_VOID(nta_agent_destroy(nta)); 
+
+  TEST_VOID(nta_agent_destroy(nta));
   TEST_VOID(su_root_destroy(root));
   TEST_VOID(su_home_deinit(home));
 
@@ -1371,7 +1371,7 @@ int main(int argc, char *argv[])
 
       if (rest == NULL || *rest)
        usage(1);
-      
+
       su_log_set_level(nta_log, level);
       su_log_set_level(tport_log, level);
     }
@@ -1427,7 +1427,7 @@ int main(int argc, char *argv[])
     retval |= api_test_dialogs(ag); SINGLE_FAILURE_CHECK();
     retval |= api_test_default(ag); SINGLE_FAILURE_CHECK();
   }
-  retval |= api_test_deinit(ag); fflush(stdout); 
+  retval |= api_test_deinit(ag); fflush(stdout);
 
   su_home_deinit(ag->ag_home);
 
index 7b287c0cada9ed8189e29399e4bf63b431787654..5c84f05e0eaec808cdcaeb51adbcad8c24b6268e 100644 (file)
@@ -1,7 +1,7 @@
 PROJECT_NAME         = "nth"
 OUTPUT_DIRECTORY     = ../docs/html/nth
 
-INPUT               = @srcdir@/nth.docs @srcdir@/sofia-sip @srcdir@ . 
+INPUT               = @srcdir@/nth.docs @srcdir@/sofia-sip @srcdir@ .
 
 @INCLUDE_PATH = . @srcdir@
 @INCLUDE = ../docs/Doxyfile.conf
index c016c02279c8929f4ba1455a06e2334597d41b07..39add225fa2fb77d5a8f557a26dcb62e662998ae 100644 (file)
@@ -32,7 +32,7 @@
 #include "config.h"
 
 /**@page http_client Make HTTP request
- * 
+ *
  * @par Name    
  * http-client - HTTP request tool
  *
  * <tt>http-client [OPTIONS] url</tt>
  *
  * @par Description
- * 
+ *
  * The @em http-client utility sends a HTTP request to an HTTP server or proxy.
  *
- * @par 
+ * @par
  *
  * The @em http-client tool will print out status line and interesting
  * headers from the response. The message body is also printed.
@@ -142,7 +142,7 @@ int payload_print(FILE *stream, msg_payload_t const *pl)
   return 0;
 }
 
-static 
+static
 char *read_file(FILE *stream)
 {
   int n;
@@ -179,7 +179,7 @@ char *read_file(FILE *stream)
   return buf;
 }
 
-char const _usage[] = 
+char const _usage[] =
 "usage: %s [OPTIONS] url\n"
 "       where OPTIONS are as follows\n"
 "       --method=name\n"
@@ -206,15 +206,15 @@ int main(int argc, char *argv[])
   su_home_t *home;
   context_t context[1] = {{{SU_HOME_INIT(context)}}};
   http_method_t method;
-  char 
-    *o_proxy = NULL, 
+  char
+    *o_proxy = NULL,
     *o_user = NULL,
     *o_max_forwards = NULL,
     *o_method_name = "GET",
     *o_user_agent = "http-client/1.0 " "nth/" NTH_VERSION;
-  int 
+  int
     o_pipe = 0, o_extra = 0;
-   
+
   char *extra = NULL;
   char *v;
 
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
     else if (MATCH(v, "--pipe"))     { o_pipe = 1;         continue; }
     else if (MATCH(v, "--extra"))    { o_extra = 1;        continue; }
     else if (MATCH(v, "--help"))     { usage(0);           continue; }
-    else 
+    else
       usage(1);
   }
 
@@ -259,8 +259,8 @@ int main(int argc, char *argv[])
   su_home_init(home = context->c_home);
 
   if (o_extra) {
-    if (isatty(0)) 
-      fprintf(stderr, 
+    if (isatty(0))
+      fprintf(stderr,
              "Type extra HTTP headers, empty line then HTTP message body "
              "(^D when complete):\n");
     fflush(stderr);
@@ -271,8 +271,8 @@ int main(int argc, char *argv[])
   context->c_root = su_root_create(context);
 
   if (context->c_root) {
-    context->c_engine = 
-      nth_engine_create(context->c_root, 
+    context->c_engine =
+      nth_engine_create(context->c_root,
                        NTHTAG_ERROR_MSG(0),
                        TAG_END());
 
@@ -280,7 +280,7 @@ int main(int argc, char *argv[])
       while ((v = argv++[1])) {
        nth_client_t *clnt;
        clnt = nth_client_tcreate(context->c_engine,
-                                 response, context, 
+                                 response, context,
                                  method, o_method_name,
                                  URL_STRING_MAKE(v),
                                  NTHTAG_PROXY(o_proxy),
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
       }
 
       if (context->c_pending)
-       su_root_run(context->c_root); 
+       su_root_run(context->c_root);
 
       nth_engine_destroy(context->c_engine), context->c_engine = NULL;
     }
@@ -320,7 +320,7 @@ int response(context_t *c,
   } else {
     status = nth_client_status(clnt);
     fprintf(stderr, "HTTP/1.1 %u Error\n", status);
-  } 
+  }
 
   if (http && (c->c_pre || status >= 200)) {
     http_header_t *h = (http_header_t *)http->http_status;
@@ -335,9 +335,9 @@ int response(context_t *c,
        header_print(stdout, NULL, h);
       else if (h->sh_class->hc_name[0]) {
        snprintf(hname, sizeof hname, "%s: %%s\n", h->sh_class->hc_name);
-       header_print(stdout, hname, h); 
+       header_print(stdout, hname, h);
       } else {
-       header_print(stdout, "%s\n", h); 
+       header_print(stdout, "%s\n", h);
       }
     }
 
@@ -364,7 +364,7 @@ int response(context_t *c,
 
     //if (user && pass &&
     if (
-       auc_challenge(&c->c_auth, c->c_home, 
+       auc_challenge(&c->c_auth, c->c_home,
                      http->http_www_authenticate,
                      http_authorization_class) > 0) {
       char const *scheme = NULL;
@@ -375,7 +375,7 @@ int response(context_t *c,
                                "realm=");
       if (auc_all_credentials(&c->c_auth, scheme, realm, user, pass)
          >= 0)
-       newclnt = nth_client_tcreate(c->c_engine, 
+       newclnt = nth_client_tcreate(c->c_engine,
                                     NULL, NULL, HTTP_NO_METHOD, NULL,
                                     NTHTAG_AUTHENTICATION(&c->c_auth),
                                     NTHTAG_TEMPLATE(clnt),
@@ -385,11 +385,11 @@ int response(context_t *c,
 
   if (status == 302 && http->http_location) {
     url_t loc[1];
-    
+
     *loc = *http->http_location->loc_url;
 
     newclnt = nth_client_tcreate(c->c_engine, NULL, NULL,
-                                HTTP_NO_METHOD, 
+                                HTTP_NO_METHOD,
                                 (url_string_t *)loc,
                                 NTHTAG_TEMPLATE(clnt),
                                 TAG_END());
@@ -398,7 +398,7 @@ int response(context_t *c,
 
   if (newclnt)
     c->c_pending++;
-  
+
   nth_client_destroy(clnt);
   if (c->c_pending-- == 1)
     su_root_break(c->c_root);
index 6777ed157871c8101973c03c2112881c49445770..9a5150659610446a86f4a9f69078b93389690c2e 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- c -*- */
 
 /**@MODULEPAGE "nth" - HTTP Transactions Module
- * 
+ *
  * @section nth_meta Module Meta Information
  *
  * NTH provides interface to simple HTTP transaction engines for both HTTP
index f9236b636182ca73e550e7b7f3fa12c4a1dabcb9..59c9398414af9905d3b1772cfacea18baa44535f 100644 (file)
 
 /**@CFILE nth_client.c
  * @brief HTTP Client implementhtion
- * 
+ *
  * Copyright (c) 2002 Nokia Research Center.  All rights reserved.
- * 
+ *
  * This source file has been divided into following sections:
  * 1) engine
  * 2) tport handling
  * 3) client transactions
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Jun 13 02:57:51 2000 ppessi
  */
 
@@ -141,7 +141,7 @@ struct nth_client_s {
   /* Attributes */
   unsigned hc_streaming:1;             /**< Enable streaming */
   unsigned hc_error_msg:1;
-  unsigned /* pad */:0;                                
+  unsigned /* pad */:0;
 
   url_string_t const *hc_route_url;
   tp_name_t hc_tpn[1];                 /**< Where to send requests */
@@ -531,7 +531,7 @@ void he_recv_message(nth_engine_t * he,
   if (msg_size(msg))
     SU_DEBUG_3(("nth client: received extra data ("MOD_ZU" bytes) "
                "from %s/%s:%s\n",
-               (size_t)msg_size(msg), 
+               (size_t)msg_size(msg),
                tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port));
   else
     SU_DEBUG_3(("nth client: received extra data from %s/%s:%s\n",
@@ -649,7 +649,7 @@ nth_client_t *nth_client_tcreate(nth_engine_t * engine,
            NTHTAG_AUTHENTICATION_REF(auc),
            NTHTAG_MESSAGE_REF(msg),
            NTHTAG_EXPIRES_REF(expires),
-           HTTPTAG_VERSION_REF(version), 
+           HTTPTAG_VERSION_REF(version),
            TAG_END());
 
     if (msg == none) {
index dadf51b1ab5716519815973ed3200418490aefc2..3ee91c21e9bf62bc34b5495b04076e5a8284eeeb 100644 (file)
@@ -24,9 +24,9 @@
 
 /**@internal @file nth_server.c
  * @brief HTTP server.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Sat Oct 19 01:37:36 2002 ppessi
  */
 
@@ -55,7 +55,7 @@ typedef struct server_s server_t;
 /* We are customer of tport_t */
 #define TP_STACK_T   server_t
 #define TP_MAGIC_T   void
-                                     
+
 #include <sofia-sip/tport.h>
 #include <sofia-sip/htable.h>
 
@@ -78,7 +78,7 @@ enum { SERVER_TICK = 1000 };
 
 HTABLE_DECLARE(hc_htable, hct, nth_client_t);
 
-struct server_s 
+struct server_s
 {
   su_home_t          srv_home[1];
   su_root_t         *srv_root;
@@ -109,7 +109,7 @@ struct server_s
   http_server_t     *srv_server;      /**< Server header */
 };
 
-struct nth_site_s 
+struct nth_site_s
 {
   nth_site_t          *site_next, **site_prev;
 
@@ -143,7 +143,7 @@ struct nth_request_s
   char const           *req_method_name;
   url_t const          *req_url;         /**< RequestURI  */
   char const           *req_version;
-  
+
   tport_t              *req_tport;
   msg_t                       *req_request;
   msg_t                *req_response;
@@ -171,7 +171,7 @@ struct nth_request_s
  *
  * The NTH_DEBUG environment variable is used to determine the debug
  * logging level for @b nth module. The default level is 1.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, nth_server_log, SOFIA_DEBUG
  */
 extern char const NTH_DEBUG[];
@@ -180,8 +180,8 @@ extern char const NTH_DEBUG[];
 #define SU_DEBUG 1
 #endif
 
-/**Debug log for @b nth module. 
- * 
+/**Debug log for @b nth module.
+ *
  * The nth_server_log is the log object used by @b nth module. The level of
  * #nth_server_log is set using #NTH_DEBUG environment variable.
  */
@@ -211,11 +211,11 @@ static nth_site_t **site_get_rslot(nth_site_t *parent, char *path,
 static nth_site_t *site_get_subdir(nth_site_t *parent, char const *path, char const **res);
 static void server_tport_error(server_t *srv, tport_t *tport,
                               int errcode, char const *remote);
-static msg_t *server_msg_create(server_t *srv, int flags, 
+static msg_t *server_msg_create(server_t *srv, int flags,
                                char const data[], usize_t dlen,
                                tport_t const *tp, tp_client_t *tpc);
 
-static void server_reply(server_t *srv, tport_t *tport, 
+static void server_reply(server_t *srv, tport_t *tport,
                         msg_t *request, msg_t *response,
                         int status, char const *phrase);
 
@@ -232,13 +232,13 @@ void nth_site_request(server_t *srv,
  * 5) Site functions
  */
 
-/** Create a http site object. 
+/** Create a http site object.
  *
  * The function nth_site_create() allocates and initializes a web site
- * object. A web site object can be either 
+ * object. A web site object can be either
  * - a primary http server (@a parent is NULL),
- * - a virtual http server (@a address contains hostpart), or 
- * - a site within a server 
+ * - a virtual http server (@a address contains hostpart), or
+ * - a site within a server
  *   (@a address does not have hostpart, only path part).
  *
  * @param parent pointer to parent site
@@ -259,7 +259,7 @@ void nth_site_request(server_t *srv,
  *
  * @since Support for multiple sites was added to @VERSION_1_12_4
  */
-nth_site_t *nth_site_create(nth_site_t *parent,  
+nth_site_t *nth_site_create(nth_site_t *parent,
                            nth_request_f *callback,
                            nth_site_magic_t *magic,
                            url_string_t const *address,
@@ -307,7 +307,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
 
   if (!url || !callback)
     return NULL;
-  
+
   is_host = url->url_host != NULL;
   is_path = url->url_path != NULL;
 
@@ -329,7 +329,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
       errno = EINVAL;
       goto error;
     }
-      
+
     srv = parent->site_server; assert(srv);
     if (is_host) {
       prev = site_get_host(&srv->srv_sites, url->url_host, url->url_port);
@@ -340,7 +340,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
        errno = EEXIST;
        goto error;
       }
-    } 
+    }
     else {
       size_t i, j;
 
@@ -370,7 +370,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
       prev = site_get_rslot(parent, path, &path);
 
       if (!prev || path[0] == '\0') {
-       SU_DEBUG_3(("nth_site_create(): directory \"%s\" already exists\n", 
+       SU_DEBUG_3(("nth_site_create(): directory \"%s\" already exists\n",
                    url->url_path));
        errno = EEXIST;
        goto error;
@@ -396,7 +396,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
 
   if (srv && (site = su_zalloc(srv->srv_home, (sizeof *site) + usize))) {
     site->site_url = (url_t *)(site + 1);
-    url_dup((void *)(site->site_url + 1), usize - sizeof(*url), 
+    url_dup((void *)(site->site_url + 1), usize - sizeof(*url),
            site->site_url, url);
 
     assert(prev);
@@ -423,7 +423,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
     site->site_wildcard = wildcard;
     site->site_callback = callback;
     site->site_magic = magic;
-    
+
     if (parent)
       site->site_auth = parent->site_auth;
 
@@ -457,8 +457,8 @@ nth_site_magic_t *nth_site_magic(nth_site_t const *site)
 }
 
 
-void nth_site_bind(nth_site_t *site, 
-                  nth_request_f *callback, 
+void nth_site_bind(nth_site_t *site,
+                  nth_request_f *callback,
                   nth_site_magic_t *magic)
 {
   if (site) {
@@ -517,7 +517,7 @@ int nth_site_set_params(nth_site_t *site,
              TAG_IF(master, NTHTAG_MFLAGS_REF(mflags)),
              NTHTAG_AUTH_MODULE_REF(am),
              TAG_END());
-  
+
   if (n > 0) {
     if (mclass)
       server->srv_mclass = mclass;
@@ -558,13 +558,13 @@ int nth_site_get_params(nth_site_t const *site,
               TAG_IF(master, NTHTAG_MCLASS(mclass)),
               TAG_IF(master, NTHTAG_MFLAGS(server->srv_mflags)),
               TAG_END());
-  
+
   ta_end(ta);
 
   return n;
 }
 
-int nth_site_get_stats(nth_site_t const *site, 
+int nth_site_get_stats(nth_site_t const *site,
                       tag_type_t tag, tag_value_t value, ...)
 {
   int n;
@@ -577,7 +577,7 @@ int nth_site_get_stats(nth_site_t const *site,
 
   n = tl_tgets(ta_args(ta),
               TAG_END());
-  
+
   ta_end(ta);
 
   return n;
@@ -606,7 +606,7 @@ nth_site_t **site_get_host(nth_site_t **list, char const *host, char const *port
  * When a resource
  */
 static
-nth_site_t **site_get_rslot(nth_site_t *parent, char *path, 
+nth_site_t **site_get_rslot(nth_site_t *parent, char *path,
                            char **return_rest)
 {
   nth_site_t *site, **prev;
@@ -626,7 +626,7 @@ nth_site_t **site_get_rslot(nth_site_t *parent, char *path,
       continue;
     if (path[len] == '\0') {
       if (site->site_isdir)
-       return *return_rest = path, prev; 
+       return *return_rest = path, prev;
       return errno = EEXIST, NULL;
     }
     if (path[len] != '/' || site->site_path[len] != '/')
@@ -662,7 +662,7 @@ nth_site_t *site_get_subdir(nth_site_t *parent,
 
   if (path[0] == '\0')
     return *return_rest = path, parent;
-  
+
   for (site = parent->site_kids; site; site = site->site_next) {
     cmp = strncmp(path, site->site_path, len = site->site_path_len);
     if (cmp > 0)
@@ -711,7 +711,7 @@ server_t *server_create(url_t const *url,
   ta_list ta;
 
   ta_start(ta, tag, value);
-  tl_gets(ta_args(ta), 
+  tl_gets(ta_args(ta),
          NTHTAG_ROOT_REF(root),
          NTHTAG_MCLASS_REF(mclass),
          TPTAG_REUSE_REF(persistent),
@@ -719,7 +719,7 @@ server_t *server_create(url_t const *url,
          HTTPTAG_SERVER_STR_REF(server_str),
          TAG_END());
 
-  if (!root || !url || 
+  if (!root || !url ||
       (url->url_type != url_http && url->url_type != url_https)
       || !(srv = su_home_new(sizeof(*srv)))) {
     ta_end(ta);
@@ -731,7 +731,7 @@ server_t *server_create(url_t const *url,
   tpn->tpn_host =  url->url_host;
   tpn->tpn_port = url_port(url);
 
-  srv->srv_tports = tport_tcreate(srv, nth_server_class, root, 
+  srv->srv_tports = tport_tcreate(srv, nth_server_class, root,
                                  TPTAG_IDLE(600000),
                                  TPTAG_TIMEOUT(300000),
                                  ta_tags(ta));
@@ -757,9 +757,9 @@ server_t *server_create(url_t const *url,
                     TAG_END());
   }
   else {
-    SU_DEBUG_1(("nth_server_create: cannot bind transports " 
+    SU_DEBUG_1(("nth_server_create: cannot bind transports "
                URL_FORMAT_STRING "\n",
-               URL_PRINT_ARGS(url))); 
+               URL_PRINT_ARGS(url)));
     server_destroy(srv), srv = NULL;
   }
 
@@ -843,7 +843,7 @@ void server_request(server_t *srv,
   } else if (http && http->http_flags & MSG_FLG_TOOLARGE) {
     server_reply(srv, tport, request, response, HTTP_413_ENTITY_TOO_LARGE);
     return;
-  } else if (!http || !http->http_request || 
+  } else if (!http || !http->http_request ||
             (http->http_flags & MSG_FLG_ERROR)) {
     server_reply(srv, tport, request, response, HTTP_400_BAD_REQUEST);
     return;
@@ -933,7 +933,7 @@ static void server_tport_error(server_t *srv,
 }
 
 /** Respond without creating a request structure */
-static void server_reply(server_t *srv, tport_t *tport, 
+static void server_reply(server_t *srv, tport_t *tport,
                         msg_t *request, msg_t *response,
                         int status, char const *phrase)
 {
@@ -947,23 +947,23 @@ static void server_reply(server_t *srv, tport_t *tport,
     status = 500, phrase = http_500_internal_server;
 
   http = http_object(request);
-  
+
   if (http && http->http_request)
     req_version = http->http_request->rq_version;
 
-  close = status >= 200 && 
+  close = status >= 200 &&
     (!srv->srv_persistent
      || status == 400
-     || (http && http->http_request && 
+     || (http && http->http_request &&
         http->http_request->rq_version != http_version_1_1)
-     || (http && http->http_connection && 
+     || (http && http->http_connection &&
         msg_params_find(http->http_connection->k_items, "close")));
 
   msg_destroy(request);
 
   http = http_object(response);
 
-  pl = http_payload_format(msg_home(response), 
+  pl = http_payload_format(msg_home(response),
                           "<html>\n"
                           "<head><title>%u %s</title></head>\n"
                           "<body><h2>%u %s</h2></body>\n"
@@ -976,7 +976,7 @@ static void server_reply(server_t *srv, tport_t *tport,
     st->st_version = http_version_1_1;
     st->st_status = status;
     st->st_phrase = phrase;
-    
+
     http_add_tl(response, http,
                HTTPTAG_STATUS(st),
                HTTPTAG_SERVER(srv->srv_server),
@@ -992,8 +992,8 @@ static void server_reply(server_t *srv, tport_t *tport,
     close = 1;
   }
 
-  if (tport_tqsend(tport, response, NULL, 
-                  TPTAG_CLOSE_AFTER(close), 
+  if (tport_tqsend(tport, response, NULL,
+                  TPTAG_CLOSE_AFTER(close),
                   TAG_END()) == -1) {
     SU_DEBUG_3(("server_reply(): cannot queue response\n"));
     tport_shutdown(tport, 2);
@@ -1004,7 +1004,7 @@ static void server_reply(server_t *srv, tport_t *tport,
 
 /** Create a new message for transport */
 static
-msg_t *server_msg_create(server_t *srv, int flags, 
+msg_t *server_msg_create(server_t *srv, int flags,
                         char const data[], usize_t dlen,
                         tport_t const *tp, tp_client_t *tpc)
 {
@@ -1014,7 +1014,7 @@ msg_t *server_msg_create(server_t *srv, int flags,
 }
 
 /* ----------------------------------------------------------------------
- * 6) Server transactions 
+ * 6) Server transactions
  */
 
 struct auth_info
@@ -1044,12 +1044,12 @@ void nth_site_request(server_t *srv,
   int status;
 
   req = su_zalloc(srv->srv_home, size);
-  
+
   if (req == NULL) {
     server_reply(srv, tport, request, response, HTTP_500_INTERNAL_SERVER);
     return;
   }
-  
+
   if (am)
     as = auth_status_init(req + 1, sizeof *as), ai = (void *)(as + 1);
   else
@@ -1066,27 +1066,27 @@ void nth_site_request(server_t *srv,
   req->req_response = response;
 
   req->req_status = 100;
-  req->req_close = 
+  req->req_close =
     !srv->srv_persistent
     || http->http_request->rq_version != http_version_1_1
-    || (http->http_connection && 
+    || (http->http_connection &&
        msg_params_find(http->http_connection->k_items, "close"));
 
   if (am) {
-    static auth_challenger_t const http_server_challenger[] = 
+    static auth_challenger_t const http_server_challenger[] =
       {{ HTTP_401_UNAUTHORIZED, http_www_authenticate_class }};
 
     req->req_as = as;
 
     as->as_method = http->http_request->rq_method_name;
     as->as_uri = path;
-    
+
     if (http->http_payload) {
       as->as_body = http->http_payload->pl_data;
       as->as_bodylen = http->http_payload->pl_len;
     }
 
-    auth_mod_check_client(am, as, 
+    auth_mod_check_client(am, as,
                          http->http_authorization,
                          http_server_challenger);
 
@@ -1143,13 +1143,13 @@ static void nth_authentication_result(void *ai0, auth_status_t *as)
 
   if (as->as_status != 0) {
     assert(as->as_status >= 300);
-    nth_request_treply(req, status = as->as_status, as->as_phrase, 
-                      HTTPTAG_HEADER((http_header_t *)as->as_response), 
+    nth_request_treply(req, status = as->as_status, as->as_phrase,
+                      HTTPTAG_HEADER((http_header_t *)as->as_response),
                       TAG_END());
   }
   else {
     req->req_in_callback = 1;
-    status = ai->site->site_callback(ai->site->site_magic, 
+    status = ai->site->site_callback(ai->site->site_magic,
                                     ai->site,
                                     ai->req,
                                     ai->http,
@@ -1178,7 +1178,7 @@ void nth_request_destroy(nth_request_t *req)
 
   req->req_destroyed = 1;
 
-  if (req->req_in_callback) 
+  if (req->req_in_callback)
     return;
 
   if (req->req_as)
@@ -1193,7 +1193,7 @@ void nth_request_destroy(nth_request_t *req)
 /** Return request authentication status.
  *
  * @param req pointer to HTTP request object
- * 
+ *
  * @retval Status code
  *
  * @since New in @VERSION_1_12_4
@@ -1206,7 +1206,7 @@ int nth_request_status(nth_request_t const *req)
 /** Return request authentication status.
  *
  * @param req pointer to HTTP request object
- * 
+ *
  * @retval Pointer to authentication status struct
  *
  * @note The authentication status struct is freed when the #nth_request_t
@@ -1236,8 +1236,8 @@ msg_t *nth_request_message(nth_request_t *req)
   return retval;
 }
 
-int nth_request_treply(nth_request_t *req, 
-                      int status, char const *phrase, 
+int nth_request_treply(nth_request_t *req,
+                      int status, char const *phrase,
                       tag_type_t tag, tag_value_t value, ...)
 {
   msg_t *response, *next = NULL;
@@ -1261,14 +1261,14 @@ int nth_request_treply(nth_request_t *req,
 
   http_add_tl(response, http,
              HTTPTAG_SERVER(req->req_server->srv_server),
-             HTTPTAG_HEADER(as_info), 
+             HTTPTAG_HEADER(as_info),
              ta_tags(ta));
 
   if (http->http_payload && !http->http_content_length) {
     http_content_length_t *l;
     http_payload_t *pl;
     size_t len = 0;
-    
+
     for (pl = http->http_payload; pl; pl = pl->pl_next)
       len += pl->pl_len;
 
@@ -1282,12 +1282,12 @@ int nth_request_treply(nth_request_t *req,
 
   if (req->req_method == http_method_head && http->http_payload) {
     http_payload_t *pl;
-    
+
     for (pl = http->http_payload; pl; pl = pl->pl_next)
       msg_header_remove(response, (msg_pub_t *)http, (msg_header_t *)pl);
   }
 
-  http_complete_response(response, status, phrase, 
+  http_complete_response(response, status, phrase,
                         http_object(req->req_request));
 
   if (!http->http_date) {
@@ -1303,9 +1303,9 @@ int nth_request_treply(nth_request_t *req,
   else {
     req_close = req->req_close;
 
-    close = (http->http_connection && 
+    close = (http->http_connection &&
             msg_params_find(http->http_connection->k_items, "close"));
-    
+
     if (req_close && !close && status >= 200) {
       close = 1;
       http_add_tl(response, http, HTTPTAG_CONNECTION_STR("close"), TAG_END());
@@ -1314,13 +1314,13 @@ int nth_request_treply(nth_request_t *req,
 
   msg_serialize(response, (msg_pub_t *)http);
 
-  retval = tport_tqsend(req->req_tport, response, next, 
+  retval = tport_tqsend(req->req_tport, response, next,
                        TAG_IF(close, TPTAG_CLOSE_AFTER(1)),
                        ta_tags(ta));
 
  fail:
   ta_end(ta);
-  
+
   if (retval == 0)
     req->req_status = status;
 
index 369d73101ef4f7c9c0e8f347ab78531f7fa89410..745bf89f05ed4c1daead631227396da9c4890437 100644 (file)
@@ -25,7 +25,7 @@
 /**@CFILE nth_tag.c
  * @brief Tags for HTTP Transaction API
  *
- * @note This file is used to automatically generate 
+ * @note This file is used to automatically generate
  * nth_tag_ref.c and nth_tag_dll.c
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
index 4040d846a7918c3198d3926a5a0009677200cc56..63e105a4a2219a79d728be6c2481890ae5989403 100644 (file)
  */
 
 /* ----------------------------------------------------------------------
- * 1) Types 
+ * 1) Types
  */
 
-#ifndef NTH_H_TYPES 
+#ifndef NTH_H_TYPES
 #define NTH_H_TYPES
 
 /** NTH engine */
@@ -74,7 +74,7 @@ typedef NTH_SITE_MAGIC_T   nth_site_magic_t;
 #define NTH_H
 
 /* ----------------------------------------------------------------------
- * 2) Constants 
+ * 2) Constants
  */
 
 /** Version number */
@@ -108,11 +108,11 @@ NTH_DLL nth_engine_t *nth_engine_create(su_root_t *root,
                                        tag_type_t tag, tag_value_t value, ...);
 NTH_DLL void nth_engine_destroy(nth_engine_t *engine);
 
-NTH_DLL int nth_engine_set_params(nth_engine_t *engine, 
+NTH_DLL int nth_engine_set_params(nth_engine_t *engine,
                                  tag_type_t tag, tag_value_t value, ...);
-NTH_DLL int nth_engine_get_params(nth_engine_t const *engine, 
+NTH_DLL int nth_engine_get_params(nth_engine_t const *engine,
                                  tag_type_t tag, tag_value_t value, ...);
-NTH_DLL int nth_engine_get_stats(nth_engine_t const *engine, 
+NTH_DLL int nth_engine_get_stats(nth_engine_t const *engine,
                                 tag_type_t tag, tag_value_t value, ...);
 
 NTH_DLL msg_t *nth_engine_msg_create(nth_engine_t *he, int flags);
@@ -147,15 +147,15 @@ NTH_DLL void nth_client_destroy(nth_client_t *clnt);
  * 5) Server side prototypes
  */
 
-typedef int nth_request_f(nth_site_magic_t *lmagic, 
+typedef int nth_request_f(nth_site_magic_t *lmagic,
                          nth_site_t *server,
-                         nth_request_t *req, 
+                         nth_request_t *req,
                          http_t const *http,
                          char const *path);
 
 char const *nth_site_server_version(void);
 
-NTH_DLL nth_site_t *nth_site_create(nth_site_t *parent,  
+NTH_DLL nth_site_t *nth_site_create(nth_site_t *parent,
                                    nth_request_f *req_callback,
                                    nth_site_magic_t *magic,
                                    url_string_t const *address,
@@ -166,13 +166,13 @@ NTH_DLL void nth_site_destroy(nth_site_t *site);
 
 NTH_DLL nth_site_magic_t *nth_site_magic(nth_site_t const *site);
 
-NTH_DLL void nth_site_bind(nth_site_t *site, 
-                          nth_request_f *callback, 
+NTH_DLL void nth_site_bind(nth_site_t *site,
+                          nth_request_f *callback,
                           nth_site_magic_t *);
 
 NTH_DLL su_time_t nth_site_access_time(nth_site_t const *site);
 
-NTH_DLL int nth_site_set_params(nth_site_t *site, 
+NTH_DLL int nth_site_set_params(nth_site_t *site,
                                tag_type_t tag, tag_value_t value, ...);
 NTH_DLL int nth_site_get_params(nth_site_t const *site,
                                tag_type_t tag, tag_value_t value, ...);
@@ -182,15 +182,15 @@ NTH_DLL int nth_site_get_stats(nth_site_t const *site,
 NTH_DLL url_t const *nth_site_url(nth_site_t const *site);
 
 /* ----------------------------------------------------------------------
- * 6) Prototypes for server transactions 
+ * 6) Prototypes for server transactions
  */
 
 NTH_DLL int nth_request_status(nth_request_t const *req);
 NTH_DLL http_method_t nth_request_method(nth_request_t const *req);
 NTH_DLL msg_t *nth_request_message(nth_request_t *req);
 
-NTH_DLL int nth_request_treply(nth_request_t *ireq, 
-                              int status, char const *phrase, 
+NTH_DLL int nth_request_treply(nth_request_t *ireq,
+                              int status, char const *phrase,
                               tag_type_t tag, tag_value_t value, ...);
 
 NTH_DLL void nth_request_destroy(nth_request_t *req);
index 76626b4be596fb57246e905ac5b1396f4580fc8e..3f9a07d739c09e2765b2814781a0194334b34479 100644 (file)
@@ -28,9 +28,9 @@
 
 /**@file sofia-sip/nth_tag.h
  * @brief Tags for @b nth, HTTP engine module.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Sun Oct 13 22:23:48 2002 ppessi
  */
 
index d059cdb2a83f48f465a7ac2c6ec7b309057dace7..3b6859e41592fb8700cd569a09f4e856b82a7802 100644 (file)
@@ -24,9 +24,9 @@
 
 /**@file test_nth.c
  * @brief Tests for nth module
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Oct 22 20:52:37 2002 ppessi
  */
 
@@ -85,7 +85,7 @@ static int init_server(tester_t *t);
 static int test_requests(tester_t *t);
 static int init_engine(tester_t *t);
 
-struct site 
+struct site
 {
   site_t       *s_next, *s_parent;
   tester_t     *s_tester;
@@ -125,9 +125,9 @@ struct tester
   site_t       *t_master;
 };
 
-static int test_site(site_t *t, 
+static int test_site(site_t *t,
                     nth_site_t *server,
-                    nth_request_t *req, 
+                    nth_request_t *req,
                     http_t const *http,
                     char const *path);
 
@@ -155,15 +155,15 @@ static site_t *site_create(tester_t *t, site_t *parent,
 
   ta_start(ta, tag, value);
 
-  s->s_tags = tl_adup(t->t_home, ta_args(ta)); 
+  s->s_tags = tl_adup(t->t_home, ta_args(ta));
   if (s->s_tags)
     s->s_ns = nth_site_create(pns, test_site, s,
-                             (url_string_t *)s->s_url, 
+                             (url_string_t *)s->s_url,
                              NTHTAG_ROOT(t->t_root),
                              ta_tags(ta));
 
   ta_end(ta);
-  
+
   if (s->s_ns == NULL)
     return NULL;
 
@@ -179,14 +179,14 @@ static int init_test(tester_t *t)
   BEGIN();
 
   t->t_root = su_root_create(t); TEST_1(t->t_root);
-  t->t_mclass = msg_mclass_clone(http_default_mclass(), 0, 0); 
+  t->t_mclass = msg_mclass_clone(http_default_mclass(), 0, 0);
   TEST_1(t->t_mclass);
 
   t->t_addr->su_len = (sizeof t->t_addr->su_sin);
   s = su_socket(t->t_addr->su_family = AF_INET, SOCK_STREAM, 0);
   TEST_1(s != INVALID_SOCKET);
   TEST_1(su_inet_pton(AF_INET, "127.0.0.1", &t->t_addr->su_sin.sin_addr) >= 0);
-  TEST_1(bind(s, &t->t_addr->su_sa, 
+  TEST_1(bind(s, &t->t_addr->su_sa,
              t->t_addrlen = (sizeof t->t_addr->su_sin)) != -1);
   TEST_1(getsockname(s, &t->t_addr->su_sa, &t->t_addrlen) != -1);
   TEST_1(t->t_addr->su_port != 0);
@@ -227,7 +227,7 @@ static int test_nth_client_api(tester_t *t)
 
   BEGIN();
 
-  s = nth_engine_version(); 
+  s = nth_engine_version();
   TEST_1(s); TEST_1(strlen(s)); TEST_S(s, "sofia-http-client/" NTH_CLIENT_VERSION);
 
   TEST_1(nth_engine_create(NULL, TAG_END()) == NULL);
@@ -235,9 +235,9 @@ static int test_nth_client_api(tester_t *t)
   TEST_VOID(nth_engine_destroy(NULL));
   TEST_1(nth_engine_get_params(NULL, TAG_END()) == -1);
   TEST_1(nth_engine_set_params(NULL, TAG_END()) == -1);
-  TEST_1(!nth_client_tcreate(NULL, NULL, NULL, 
-                            HTTP_METHOD_OPTIONS, 
-                            URL_STRING_MAKE("*"), 
+  TEST_1(!nth_client_tcreate(NULL, NULL, NULL,
+                            HTTP_METHOD_OPTIONS,
+                            URL_STRING_MAKE("*"),
                             TAG_END()));
   TEST(nth_client_status(NULL), 400);
   TEST(nth_client_method(NULL), http_method_invalid);
@@ -247,7 +247,7 @@ static int test_nth_client_api(tester_t *t)
   TEST_P(nth_client_response(NULL), NULL);
   TEST_VOID(nth_client_destroy(NULL));
 
-  t->t_engine = nth_engine_create(t->t_root, 
+  t->t_engine = nth_engine_create(t->t_root,
                                  NTHTAG_ERROR_MSG(2),
                                  NTHTAG_MCLASS(t->t_mclass),
                                  NTHTAG_MFLAGS(MSG_DO_CANONIC|MSG_DO_COMPACT),
@@ -255,7 +255,7 @@ static int test_nth_client_api(tester_t *t)
                                  NTHTAG_PROXY("http://localhost:8888"),
                                  TAG_END());
   TEST_1(t->t_engine);
-  
+
   {
     int error_msg = -1;
     msg_mclass_t const *mclass = (void *)-1;
@@ -266,14 +266,14 @@ static int test_nth_client_api(tester_t *t)
 
     char *proxy_str;
 
-    TEST(nth_engine_get_params(t->t_engine, 
+    TEST(nth_engine_get_params(t->t_engine,
                               NTHTAG_ERROR_MSG_REF(error_msg),
                               NTHTAG_MCLASS_REF(mclass),
                               NTHTAG_MFLAGS_REF(mflags),
                               NTHTAG_EXPIRES_REF(expires),
                               NTHTAG_STREAMING_REF(streaming),
                               NTHTAG_PROXY_REF(proxy),
-                              TAG_END()), 
+                              TAG_END()),
         6);
 
     TEST(error_msg, 1);
@@ -287,14 +287,14 @@ static int test_nth_client_api(tester_t *t)
 
     proxy = URL_STRING_MAKE("http://127.0.0.1:80");
 
-    TEST(nth_engine_set_params(t->t_engine, 
+    TEST(nth_engine_set_params(t->t_engine,
                               NTHTAG_ERROR_MSG(0),
                               NTHTAG_MCLASS(http_default_mclass()),
                               NTHTAG_MFLAGS(0),
                               NTHTAG_EXPIRES(10000),
                               NTHTAG_STREAMING(2),
                               NTHTAG_PROXY(proxy),
-                              TAG_END()), 
+                              TAG_END()),
         6);
 
     error_msg = -1;
@@ -304,14 +304,14 @@ static int test_nth_client_api(tester_t *t)
     streaming = -1;
     proxy = (void *)-1;
 
-    TEST(nth_engine_get_params(t->t_engine, 
+    TEST(nth_engine_get_params(t->t_engine,
                               NTHTAG_ERROR_MSG_REF(error_msg),
                               NTHTAG_MCLASS_REF(mclass),
                               NTHTAG_MFLAGS_REF(mflags),
                               NTHTAG_EXPIRES_REF(expires),
                               NTHTAG_STREAMING_REF(streaming),
                               NTHTAG_PROXY_REF(proxy),
-                              TAG_END()), 
+                              TAG_END()),
         6);
 
     TEST(error_msg, 0);
@@ -319,13 +319,13 @@ static int test_nth_client_api(tester_t *t)
     TEST(mflags, 0);
     TEST(expires, 10000);
     TEST(streaming, 1);
-    TEST_1(proxy != NULL); 
+    TEST_1(proxy != NULL);
     TEST_1(proxy_str = url_as_string(t->t_home, proxy->us_url));
     TEST_S(proxy_str, "http://127.0.0.1:80");
   }
 
   TEST_1(nth_engine_get_stats(NULL, TAG_END()) == -1);
-  
+
   {
     msg_t *msg;
     http_t *http;
@@ -349,9 +349,9 @@ static int test_nth_client_api(tester_t *t)
   END();
 }
 
-static int site_check_all(site_t *t, 
+static int site_check_all(site_t *t,
                          nth_site_t *server,
-                         nth_request_t *req, 
+                         nth_request_t *req,
                          http_t const *http,
                          char const *path);
 
@@ -360,12 +360,12 @@ static int test_nth_server_api(tester_t *t)
 {
   char const *v;
   site_t s[1];
-  
+
   BEGIN();
 
   memset(s, 0, sizeof s);
 
-  v = nth_site_server_version(); 
+  v = nth_site_server_version();
   TEST_1(v); TEST_1(strlen(v)); TEST_S(v, "nth/" NTH_SERVER_VERSION);
 
   /* Fails because no parent site, no root */
@@ -374,8 +374,8 @@ static int test_nth_server_api(tester_t *t)
                          TAG_END()));
 
   /* Fails because url specifies both host and path */
-  TEST_1(!nth_site_create(NULL, site_check_all, s, 
-                         URL_STRING_MAKE("http://127.0.0.1:8888/foo/"), 
+  TEST_1(!nth_site_create(NULL, site_check_all, s,
+                         URL_STRING_MAKE("http://127.0.0.1:8888/foo/"),
                          NTHTAG_ROOT(t->t_root), TAG_END()));
 
   TEST_VOID(nth_site_destroy(NULL));
@@ -393,9 +393,9 @@ static int test_nth_server_api(tester_t *t)
   END();
 }
 
-static int test_site(site_t *s, 
+static int test_site(site_t *s,
                     nth_site_t *ns,
-                    nth_request_t *req, 
+                    nth_request_t *req,
                     http_t const *http,
                     char const *path)
 {
@@ -411,9 +411,9 @@ static int test_site(site_t *s,
 }
 
 
-static int site_check_all(site_t *s, 
+static int site_check_all(site_t *s,
                          nth_site_t *ns,
-                         nth_request_t *req, 
+                         nth_request_t *req,
                          http_t const *http,
                          char const *path)
 {
@@ -462,45 +462,45 @@ static int init_server(tester_t *t)
   auth_mod_t *am;
   int temp;
 
-  TEST_1(t->t_master = m = 
+  TEST_1(t->t_master = m =
         site_create(t, NULL,
-                    su_sprintf(t->t_home, "HTTP://127.0.0.1:%u", 
+                    su_sprintf(t->t_home, "HTTP://127.0.0.1:%u",
                                htons(t->t_addr->su_port)),
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR("<html><body>Hello</body></html>\n"),
                     TPTAG_CERTIFICATE(t->t_pem),
                     TAG_END()));
 
   TEST_1(site_create(t, m, "/sub/sub",
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR
                     ("<html><body>sub/sub</body></html>\n"),
                     TAG_END()));
 
   TEST_1(site_create(t, m, "/sub/",
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR("<html><body>sub/</body></html>\n"),
                     TAG_END()));
 
   TEST_1(site_create(t, m, "/sub/sub/",
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR
                     ("<html><body>sub/sub/</body></html>\n"),
                     TAG_END()));
 
-  TEST_1(sub2 = 
+  TEST_1(sub2 =
         site_create(t, m, "/sub2/",
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR("<html><body>sub2/</body></html>\n"),
                     TAG_END()));
 
   TEST_1(site_create(t, sub2, "sub/",
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR
                     ("<html><body>sub2/sub/</body></html>\n"),
@@ -519,15 +519,15 @@ static int init_server(tester_t *t)
 
   TEST_1(close(temp) == 0);
 
-  am = auth_mod_create(t->t_root, 
-                      AUTHTAG_METHOD("Digest"), 
+  am = auth_mod_create(t->t_root,
+                      AUTHTAG_METHOD("Digest"),
                       AUTHTAG_REALM("auth"),
                       AUTHTAG_DB(passwd_name),
                       TAG_END());
   TEST_1(am);
 
   TEST_1(site_create(t, m, "auth/",
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR
                     ("<html><body>auth/</body></html>\n"),
@@ -537,15 +537,15 @@ static int init_server(tester_t *t)
   auth_mod_unref(am);
 
 
-  am = auth_mod_create(t->t_root, 
-                      AUTHTAG_METHOD("Delayed+Basic"), 
+  am = auth_mod_create(t->t_root,
+                      AUTHTAG_METHOD("Delayed+Basic"),
                       AUTHTAG_REALM("auth2"),
                       AUTHTAG_DB(passwd_name),
                       TAG_END());
   TEST_1(am);
 
   TEST_1(site_create(t, m, "auth2/",
-                    HTTP_200_OK, 
+                    HTTP_200_OK,
                     HTTPTAG_CONTENT_TYPE_STR("text/html"),
                     HTTPTAG_PAYLOAD_STR
                     ("<html><body>auth/</body></html>\n"),
@@ -604,12 +604,12 @@ static int send_request(tester_t *t, char const *req, size_t reqlen,
   END();
 }
 
-int sspace(char const *buffer) 
+int sspace(char const *buffer)
 {
-  int m = strcspn(buffer, " "); 
+  int m = strcspn(buffer, " ");
 
-  if (buffer[m]) 
-    m += 1 + strcspn(buffer + m + 1, " "); 
+  if (buffer[m])
+    m += 1 + strcspn(buffer + m + 1, " ");
 
   return m;
 }
@@ -624,7 +624,7 @@ static int test_requests(tester_t *t)
   BEGIN();
 
   {
-    static char const get[] = 
+    static char const get[] =
       "GET / HTTP/1.1" CRLF
       "Host: 127.0.0.1" CRLF
       "User-Agent: Test-Tool" CRLF
@@ -638,7 +638,7 @@ static int test_requests(tester_t *t)
   }
 
   {
-    static char const get[] = 
+    static char const get[] =
       "GET / HTTP/1.1" CRLF
       "Host: 127.0.0.1" CRLF
       "User-Agent: Test-Tool" CRLF
@@ -652,7 +652,7 @@ static int test_requests(tester_t *t)
   }
 
   {
-    static char const request[] = 
+    static char const request[] =
       "GET %s HTTP/1.1" CRLF
       "Host: 127.0.0.1" CRLF
       "User-Agent: Test-Tool" CRLF
@@ -724,7 +724,7 @@ static int test_requests(tester_t *t)
   }
 
   {
-    static char const get[] = 
+    static char const get[] =
       "GET /auth2/ HTTP/1.1" CRLF
       "Host: 127.0.0.1" CRLF
       "User-Agent: Test-Tool" CRLF
@@ -739,7 +739,7 @@ static int test_requests(tester_t *t)
   }
 
   {
-    static char const kuik[] = 
+    static char const kuik[] =
       "kuik" CRLF CRLF;
 
     TEST(send_request(t, kuik, -1, 0, buffer, sizeof(buffer), &m), 0);
@@ -748,7 +748,7 @@ static int test_requests(tester_t *t)
   }
 
   {
-    static char const kuik[] = 
+    static char const kuik[] =
       "POST / HTTP/1.1" CRLF
       "Host: 127.0.0.1" CRLF
       "Content-Length: 4294967296" CRLF
@@ -760,7 +760,7 @@ static int test_requests(tester_t *t)
   }
 
   {
-    static char const get[] = 
+    static char const get[] =
       "GET / HTTP/10.10" CRLF
       "Host: 127.0.0.1" CRLF
       "User-Agent: Test-Tool" CRLF
@@ -774,7 +774,7 @@ static int test_requests(tester_t *t)
   }
 
   {
-    static char const get[] = 
+    static char const get[] =
       "GET /" CRLF;
 
     TEST(send_request(t, get, -1, 1, buffer, sizeof(buffer) - 1, &m), 0);
@@ -785,7 +785,7 @@ static int test_requests(tester_t *t)
 
   if (0)
   {
-    static char const post[] = 
+    static char const post[] =
       "POST /foo HTTP/1.1" CRLF
       "Host: 127.0.0.1" CRLF
       "User-Agent: Test-Tool" CRLF
@@ -816,20 +816,20 @@ static int init_engine(tester_t *t)
   BEGIN();
   su_socket_t s;
 
-  t->t_engine = nth_engine_create(t->t_root, 
+  t->t_engine = nth_engine_create(t->t_root,
                                  NTHTAG_STREAMING(0),
                                  TAG_END());
   TEST_1(t->t_engine);
 
   t->t_sink = s = su_socket(AF_INET, SOCK_STREAM, 0); TEST_1(s != -1);
-  TEST(bind(s, &t->t_sinkaddr->su_sa, 
+  TEST(bind(s, &t->t_sinkaddr->su_sa,
            t->t_sinkaddrlen = (sizeof t->t_sinkaddr->su_sin)),
        0);
   TEST_1(getsockname(s, &t->t_sinkaddr->su_sa, &t->t_sinkaddrlen) != -1);
   TEST(listen(t->t_sink, 5), 0);
-  
+
   TEST_1(t->t_sinkuri = (url_string_t *)
-        su_sprintf(t->t_home, "HTTP://127.0.0.1:%u", 
+        su_sprintf(t->t_home, "HTTP://127.0.0.1:%u",
                    htons(t->t_sinkaddr->su_port)));
 
   END();
@@ -883,7 +883,7 @@ static int test_client(tester_t *t)
   while (client->c_status == 0) su_root_step(t->t_root, 1);
   TEST(client->c_status, 408);
   nth_client_destroy(hc);
-        
+
   END();
 }
 #if HAVE_ALARM
@@ -956,7 +956,7 @@ int main(int argc, char **argv)
   retval |= init_engine(t);
   retval |= test_client(t);
   retval |= deinit_test(t);
+
   su_deinit();
 
   return retval;
index b81273c22a5d5f5e51653c9bd011a7911f0f7a6f..376f915580fae3b51faa8b320b86996bb61f2ac5 100644 (file)
@@ -16,7 +16,7 @@
 
        * Fixed call state events with UPDATE in nua.
 
-       Fixed the order the nua_i_update and nua_i_state events are sent. 
+       Fixed the order the nua_i_update and nua_i_state events are sent.
        Now we are using session-timer headers in responses, too.
 
        * Added NUTAG_ALLOW() and NUTAG_ALLOW_REF() to nua.
@@ -67,7 +67,7 @@
 
   * Fixed response to 401.
   We are now not terminating call when application is expected to authenticate
-  request. Should we add 
+  request. Should we add
 
     M ./libsofia-sip-ua/nua/nua_stack.c -10 +28
 
 
 2005-10-10  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
-  * Fixed basic call test run. 
+  * Fixed basic call test run.
 
     M ./libsofia-sip-ua/nua/test_nua.c -8 +11
 
     M ./libsofia-sip-ua/nua/nua_common.c -1 +1
     M ./libsofia-sip-ua/nua/nua_stack.c -1 +1
     M ./libsofia-sip-ua/nua/test_nua.c -2 +2
-       
+
   * Running a basic call test case.
 
     M ./libsofia-sip-ua/nua/test_nua.c -24 +109
 
     M ./libsofia-sip-ua/nua/nua.docs -1 +355
 
-  * Used picture-mode here. 
+  * Used picture-mode here.
 
     M ./libsofia-sip-ua/nua/nua.docs -227 +227
 
-  * Fixed nua_set_hparams() documentation. 
+  * Fixed nua_set_hparams() documentation.
 
     M ./libsofia-sip-ua/nua/nua.c -1 +1
 
   * Do not pass soa handle to application.
 
     M ./libsofia-sip-ua/nua/nua_stack.c -3 +3
-       
+
 2005-09-23  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * nua_stack.c: Fix delivering nua_i_active.
 
        * nua_tag.h: Removed NUTAG_MEDIA_SUBSYSTEM.
 
-       * nua.h: Added nua_i_state_change event. Removed 
+       * nua.h: Added nua_i_state_change event. Removed
        nua_i_media_update (replaced by nua_i_state_change).
 
 2005-09-21  Kai Vehmanen  <kai.vehmanen@nokia.com>
        code related to old media subsystem interface (HAVE_MSS).
        Added nua_i_media_update event. Removed code related
        to ring-tone generation (HAVE_HERBIE).
-       
+
 2005-09-20  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * nua.h, nua.c: Removed implementation for obsolete media
-       param functions. Added dummy implementations that print 
+       param functions. Added dummy implementations that print
        a warning to users of the removed interfaces.
 
        * nua_stack.c: Removed obsolete media param code.
-       
+
 2005-07-18  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * Initial import of the module to Sofia-SIP tree.
index 08534bc7750ade6f9445e5b6e7d8dcebda0dda60..bda8fa5892b77858af32589f5f4734a1a37be2d5 100644 (file)
@@ -99,14 +99,14 @@ su_log_t nua_log[] = { SU_LOG_INIT("nua", "NUA_DEBUG", SU_DEBUG) };
  *   (but see also NUTAG_INITIAL_ROUTE()).
  * - NUTAG_URL() (and NUTAG_SIPS_URL(), listing URIs describing
  *   transports)
- * - NUTAG_CERTIFICATE_DIR(), specifying the location of the 
+ * - NUTAG_CERTIFICATE_DIR(), specifying the location of the
  *   root and client/server certificate files
- * - NUTAG_SIP_PARSER(), providing customized parser used to 
+ * - NUTAG_SIP_PARSER(), providing customized parser used to
  *   parse received SIP messages
  * - All parameter tags, listed with nua_set_params()
  * - All NTATAG_* are passed to NTA documented in <sofia-sip/nta_tag.h>:
- *   see NTATAG_EXTRA_100(), 
- * - All tport tags are passed to tport. 
+ *   see NTATAG_EXTRA_100(),
+ * - All tport tags are passed to tport.
  *   They are documented in <sofia-sip/tport_tag.h>
  * - All SOATAG_* are passed to the default SOA (media session) object which
  *   is created by nua_create() unless NUTAG_MEDIA_ENABLE(0) is included in
index 2a44c57bc7302ea656b44daaf5ae69f45b25c86d..d633c9d57e135de49c44ce4f9e62d9963ed6a691 100644 (file)
@@ -338,7 +338,7 @@ The following sections will present code examples from a simple application
 that uses services of NUA. The example is not complete but should present
 all relevant details of the basic use of NUA.
 
-On sourceforge.net there is available an example application 
+On sourceforge.net there is available an example application
 <a href="http://sourceforge.net/project/showfiles.php?group_id=143636&package_id=179933">
 sofisip_cli.c</a> that can be studied for more complete example.
 
@@ -591,7 +591,7 @@ void app_i_state(int           status,
           NUTAG_CALLSTATE_REF(state),
           NUTAG__REF(state),
 
-  
+
     state = (nua_callstate_t)t->t_value;
 
   printf("call %s\n", nua_callstate_name(state));
@@ -935,7 +935,7 @@ NUTAG_OFFER_RECV() or NUTAG_ANSWER_RECV(). SOATAG_ACTIVE_AUDIO() and
 SOATAG_ACTIVE_VIDEO() are informational tags used to indicate what is the
 status of these media.
 
-The #nua_i_state event is not sent, however, if the change is invoked by 
+The #nua_i_state event is not sent, however, if the change is invoked by
 application calling API functions like nua_bye() and there is no change in
 SDP offer/answer status.
 
@@ -2089,7 +2089,7 @@ NUTAG_AUTOANSWER(0) on B side, NUTAG_AUTOACK(0) on A side.
  * #nua_r_unregister  \n
  * #nua_r_unsubscribe \n
  * #nua_r_update
- * 
+ *
  * @sa nua_event_is_incoming_request(), nua_event_name()
  */
 
@@ -2175,7 +2175,7 @@ NUTAG_AUTOANSWER(0) on B side, NUTAG_AUTOACK(0) on A side.
  * @param tags   empty
  *
  * @since Experimental in @VERSION_1_12_2.
- * 
+ *
  * @END_NUA_EVENT
  */
 
@@ -2276,7 +2276,7 @@ NUTAG_AUTOANSWER(0) on B side, NUTAG_AUTOACK(0) on A side.
  * @param hmagic operation magic associated with the notifier
  * @param sip    NULL
  * @param tags   empty
- * 
+ *
  * @sa nua_terminate(), nua_handle_destroy()
  *
  * @END_NUA_EVENT
index 19e2655e0b0963a1471d43b5450b21b01d41d7c7..c378ea1aa0d738fe079dcad349bd924faa9690fe 100644 (file)
  */
 
 /**@CFILE nua_common.c
- * @brief Function common to both stack and application side.  
- * 
+ * @brief Function common to both stack and application side.
+ *
  * @author Pekka.Pessi@nokia.com
- * 
+ *
  * @date Created: Tue Apr 26 13:23:17 2005 ppessi
- * 
+ *
  */
 
 #include "config.h"
@@ -76,7 +76,7 @@
 static void nh_destructor(void *arg);
 
 /**@internal
- * Create an operation handle 
+ * Create an operation handle
  *
  * Allocates a new operation handle and associated storage.
  *
@@ -88,7 +88,7 @@ static void nh_destructor(void *arg);
  * @retval NULL    Creation failed
  *
  * @par Related tags:
- *     Creates a copy of the provided tags which will 
+ *     Creates a copy of the provided tags which will
  *     be used with every operation.
  *
  * @par Events:
@@ -120,7 +120,7 @@ nua_handle_t *nh_create_handle(nua_t *nua,
                  (void *)nua, (void *)nh));
       su_home_unref(nh->nh_home), nh = NULL;
     }
-    
+
     if (nh && su_home_is_threadsafe(nua->nua_home)) {
       if (su_home_threadsafe(nh->nh_home) < 0) {
        su_home_unref(nh->nh_home);
@@ -128,13 +128,13 @@ nua_handle_t *nh_create_handle(nua_t *nua,
       }
     }
 
-    if (nh && _handle_lifetime) {      
+    if (nh && _handle_lifetime) {
       /* This far, we have nothing real to destruct but
-       * when _NUA_HANDLE_DEBUG is set, we add destructor 
+       * when _NUA_HANDLE_DEBUG is set, we add destructor
        * and get more entertaining debugging output */
       if (_handle_lifetime == 1 && !getenv("_NUA_HANDLE_DEBUG")) {
        _handle_lifetime = 0;
-      } 
+      }
       else {
        _handle_lifetime = 2;
        SU_DEBUG_0(("nh_handle_create(%p)\n", (void *)nh));
@@ -222,7 +222,7 @@ nua_handle_t *nua_handle_ref(nua_handle_t *nh)
   return (nua_handle_t *)su_home_ref(nh->nh_home);
 }
 
-/** Destroy reference to handle. 
+/** Destroy reference to handle.
  *
  * The handles use reference counting for memory management. In addition to
  * the memory management, there is protocol state associated with the
@@ -301,7 +301,7 @@ int nua_event_is_incoming_request(nua_event_t event)
   }
 }
 
-/** Get name for a NUA event. 
+/** Get name for a NUA event.
  *
  * @sa #nua_event_e, #nua_event_t, nua_callstate_name(), nua_substate_name()
  */
@@ -374,7 +374,7 @@ char const *nua_event_name(nua_event_t event)
 }
 
 /** Return name of call state.
- * 
+ *
  * @sa enum #nua_callstate, nua_event_name(), nua_substate_name()
  */
 char const *nua_callstate_name(enum nua_callstate state)
@@ -395,7 +395,7 @@ char const *nua_callstate_name(enum nua_callstate state)
   }
 }
 
-/** Return name of subscription state. @NEW_1_12_5. 
+/** Return name of subscription state. @NEW_1_12_5.
  *
  * @sa enum #nua_substate, nua_event_name(), nua_callstate_name()
  */
@@ -424,7 +424,7 @@ enum nua_substate nua_substate_make(char const *sip_substate)
     return nua_substate_terminated;
   else if (strcasecmp(sip_substate, "pending") == 0)
     return nua_substate_pending;
-  else /* if (strcasecmp(sip_substate, "active") == 0) */ 
+  else /* if (strcasecmp(sip_substate, "active") == 0) */
     return nua_substate_active;
 }
 
index fd0c93c1cba795f397a8c0fd2743bc4d953f24d5..eb6a273911e1644ef78b0a09e4d8e2a002063874 100644 (file)
@@ -59,7 +59,7 @@
 /* ======================================================================== */
 /* Dialog handling */
 
-static void nua_dialog_usage_remove_at(nua_owner_t*, nua_dialog_state_t*, 
+static void nua_dialog_usage_remove_at(nua_owner_t*, nua_dialog_state_t*,
                                       nua_dialog_usage_t**,
                                       nua_client_request_t *cr,
                                       nua_server_request_t *sr);
@@ -75,9 +75,9 @@ static void nua_dialog_log_usage(nua_owner_t *, nua_dialog_state_t *);
  * @param sip  SIP message containing response used to update dialog
  * @param rtag if true, set remote tag within the leg
  */
-void nua_dialog_uas_route(nua_owner_t *own, 
+void nua_dialog_uas_route(nua_owner_t *own,
                          nua_dialog_state_t *ds,
-                         sip_t const *sip, 
+                         sip_t const *sip,
                          int rtag)
 {
   int established = nua_dialog_is_established(ds);
@@ -105,7 +105,7 @@ void nua_dialog_uas_route(nua_owner_t *own,
  * @param sip  SIP message containing response used to update dialog
  * @param rtag if true, set remote tag within the leg
  */
-void nua_dialog_uac_route(nua_owner_t *own, 
+void nua_dialog_uac_route(nua_owner_t *own,
                          nua_dialog_state_t *ds,
                          sip_t const *sip,
                          int rtag)
@@ -126,7 +126,7 @@ void nua_dialog_uac_route(nua_owner_t *own,
 }
 
 /**@internal Store information from remote endpoint. */
-void nua_dialog_store_peer_info(nua_owner_t *own, 
+void nua_dialog_store_peer_info(nua_owner_t *own,
                                nua_dialog_state_t *ds,
                                sip_t const *sip)
 {
@@ -190,7 +190,7 @@ int nua_dialog_zap(nua_owner_t *own,
                   nua_dialog_state_t *ds)
 {
   /* zap peer info */
-  nua_dialog_store_peer_info(own, ds, NULL); 
+  nua_dialog_store_peer_info(own, ds, NULL);
   /* Local Contact */
   msg_header_free(own, (msg_header_t *)ds->ds_ltarget), ds->ds_ltarget = NULL;
   /* Leg */
@@ -216,7 +216,7 @@ int nua_dialog_remove(nua_owner_t *own,
 
 /** @internal Get dialog usage slot. */
 nua_dialog_usage_t **
-nua_dialog_usage_at(nua_dialog_state_t const *ds, 
+nua_dialog_usage_at(nua_dialog_state_t const *ds,
                    nua_usage_class const *kind,
                    sip_event_t const *event)
 {
@@ -257,7 +257,7 @@ nua_dialog_usage_at(nua_dialog_state_t const *ds,
 }
 
 /** @internal Get a dialog usage */
-nua_dialog_usage_t *nua_dialog_usage_get(nua_dialog_state_t const *ds, 
+nua_dialog_usage_t *nua_dialog_usage_get(nua_dialog_state_t const *ds,
                                         nua_usage_class const *kind,
                                         sip_event_t const *event)
 {
@@ -270,11 +270,11 @@ char const *nua_dialog_usage_name(nua_dialog_usage_t const *du)
   if (du == NULL)
     return "<NULL>";
   return du->du_class->usage_name(du);
-} 
+}
 
 /** @internal Add dialog usage */
-nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own, 
-                                        struct nua_dialog_state *ds, 
+nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own,
+                                        struct nua_dialog_state *ds,
                                         nua_usage_class const *uclass,
                                         sip_event_t const *event)
 {
@@ -286,9 +286,9 @@ nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own,
     du = *prev_du;
     if (du) {          /* Already exists */
       SU_DEBUG_5(("nua(%p): adding already existing %s usage%s%s\n",
-                 (void *)own, nua_dialog_usage_name(du), 
+                 (void *)own, nua_dialog_usage_name(du),
                  event ? "  with event " : "", event ? event->o_type : ""));
-      
+
       if (prev_du != &ds->ds_usage) {
        /* Move as a first usage in the list */
        *prev_du = du->du_next;
@@ -305,7 +305,7 @@ nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own,
 
     if (du) {
       su_home_ref(own);
-      du->du_dialog = ds; 
+      du->du_dialog = ds;
       du->du_class = uclass;
       du->du_event = o;
 
@@ -314,9 +314,9 @@ nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own,
        su_free(own, du);
        return NULL;
       }
-       
+
       SU_DEBUG_5(("nua(%p): adding %s usage%s%s\n",
-                 (void *)own, nua_dialog_usage_name(du), 
+                 (void *)own, nua_dialog_usage_name(du),
                  o ? " with event " : "", o ? o->o_type :""));
 
       du->du_next = ds->ds_usage, ds->ds_usage = du;
@@ -331,7 +331,7 @@ nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *own,
 }
 
 /** @internal Remove dialog usage. */
-void nua_dialog_usage_remove(nua_owner_t *own, 
+void nua_dialog_usage_remove(nua_owner_t *own,
                             nua_dialog_state_t *ds,
                             nua_dialog_usage_t *du,
                             nua_client_request_t *cr,
@@ -350,9 +350,9 @@ void nua_dialog_usage_remove(nua_owner_t *own,
   nua_dialog_usage_remove_at(own, ds, at, cr, sr);
 }
 
-/** @internal Remove dialog usage. 
+/** @internal Remove dialog usage.
  *
- * Zap dialog state (leg, tag and route) if no usages remain. 
+ * Zap dialog state (leg, tag and route) if no usages remain.
 */
 static void
 nua_dialog_usage_remove_at(nua_owner_t *own,
@@ -372,7 +372,7 @@ nua_dialog_usage_remove_at(nua_owner_t *own,
     o = du->du_event;
 
     SU_DEBUG_5(("nua(%p): removing %s usage%s%s\n",
-               (void *)own, nua_dialog_usage_name(du), 
+               (void *)own, nua_dialog_usage_name(du),
                o ? " with event " : "", o ? o->o_type :""));
     du->du_class->usage_remove(own, ds, du, cr0, sr0);
 
@@ -423,7 +423,7 @@ void nua_dialog_log_usage(nua_owner_t *own, nua_dialog_state_t *ds)
     char buffer[160];
     size_t l = 0, N = sizeof buffer;
     ssize_t n;
-    
+
     buffer[0] = '\0';
 
     for (du = ds->ds_usage; du; du = du->du_next) {
@@ -441,9 +441,9 @@ void nua_dialog_log_usage(nua_owner_t *own, nua_dialog_state_t *ds)
        l += 2;
       }
     }
-    
+
     SU_DEBUG_3(("nua(%p): handle with %s%s%s\n", (void *)own,
-               ds->ds_has_session ? "session and " : "", 
+               ds->ds_has_session ? "session and " : "",
                ds->ds_has_events ? "events " : "",
                buffer));
   }
@@ -486,7 +486,7 @@ void nua_base_usage_update_params(nua_dialog_usage_t const *du,
 }
 
 /**@internal
- * Set refresh value suitably. 
+ * Set refresh value suitably.
  *
  * The refresh time is set either around half of the @a delta interval or,
  * if @a delta is less than 5 minutes but longer than 90 seconds, 30..60
@@ -512,7 +512,7 @@ void nua_dialog_usage_set_refresh(nua_dialog_usage_t *du, unsigned delta)
 }
 
 /**@internal Set refresh in range min..max seconds in the future. */
-void nua_dialog_usage_set_refresh_range(nua_dialog_usage_t *du, 
+void nua_dialog_usage_set_refresh_range(nua_dialog_usage_t *du,
                                        unsigned min, unsigned max)
 {
   sip_time_t now = sip_now(), target;
@@ -546,7 +546,7 @@ void nua_dialog_usage_set_refresh_at(nua_dialog_usage_t *du,
   SU_DEBUG_7(("nua(): refresh %s after %lu seconds\n",
              nua_dialog_usage_name(du), target - sip_now()));
   du->du_refresh = target;
-} 
+}
 
 /**@internal Do not refresh. */
 void nua_dialog_usage_reset_refresh(nua_dialog_usage_t *du)
@@ -560,7 +560,7 @@ void nua_dialog_usage_reset_refresh(nua_dialog_usage_t *du)
 /** @internal Refresh usage. */
 void nua_dialog_usage_refresh(nua_owner_t *owner,
                              nua_dialog_state_t *ds,
-                             nua_dialog_usage_t *du, 
+                             nua_dialog_usage_t *du,
                              sip_time_t now)
 {
   assert(du && du->du_class->usage_refresh);
index 04b75a83f1a9ffc5add4deb9486febb822ec7887..e24cbeaf4adf2eb06ab22497e532c4529152d201 100644 (file)
@@ -26,7 +26,7 @@
 /** Defined when <nua_dialog.h> has been included. */
 #define NUA_DIALOG_H
 
-/**@IFILE nua_dialog.h 
+/**@IFILE nua_dialog.h
  * @brief Dialog and dialog usage handling
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -42,7 +42,7 @@
 #endif
 
 typedef struct {
-  sip_method_t sm_method; 
+  sip_method_t sm_method;
   char const *sm_method_name;
 
   int sm_event;
@@ -80,7 +80,7 @@ struct nua_server_request {
   nua_dialog_usage_t *sr_usage;        /**< Backpointer to usage */
 
   nta_incoming_t *sr_irq;      /**< Server transaction object */
-  
+
   struct {
     msg_t *msg;                        /**< Request message */
     sip_t const *sip;          /**< Headers in request message */
@@ -133,7 +133,7 @@ struct nua_server_request {
 
 #define SR_HAS_SAVED_SIGNAL(sr) ((sr)->sr_signal[0] != NULL)
 
-su_inline 
+su_inline
 int sr_status(nua_server_request_t *sr, int status, char const *phrase)
 {
   return (void)(sr->sr_phrase = phrase), (sr->sr_status = status);
@@ -160,7 +160,7 @@ typedef struct {
                      msg_t **return_msg,
                      tagi_t const *tags);
 
-  /**@a crm_init is called when a client request is sent first time. 
+  /**@a crm_init is called when a client request is sent first time.
    *
    * @retval 1 when request has been responded
    * @retval 0 when request should be sent in normal fashion
@@ -278,9 +278,9 @@ struct nua_client_request
   uint32_t            cr_seq;
 
   unsigned            cr_refs;  /**< References to client request */
-  
+
   /* Flags used with offer-answer */
-  unsigned short      cr_answer_recv;   /**< Recv answer in response 
+  unsigned short      cr_answer_recv;   /**< Recv answer in response
                                         *  with this status.
                                         */
   unsigned cr_offer_sent:1;    /**< Sent offer in this request */
@@ -305,7 +305,7 @@ struct nua_client_request
   unsigned cr_restarting:1;    /**< Request is being restarted */
   unsigned cr_reporting:1;     /**< Reporting in progress */
   unsigned cr_terminating:1;   /**< Request terminates the usage */
-  signed int cr_terminated:2;  /**< Response terminated usage (1) or 
+  signed int cr_terminated:2;  /**< Response terminated usage (1) or
                                    whole dialog (-1) */
   unsigned cr_graceful:1;      /**< Graceful termination required */
 };
@@ -347,11 +347,11 @@ struct nua_dialog_state
   sip_to_t const *ds_remote;           /**< Remote address */
   nta_leg_t      *ds_leg;
   sip_contact_t  *ds_ltarget;          /**< Local target */
-  char const     *ds_remote_tag;       /**< Remote tag (if any). 
-                                        * Should be non-NULL 
+  char const     *ds_remote_tag;       /**< Remote tag (if any).
+                                        * Should be non-NULL
                                         * if dialog is established.
                                         */
-  
+
   struct nua_dialog_peer_info {
     sip_allow_t      *nr_allow;
     sip_accept_t     *nr_accept;
@@ -364,10 +364,10 @@ struct nua_dialog_state
 /* Virtual function pointer table for dialog usage. */
 typedef struct {
   unsigned usage_size, usage_class_size;
-  int (*usage_add)(nua_owner_t *, 
+  int (*usage_add)(nua_owner_t *,
                   nua_dialog_state_t *ds,
                   nua_dialog_usage_t *du);
-  void (*usage_remove)(nua_owner_t *, 
+  void (*usage_remove)(nua_owner_t *,
                       nua_dialog_state_t *ds,
                       nua_dialog_usage_t *du,
                       nua_client_request_t *cr,
@@ -382,7 +382,7 @@ typedef struct {
                          sip_t const *sip);
   void (*usage_refresh)(nua_owner_t *, nua_dialog_state_t *ds,
                        nua_dialog_usage_t *, sip_time_t now);
-  int (*usage_shutdown)(nua_owner_t *, nua_dialog_state_t *ds, 
+  int (*usage_shutdown)(nua_owner_t *, nua_dialog_state_t *ds,
                        nua_dialog_usage_t *);
 } nua_usage_class;
 
@@ -428,16 +428,16 @@ su_inline int nua_dialog_is_reporting(nua_dialog_state_t const *ds)
 
 char const *nua_dialog_usage_name(nua_dialog_usage_t const *du);
 
-nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *, 
+nua_dialog_usage_t *nua_dialog_usage_add(nua_owner_t *,
                                         struct nua_dialog_state *ds,
                                         nua_usage_class const *uclass,
                                         sip_event_t const *event);
 
-nua_dialog_usage_t *nua_dialog_usage_get(nua_dialog_state_t const *ds, 
+nua_dialog_usage_t *nua_dialog_usage_get(nua_dialog_state_t const *ds,
                                         nua_usage_class const *uclass,
                                         sip_event_t const *event);
 
-void nua_dialog_usage_remove(nua_owner_t *, 
+void nua_dialog_usage_remove(nua_owner_t *,
                             nua_dialog_state_t *ds,
                             nua_dialog_usage_t *du,
                             nua_client_request_t *cr,
@@ -463,17 +463,17 @@ int nua_dialog_repeat_shutdown(nua_owner_t *owner,
 
 void nua_dialog_usage_set_refresh(nua_dialog_usage_t *du, unsigned delta);
 
-void nua_dialog_usage_set_refresh_range(nua_dialog_usage_t *du, 
+void nua_dialog_usage_set_refresh_range(nua_dialog_usage_t *du,
                                        unsigned min, unsigned max);
 
-void nua_dialog_usage_set_refresh_at(nua_dialog_usage_t *du, 
+void nua_dialog_usage_set_refresh_at(nua_dialog_usage_t *du,
                                     sip_time_t target);
 
 void nua_dialog_usage_reset_refresh(nua_dialog_usage_t *du);
 
 void nua_dialog_usage_refresh(nua_owner_t *owner,
                              nua_dialog_state_t *ds,
-                             nua_dialog_usage_t *du, 
+                             nua_dialog_usage_t *du,
                              sip_time_t now);
 
 int nua_dialog_usage_shutdown(nua_owner_t *owner,
@@ -513,12 +513,12 @@ int nua_client_create(nua_owner_t *owner,
                      nua_client_methods_t const *methods,
                      tagi_t const *tags);
 
-int nua_client_tcreate(nua_owner_t *nh, 
+int nua_client_tcreate(nua_owner_t *nh,
                       int event,
                       nua_client_methods_t const *methods,
                       tag_type_t tag, tag_value_t value, ...);
 
-su_inline 
+su_inline
 void *nua_private_client_request(nua_client_request_t const *cr)
 {
   return (void *)(cr + 1);
@@ -654,14 +654,14 @@ extern nua_server_methods_t const
   nua_refer_server_methods,    /**< REFER */
   nua_publish_server_methods;  /**< PUBLISH */
 
-/** Return true if we have not sent final response to request */ 
-su_inline 
+/** Return true if we have not sent final response to request */
+su_inline
 int nua_server_request_is_pending(nua_server_request_t const *sr)
 {
   return sr && sr->sr_response.msg;
 }
 
-su_inline 
+su_inline
 int nua_server_request_status(nua_server_request_t const *sr)
 {
   return sr ? nta_incoming_status(sr->sr_irq) : 500;
@@ -694,7 +694,7 @@ int nua_base_server_respond(nua_server_request_t *sr,
 
 int nua_server_report(nua_server_request_t *sr);
 
-int nua_base_server_treport(nua_server_request_t *sr, 
+int nua_base_server_treport(nua_server_request_t *sr,
                            tag_type_t tag, tag_value_t value, ...);
 int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags);
 
index fd6c6b7f46a602917bdc2f4098eaceaf72943a59..df7faf2d0b7022b3f6edc9eca2d071acf0df8ba9 100644 (file)
@@ -54,8 +54,8 @@
 /* Event server */
 
 static
-nea_event_t *nh_notifier_event(nua_handle_t *nh, 
-                              su_home_t *home, 
+nea_event_t *nh_notifier_event(nua_handle_t *nh,
+                              su_home_t *home,
                               sip_event_t const *event,
                               tagi_t const *tags);
 
@@ -81,8 +81,8 @@ nua_stack_notifier(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *ta
 
   nua_stack_init_handle(nua, nh, tags);
 
-  tl_gets(tags, 
-         NUTAG_URL_REF(url), 
+  tl_gets(tags,
+         NUTAG_URL_REF(url),
          SIPTAG_EVENT_REF(event),
          SIPTAG_EVENT_STR_REF(event_s),
          SIPTAG_CONTENT_TYPE_STR_REF(ct_s),
@@ -93,16 +93,16 @@ nua_stack_notifier(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *ta
   if (!event && !event_s)
     status = 400, phrase = "Missing Event";
 
-  else if (!ct && !ct_s) 
+  else if (!ct && !ct_s)
     status = 400, phrase = "Missing Content-Type";
 
   else if (!nh->nh_notifier &&
-          !(nh->nh_notifier = 
+          !(nh->nh_notifier =
             nea_server_create(nua->nua_nta, nua->nua_root,
                               url->us_url,
-                              NH_PGET(nh, max_subscriptions), 
+                              NH_PGET(nh, max_subscriptions),
                               NULL, nh,
-                              TAG_NEXT(tags)))) 
+                              TAG_NEXT(tags))))
     status = 900, phrase = nua_internal_error;
 
   else if (!event && !(event = sip_event_make(home, event_s)))
@@ -117,12 +117,12 @@ nua_stack_notifier(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *ta
   else if (nea_server_notify(nh->nh_notifier, ev) < 0)
     status = 900, phrase = "Error when notifying watchers";
 
-  else 
-    nua_stack_tevent(nua, nh, NULL, e, status = SIP_200_OK, 
+  else
+    nua_stack_tevent(nua, nh, NULL, e, status = SIP_200_OK,
                     SIPTAG_EVENT(event),
                     SIPTAG_CONTENT_TYPE(ct),
                     TAG_END());
-            
+
   if (status != 200)
     nua_stack_event(nua, nh, NULL, e, status, phrase, NULL);
 
@@ -132,8 +132,8 @@ nua_stack_notifier(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *ta
 
 /* Create a event view for notifier */
 static
-nea_event_t *nh_notifier_event(nua_handle_t *nh, 
-                              su_home_t *home, 
+nea_event_t *nh_notifier_event(nua_handle_t *nh,
+                              su_home_t *home,
                               sip_event_t const *event,
                               tagi_t const *tags)
 {
@@ -150,13 +150,13 @@ nea_event_t *nh_notifier_event(nua_handle_t *nh,
     if (o_subtype)
       *o_subtype++ = '\0';
 
-    tl_gets(tags, 
+    tl_gets(tags,
            SIPTAG_ACCEPT_REF(accept),
            SIPTAG_ACCEPT_STR_REF(accept_s),
            SIPTAG_CONTENT_TYPE_REF(ct),
            SIPTAG_CONTENT_TYPE_STR_REF(ct_s),
            TAG_END());
-      
+
     /*
      * XXX - We really should build accept header when we add new content
      * types
@@ -168,7 +168,7 @@ nea_event_t *nh_notifier_event(nua_handle_t *nh,
     if (accept_s == NULL && ct_s)
       accept_s = ct_s;
 
-    ev = nea_event_create(nh->nh_notifier, 
+    ev = nea_event_create(nh->nh_notifier,
                          authorize_watcher, nh,
                          o_type, o_subtype,
                          ct ? ct->c_type : ct_s,
@@ -196,8 +196,8 @@ void authorize_watcher(nea_server_t *nes,
 
   /* OK. In nhp (nua_handle_preferences_t) structure we have the
      current default action (or state) for incoming
-     subscriptions. 
-     Action can now be modified by the application with NUTAG_SUBSTATE(). 
+     subscriptions.
+     Action can now be modified by the application with NUTAG_SUBSTATE().
   */
   irq = nea_sub_get_request(sn->sn_subscriber);
   msg = nta_incoming_getrequest(irq);
@@ -220,7 +220,7 @@ void authorize_watcher(nea_server_t *nes,
       what = "active";
     }
 
-    SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n", (void *)nh, what)); 
+    SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n", (void *)nh, what));
     nea_sub_auth(sn->sn_subscriber, substate,
                 TAG_IF(substate == nua_substate_pending,
                        NEATAG_FAKE(1)),
@@ -231,8 +231,8 @@ void authorize_watcher(nea_server_t *nes,
   else if (sn->sn_state == nea_terminated || sn->sn_expires == 0) {
     substate = nua_substate_terminated;
     nea_server_flush(nes, NULL);
-    SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n", 
-               (void *)nh, "watcher is removed")); 
+    SU_DEBUG_7(("nua(%p): authorize_watcher: %s\n",
+               (void *)nh, "watcher is removed"));
   }
 
   nua_stack_tevent(nua, nh, msg, nua_i_subscription, status, phrase,
@@ -269,7 +269,7 @@ void nua_stack_authorize(nua_t *nua,
 /** @internal Shutdown notifier object */
 int nh_notifier_shutdown(nua_handle_t *nh,
                         nea_event_t *ev,
-                        tag_type_t t, 
+                        tag_type_t t,
                         tag_value_t v, ...)
 {
   nea_server_t *nes = nh->nh_notifier;
@@ -286,17 +286,17 @@ int nh_notifier_shutdown(nua_handle_t *nh,
     ta_list ta;
 
     ta_start(ta, t, v);
-    
+
     for (i = 0; subs[i]; i++)
       nea_sub_auth(subs[i]->sn_subscriber, nea_terminated, ta_tags(ta));
-    
+
     ta_end(ta);
 
     busy++;
   }
 
   nea_server_free_subscribers(nes, subs);
-  
+
   nea_server_flush(nh->nh_notifier, NULL);
 
   if (ev == NULL)
@@ -323,7 +323,7 @@ void nua_stack_terminate(nua_t *nua,
     return;
   }
 
-  tl_gets(tags, 
+  tl_gets(tags,
          SIPTAG_EVENT_REF(event),
          SIPTAG_EVENT_STR_REF(event_s),
          SIPTAG_CONTENT_TYPE_REF(ct),
@@ -332,15 +332,15 @@ void nua_stack_terminate(nua_t *nua,
          SIPTAG_PAYLOAD_STR_REF(pl_s),
          TAG_END());
 
-  nev = nea_event_get(nh->nh_notifier, 
+  nev = nea_event_get(nh->nh_notifier,
                      event ? event->o_type : event_s);
 
   if (nev && (pl || pl_s) && (ct || ct_s)) {
     nea_server_update(nh->nh_notifier, nev, TAG_NEXT(tags));
   }
 
-  nh_notifier_shutdown(nh, NULL, 
-                      NEATAG_REASON("noresource"), 
+  nh_notifier_shutdown(nh, NULL,
+                      NEATAG_REASON("noresource"),
                       TAG_NEXT(tags));
 
   nua_stack_event(nua, nh, NULL, e, SIP_200_OK, NULL);
index c9237b6ba076aa4bc612a5304f17da7abaf8978d..f327d998e37557f1c597dd1f148fef255fd11ab9 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "nua_stack.h"
 
-/**Send a request message with an extension method. 
+/**Send a request message with an extension method.
  *
  * Send a request message with the request method specified with
  * NUTAG_METHOD().
@@ -53,7 +53,7 @@
  * @param nh              Pointer to operation handle
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * Note that it is possible to send a request with any method (except
@@ -91,9 +91,9 @@ static nua_client_methods_t const nua_method_client_methods = {
   NULL,                                /* crm_complete */
 };
 
-int 
+int
 nua_stack_method(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags)
-{ 
+{
   return nua_client_create(nh, e, &nua_method_client_methods, tags);
 }
 
@@ -109,7 +109,7 @@ nua_stack_method(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags
  * @param nh     operation handle associated with the method
  * @param hmagic application context associated with the handle
  * @param sip    response to the extension request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive method in @a phrase parameters)
  * @param tags   empty
  *
@@ -148,11 +148,11 @@ nua_stack_method(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags
  * @END_NUA_EVENT
  */
 
-nua_server_methods_t const nua_extension_server_methods = 
+nua_server_methods_t const nua_extension_server_methods =
   {
     SIP_METHOD_UNKNOWN,
     nua_i_method,              /* Event */
-    { 
+    {
       1,                       /* Do create dialog */
       0,                       /* Can be an initial request */
       1,                       /* Perhaps a target refresh request? */
index 1d6c3a22500e0c0ea3d89a62ecc4a8d1b5d4e7a0..fc9f5760b86b6d9f6e6e0fdd1f89be690ceb0c27 100644 (file)
 /**@fn void nua_message( \
  *       nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
  *
- * Send an instant message. 
+ * Send an instant message.
  *
  * Send an instant message using SIP MESSAGE method.
  *
  * @param nh              Pointer to operation handle
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * @par Related Tags:
@@ -72,7 +72,7 @@
  * @sa #nua_i_message, @RFC3428
  */
 
-static int nua_message_client_init(nua_client_request_t *cr, 
+static int nua_message_client_init(nua_client_request_t *cr,
                                   msg_t *, sip_t *,
                                   tagi_t const *tags);
 
@@ -95,16 +95,16 @@ static nua_client_methods_t const nua_message_client_methods = {
 
 };
 
-int 
+int
 nua_stack_message(nua_t *nua,
                  nua_handle_t *nh,
                  nua_event_t e,
                  tagi_t const *tags)
-{ 
+{
   return nua_client_create(nh, e, &nua_message_client_methods, tags);
 }
 
-static int nua_message_client_init(nua_client_request_t *cr, 
+static int nua_message_client_init(nua_client_request_t *cr,
                                   msg_t *msg, sip_t *sip,
                                   tagi_t const *tags)
 {
@@ -125,7 +125,7 @@ static int nua_message_client_init(nua_client_request_t *cr,
  * @param nh     operation handle associated with the message
  * @param hmagic application context associated with the handle
  * @param sip    response to MESSAGE request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   empty
  *
@@ -159,11 +159,11 @@ static int nua_message_client_init(nua_client_request_t *cr,
 int nua_message_server_init(nua_server_request_t *sr);
 int nua_message_server_params(nua_server_request_t *, tagi_t const *);
 
-nua_server_methods_t const nua_message_server_methods = 
+nua_server_methods_t const nua_message_server_methods =
   {
     SIP_METHOD_MESSAGE,
     nua_i_message,             /* Event */
-    { 
+    {
       0,                       /* Do not create dialog */
       0,                       /* Can be initial request */
       0,                       /* Perhaps a target refresh request? */
index 4a204bc8bc4a8061526c9333f803a140273ab4ad..f77cfb341b66df0042ebaee783b5ab647b9e33e6 100644 (file)
@@ -70,10 +70,10 @@ struct notifier_usage
 };
 
 static char const *nua_notify_usage_name(nua_dialog_usage_t const *du);
-static int nua_notify_usage_add(nua_handle_t *nh, 
+static int nua_notify_usage_add(nua_handle_t *nh,
                                   nua_dialog_state_t *ds,
                                   nua_dialog_usage_t *du);
-static void nua_notify_usage_remove(nua_handle_t *nh, 
+static void nua_notify_usage_remove(nua_handle_t *nh,
                                    nua_dialog_state_t *ds,
                                    nua_dialog_usage_t *du,
                                    nua_client_request_t *cr,
@@ -103,8 +103,8 @@ static char const *nua_notify_usage_name(nua_dialog_usage_t const *du)
   return "notify";
 }
 
-static 
-int nua_notify_usage_add(nua_handle_t *nh, 
+static
+int nua_notify_usage_add(nua_handle_t *nh,
                         nua_dialog_state_t *ds,
                         nua_dialog_usage_t *du)
 {
@@ -113,15 +113,15 @@ int nua_notify_usage_add(nua_handle_t *nh,
   return 0;
 }
 
-static 
-void nua_notify_usage_remove(nua_handle_t *nh, 
+static
+void nua_notify_usage_remove(nua_handle_t *nh,
                             nua_dialog_state_t *ds,
                             nua_dialog_usage_t *du,
                             nua_client_request_t *cr,
                             nua_server_request_t *sr)
 {
-  ds->ds_has_events--; 
-  ds->ds_has_notifys--;        
+  ds->ds_has_events--;
+  ds->ds_has_notifys--;
 }
 
 /* ====================================================================== */
@@ -173,14 +173,14 @@ void nua_notify_usage_remove(nua_handle_t *nh,
  * subscriber terminates the subscription, it times out or the application
  * terminates the usage with nua_notify() call containing the tag
  * NUTAG_SUBSTATE(nua_substate_terminated) or @SubscriptionState header with
- * state "terminated" and/or expiration time 0. 
+ * state "terminated" and/or expiration time 0.
  *
  * When the subscriber terminates the subscription, the application is
  * notified of an termination by a #nua_i_subscribe event with
  * NUTAG_SUBSTATE(nua_substate_terminated) tag. When the subscription times
  * out, nua automatically initiates a NOTIFY transaction. When it is
  * terminated, the application is sent a #nua_r_notify event with
- * NUTAG_SUBSTATE(nua_substate_terminated) tag. 
+ * NUTAG_SUBSTATE(nua_substate_terminated) tag.
  *
  * @sa @RFC3265, nua_notify(), NUTAG_SUBSTATE(), @SubscriptionState,
  * @Event, nua_subscribe(), #nua_r_subscribe, #nua_i_refer, nua_refer()
@@ -193,11 +193,11 @@ static int nua_subscribe_server_preprocess(nua_server_request_t *sr);
 static int nua_subscribe_server_respond(nua_server_request_t*, tagi_t const *);
 static int nua_subscribe_server_report(nua_server_request_t*, tagi_t const *);
 
-nua_server_methods_t const nua_subscribe_server_methods = 
+nua_server_methods_t const nua_subscribe_server_methods =
   {
     SIP_METHOD_SUBSCRIBE,
     nua_i_subscribe,           /* Event */
-    { 
+    {
       1,                       /* Create dialog */
       0,                       /* Initial request */
       1,                       /* Target refresh request  */
@@ -218,7 +218,7 @@ int nua_subscribe_server_init(nua_server_request_t *sr)
   sip_t const *sip = sr->sr_request.sip;
   sip_event_t *o = sip->sip_event;
   char const *event = o ? o->o_type : NULL;
-  
+
   if (sr->sr_initial || !nua_dialog_usage_get(ds, nua_notify_usage, o)) {
     if (event && str0cmp(event, "refer") == 0)
       /* refer event subscription should be initiated with REFER */
@@ -246,7 +246,7 @@ int nua_subscribe_server_preprocess(nua_server_request_t *sr)
   sip_time_t now = sip_now();
 
   assert(nh && nh->nh_nua->nua_dhandle != nh);
-  
+
   du = nua_dialog_usage_get(ds, nua_notify_usage, o);
 
   if (du == NULL) {
@@ -271,7 +271,7 @@ int nua_subscribe_server_preprocess(nua_server_request_t *sr)
     nu->nu_requested = SIP_TIME_MAX - 1;
 
 #if SU_HAVE_EXPERIMENTAL
-  nu->nu_etags = 
+  nu->nu_etags =
     sip_suppress_body_if_match(sip) ||
     sip_suppress_notify_if_match(sip) ||
     sip_has_feature(sr->sr_request.sip->sip_supported, "etags");
@@ -294,7 +294,7 @@ int nua_subscribe_server_respond(nua_server_request_t *sr, tagi_t const *tags)
   sip_t *sip = sr->sr_response.sip;
 
   if (200 <= sr->sr_status && sr->sr_status < 300) {
-    sip_expires_t ex[1]; 
+    sip_expires_t ex[1];
 
     sip_expires_init(ex);
 
@@ -304,7 +304,7 @@ int nua_subscribe_server_respond(nua_server_request_t *sr, tagi_t const *tags)
       if (nu->nu_requested) {
        if (sip->sip_expires) {
          /* Expires in response can only shorten the expiration time */
-         if (nu->nu_requested > now + sip->sip_expires->ex_delta) 
+         if (nu->nu_requested > now + sip->sip_expires->ex_delta)
            nu->nu_requested = now + sip->sip_expires->ex_delta;
        }
        else {
@@ -357,14 +357,14 @@ int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
     sip_t const *sip = sr->sr_request.sip;
     sip_suppress_notify_if_match_t *snim = sip_suppress_notify_if_match(sip);
     sip_suppress_body_if_match_t *sbim = sip_suppress_body_if_match(sip);
-    
+
     if (!nu->nu_tag)
       notify = 1;
     else if (snim && !strcasecmp(snim->snim_tag, nu->nu_tag))
       notify = 0;
     else if (sbim && !strcasecmp(snim->snim_tag, nu->nu_tag))
       notify = 1, nu->nu_no_body = 1;
-    else 
+    else
 #endif
       notify = 1;
 
@@ -375,12 +375,12 @@ int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
 
   if (retval >= 2 || du == NULL)
     return retval;
-  
+
   if (notify) {
     /* Send NOTIFY (and terminate subscription, when needed) */
     nua_dialog_usage_refresh(nh, ds, du, sip_now());
   }
-  
+
   return retval;
 }
 
@@ -399,7 +399,7 @@ int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
  *
  * @bug If the @Event is not given by application, stack uses the @Event
  * header from the first subscription usage on handle.
- * 
+ *
  * If there is no active <i>notifier dialog usage</i> or no notifier dialog
  * usage matches the @Event header given by the application the nua_notify()
  * request is rejected locally by the stack with status code 481. The local
@@ -413,7 +413,7 @@ int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
  * @param nh              Pointer to operation handle
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * @par Related Tags:
@@ -428,7 +428,7 @@ int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
  * @sa @RFC3265, #nua_i_subscribe, #nua_i_refer, NUTAG_ALLOW_EVENTS()
  */
 
-static int nua_notify_client_init(nua_client_request_t *cr, 
+static int nua_notify_client_init(nua_client_request_t *cr,
                                  msg_t *, sip_t *,
                                  tagi_t const *tags);
 static int nua_notify_client_init_etag(nua_client_request_t *cr,
@@ -480,7 +480,7 @@ static int nua_notify_client_init(nua_client_request_t *cr,
   sip_event_t const *o = sip->sip_event;
   sip_subscription_state_t *ss = sip->sip_subscription_state;
   sip_time_t now = sip_now();
-    
+
   if (o == NULL && nh->nh_ds->ds_has_notifys == 1)
     o = NONE;
 
@@ -519,7 +519,7 @@ static int nua_notify_client_init(nua_client_request_t *cr,
       /* We can change the lifetime of unsolicited subscription at will */
       if (nu->nu_requested == 0)
        nu->nu_expires = nu->nu_requested = now + expires;
-      /* Notifier can only shorten the subscribed time */ 
+      /* Notifier can only shorten the subscribed time */
       else if (nu->nu_requested >= now + expires)
        nu->nu_expires = nu->nu_requested = now + expires;
     }
@@ -617,7 +617,7 @@ static int nua_notify_client_init_etag(nua_client_request_t *cr,
 
     sip_suppress_body_if_match_t *sbim;
     sip_suppress_notify_if_match_t *snim;
-    
+
     if (cr->cr_usage->du_ready) {
       snim = sip_suppress_notify_if_match(sip);
 
@@ -643,7 +643,7 @@ int nua_notify_client_request(nua_client_request_t *cr,
                              msg_t *msg, sip_t *sip,
                              tagi_t const *tags)
 {
-  nua_dialog_usage_t *du = cr->cr_usage; 
+  nua_dialog_usage_t *du = cr->cr_usage;
   struct notifier_usage *nu = nua_dialog_usage_private(du);
   su_home_t *home = msg_home(msg);
   sip_time_t now = sip_now();
@@ -674,7 +674,7 @@ int nua_notify_client_request(nua_client_request_t *cr,
     if (nu->nu_substate == nua_substate_terminated)
       expires = nu->nu_expires > now ? "noresource" : "timeout";
 
-    ss = sip_subscription_state_format(home, "%s;%s", 
+    ss = sip_subscription_state_format(home, "%s;%s",
                                       nua_substate_name(nu->nu_substate),
                                       expires);
 
@@ -737,8 +737,8 @@ int nua_notify_client_request(nua_client_request_t *cr,
  * @param phrase a short textual description of @a status code
  * @param nh     operation handle associated with the subscription
  * @param hmagic application context associated with the handle
- * @param sip    response to @b NOTIFY request or NULL upon an error 
- *               (status code is in @a status and 
+ * @param sip    response to @b NOTIFY request or NULL upon an error
+ *               (status code is in @a status and
  *               descriptive message in @a phrase parameters)
  * @param tags   NUTAG_SUBSTATE() indicating subscription state
  *               SIPTAG_EVENT() indicating subscription event
@@ -762,7 +762,7 @@ static int nua_notify_client_report(nua_client_request_t *cr,
   if (nu && !cr->cr_terminated)
     substate = nu->nu_substate;
 
-  nua_stack_tevent(nh->nh_nua, nh, 
+  nua_stack_tevent(nh->nh_nua, nh,
                   nta_outgoing_getresponse(orq),
                   cr->cr_event,
                   status, phrase,
@@ -816,7 +816,7 @@ static void nua_notify_usage_refresh(nua_handle_t *nh,
   nua_dialog_usage_remove(nh, ds, du, NULL, NULL);
 }
 
-/** @interal Shut down NOTIFY usage. 
+/** @interal Shut down NOTIFY usage.
  *
  * @retval >0  shutdown done
  * @retval 0   shutdown in progress
@@ -836,8 +836,8 @@ static int nua_notify_usage_shutdown(nua_handle_t *nh,
       return 0;
   }
   else {
-    if (nua_client_tcreate(nh, nua_r_notify, 
-                          &nua_notify_client_methods, 
+    if (nua_client_tcreate(nh, nua_r_notify,
+                          &nua_notify_client_methods,
                           SIPTAG_EVENT(du->du_event),
                           NUTAG_SUBSTATE(nua_substate_terminated),
                           TAG_END()) >= 0)
@@ -857,11 +857,11 @@ static int nua_refer_server_preprocess(nua_server_request_t *sr);
 static int nua_refer_server_respond(nua_server_request_t*, tagi_t const *);
 static int nua_refer_server_report(nua_server_request_t*, tagi_t const *);
 
-nua_server_methods_t const nua_refer_server_methods = 
+nua_server_methods_t const nua_refer_server_methods =
   {
     SIP_METHOD_REFER,
     nua_i_refer,               /* Event */
-    { 
+    {
       1,                       /* Create dialog */
       0,                       /* Initial request */
       1,                       /* Target refresh request  */
@@ -914,7 +914,7 @@ int nua_refer_server_respond(nua_server_request_t *sr, tagi_t const *tags)
 
   if (sr->sr_status < 200 || nu == NULL) {
   }
-  else if (sr->sr_status < 300 && 
+  else if (sr->sr_status < 300 &&
           /* Application included Refer-Sub: false in response */
           (rs == NULL || str0casecmp("false", rs->rs_value))) {
     sr->sr_usage->du_ready = 1;
@@ -942,7 +942,7 @@ int nua_refer_server_respond(nua_server_request_t *sr, tagi_t const *tags)
  * REFER. The @ReferredBy structure contained in the tag is constructed from
  * the @From header if the @ReferredBy header was not present in the REFER
  * request.
- * 
+ *
  * The application can let the nua to send NOTIFYs from the call it
  * initiates with nua_invite() if it includes in the nua_invite() arguments
  * both the NUTAG_NOTIFY_REFER() with the handle with which nua_i_refer was
@@ -956,8 +956,8 @@ int nua_refer_server_respond(nua_server_request_t *sr, tagi_t const *tags)
  * @param sip    incoming REFER request
  * @param tags   NUTAG_REFER_EVENT() \n
  *               SIPTAG_REFERRED_BY()
- *  
- * @sa nua_refer(), #nua_r_refer, @ReferTo, NUTAG_REFER_EVENT(), 
+ *
+ * @sa nua_refer(), #nua_r_refer, @ReferTo, NUTAG_REFER_EVENT(),
  * SIPTAG_REFERRED_BY(), @ReferredBy, NUTAG_NOTIFY_REFER(),
  * NUTAG_REFER_WITH_ID(), @RFC3515.
  *
index 462a15f552958caa7e44c38389ccfdb972ac3e35..5c7ab9e6dcd96103febdb68f063a7be3a3d2b9cb 100644 (file)
@@ -54,7 +54,7 @@
  * @param nh              Pointer to operation handle
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * @par Related Tags:
@@ -78,7 +78,7 @@
  * @param nh     operation handle associated with the incoming OPTIONS request
  * @param hmagic application context associated with the handle
  * @param sip    response to OPTIONS request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   empty
  *
@@ -109,6 +109,6 @@ int nua_stack_options(nua_t *nua,
                      nua_handle_t *nh,
                      nua_event_t e,
                      tagi_t const *tags)
-{ 
+{
   return nua_client_create(nh, e, &nua_options_client_methods, tags);
 }
index 8460111e4376e47254865cf427a617b190975144..1869793e439f18e37e79d182913380825746d72f 100644 (file)
@@ -84,7 +84,7 @@ su_inline void nhp_or_set(nua_handle_preferences_t *a,
   a->nhp_set_.set_unsigned[1] |= b->nhp_set_.set_unsigned[1];
 }
 
-static int nhp_set_tags(su_home_t *home, 
+static int nhp_set_tags(su_home_t *home,
                        nua_handle_preferences_t *nhp,
                        nua_global_preferences_t *ngp,
                        tagi_t const *tags);
@@ -127,7 +127,7 @@ static char const nua_allow_str[] =
 "MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE";
 
 /** @internal Set default parameters */
-int nua_stack_set_defaults(nua_handle_t *nh, 
+int nua_stack_set_defaults(nua_handle_t *nh,
                           nua_handle_preferences_t *nhp)
 {
   su_home_t *home = (su_home_t *)nh;
@@ -222,7 +222,7 @@ int nua_stack_set_from(nua_t *nua, int initial, tagi_t const *tags)
     sip_contact_t const *m;
 
     m = nua_stack_get_contact(nua->nua_registrations);
-    
+
     if (m) {
       f0->a_display = m->m_display;
       *f0->a_url = *m->m_url;
@@ -233,7 +233,7 @@ int nua_stack_set_from(nua_t *nua, int initial, tagi_t const *tags)
 
   if (!f)
     return -1;
-  
+
   nua->nua_from_is_set = set;
   *nua->nua_from = *f;
   return 0;
@@ -269,7 +269,7 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  *
  * @par Related tags:
  *   NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR() \n
- *   NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and 
+ *   NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and
  *                         SIPTAG_ALLOW_EVENTS_STR() \n
  *   NUTAG_AUTOACK() \n
  *   NUTAG_AUTOALERT() \n
@@ -323,7 +323,7 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  *
  * nua_set_params() also accepts any soa tags, defined in
  * <sofia-sip/soa_tag.h>, and nta tags, defined in <sofia-sip/nta_tag.h>.
- * 
+ *
  * @par Events:
  *     #nua_r_set_params
  *
@@ -335,7 +335,7 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  * @par
  * When multiple tags for the same header are specified, the behaviour
  * depends on the header type. If only a single header field can be included
- * in a SIP message, the latest non-NULL value is used, e.g., @Organization. 
+ * in a SIP message, the latest non-NULL value is used, e.g., @Organization.
  * However, if the SIP header can consist of multiple lines or header fields
  * separated by comma, in this case, @Allow and @Supported, all the tagged
  * values are concatenated.
@@ -390,7 +390,7 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  *
  * @par Tags Used to Set Handle-Specific Parameters:
  *   NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR() \n
- *   NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and 
+ *   NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and
  *                         SIPTAG_ALLOW_EVENTS_STR() \n
  *   NUTAG_AUTH_CACHE() \n
  *   NUTAG_AUTOACK() \n
@@ -437,9 +437,9 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  * Any soa tags are also considered as handle-specific parameters. They are
  * defined in <sofia-sip/soa_tag.h>.
  *
- * The global parameters that can not be set by nua_set_hparams() include 
+ * The global parameters that can not be set by nua_set_hparams() include
  * NUTAG_DETECT_NETWORK_UPDATES(), NUTAG_SMIME_* tags, and all NTA tags.
- * 
+ *
  * @par Events:
  *     #nua_r_set_params
  */
@@ -453,12 +453,12 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  * @param nh     NULL when responding to nua_set_params(),
  *               operation handle when responding to nua_set_hparams()
  * @param hmagic NULL when responding to nua_set_params(),
- *               application contact associated with the operation handle 
+ *               application contact associated with the operation handle
  *               when responding to nua_set_hparams()
  * @param sip    NULL
  * @param tags   None
  *
- * @sa nua_set_params(), nua_set_hparams(), 
+ * @sa nua_set_params(), nua_set_hparams(),
  * #nua_r_get_params, nua_get_params(), nua_get_hparams()
  *
  * @END_NUA_EVENT
@@ -468,7 +468,7 @@ int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
                         tagi_t const *tags)
 {
   nua_handle_t *dnh = nua->nua_dhandle;
-  
+
   int status;
   char const *phrase;
 
@@ -486,8 +486,8 @@ int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
     *tmp = *nhp; NHP_UNSET_ALL(tmp);
 
     /*
-     * Supported features, allowed methods and events are merged 
-     * with previous or default settings. 
+     * Supported features, allowed methods and events are merged
+     * with previous or default settings.
      *
      * Here we just copy pointers from default settings. However when saving
      * settings we have to be extra careful so that we
@@ -495,20 +495,20 @@ int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
      * 2) do not free pointer if the setting has been modified
      * See NHP_ZAP_OVERRIDEN() below for gorier details.
      */
-    if (!NHP_ISSET(nhp, supported)) 
+    if (!NHP_ISSET(nhp, supported))
       tmp->nhp_supported = dnhp->nhp_supported;
-    if (!NHP_ISSET(nhp, allow)) 
+    if (!NHP_ISSET(nhp, allow))
       tmp->nhp_allow = dnhp->nhp_allow;
-    if (!NHP_ISSET(nhp, allow_events)) 
+    if (!NHP_ISSET(nhp, allow_events))
       tmp->nhp_allow_events = dnhp->nhp_allow_events;
-    if (!NHP_ISSET(nhp, appl_method)) 
+    if (!NHP_ISSET(nhp, appl_method))
       tmp->nhp_appl_method = dnhp->nhp_appl_method;
-    
+
     if (nh == dnh) /* nua_set_params() call, save stack-wide params, too */
       ngp = gtmp, *gtmp = *nua->nua_prefs;
 
     /* Set and save parameters to tmp */
-    if (!nh->nh_used_ptags && 
+    if (!nh->nh_used_ptags &&
        nhp_set_tags(tmphome, tmp, NULL, nh->nh_ptags) < 0)
       status = 900, phrase = "Error storing default handle parameters";
     else if (nhp_set_tags(tmphome, tmp, ngp, tags) < 0)
@@ -531,9 +531,9 @@ int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
 
       if (dnh->nh_soa)
        nh->nh_soa = soa_clone(dnh->nh_soa, nua->nua_root, nh);
-      else  
+      else
        nh->nh_soa = soa_create(soa_name, nua->nua_root, nh);
-      
+
       if (!nh->nh_soa)
        status = 900, phrase = "Error Creating SOA Object";
       else if (soa_set_params(nh->nh_soa, TAG_NEXT(nh->nh_ptags)) < 0)
@@ -544,8 +544,8 @@ int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
       soa_destroy(nh->nh_soa), nh->nh_soa = NULL;
     }
 
-    if (status == 200 && tags && nh->nh_soa && 
-       soa_set_params(nh->nh_soa, TAG_NEXT(tags)) < 0) 
+    if (status == 200 && tags && nh->nh_soa &&
+       soa_set_params(nh->nh_soa, TAG_NEXT(tags)) < 0)
       status = 900, phrase = "Error Setting SOA Parameters";
   }
 
@@ -598,7 +598,7 @@ int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
  * @param ngp  structure to store global preferences
  * @param tags list of tags to parse
  */
-static int nhp_set_tags(su_home_t *home, 
+static int nhp_set_tags(su_home_t *home,
                        nua_handle_preferences_t *nhp,
                        nua_global_preferences_t *ngp,
                        tagi_t const *tags)
@@ -828,12 +828,12 @@ static int nhp_set_tags(su_home_t *home,
     /* SIPTAG_SUPPORTED_STR(supported_str) */
     /* SIPTAG_SUPPORTED(supported) */
     else if (tag == nutag_supported ||
-            tag == siptag_supported || 
+            tag == siptag_supported ||
             tag == siptag_supported_str) {
       int ok;
       sip_supported_t *supported = NULL;
 
-      ok = nhp_merge_lists(home, 
+      ok = nhp_merge_lists(home,
                           sip_supported_class, &supported, nhp->nhp_supported,
                           NHP_ISSET(nhp, supported), /* already set by tags */
                           tag == siptag_supported, /* dup it, don't make */
@@ -853,7 +853,7 @@ static int nhp_set_tags(su_home_t *home,
       int ok;
       msg_list_t *allow = NULL;
 
-      ok = nhp_merge_lists(home, 
+      ok = nhp_merge_lists(home,
                           sip_allow_class,
                           &allow,
                           (msg_list_t const *)nhp->nhp_allow,
@@ -875,9 +875,9 @@ static int nhp_set_tags(su_home_t *home,
       int ok;
       sip_allow_events_t *allow_events = NULL;
 
-      ok = nhp_merge_lists(home, 
+      ok = nhp_merge_lists(home,
                           sip_allow_events_class,
-                          &allow_events, 
+                          &allow_events,
                           nhp->nhp_allow_events,
                           NHP_ISSET(nhp, allow_events), /* already set */
                           tag == siptag_allow_events, /* dup it, don't make */
@@ -902,7 +902,7 @@ static int nhp_set_tags(su_home_t *home,
                             &appl_method,
                             (msg_list_t const *)nhp->nhp_appl_method,
                             /* already set by tags? */
-                            NHP_ISSET(nhp, appl_method), 
+                            NHP_ISSET(nhp, appl_method),
                             0, /* dup it, don't make */
                             1, /* merge with old value */
                             t->t_value);
@@ -1036,7 +1036,7 @@ static int nhp_merge_lists(su_home_t *home,
     return 0;
   }
 
-  if (already_parsed) 
+  if (already_parsed)
     elems = (void *)msg_header_dup_as(home, hc, (msg_header_t *)value);
   else
     elems = (void *)msg_header_make(home, hc, (char const *)value);
@@ -1065,8 +1065,8 @@ static int nhp_merge_lists(su_home_t *home,
   if (msg_params_join(home, (msg_param_t **)&list->k_items, elems->k_items,
                      2 /* prune */, 0 /* don't dup */) < 0)
     return -1;
-  
-  *return_new_list = 
+
+  *return_new_list =
     (msg_list_t *)msg_header_dup_as(home, hc, (msg_header_t *)list);
   if (!*return_new_list)
     return -1;
@@ -1083,9 +1083,9 @@ static int nhp_merge_lists(su_home_t *home,
  * @retval 0 - no changes in parameters
  * @retval -1 - an error
  */
-static 
+static
 int nhp_save_params(nua_handle_t *nh,
-                   su_home_t *tmphome, 
+                   su_home_t *tmphome,
                    nua_global_preferences_t *gsrc,
                    nua_handle_preferences_t *src)
 {
@@ -1112,12 +1112,12 @@ int nhp_save_params(nua_handle_t *nh,
 
   /* Move allocations from tmphome to home */
   su_home_move(nh->nh_home, tmphome);
-  
+
   /* Copy parameters that are set from src to dst */
   nhp_or_set(dst, src);
 
   /* Handle pointer items. Free changed ones and zap unset ones. */
-  /* Note that pointer items where !NHP_ISSET(old, pref) are not freed 
+  /* Note that pointer items where !NHP_ISSET(old, pref) are not freed
      (because they were just on loan from the default preference set) */
 #define NHP_ZAP_OVERRIDEN(old, dst, free, pref)                                \
   (((NHP_ISSET(old, pref) &&                                           \
@@ -1142,7 +1142,7 @@ int nhp_save_params(nua_handle_t *nh,
   NHP_ZAP_OVERRIDEN(old, dst, msg_header_free, initial_route);
 
   nh->nh_prefs = dst;
-  
+
   return memcmp(dst, old, sizeof *dst) != 0;
 }
 
@@ -1239,17 +1239,17 @@ int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags)
   else if (to_str)
     p_to = sip_to_make(tmphome, to_str);
   else if (url)
-    p_to = sip_to_create(tmphome, url), 
+    p_to = sip_to_create(tmphome, url),
       p_to ? sip_aor_strip((url_t*)p_to->a_url) : 0;
   else
     p_to = SIP_NONE;
-  
+
   if (p_to == NULL || p_from == NULL) {
     su_home_deinit(tmphome);
     return -1;
   }
 
-  nh->nh_tags = 
+  nh->nh_tags =
     tl_filtered_tlist(nh->nh_home, tagfilter,
                      TAG_IF(p_from != SIP_NONE, SIPTAG_FROM(p_from)),
                      TAG_IF(p_from != SIP_NONE, TAG_FILTER(nua_handle_tags_filter)),
@@ -1257,7 +1257,7 @@ int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags)
                      TAG_IF(p_to != SIP_NONE, TAG_FILTER(nua_handle_tags_filter)),
                      TAG_NEXT(tags));
 
-  nh->nh_ptags = 
+  nh->nh_ptags =
     tl_filtered_tlist(nh->nh_home, paramfilter, TAG_NEXT(tags));
 
   error = nh->nh_tags == NULL || nh->nh_ptags == NULL;
@@ -1270,7 +1270,7 @@ int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags)
 
   if (nh->nh_ptags && nh->nh_ptags->t_tag == NULL)
     su_free(nh->nh_home, nh->nh_ptags), nh->nh_ptags = NULL;
-    
+
   if (identity)
     nh->nh_identity = nua_handle_ref(identity);
 
@@ -1287,12 +1287,12 @@ static int nua_handle_param_filter(tagi_t const *f, tagi_t const *t)
   if (!t || !t->t_tag)
     return 0;
 
-  if (t->t_tag == nutag_url || 
+  if (t->t_tag == nutag_url ||
       t->t_tag == nutag_sips_url ||
       t->t_tag == nutag_identity)
     return 0;
 
-  ns = t->t_tag->tt_ns; 
+  ns = t->t_tag->tt_ns;
   if (!ns)
     return 0;
 
@@ -1311,12 +1311,12 @@ static int nua_handle_tags_filter(tagi_t const *f, tagi_t const *t)
 
   if (tag == tag_filter)
     return 0;
-  
+
   /* Accept @From or @To only when they are followed by
      TAG_FILTER(nua_handle_tags_filter) */
   if (tag == siptag_from || tag == siptag_to) {
     t = tl_next(t);
-    return t && t->t_tag == tag_filter && 
+    return t && t->t_tag == tag_filter &&
       t->t_value == (tag_value_t)nua_handle_tags_filter;
   }
 
@@ -1371,7 +1371,7 @@ int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags)
     return n;
 
   /* XXX - all other S/MIME parameters? */
-  return sm_set_params(nua->sm, smime_enable, smime_opt, 
+  return sm_set_params(nua->sm, smime_enable, smime_opt,
                       smime_protection_mode, smime_path);
 #endif
 
@@ -1404,7 +1404,7 @@ int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags)
  */
 
 /**@fn void nua_get_hparams(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
- * 
+ *
  * Get values of handle-specific parameters in #nua_r_get_params event.
  *
  * Application will specify either expilicit list of tags it is interested
@@ -1443,7 +1443,7 @@ int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags)
  * @param nh     NULL when responding to nua_get_params(),
  *               operation handle when responding to nua_get_hparams()
  * @param hmagic NULL when responding to nua_get_params(),
- *               application contact associated with the operation handle 
+ *               application contact associated with the operation handle
  *               when responding to nua_get_hparams()
  * @param sip    NULL
  * @param tags
@@ -1588,7 +1588,7 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
   TAG_IF(nhp->nhp_set.nhb_##pref, TAG(nhp->nhp_##pref))
 
   /* Include tag in the list returned to user
-   * if it has been earlier set (by user) 
+   * if it has been earlier set (by user)
    * but always include in the default parameters */
 #define TIFD(TAG, pref) \
   TAG_IF(nh == dnh || nhp->nhp_set.nhb_##pref, TAG(nhp->nhp_##pref))
index f12b2cdf4c73710ba5b7d874a01b3ccd14767dea..924fa7c730a98b2afd8c2eb1cbb53ee30732b048 100644 (file)
@@ -168,7 +168,7 @@ void nua_publish_usage_remove(nua_handle_t *nh,
  * @param nh     operation handle associated with the publication
  * @param hmagic application context associated with the handle
  * @param sip    response to PUBLISH request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   empty
  *
@@ -206,8 +206,8 @@ void nua_unpublish(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
  *
  * @par Events:
  *    #nua_r_unpublish
- * 
- * @sa #nua_r_unpublish, @RFC3903, @SIPIfMatch, 
+ *
+ * @sa #nua_r_unpublish, @RFC3903, @SIPIfMatch,
  * #nua_i_publish, nua_publish(), #nua_r_publish
  */
 
@@ -223,7 +223,7 @@ void nua_unpublish(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
  * @param nh     operation handle associated with the publication
  * @param hmagic application context associated with the handle
  * @param sip    response to PUBLISH request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   empty
  *
@@ -369,7 +369,7 @@ static int nua_publish_client_check_restart(nua_client_request_t *cr,
     ;
   else if (status == 412)
     restarting = phrase;
-  else if (200 <= status && status < 300 && 
+  else if (200 <= status && status < 300 &&
           sip->sip_expires && sip->sip_expires->ex_delta == 0)
     restarting = "Immediate re-PUBLISH";
 
@@ -473,7 +473,7 @@ static int nua_publish_usage_shutdown(nua_handle_t *nh,
  *
  * In order to receive #nua_i_publish events, the application must enable
  * both the PUBLISH method with NUTAG_ALLOW() tag and the acceptable SIP
- * events with nua_set_params() tag NUTAG_ALLOW_EVENTS(). 
+ * events with nua_set_params() tag NUTAG_ALLOW_EVENTS().
  *
  * The nua_response() call responding to a PUBLISH request must have
  * NUTAG_WITH() (or NUTAG_WITH_THIS()/NUTAG_WITH_SAVED()) tag. Note that
@@ -495,8 +495,8 @@ static int nua_publish_usage_shutdown(nua_handle_t *nh,
  * @param tags   empty
  *
  * @sa @RFC3903, nua_respond(),
- * @Expires, @SIPETag, @SIPIfMatch, @Event, 
- * nua_subscribe(), #nua_i_subscribe, 
+ * @Expires, @SIPETag, @SIPIfMatch, @Event,
+ * nua_subscribe(), #nua_i_subscribe,
  * nua_notifier(), #nua_i_subscription,
  *
  * @since First used in @VERSION_1_12_4
@@ -506,11 +506,11 @@ static int nua_publish_usage_shutdown(nua_handle_t *nh,
 
 int nua_publish_server_init(nua_server_request_t *sr);
 
-nua_server_methods_t const nua_publish_server_methods = 
+nua_server_methods_t const nua_publish_server_methods =
   {
     SIP_METHOD_PUBLISH,
     nua_i_publish,             /* Event */
-    { 
+    {
       0,                       /* Do not create dialog */
       0,                       /* Initial request */
       0,                       /* Not a target refresh request  */
@@ -528,7 +528,7 @@ int nua_publish_server_init(nua_server_request_t *sr)
   sip_allow_events_t *allow_events = NH_PGET(sr->sr_owner, allow_events);
   sip_event_t *o = sr->sr_request.sip->sip_event;
   char const *event = o ? o->o_type : NULL;
-  
+
   if (!allow_events)
     return SR_STATUS1(sr, SIP_501_NOT_IMPLEMENTED);
   else if (!event || !msg_header_find_param(allow_events->k_common, event))
index 47d7d8c0588a66948d747e99a2ff0d985bcb710a..c38ac1ffdf711044aa28156f9d8a340439734415 100644 (file)
@@ -76,7 +76,7 @@
 /* Registrations and contacts */
 
 int nua_registration_from_via(nua_registration_t **list,
-                             nua_handle_t *nh, 
+                             nua_handle_t *nh,
                              sip_via_t const *via,
                              int public);
 
@@ -150,7 +150,7 @@ struct register_usage {
   unsigned nr_by_stack:1;
 
   unsigned:0;
-  
+
   int nr_error_report_id;      /**< ID used to ask for error reports from tport */
 
   sip_route_t *nr_route;       /**< Outgoing Service-Route */
@@ -285,8 +285,8 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
   };
 
 /**@fn void nua_register(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
- * 
- * Send SIP REGISTER request to the registrar. 
+ *
+ * Send SIP REGISTER request to the registrar.
  *
  * Request status will be delivered to the application using #nua_r_register
  * event. When successful the registration will be updated periodically.
@@ -306,7 +306,7 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  *
  * @par Events:
  *     #nua_r_register, #nua_i_outbound
- * 
+ *
  * @par Generating Contact Header
  *
  * If the application did not specify the Contact header in the tags,
@@ -314,10 +314,10 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  * for the host and port number for the Contact URI from the transport
  * socket. The diplay name is taken from NUTAG_M_DISPLAY(), URL username
  * part is taken from NUTAG_M_USERNAME(), URI parameters from
- * NUTAG_M_PARAMS(), and Contact header parameters from NUTAG_M_FEATURES(). 
+ * NUTAG_M_PARAMS(), and Contact header parameters from NUTAG_M_FEATURES().
  * If NUTAG_CALLEE_CAPS(1) is specified, additional Contact header
  * parameters are generated based on SDP capabilities and SIP @Allow header.
- * 
+ *
  * Note that @b nua may append a identifier of its own to the @Contact URI
  * username. Such nua-generated identifier trailer always starts with "="
  * (equal sign), rest of the nua-generated identifier may contain any
@@ -349,7 +349,7 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  * by NUTAG_M_USERNAME() and the non-transport parameters of the request URI
  * set by NUTAG_M_PARAMS() when determining to which registration the
  * incoming request belongs.
- * 
+ *
  * For example, a request line correspoding to the @Contact in above example
  * may look like:
  * @code
@@ -363,17 +363,17 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  *
  * Normally, @b nua will start start a protocol engine for outbound
  * connections used for NAT and firewall traversal and connectivity checks
- * when registering. 
+ * when registering.
  *
  * @note If the application provides @b nua with a
  * @Contact header of its own (or includes a SIPTAG_CONTACT(NULL) tag in
  * nua_register() tags), the outbound protocol engine is not started. It is
  * assumed that the application knows better what it is doing when it sets
- * the @Contact, or it is using experimental CPL upload as specified in 
+ * the @Contact, or it is using experimental CPL upload as specified in
  * <a href="http://www.ietf.org/internet-drafts/draft-lennox-sip-reg-payload-01.txt">
  * draft-lennox-sip-reg-payload-01.txt</a>.
  *
- * First, outbound engine will probe for NATs in between UA and registrar. 
+ * First, outbound engine will probe for NATs in between UA and registrar.
  * It will send a REGISTER request as usual. Upon receiving the response it
  * checks for the presence of "received" and "rport" parameters in the Via
  * header returned by registrar. The presence of NAT is determined from the
@@ -416,14 +416,14 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  *
  * You can disable this kind of NAT traversal by setting "no-natify" into
  * NUTAG_OUTBOUND() options string.
- * 
+ *
  * @par GRUU and Service-Route
  *
  * After a successful response to the REGISTER request has been received,
  * nua_register() will update the information about the registration based
  * on it. If there is a "gruu" parameter included in the response,
  * nua_register() will save it and use the gruu URI in the Contact header
- * fields of dialog-establishing messages, such as INVITE or SUBSCRIBE. 
+ * fields of dialog-establishing messages, such as INVITE or SUBSCRIBE.
  * Also, if the registrar has included a Service-Route header in the
  * response, and the service route feature has not been disabled using
  * NUTAG_SERVICE_ROUTE_ENABLE(), the route URIs from the Service-Route
@@ -444,8 +444,8 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  * You can disable validation by inserting "no-validate" into
  * NUTAG_OUTBOUND() string.
  *
- * The keepalive mechanism depends on the network features detected earlier. 
- * If @a outbound extension is used, the STUN keepalives will be used. 
+ * The keepalive mechanism depends on the network features detected earlier.
+ * If @a outbound extension is used, the STUN keepalives will be used.
  * Otherwise, NUA stack will repeatedly send OPTIONS requests to itself. In
  * order to save bandwidth, it will include Max-Forwards: 0 in the
  * keep-alive requests, however. The keepalive interval is determined by
@@ -462,18 +462,18 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  *
  * As alternative to OPTIONS/STUN keepalives, the client can propose
  * a more frequent registration refresh interval with
- * NUTAG_M_FEATURES() (e.g. NUTAG_M_FEATURES("expires=120") given as 
+ * NUTAG_M_FEATURES() (e.g. NUTAG_M_FEATURES("expires=120") given as
  * parameter to nua_register()).
- * 
- * @sa #nua_r_register, nua_unregister(), #nua_r_unregister, 
+ *
+ * @sa #nua_r_register, nua_unregister(), #nua_r_unregister,
  * #nua_i_register,
  * @RFC3261 section 10,
  * @Expires, @Contact, @CallID, @CSeq,
  * @Path, @RFC3327, @ServiceRoute, @RFC3608, @RFC3680,
  *     NUTAG_REGISTRAR(), NUTAG_INSTANCE(), NUTAG_OUTBOUND(),
- *     NUTAG_KEEPALIVE(), NUTAG_KEEPALIVE_STREAM(), 
+ *     NUTAG_KEEPALIVE(), NUTAG_KEEPALIVE_STREAM(),
  *     SIPTAG_CONTACT(), SIPTAG_CONTACT_STR(), NUTAG_M_USERNAME(),
- *     NUTAG_M_DISPLAY(), NUTAG_M_PARAMS(), NUTAG_M_FEATURES(), 
+ *     NUTAG_M_DISPLAY(), NUTAG_M_PARAMS(), NUTAG_M_FEATURES(),
  */
 
 /** @NUA_EVENT nua_r_register
@@ -481,8 +481,8 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  * Response to an outgoing REGISTER.
  *
  * The REGISTER may be sent explicitly by nua_register() or implicitly by
- * NUA state machines. 
- * 
+ * NUA state machines.
+ *
  * When REGISTER request has been restarted the @a status may be 100 even
  * while the real response status returned is different.
  *
@@ -494,23 +494,23 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  * @param nh     operation handle associated with the registration
  * @param hmagic application context associated with the registration
  * @param sip    response message to REGISTER request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   empty
  *
  * @sa nua_register(), nua_unregister(), #nua_r_unregister,
  * @Contact, @CallID, @CSeq, @RFC3261 section 10,
  * @Path, @RFC3327, @ServiceRoute, @RFC3608, @RFC3680
- * 
+ *
  * @END_NUA_EVENT
  */
 
 /**@fn void nua_unregister(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
- * Unregister. 
+ * Unregister.
  *
- * Send a REGISTER request with expiration time 0. This removes the 
- * registration from the registrar. If the handle was earlier used 
- * with nua_register() the periodic updates will be terminated. 
+ * Send a REGISTER request with expiration time 0. This removes the
+ * registration from the registrar. If the handle was earlier used
+ * with nua_register() the periodic updates will be terminated.
  *
  * If a SIPTAG_CONTACT_STR() with argument "*" is used, all the
  * registrations will be removed from the registrar otherwise only the
@@ -534,9 +534,9 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  * @Expires, @Contact, @CallID, @CSeq, @RFC3261 section 10,
  * @Path, @RFC3327, @ServiceRoute, @RFC3608, @RFC3680,
  *     NUTAG_REGISTRAR(), NUTAG_INSTANCE(), NUTAG_OUTBOUND(),
- *     NUTAG_KEEPALIVE(), NUTAG_KEEPALIVE_STREAM(), 
+ *     NUTAG_KEEPALIVE(), NUTAG_KEEPALIVE_STREAM(),
  *     SIPTAG_CONTACT(), SIPTAG_CONTACT_STR(), NUTAG_M_USERNAME(),
- *     NUTAG_M_DISPLAY(), NUTAG_M_PARAMS(), NUTAG_M_FEATURES(), 
+ *     NUTAG_M_DISPLAY(), NUTAG_M_PARAMS(), NUTAG_M_FEATURES(),
  */
 
 /** @NUA_EVENT nua_r_unregister
@@ -551,14 +551,14 @@ outbound_owner_vtable nua_stack_outbound_callbacks = {
  * @param nh     operation handle associated with the registration
  * @param hmagic application context associated with the registration
  * @param sip    response message to REGISTER request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   empty
  *
  * @sa nua_unregister(), nua_register(), #nua_r_register,
  * @Contact, @CallID, @CSeq, @RFC3261 section 10,
  * @Path, @RFC3327, @ServiceRoute, @RFC3608, @RFC3680
- * 
+ *
  * @END_NUA_EVENT
  */
 
@@ -692,7 +692,7 @@ static int nua_register_client_init(nua_client_request_t *cr,
       for (m = sip->sip_contact; m; m = m->m_next)
        if (!m->m_expires || strtoul(m->m_expires, NULL, 10) != 0)
          break;
-      
+
       if (m == NULL)
        unreg = 1;      /* All contacts have expires=0 */
     }
@@ -754,7 +754,7 @@ int nua_register_client_request(nua_client_request_t *cr,
       outbound_get_contacts(nr->nr_ob, &m, &previous);
 
       sip_add_dup(msg, sip, (sip_header_t *)m);
-      /* previous is an outdated contact generated by stack 
+      /* previous is an outdated contact generated by stack
        * and it is now unregistered */
       if (previous)
        sip_add_dup(msg, sip, (sip_header_t *)previous);
@@ -780,10 +780,10 @@ int nua_register_client_request(nua_client_request_t *cr,
       /* Remove the expire parameters from contacts */
       msg_header_remove_param(m->m_common, "expires");
     }
-    else if (nr && nr->nr_min_expires && 
+    else if (nr && nr->nr_min_expires &&
             strtoul(m->m_expires, 0, 10) < nr->nr_min_expires) {
-      if (min_expires == NULL) 
-       min_expires = su_sprintf(msg_home(msg), "expires=%lu", 
+      if (min_expires == NULL)
+       min_expires = su_sprintf(msg_home(msg), "expires=%lu",
                                 nr->nr_min_expires);
       msg_header_replace_param(msg_home(msg), m->m_common, min_expires);
     }
@@ -815,7 +815,7 @@ static int nua_register_client_check_restart(nua_client_request_t *cr,
                                       req, sip);
 
     restart = retry >= ob_reregister_now;
-    
+
     if (retry == ob_reregister)
       /* outbound restarts REGISTER later */;
 
@@ -835,7 +835,7 @@ static int nua_register_client_check_restart(nua_client_request_t *cr,
   /* Restart only if nua_base_client_check_restart() did not try to restart */
   if (restart && retry_count == cr->cr_retry_count)
     return nua_client_restart(cr, 100, "Outbound NAT Detected");
-  
+
   return 0;
 }
 
@@ -874,7 +874,7 @@ static int nua_register_client_response(nua_client_request_t *cr,
     }
 #endif
 
-    /* XXX - if store/remove, remove 
+    /* XXX - if store/remove, remove
        Content-Disposition
        Content-Type
        body
@@ -886,7 +886,7 @@ static int nua_register_client_response(nua_client_request_t *cr,
     reqdelta = req->sip_expires ? req->sip_expires->ex_delta : 0;
 
     for (m = sip->sip_contact; m; m = m->m_next) {
-      if (m->m_url->url_type != url_sip && 
+      if (m->m_url->url_type != url_sip &&
          m->m_url->url_type != url_sips)
        continue;
 
@@ -901,7 +901,7 @@ static int nua_register_client_response(nua_client_request_t *cr,
 
        if (mdelta == 0)
          mdelta = 3600;
-         
+
        delta = sip_contact_expires(m, sip->sip_expires, sip->sip_date,
                                    mdelta, now);
        if (delta > 0 && delta < mindelta)
@@ -975,7 +975,7 @@ static int nua_register_client_response(nua_client_request_t *cr,
 
       if (tport_is_secondary(tport)) {
        tport_set_params(tport, TPTAG_SDWN_ERROR(1), TAG_END());
-       nr->nr_error_report_id = 
+       nr->nr_error_report_id =
          tport_pend(tport, NULL, nua_register_connection_closed, nr);
       }
     }
@@ -1033,7 +1033,7 @@ void nua_register_connection_closed(tp_stack_t *sip_stack,
 
   tpn = tport_name(nr->nr_tport);
 
-  SU_DEBUG_5(("nua_register(%p): tport to %s/%s:%s%s%s closed %s\n", 
+  SU_DEBUG_5(("nua_register(%p): tport to %s/%s:%s%s%s closed %s\n",
              du->du_dialog->ds_owner,
              tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port,
              tpn->tpn_comp ? ";comp=" : "",
@@ -1162,13 +1162,13 @@ nua_stack_init_transport(nua_t *nua, tagi_t const *tags)
     contact1 = contact2, contact2 = NULL;
 
   if (contact1 &&
-      (url_is_string(contact1) 
+      (url_is_string(contact1)
        ? strncasecmp(contact1->us_str, "sips:", 5) == 0
        : contact1->us_url->url_type == url_sips))
     name1 = "sips";
 
-  if (contact2 && 
-      (url_is_string(contact2) 
+  if (contact2 &&
+      (url_is_string(contact2)
        ? strncasecmp(contact2->us_str, "sips:", 5) == 0
        : contact2->us_url->url_type == url_sips))
     name2 = "sips";
@@ -1205,7 +1205,7 @@ nua_stack_init_transport(nua_t *nua, tagi_t const *tags)
        nta_agent_add_tport(nua->nua_nta, contact2,
                            TPTAG_IDENT(name2),
                            TPTAG_CERTIFICATE(certificate_dir),
-                           TAG_NEXT(nua->nua_args)) < 0) 
+                           TAG_NEXT(nua->nua_args)) < 0)
       return -1;
   }
 
@@ -1238,7 +1238,7 @@ void nua_network_changed_cb(nua_t *nua, su_root_t *root)
   case NUA_NW_DETECT_ONLY_INFO:
     nua_stack_event(nua, NULL, NULL, nua_i_network_changed, SIP_200_OK, NULL);
     break;
-    
+
   case NUA_NW_DETECT_TRY_FULL:
 
     /* 1) Shutdown all tports */
@@ -1254,7 +1254,7 @@ void nua_network_changed_cb(nua_t *nua, su_root_t *root)
                      SIP_200_OK, NULL);
 
     break;
-    
+
   default:
     break;
   }
@@ -1270,7 +1270,7 @@ int nua_stack_launch_network_change_detector(nua_t *nua)
                                    nua->nua_api_root,
                                    nua_network_changed_cb,
                                    nua);
-  
+
   if (!snc)
     return -1;
 
@@ -1394,13 +1394,13 @@ int nua_registration_from_via(nua_registration_t **list,
     }
 
     /* if more than one candidate, ignore local entries */
-    if (v && (*vv || nr_items > 0) && 
+    if (v && (*vv || nr_items > 0) &&
        host_is_local(v->v_host)) {
-      SU_DEBUG_9(("nua_register: ignoring contact candidate %s:%s.\n", 
+      SU_DEBUG_9(("nua_register: ignoring contact candidate %s:%s.\n",
                  v->v_host, v->v_port ? v->v_port : ""));
       continue;
     }
-     
+
     nr = su_zalloc(home, sizeof *nr);
     if (!nr)
       break;
@@ -1494,7 +1494,7 @@ nua_registration_t *nua_registration_by_aor(nua_registration_t const *list,
        continue;
       if (nr->nr_ip6 && ip4)
        continue;
-      if (sips_uri ? nr->nr_secure : !nr->nr_secure) 
+      if (sips_uri ? nr->nr_secure : !nr->nr_secure)
        return (nua_registration_t *)nr;
       if (!registered && nr->nr_aor)
        registered = nr;
@@ -1528,7 +1528,7 @@ nua_registration_t *nua_registration_by_aor(nua_registration_t const *list,
        namewise = nr;
     }
 
-    if (!sipswise && ((sips_aor || sips_uri) ? 
+    if (!sipswise && ((sips_aor || sips_uri) ?
                      nr->nr_secure : !nr->nr_secure))
       sipswise = nr;
     if (!registered)
@@ -1545,8 +1545,8 @@ nua_registration_t *nua_registration_by_aor(nua_registration_t const *list,
     return (nua_registration_t *)sipswise;
   if (registered)
     return (nua_registration_t *)registered;
-    
-  /* XXX - 
+
+  /* XXX -
      should we do some policing whether sips_aor or sips_uri can be used
      with sip contact?
   */
@@ -1572,7 +1572,7 @@ nua_registration_for_request(nua_registration_t const *list, sip_t const *sip)
 }
 
 nua_registration_t *
-nua_registration_for_response(nua_registration_t const *list, 
+nua_registration_for_response(nua_registration_t const *list,
                              sip_t const *sip,
                              sip_record_route_t const *record_route,
                              sip_contact_t const *remote_contact)
@@ -1583,7 +1583,7 @@ nua_registration_for_response(nua_registration_t const *list,
 
   if (sip)
     aor = sip->sip_to;
-  
+
   if (record_route)
     uri = record_route->r_url;
   else if (sip && sip->sip_record_route)
@@ -1647,8 +1647,8 @@ int nua_registration_add_contact_to_request(nua_handle_t *nh,
   if (nr == NULL)
     nr = nua_registration_for_request(nh->nh_nua->nua_registrations, sip);
 
-  return nua_registration_add_contact_and_route(nh, nr, msg, sip, 
-                                               add_contact, 
+  return nua_registration_add_contact_and_route(nh, nr, msg, sip,
+                                               add_contact,
                                                add_service_route);
 }
 
@@ -1678,13 +1678,13 @@ int nua_registration_add_contact_to_response(nua_handle_t *nh,
     nr = nua_registration_for_response(nh->nh_nua->nua_registrations, sip,
                                       record_route, remote_contact);
 
-  return nua_registration_add_contact_and_route(nh, nr, msg, sip, 
+  return nua_registration_add_contact_and_route(nh, nr, msg, sip,
                                                1,
                                                0);
 }
 
 /** Add a Contact (and Route) header to request */
-static 
+static
 int nua_registration_add_contact_and_route(nua_handle_t *nh,
                                           nua_registration_t *nr,
                                           msg_t *msg,
@@ -1825,7 +1825,7 @@ int nua_registration_set_contact(nua_handle_t *nh,
     return -1;
 
   uri = nr->nr_aor ? nr->nr_aor->a_url : NULL;
-    
+
   previous = nr->nr_contact;
 
   if (application_contact) {
@@ -1836,7 +1836,7 @@ int nua_registration_set_contact(nua_handle_t *nh,
   }
   else {
     nua_registration_t *nr0;
-    
+
     nr0 = nua_registration_by_aor(*nr->nr_list, NULL, uri, 1);
 
     if (nr0 && nr0->nr_via) {
@@ -1920,12 +1920,12 @@ static int nua_stack_outbound_refresh(nua_handle_t *nh,
  * @param phrase a short textual description of @a status code
  * @param nh     operation handle associated with the outbound engine
  * @param hmagic application context associated with the handle
- * @param sip    NULL or response message to an keepalive message or 
+ * @param sip    NULL or response message to an keepalive message or
  *               registration probe
  *               (error code and message are in status an phrase parameters)
  * @param tags   empty
  *
- * @sa NUTAG_OUTBOUND(), NUTAG_KEEPALIVE(), NUTAG_KEEPALIVE_STREAM(), 
+ * @sa NUTAG_OUTBOUND(), NUTAG_KEEPALIVE(), NUTAG_KEEPALIVE_STREAM(),
  * nua_register(), #nua_r_register, nua_unregister(), #nua_r_unregister
  *
  * @END_NUA_EVENT
@@ -1967,7 +1967,7 @@ static int nua_stack_outbound_failed(nua_handle_t *nh, outbound_t *ob,
 }
 
 /** @internal Callback for obtaining credentials for keepalive */
-static int nua_stack_outbound_credentials(nua_handle_t *nh, 
+static int nua_stack_outbound_credentials(nua_handle_t *nh,
                                          auth_client_t **auc)
 {
   return auc_copy_credentials(auc, nh->nh_auth);
@@ -2080,12 +2080,12 @@ sip_contact_t *nua_handle_contact_by_via(nua_handle_t *nh,
     su_strlst_append(l, s[0] == ';' ? "" : ";");
     su_strlst_append(l, s);
   }
-  
+
   va_end(va);
 
   if (!in_dialog) {
     s = NH_PGET(nh, m_features);
-    if (s) 
+    if (s)
       s[0] == ';' ? "" : su_strlst_append(l, ";"), su_strlst_append(l, s);
 
     if (NH_PGET(nh, callee_caps)) {
@@ -2106,7 +2106,7 @@ sip_contact_t *nua_handle_contact_by_via(nua_handle_t *nh,
 
       if (nh->nh_soa) {
        char **media = soa_media_features(nh->nh_soa, 0, home);
-       
+
        while (*media) {
          if (su_strlst_len(l))
            su_strlst_append(l, ";");
@@ -2117,8 +2117,8 @@ sip_contact_t *nua_handle_contact_by_via(nua_handle_t *nh,
   }
 
   m = sip_contact_make(home, su_strlst_join(l, su_strlst_home(l), ""));
-  
+
   su_strlst_destroy(l);
-  
+
   return m;
 }
index ece57673ed3ae265b84fd0cf2eaf27ac209afa0c..3a38ae0f725c7995a8c46a89c757f8f633dd7abd 100644 (file)
  * @END_NUA_EVENT
  */
 
-nua_server_methods_t const nua_register_server_methods = 
+nua_server_methods_t const nua_register_server_methods =
   {
     SIP_METHOD_REGISTER,
     nua_i_register,            /* Event */
-    { 
+    {
       0,                       /* Do not create dialog */
       0,                       /* Initial request */
       0,                       /* Not a target refresh request  */
index 4a21249ae50babde3cd51033d066fdab1bd5caa1..ccf9a8f4e8a73a6a5427519e244df04a1f5ca9eb 100644 (file)
@@ -92,7 +92,7 @@
 typedef struct nua_ee_data {
   nua_t *ee_nua;
   nua_event_data_t ee_data[1];
-} nua_ee_data_t;               
+} nua_ee_data_t;
 
 /** @internal Linked stack frames from nua event callback */
 struct nua_event_frame_s {
@@ -170,7 +170,7 @@ int nua_stack_init(su_root_t *root, nua_t *nua)
   dnh->nh_prefs = (void *)(dnh + 1);
   dnh->nh_valid = nua_valid_handle_cookie;
   dnh->nh_nua = nua;
-  nua_handle_ref(dnh); dnh->nh_ref_by_stack = 1; 
+  nua_handle_ref(dnh); dnh->nh_ref_by_stack = 1;
   nua_handle_ref(dnh); dnh->nh_ref_by_user = 1;
   nh_append(nua, dnh);
   dnh->nh_identity = dnh;
@@ -201,7 +201,7 @@ int nua_stack_init(su_root_t *root, nua_t *nua)
                                       TAG_END());
 
   if (nua->nua_nta == NULL ||
-      dnh->nh_ds->ds_leg == NULL || 
+      dnh->nh_ds->ds_leg == NULL ||
       nta_agent_set_params(nua->nua_nta, NTATAG_UA(1), TAG_END()) < 0 ||
       nua_stack_init_transport(nua, nua->nua_args) < 0) {
     SU_DEBUG_1(("nua: initializing SIP stack failed\n"));
@@ -295,7 +295,7 @@ int nua_stack_event(nua_t *nua, nua_handle_t *nh, msg_t *msg,
   if ((event > nua_r_authenticate && event <= nua_r_ack)
       || event < nua_i_error
       || (nh && !nh->nh_valid)
-      || (nua->nua_shutdown && event != nua_r_shutdown && 
+      || (nua->nua_shutdown && event != nua_r_shutdown &&
          !nua->nua_prefs->ngp_shutdown_events)) {
     if (msg)
       msg_destroy(msg);
@@ -380,7 +380,7 @@ void nua_application_event(nua_t *dummy, su_msg_r sumsg, nua_ee_data_t *ee)
     if (!nh->nh_ref_by_user) {
       /* Application must now call nua_handle_destroy() */
       nh->nh_ref_by_user = 1;
-      nua_handle_ref(nh);      
+      nua_handle_ref(nh);
     }
   }
   else if (!nh->nh_valid) {    /* Handle has been destroyed */
@@ -398,7 +398,7 @@ void nua_application_event(nua_t *dummy, su_msg_r sumsg, nua_ee_data_t *ee)
 
   if (nua->nua_callback) {
     nua_event_frame_t frame[1];
-    
+
     su_msg_save(frame->nf_saved, sumsg);
     frame->nf_next = nua->nua_current, nua->nua_current = frame;
 
@@ -429,9 +429,9 @@ msg_t *nua_current_request(nua_t const *nua)
   return NULL;
 }
 
-/** Get request message from saved nua event. @NEW_1_12_4. 
+/** Get request message from saved nua event. @NEW_1_12_4.
  *
- * @sa nua_save_event(), nua_respond(), NUTAG_WITH_SAVED(), 
+ * @sa nua_save_event(), nua_respond(), NUTAG_WITH_SAVED(),
  */
 msg_t *nua_saved_event_request(nua_saved_event_t const *saved)
 {
@@ -514,7 +514,7 @@ int nua_signal(nua_t *nua, nua_handle_t *nh, msg_t *msg,
     e->e_phrase = phrase;
 
     su_msg_deinitializer(sumsg, nua_event_deinit);
-      
+
     retval = su_msg_send_to(sumsg, nua->nua_server, nua_stack_signal);
 
     if (retval == 0){
@@ -649,7 +649,7 @@ void nua_stack_signal(nua_t *nua, su_msg_r msg, nua_ee_data_t *ee)
   case nua_r_respond:
     nua_stack_respond(nua, nh, e->e_status, e->e_phrase, tags);
     break;
-  case nua_r_destroy: 
+  case nua_r_destroy:
     nua_stack_destroy_handle(nua, nh, tags);
     su_msg_destroy(nua->nua_signal);
     return;
@@ -1102,7 +1102,7 @@ int nua_stack_set_handle_special(nua_handle_t *nh,
   return 0;
 }
 
-sip_replaces_t *nua_stack_handle_make_replaces(nua_handle_t *nh, 
+sip_replaces_t *nua_stack_handle_make_replaces(nua_handle_t *nh,
                                               su_home_t *home,
                                               int early_only)
 {
@@ -1184,7 +1184,7 @@ int can_redirect(sip_contact_t const *m, sip_method_t method)
 /** @NUA_EVENT nua_r_authenticate
  *
  * Response to nua_authenticate(). Under normal operation, this event is
- * never sent but rather the unauthenticated operation is completed. 
+ * never sent but rather the unauthenticated operation is completed.
  * However, if there is no operation to authentication or if there is an
  * authentication error the #nua_r_authenticate event is sent to the
  * application with the status code as follows:
@@ -1195,16 +1195,16 @@ int can_redirect(sip_contact_t const *m, sip_method_t method)
  *   There was internal problem updating authenticator.
  * - <i>904 No matching challenge</i>:\n
  *   There was no challenge matching with the credentials provided by
- *   nua_authenticate(), e.g., their realm did not match with the one 
+ *   nua_authenticate(), e.g., their realm did not match with the one
  *   received with the challenge.
- * 
- * @param status status code from authentication 
+ *
+ * @param status status code from authentication
  * @param phrase a short textual description of @a status code
  * @param nh     operation handle authenticated
  * @param hmagic application context associated with the handle
  * @param sip    NULL
  * @param tags   empty
- * 
+ *
  * @sa nua_terminate(), nua_handle_destroy()
  *
  * @END_NUA_EVENT
@@ -1223,14 +1223,14 @@ nua_stack_authenticate(nua_t *nua, nua_handle_t *nh, nua_event_t e,
       nua_client_restart_request(cr, cr->cr_terminating, tags);
     }
     else {
-      nua_stack_event(nua, nh, NULL, e, 
+      nua_stack_event(nua, nh, NULL, e,
                      202, "No operation to restart",
                      NULL);
     }
   }
   else if (cr && cr->cr_wait_for_cred) {
     cr->cr_waiting = cr->cr_wait_for_cred = 0;
-    
+
     if (status < 0)
       nua_client_response(cr, 900, "Operation cannot add credentials", NULL);
     else
@@ -1349,7 +1349,7 @@ int nua_stack_process_request(nua_handle_t *nh,
   }
   else if (initial && sip->sip_to->a_tag) {
     /* RFC 3261 section 12.2.2:
-       
+
        If the UAS wishes to reject the request because it does not wish to
        recreate the dialog, it MUST respond to the request with a 481
        (Call/Transaction Does Not Exist) status code and pass that to the
@@ -1465,7 +1465,7 @@ int nua_stack_process_request(nua_handle_t *nh,
     return 0;
 
   return 501;
-}               
+}
 
 #undef nua_base_server_init
 #undef nua_base_server_preprocess
@@ -1506,7 +1506,7 @@ void nua_server_request_destroy(nua_server_request_t *sr)
 }
 
 /**@fn void nua_respond(nua_handle_t *nh, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...);
- * 
+ *
  * Respond to a request with given status code and phrase.
  *
  * The stack returns a SIP response message with given status code and
@@ -1526,7 +1526,7 @@ void nua_server_request_destroy(nua_server_request_t *sr)
  * @param phrase          free text (default response phrase is used if NULL)
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * @par Responses by Protocol Engine
@@ -1642,7 +1642,7 @@ int nua_server_params(nua_server_request_t *sr, tagi_t const *tags)
 
 #undef nua_base_server_params
 
-int nua_base_server_params(nua_server_request_t *sr, tagi_t const *tags) 
+int nua_base_server_params(nua_server_request_t *sr, tagi_t const *tags)
 {
   return 0;
 }
@@ -1714,7 +1714,7 @@ int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
           sip_add_dup(msg, sip, (sip_header_t *)NH_PGET(nh, supported)) < 0)
     ;
   else if (!sip->sip_user_agent && NH_PGET(nh, user_agent) &&
-          sip_add_make(msg, sip, sip_user_agent_class, 
+          sip_add_make(msg, sip, sip_user_agent_class,
                        NH_PGET(nh, user_agent)) < 0)
     ;
   else if (!sip->sip_organization && NH_PGET(nh, organization) &&
@@ -1724,10 +1724,10 @@ int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
   else if (!sip->sip_allow && NH_PGET(nh, allow) &&
           sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow)) < 0)
     ;
-  else if (!sip->sip_allow_events && 
+  else if (!sip->sip_allow_events &&
           NH_PGET(nh, allow_events) &&
           (method == sip_method_publish || method == sip_method_subscribe ||
-           method == sip_method_options || method == sip_method_refer || 
+           method == sip_method_options || method == sip_method_refer ||
            (sr->sr_initial &&
             (method == sip_method_invite ||
              method == sip_method_notify))) &&
@@ -1735,8 +1735,8 @@ int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
     ;
   else if (!sip->sip_contact && sr->sr_status < 300 && sr->sr_add_contact &&
           (user_contact = 0,
-           ds->ds_ltarget 
-           ? sip_add_dup(msg, sip, (sip_header_t *)ds->ds_ltarget) 
+           ds->ds_ltarget
+           ? sip_add_dup(msg, sip, (sip_header_t *)ds->ds_ltarget)
            : nua_registration_add_contact_to_response(nh, msg, sip, NULL, m))
           < 0)
     ;
@@ -1748,7 +1748,7 @@ int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
 
     sr->sr_terminating = (term < 0) ? -1 : (term > 0 || sr->sr_terminating);
 
-    if (sr->sr_target_refresh && sr->sr_status < 300 && !sr->sr_terminating && 
+    if (sr->sr_target_refresh && sr->sr_status < 300 && !sr->sr_terminating &&
        user_contact && sip->sip_contact) {
       /* Save Contact given by application */
       ltarget = sip_contact_dup(nh->nh_home, sip->sip_contact);
@@ -1756,7 +1756,7 @@ int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
 
     retval = sr->sr_methods->sm_respond(sr, next_tags);
 
-    if (sr->sr_status < 200) 
+    if (sr->sr_status < 200)
       sr->sr_response.msg = next.msg, sr->sr_response.sip = next.sip;
     else if (next.msg)
       msg_destroy(next.msg);
@@ -1767,9 +1767,9 @@ int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
       if (sr->sr_status < 300) {
        nua_dialog_state_t *ds = nh->nh_ds;
        msg_header_free(nh->nh_home, (msg_header_t *)ds->ds_ltarget);
-       ds->ds_ltarget = ltarget;       
+       ds->ds_ltarget = ltarget;
       }
-      else 
+      else
        msg_header_free(nh->nh_home, (msg_header_t *)ltarget);
     }
 
@@ -1807,7 +1807,7 @@ int nua_base_server_respond(nua_server_request_t *sr, tagi_t const *tags)
                      (msg_header_t *)sip->sip_status);
     nta_incoming_complete_response(sr->sr_irq, response,
                                   sr->sr_status,
-                                  sr->sr_phrase,    
+                                  sr->sr_phrase,
                                   TAG_END());
   }
 
@@ -1927,17 +1927,17 @@ int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags)
  * exception is the client requests bound to a dialog usage: they are saved
  * and re-used when the dialog usage is refreshed (and sometimes when the
  * usage is terminated).
- * 
+ *
  * The client request is subclassed and its behaviour modified using virtual
  * function table in #nua_client_methods_t.
- * 
+ *
  * The first three methods (crm_template(), crm_init(), crm_send()) are
  * called when the request is sent first time.
- * 
+ *
  * The crm_template() is called if a template request message is needed (for
  * example, in case of unregister, unsubscribe and unpublish, the template
  * message is taken from the request establishing the usage).
- * 
+ *
  * The crm_init() is called when the template message and dialog leg has
  * been created and populated by the tags procided by the application. Its
  * parameters msg and sip are pointer to the template request message that
@@ -1966,7 +1966,7 @@ int nua_base_server_report(nua_server_request_t *sr, tagi_t const *tags)
  *
  * @par Terminating Dialog Usages and Dialogs
  *
- * The response is marked as terminating with nua_client_set_terminating(). 
+ * The response is marked as terminating with nua_client_set_terminating().
  * When a terminating request completes the dialog usage is removed and the
  * dialog is destroyed (unless there is an another active usage).
  */
@@ -1985,7 +1985,7 @@ static void nua_client_restart_after(su_root_magic_t *magic,
  * @retval > 0 if error event has been sent
  * @retval < 0 upon an error
  */
-int nua_client_create(nua_handle_t *nh, 
+int nua_client_create(nua_handle_t *nh,
                      int event,
                      nua_client_methods_t const *methods,
                      tagi_t const * const tags)
@@ -2004,7 +2004,7 @@ int nua_client_create(nua_handle_t *nh,
 
   cr = su_zalloc(home, sizeof *cr + methods->crm_extra);
   if (!cr) {
-    return nua_stack_event(nh->nh_nua, nh, 
+    return nua_stack_event(nh->nh_nua, nh,
                           NULL,
                           event,
                           NUA_ERROR_AT(__FILE__, __LINE__),
@@ -2052,7 +2052,7 @@ int nua_client_create(nua_handle_t *nh,
   return nua_client_init_request(cr);
 }
 
-int nua_client_tcreate(nua_handle_t *nh, 
+int nua_client_tcreate(nua_handle_t *nh,
                       int event,
                       nua_client_methods_t const *methods,
                       tag_type_t tag, tag_value_t value, ...)
@@ -2203,7 +2203,7 @@ static void
 nua_client_request_destroy(nua_client_request_t *cr)
 {
   nua_handle_t *nh;
-  
+
   if (cr == NULL)
     return;
 
@@ -2237,7 +2237,7 @@ nua_client_request_destroy(nua_client_request_t *cr)
   nua_handle_unref(nh);
 }
 
-/** Bind client request to a dialog usage */ 
+/** Bind client request to a dialog usage */
 int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du)
 {
   assert(cr);
@@ -2301,7 +2301,7 @@ int nua_client_init_request0(nua_client_request_t *cr)
   tagi_t const *t;
   int has_contact = 0;
   int error = 0;
-  
+
   if (!cr->cr_method_name)
     return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), NULL);
 
@@ -2382,7 +2382,7 @@ int nua_client_init_request0(nua_client_request_t *cr)
 
   if (cr->cr_method == sip_method_register && url == NULL)
     url = (url_string_t const *)NH_PGET(nh, registrar);
-  
+
   if ((t = cr->cr_tags)) {
     if (sip_add_tagis(msg, sip, &t) < 0)
       return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
@@ -2403,11 +2403,11 @@ int nua_client_init_request0(nua_client_request_t *cr)
    */
 
   if (!ds->ds_leg) {
-    if (ds->ds_remote_tag && ds->ds_remote_tag[0] && 
+    if (ds->ds_remote_tag && ds->ds_remote_tag[0] &&
        sip_to_tag(nh->nh_home, sip->sip_to, ds->ds_remote_tag) < 0)
       return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
 
-    if (sip->sip_from == NULL && 
+    if (sip->sip_from == NULL &&
        sip_add_dup(msg, sip, (sip_header_t *)nua->nua_from) < 0)
       return nua_client_return(cr, NUA_ERROR_AT(__FILE__, __LINE__), msg);
 
@@ -2475,7 +2475,7 @@ msg_t *nua_client_request_template(nua_client_request_t *cr)
   if (nh->nh_tags) {
     tagi_t const *t = nh->nh_tags;
 
-    /* Use the From header from the dialog. 
+    /* Use the From header from the dialog.
        If From is set, it is always first tag in the handle */
     if (ds->ds_leg && t->t_tag == siptag_from)
       t++;
@@ -2619,8 +2619,8 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
     if (initial_route) {
       initial_route = sip_route_dup(msg_home(msg), initial_route);
       if (!initial_route) return -1;
-      msg_header_prepend(msg, (msg_pub_t*)sip, 
-                        /* This should be 
+      msg_header_prepend(msg, (msg_pub_t*)sip,
+                        /* This should be
                            (msg_header_t **)&sip->sip_route
                          * but directly casting pointer &sip->sip_route gives
                          * spurious type-punning warning */
@@ -2629,14 +2629,14 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
     }
   }
 
-  
+
   /**
    * For in-dialog requests, the request URI is taken from the @Contact
-   * header received from the remote party during dialog establishment, 
+   * header received from the remote party during dialog establishment,
    * and the NUTAG_URL() is ignored.
    *
    * Also, the @CallID and @CSeq headers and @From and @To tags are
-   * generated based on the dialog information and added to the request. 
+   * generated based on the dialog information and added to the request.
    * If the dialog has a route, it is added to the request, too.
    */
   if (nta_msg_request_complete(msg, leg, method, name, url) < 0)
@@ -2659,15 +2659,15 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
    */
   if (!sip->sip_allow)
     sip_add_dup(msg, sip, (sip_header_t*)NH_PGET(nh, allow));
-  
+
   if (!sip->sip_supported && NH_PGET(nh, supported))
     sip_add_dup(msg, sip, (sip_header_t *)NH_PGET(nh, supported));
-  
+
   if (method == sip_method_register && NH_PGET(nh, path_enable) &&
       !sip_has_feature(sip->sip_supported, "path") &&
       !sip_has_feature(sip->sip_require, "path"))
     sip_add_make(msg, sip, sip_supported_class, "path");
-  
+
   if (!sip->sip_organization && NH_PGET(nh, organization))
     sip_add_make(msg, sip, sip_organization_class, NH_PGET(nh, organization));
 
@@ -2704,7 +2704,7 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
   if (cr->cr_method != sip_method_register) {
     if (cr->cr_contactize && cr->cr_has_contact) {
       sip_contact_t *ltarget = sip_contact_dup(nh->nh_home, sip->sip_contact);
-      if (ds->ds_ltarget) 
+      if (ds->ds_ltarget)
        msg_header_free(nh->nh_home, (msg_header_t *)ds->ds_ltarget);
       ds->ds_ltarget = ltarget;
     }
@@ -2728,7 +2728,7 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip)
   return nua_base_client_request(cr, msg, sip, NULL);
 }
 
-/**Add tags to request message and send it, 
+/**Add tags to request message and send it,
  *
  * @retval 0 success
  * @retval -1 if error occurred, but event has not been sent
@@ -2764,7 +2764,7 @@ int nua_base_client_request(nua_client_request_t *cr, msg_t *msg, sip_t *sip,
   url_string_t * proxy = NH_PGET(nh, proxy);
 
   if (nh->nh_auth) {
-    if (cr->cr_challenged || 
+    if (cr->cr_challenged ||
        NH_PGET(nh, auth_cache) == nua_auth_cache_dialog) {
       if (auc_authorize(&nh->nh_auth, msg, sip) < 0)
        return nua_client_return(cr, 900, "Cannot add credentials", msg);
@@ -2895,7 +2895,7 @@ int nua_client_response(nua_client_request_t *cr,
       terminated = 0, graceful = 1;
 
     if (terminated < 0)
-      cr->cr_terminated = terminated;      
+      cr->cr_terminated = terminated;
     else if (cr->cr_terminating || terminated)
       cr->cr_terminated = 1;
     else if (graceful)
@@ -2908,7 +2908,7 @@ int nua_client_response(nua_client_request_t *cr,
     else
       nua_base_client_response(cr, status, phrase, sip, NULL);
     cr->cr_phrase = NULL;
-  }  
+  }
   else {
     if (cr->cr_methods->crm_recv)
       retval = cr->cr_methods->crm_recv(cr, status, phrase, sip);
@@ -2951,7 +2951,7 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
                                  char const *phrase,
                                  sip_t const *sip)
 {
-  nua_handle_t *nh = cr->cr_owner; 
+  nua_handle_t *nh = cr->cr_owner;
   nta_outgoing_t *orq;
 
   if (status == 302 || status == 305) {
@@ -2983,7 +2983,7 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
 
   if (status == 423) {
     unsigned my_expires = 0;
-    
+
     if (cr->cr_sip->sip_expires)
       my_expires = cr->cr_sip->sip_expires->ex_delta;
 
@@ -3024,7 +3024,7 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
        SU_DEBUG_7(("nua(%p): bad credentials, clearing them\n", (void *)nh));
        auc_clear_credentials(&nh->nh_auth, NULL, NULL);
       }
-      else if (auc_has_authorization(&nh->nh_auth)) 
+      else if (auc_has_authorization(&nh->nh_auth))
        return nua_client_restart(cr, 100, "Request Authorized by Cache");
 
       orq = cr->cr_orq, cr->cr_orq = NULL;
@@ -3039,8 +3039,8 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
     }
   }
 
-  if (500 <= status && status < 600 && 
-      sip->sip_retry_after && 
+  if (500 <= status && status < 600 &&
+      sip->sip_retry_after &&
       sip->sip_retry_after->af_delta < 32) {
     su_timer_t *timer;
     char phrase[18];           /* Retry After XXXX\0 */
@@ -3055,7 +3055,7 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
 
     cr->cr_timer = timer;      /* This takes over reference from orq */
 
-    snprintf(phrase, sizeof phrase, "Retry After %u", 
+    snprintf(phrase, sizeof phrase, "Retry After %u",
             (unsigned)sip->sip_retry_after->af_delta);
 
     orq = cr->cr_orq, cr->cr_orq = NULL;
@@ -3073,7 +3073,7 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
 static
 void nua_client_restart_after(su_root_magic_t *magic,
                              su_timer_t *timer,
-                             nua_client_request_t *cr) 
+                             nua_client_request_t *cr)
 {
   cr->cr_waiting = 0;
   su_timer_destroy(cr->cr_timer), cr->cr_timer = NULL;
@@ -3165,7 +3165,7 @@ int nua_client_set_target(nua_client_request_t *cr, url_t const *target)
 /**@internal
  * Relay response event to the application.
  *
- * @todo 
+ * @todo
  * If handle has already been marked as destroyed by nua_handle_destroy(),
  * release the handle with nh_destroy().
  *
@@ -3194,7 +3194,7 @@ int nua_base_client_tresponse(nua_client_request_t *cr,
 /**@internal
  * Relay response event to the application.
  *
- * @todo 
+ * @todo
  * If handle has already been marked as destroyed by nua_handle_destroy(),
  * release the handle with nh_destroy().
  *
@@ -3220,7 +3220,7 @@ int nua_base_client_response(nua_client_request_t *cr,
       auc_info(&nh->nh_auth,
               sip->sip_authentication_info,
               sip_authorization_class);
-    if (sip->sip_proxy_authentication_info) 
+    if (sip->sip_proxy_authentication_info)
       auc_info(&nh->nh_auth,
               sip->sip_proxy_authentication_info,
               sip_proxy_authorization_class);
@@ -3288,8 +3288,8 @@ int nua_client_report(nua_client_request_t *cr,
     return cr->cr_methods->crm_report(cr, status, phrase, sip, orq, tags);
 
   nh = cr->cr_owner;
-  
-  nua_stack_event(nh->nh_nua, nh, 
+
+  nua_stack_event(nh->nh_nua, nh,
                  nta_outgoing_getresponse(orq),
                  cr->cr_event,
                  status, phrase,
@@ -3316,8 +3316,8 @@ int nua_client_next_request(nua_client_request_t *cr, int invite)
   for (; cr; cr = cr->cr_next) {
     if (cr->cr_method == sip_method_cancel)
       continue;
-    
-    if (invite 
+
+    if (invite
        ? cr->cr_method == sip_method_invite
        : cr->cr_method != sip_method_invite)
       break;
index 81a01636095392a201053ca3ac9bbf1d1134bf36..e83a38b1b4cacaa27a2d209ed0e185f92bb6014e 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef NUA_STACK_H
 /** Defined when <nua_stack.h> has been included. */
 #define NUA_STACK_H
-/**@IFILE nua_stack.h 
+/**@IFILE nua_stack.h
  * @brief Sofia-SIP User Agent Engine - internal stack interface
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -103,10 +103,10 @@ typedef struct register_usage nua_registration_t;
   TAG_IF((include) && (soa) && soa_is_remote_chat_active(soa) >= 0,    \
         SOATAG_ACTIVE_CHAT(soa_is_remote_chat_active(soa)))
 
-/** @internal @brief NUA handle. 
+/** @internal @brief NUA handle.
  *
  */
-struct nua_handle_s 
+struct nua_handle_s
 {
   su_home_t       nh_home[1];  /**< Memory home  */
   nua_handle_t   *nh_next;
@@ -205,7 +205,7 @@ struct nua_s {
 
   unsigned             nua_from_is_set;
   unsigned :0;
-  
+
   /**< Local SIP address. Contents are kept around for ever. */
   sip_from_t           nua_from[1];
 
@@ -261,12 +261,12 @@ int _nua_handle_unref_by(
 #endif
 
 su_inline nua_t *nua_stack_ref(nua_t *nua)
-{ 
+{
   return (nua_t *)su_home_ref(nua->nua_home);
 }
 
 su_inline void nua_stack_unref(nua_t *nua)
-{ 
+{
   su_home_unref(nua->nua_home);
 }
 
@@ -289,25 +289,25 @@ int nua_registration_process_request(nua_registration_t *nr,
                                     nta_incoming_t *irq,
                                     sip_t const *sip);
 
-void nua_stack_post_signal(nua_handle_t *nh, nua_event_t event, 
+void nua_stack_post_signal(nua_handle_t *nh, nua_event_t event,
                           tag_type_t tag, tag_value_t value, ...);
 
-typedef int nua_stack_signal_handler(nua_t *, 
-                                    nua_handle_t *, 
-                                    nua_event_t, 
+typedef int nua_stack_signal_handler(nua_t *,
+                                    nua_handle_t *,
+                                    nua_event_t,
                                     tagi_t const *);
 
 void nua_move_signal(nua_saved_signal_t a[1], nua_saved_signal_t b[1]);
 nua_signal_data_t const *nua_signal_data(nua_saved_signal_t const saved[1]);
 void nua_destroy_signal(nua_saved_signal_t saved[1]);
 
-nua_stack_signal_handler 
+nua_stack_signal_handler
   nua_stack_set_params, nua_stack_get_params,
-  nua_stack_register, 
-  nua_stack_invite, nua_stack_ack, nua_stack_cancel, 
+  nua_stack_register,
+  nua_stack_invite, nua_stack_ack, nua_stack_cancel,
   nua_stack_bye, nua_stack_info, nua_stack_update,
   nua_stack_prack,
-  nua_stack_options, nua_stack_publish, nua_stack_message, 
+  nua_stack_options, nua_stack_publish, nua_stack_message,
   nua_stack_subscribe, nua_stack_notify, nua_stack_refer,
   nua_stack_method;
 
@@ -358,7 +358,7 @@ void nh_destroy(nua_t *nua, nua_handle_t *nh);
 
 nua_handle_t *nh_validate(nua_t *nua, nua_handle_t *maybe);
 
-sip_replaces_t *nua_stack_handle_make_replaces(nua_handle_t *handle, 
+sip_replaces_t *nua_stack_handle_make_replaces(nua_handle_t *handle,
                                               su_home_t *home,
                                               int early_only);
 
@@ -386,7 +386,7 @@ int nua_stack_launch_network_change_detector(nua_t *nua);
 sip_contact_t const *nua_stack_get_contact(nua_registration_t const *nr);
 
 int nua_registration_add_contact_to_request(nua_handle_t *nh,
-                                           msg_t *msg, 
+                                           msg_t *msg,
                                            sip_t *sip,
                                            int add_contact,
                                            int add_service_route);
index 13de556851319fdeb0d2f668810513f080b6ce2e..6be3f8670b6b002711964cae79a9b08d55090cbc 100644 (file)
@@ -69,10 +69,10 @@ struct event_usage
 };
 
 static char const *nua_subscribe_usage_name(nua_dialog_usage_t const *du);
-static int nua_subscribe_usage_add(nua_handle_t *nh, 
+static int nua_subscribe_usage_add(nua_handle_t *nh,
                                   nua_dialog_state_t *ds,
                                   nua_dialog_usage_t *du);
-static void nua_subscribe_usage_remove(nua_handle_t *nh, 
+static void nua_subscribe_usage_remove(nua_handle_t *nh,
                                       nua_dialog_state_t *ds,
                                       nua_dialog_usage_t *du,
                                       nua_client_request_t *cr,
@@ -102,8 +102,8 @@ static char const *nua_subscribe_usage_name(nua_dialog_usage_t const *du)
   return "subscribe";
 }
 
-static 
-int nua_subscribe_usage_add(nua_handle_t *nh, 
+static
+int nua_subscribe_usage_add(nua_handle_t *nh,
                           nua_dialog_state_t *ds,
                           nua_dialog_usage_t *du)
 {
@@ -113,15 +113,15 @@ int nua_subscribe_usage_add(nua_handle_t *nh,
   return 0;
 }
 
-static 
-void nua_subscribe_usage_remove(nua_handle_t *nh, 
+static
+void nua_subscribe_usage_remove(nua_handle_t *nh,
                               nua_dialog_state_t *ds,
                               nua_dialog_usage_t *du,
                                nua_client_request_t *cr,
                                nua_server_request_t *sr)
 {
-  ds->ds_has_events--; 
-  ds->ds_has_subscribes--;     
+  ds->ds_has_events--;
+  ds->ds_has_subscribes--;
 }
 
 /* ====================================================================== */
@@ -129,17 +129,17 @@ void nua_subscribe_usage_remove(nua_handle_t *nh,
 
 /**@fn void nua_subscribe(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
  *
- *  Subscribe to a SIP event. 
+ *  Subscribe to a SIP event.
  *
- * Subscribe a SIP event using the SIP SUBSCRIBE request. If the 
- * SUBSCRBE is successful a subscription state is established and 
+ * Subscribe a SIP event using the SIP SUBSCRIBE request. If the
+ * SUBSCRBE is successful a subscription state is established and
  * the subscription is refreshed regularly. The refresh requests will
  * generate #nua_r_subscribe events.
  *
  * @param nh              Pointer to operation handle
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * @par Related Tags:
@@ -155,17 +155,17 @@ void nua_subscribe_usage_remove(nua_handle_t *nh,
 
 /**@fn void nua_unsubscribe(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
  *
- * Unsubscribe an event. 
+ * Unsubscribe an event.
  *
- * Unsubscribe an active or pending subscription with SUBSCRIBE request 
- * containing Expires: header with value 0. The dialog associated with 
- * subscription will be destroyed if there is no other subscriptions or 
+ * Unsubscribe an active or pending subscription with SUBSCRIBE request
+ * containing Expires: header with value 0. The dialog associated with
+ * subscription will be destroyed if there is no other subscriptions or
  * call using this dialog.
  *
  * @param nh              Pointer to operation handle
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * @par Related Tags:
@@ -173,12 +173,12 @@ void nua_subscribe_usage_remove(nua_handle_t *nh,
  *    Header tags defined in <sofia-sip/sip_tag.h> except SIPTAG_EXPIRES() or SIPTAG_EXPIRES_STR()
  *
  * @par Events:
- *    #nua_r_unsubscribe 
+ *    #nua_r_unsubscribe
  *
  * @sa NUTAG_SUBSTATE(), @RFC3265
  */
 
-static int nua_subscribe_client_init(nua_client_request_t *cr, 
+static int nua_subscribe_client_init(nua_client_request_t *cr,
                                     msg_t *, sip_t *,
                                     tagi_t const *tags);
 static int nua_subscribe_client_request(nua_client_request_t *cr,
@@ -231,7 +231,7 @@ static int nua_subscribe_client_init(nua_client_request_t *cr,
       /* Add Event header */
       sip_add_dup(msg, sip, (sip_header_t *)du->du_event);
   }
-  else if (cr->cr_event == nua_r_subscribe) {  
+  else if (cr->cr_event == nua_r_subscribe) {
     /* Create dialog usage */
     du = nua_dialog_usage_add(nh, nh->nh_ds, nua_subscribe_usage, o);
     /* Note that we allow SUBSCRIBE without event */
@@ -246,7 +246,7 @@ static int nua_subscribe_client_request(nua_client_request_t *cr,
                                        msg_t *msg, sip_t *sip,
                                        tagi_t const *tags)
 {
-  nua_dialog_usage_t *du = cr->cr_usage; 
+  nua_dialog_usage_t *du = cr->cr_usage;
   sip_time_t expires = 0;
 
   if (cr->cr_event == nua_r_destroy || !du || du->du_shutdown)
@@ -275,7 +275,7 @@ static int nua_subscribe_client_request(nua_client_request_t *cr,
 #endif
 
     nua_dialog_usage_reset_refresh(du); /* during SUBSCRIBE transaction */
-    
+
     if (cr->cr_terminating || cr->cr_event != nua_r_subscribe)
       expires = eu->eu_delta = 0;
     else if (sip->sip_expires)
@@ -318,7 +318,7 @@ static int nua_subscribe_client_request(nua_client_request_t *cr,
  * @param nh     operation handle associated with the subscription
  * @param hmagic application context associated with the handle
  * @param sip    response to SUBSCRIBE request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   NUTAG_SUBSTATE()
  *
@@ -339,7 +339,7 @@ static int nua_subscribe_client_request(nua_client_request_t *cr,
  * @param nh     operation handle associated with the subscription
  * @param hmagic application context associated with the handle
  * @param sip    response to SUBSCRIBE request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags   NUTAG_SUBSTATE()
  *
@@ -368,9 +368,9 @@ static int nua_subscribe_client_response(nua_client_request_t *cr,
     du->du_ready = 1;
 
     if (eu->eu_substate != nua_substate_terminated)
-      /* If there is no @Expires header, 
+      /* If there is no @Expires header,
         use default value stored in eu_delta */
-      delta = sip_contact_expires(NULL, sip->sip_expires, sip->sip_date, 
+      delta = sip_contact_expires(NULL, sip->sip_expires, sip->sip_date,
                                  eu->eu_delta, now);
     else
       delta = 0;
@@ -379,14 +379,14 @@ static int nua_subscribe_client_response(nua_client_request_t *cr,
       delta = eu->eu_delta;
 
     if (win_messenger_enable && !nua_dialog_is_established(nh->nh_ds)) {
-      /* Notify from messanger does not match with dialog tag */ 
+      /* Notify from messanger does not match with dialog tag */
       nh->nh_ds->ds_remote_tag = su_strdup(nh->nh_home, "");
     }
 
     if (delta > 0) {
       nua_dialog_usage_set_refresh(du, delta);
       eu->eu_expires = du->du_refquested + delta;
-    } 
+    }
     else {
       if (eu->eu_substate == nua_substate_terminated) {
        if (!eu->eu_notified)
@@ -396,7 +396,7 @@ static int nua_subscribe_client_response(nua_client_request_t *cr,
       if (eu->eu_substate != nua_substate_terminated) {
        /* Wait 32 seconds for NOTIFY. */
        delta = 64 * NTA_SIP_T1 / 1000;
-       
+
        eu->eu_final_wait = 1;
 
        if (!eu->eu_notified && win_messenger_enable)
@@ -405,7 +405,7 @@ static int nua_subscribe_client_response(nua_client_request_t *cr,
        nua_dialog_usage_set_refresh_range(du, delta, delta);
       }
       else {
-       nua_dialog_usage_reset_refresh(du); 
+       nua_dialog_usage_reset_refresh(du);
       }
 
       eu->eu_expires = du->du_refquested;
@@ -418,7 +418,7 @@ static int nua_subscribe_client_response(nua_client_request_t *cr,
       cr->cr_terminated = 1;
   }
 
-  return nua_base_client_tresponse(cr, status, phrase, sip, 
+  return nua_base_client_tresponse(cr, status, phrase, sip,
                                   NUTAG_SUBSTATE(substate),
                                   SIPTAG_EVENT(du ? du->du_event : NULL),
                                   TAG_END());
@@ -432,9 +432,9 @@ static void nua_subscribe_usage_refresh(nua_handle_t *nh,
 {
   nua_client_request_t *cr = du->du_cr;
   struct event_usage *eu = nua_dialog_usage_private(du);
-  
+
   assert(eu);
-  
+
   if (eu->eu_final_wait) {
     /* Did not receive NOTIFY for fetch */
     sip_event_t const *o = du->du_event;
@@ -445,7 +445,7 @@ static void nua_subscribe_usage_refresh(nua_handle_t *nh,
                id ? "; id=" : "", id ? id : ""));
 
     nua_stack_tevent(nh->nh_nua, nh,  NULL,
-                    nua_i_notify, 408, "Fetch Timeouts without NOTIFY", 
+                    nua_i_notify, 408, "Fetch Timeouts without NOTIFY",
                     NUTAG_SUBSTATE(nua_substate_terminated),
                     SIPTAG_EVENT(du->du_event),
                     TAG_END());
@@ -494,7 +494,7 @@ static int nua_subscribe_usage_shutdown(nua_handle_t *nh,
     if (nua_client_resend_request(cr, 1) >= 0)
       return 0;
   }
-  
+
   nua_dialog_usage_remove(nh, ds, du, NULL, NULL);
   return 200;
 }
@@ -514,7 +514,7 @@ static int nua_subscribe_usage_shutdown(nua_handle_t *nh,
  * @param tags   NUTAG_SUBSTATE() indicating the subscription state
  *
  * @sa nua_subscribe(), nua_unsubscribe(), @RFC3265, #nua_i_subscribe
- * 
+ *
  * @END_NUA_EVENT
  */
 
@@ -522,11 +522,11 @@ int nua_notify_server_init(nua_server_request_t *sr);
 int nua_notify_server_preprocess(nua_server_request_t *sr);
 int nua_notify_server_report(nua_server_request_t *, tagi_t const *);
 
-nua_server_methods_t const nua_notify_server_methods = 
+nua_server_methods_t const nua_notify_server_methods =
   {
     SIP_METHOD_NOTIFY,
     nua_i_notify,              /* Event */
-    { 
+    {
       /* create_dialog: */ 1,  /* Do create dialog */
       /* in_dialog: */ 0,      /* Not always in-dialog request */
       /* target_refresh: */ 1, /* Target refresh request  */
@@ -546,15 +546,15 @@ int nua_notify_server_init(nua_server_request_t *sr)
     nua_dialog_state_t *ds = sr->sr_owner->nh_ds;
 
     /* Check for forked subscription. */
-    if (ds->ds_remote_tag && ds->ds_remote_tag[0] && 
+    if (ds->ds_remote_tag && ds->ds_remote_tag[0] &&
        str0cmp(ds->ds_remote_tag, sr->sr_request.sip->sip_from->a_tag)) {
       sip_contact_t const *m = NULL;
 
       m = nua_stack_get_contact(sr->sr_owner->nh_nua->nua_registrations);
-      
+
       if (m) {
        sip_warning_t w[1];
-       
+
        sip_warning_init(w)->w_code = 399;
        w->w_host = m->m_url->url_host;
        w->w_port = m->m_url->url_port;
@@ -593,17 +593,17 @@ int nua_notify_server_preprocess(nua_server_request_t *sr)
     if (!du)
       return SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
   }
-  
+
   sr->sr_usage = du;
   eu = nua_dialog_usage_private(du); assert(eu);
   eu->eu_notified++;
-  if (!o || !o->o_id) 
+  if (!o || !o->o_id)
     eu->eu_no_id = 1;
 
   if (subs == NULL) {
     /* Compatibility */
     unsigned long delta = eu->eu_delta;
-    if (sip->sip_expires) 
+    if (sip->sip_expires)
       delta = sip->sip_expires->ex_delta;
 
     if (delta == 0)
@@ -616,7 +616,7 @@ int nua_notify_server_preprocess(nua_server_request_t *sr)
     reason = subs->ss_reason;
 
     if (str0casecmp(reason, "deactivated") == 0 ||
-       str0casecmp(reason, "probation") == 0) 
+       str0casecmp(reason, "probation") == 0)
       substate = nua_substate_embryonic;
   }
   else if (strcasecmp(subs->ss_substate, what = "pending") == 0) {
@@ -632,7 +632,7 @@ int nua_notify_server_preprocess(nua_server_request_t *sr)
   if (!solicited)
     eu->eu_unsolicited = 1;
 
-  SU_DEBUG_5(("nua(%p): %s: %s (%s)\n", 
+  SU_DEBUG_5(("nua(%p): %s: %s (%s)\n",
              (void *)sr->sr_owner, "nua_notify_server_preprocess",
              what, reason ? reason : ""));
 
@@ -672,7 +672,7 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
       if (subs && subs->ss_reason) {
        if (str0casecmp(subs->ss_reason, "deactivated") == 0) {
          retry = 0;            /* retry immediately */
-       } 
+       }
        else if (str0casecmp(subs->ss_reason, "probation") == 0) {
          retry = 30;
          if (subs->ss_retry_after)
@@ -686,11 +686,11 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
       sr->sr_terminating = 1;
     }
   }
-  
+
   retval = nua_base_server_treport(sr, /* can destroy sr */
                                   NUTAG_SUBSTATE(substate),
                                   SIPTAG_EVENT(o),
-                                  TAG_NEXT(tags)); 
+                                  TAG_NEXT(tags));
 
   if (retval != 1 || du == NULL)
     return retval;
@@ -719,9 +719,9 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
 
 /**@fn void nua_refer(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
  *
- * Transfer a call. 
- * 
- * Send a REFER request asking the recipient to transfer the call. 
+ * Transfer a call.
+ *
+ * Send a REFER request asking the recipient to transfer the call.
  *
  * The REFER request also establishes an implied subscription to the "refer"
  * event. The "refer" event can have an "id" parameter, which has the value
@@ -745,7 +745,7 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
  * @param nh              Pointer to operation handle
  * @param tag, value, ... List of tagged parameters
  *
- * @return 
+ * @return
  *    nothing
  *
  * @par Related Tags:
@@ -776,7 +776,7 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
  * @param nh     operation handle associated with the REFER request
  * @param hmagic application context associated with the handle
  * @param sip    response to REFER request or NULL upon an error
- *               (status code is in @a status and 
+ *               (status code is in @a status and
  *                descriptive message in @a phrase parameters)
  * @param tags    NUTAG_REFER_EVENT() \n
  *                NUTAG_SUBSTATE()
@@ -787,7 +787,7 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
  * @END_NUA_EVENT
  */
 
-static int nua_refer_client_init(nua_client_request_t *cr, 
+static int nua_refer_client_init(nua_client_request_t *cr,
                                 msg_t *, sip_t *,
                                 tagi_t const *tags);
 static int nua_refer_client_request(nua_client_request_t *cr,
@@ -901,15 +901,15 @@ static int nua_refer_client_response(nua_client_request_t *cr,
                                     int status, char const *phrase,
                                     sip_t const *sip)
 {
-  nua_dialog_usage_t *du = cr->cr_usage; 
+  nua_dialog_usage_t *du = cr->cr_usage;
   enum nua_substate substate = nua_substate_terminated;
 
   if (du) {
     struct event_usage *eu = nua_dialog_usage_private(du);
 
     if (status < 200) {
-      substate = eu->eu_substate;      
-    } 
+      substate = eu->eu_substate;
+    }
     else if (status < 300) {
       sip_refer_sub_t const *rs = sip_refer_sub(sip);
 
@@ -920,8 +920,8 @@ static int nua_refer_client_response(nua_client_request_t *cr,
        substate = eu->eu_substate;
     }
   }
-  
-  return nua_base_client_tresponse(cr, status, phrase, sip, 
+
+  return nua_base_client_tresponse(cr, status, phrase, sip,
                                   NUTAG_SUBSTATE(substate),
                                   SIPTAG_EVENT(du ? du->du_event : NULL),
                                   TAG_END());
index 8e52b21ebe51607fc4a380f7611cbc831a355129..fa533045a00a8cd3d59942f5a4e76d8a07b48df7 100644 (file)
@@ -462,15 +462,15 @@ tag_typedef_t nutag_early_media = BOOLTAG_TYPEDEF(early_media);
  *    int (boolean: nonzero is true, zero is false)
  *
  * @par Values
- *    - 0 (false) - include 100rel in all preliminary responses 
+ *    - 0 (false) - include 100rel in all preliminary responses
  *    - 1 (true) - include 100rel only in 183 responses
  *
- * @note 
+ * @note
  * This tag takes only effect when NUTAG_EARLY_MEDIA(1) has been used, too.
  *
  * Corresponding tag taking reference parameter is NUTAG_ONLY183_100REL_REF().
  *
- * @sa 
+ * @sa
  */
 tag_typedef_t nutag_only183_100rel = BOOLTAG_TYPEDEF(only183_100rel);
 
@@ -527,7 +527,7 @@ tag_typedef_t nutag_early_answer = BOOLTAG_TYPEDEF(early_answer);
  *
  * @par Values
  *    - 0 (false) - do not include extra SDP on 200 OK
- *    - 1 (true) - include SDP in 200 OK even if it has been sent 
+ *    - 1 (true) - include SDP in 200 OK even if it has been sent
  *                 a 100rel response, too
  *
  * Corresponding tag taking reference parameter is
index f8022a66a01c3207af9d6d4a33e7821997237da3..18fb05a62527e533e409ffe61de87f4ad80990c2 100644 (file)
@@ -26,7 +26,7 @@
 /** Defined when <nua_types.h> has been included. */
 #define NUA_TYPES_H
 
-/**@internal @file nua_types.h 
+/**@internal @file nua_types.h
  * @brief Internal types for nua.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -42,8 +42,8 @@ typedef NUA_OWNER_T nua_owner_t;
 
 typedef struct nua_dialog_state nua_dialog_state_t;
 typedef struct nua_dialog_usage nua_dialog_usage_t;
-typedef struct nua_server_request nua_server_request_t; 
-typedef struct nua_client_request nua_client_request_t; 
+typedef struct nua_server_request nua_server_request_t;
+typedef struct nua_client_request nua_client_request_t;
 typedef struct nua_dialog_peer_info nua_dialog_peer_info_t;
 
 #ifndef NUA_SAVED_SIGNAL_T
index cf4f772222e307a39ef2e045058d4099ba73bd66..8d9b204c7588175923cf255dbe3717a6e18f6c99 100644 (file)
@@ -200,7 +200,7 @@ outbound_new(outbound_owner_t *owner,
     return NULL;
 
   ob = su_home_clone((su_home_t *)owner, sizeof *ob);
-  
+
   if (ob) {
     su_md5_t md5[1];
     uint8_t digest[SU_MD5_DIGEST_SIZE];
@@ -224,7 +224,7 @@ outbound_new(outbound_owner_t *owner,
     su_md5_update(md5, (void *)guid, sizeof guid);
     su_md5_digest(md5, digest);
     token64_e(ob->ob_cookie, sizeof ob->ob_cookie, digest, sizeof digest);
-    
+
     if (instance && !ob->ob_instance)
       su_home_unref(ob->ob_home), ob = NULL;
   }
@@ -310,7 +310,7 @@ int outbound_set_options(outbound_t *ob,
   su_free(NULL, options);
 
   if (invalid) {
-    SU_DEBUG_1(("outbound(%p): invalid options \"%s\"\n", 
+    SU_DEBUG_1(("outbound(%p): invalid options \"%s\"\n",
                (void *)ob->ob_owner, options));
     return -1;
   }
@@ -354,8 +354,8 @@ int outbound_set_proxy(outbound_t *ob,
 /* ---------------------------------------------------------------------- */
 
 /** Obtain contacts for REGISTER */
-int outbound_get_contacts(outbound_t *ob, 
-                         sip_contact_t **return_current_contact, 
+int outbound_get_contacts(outbound_t *ob,
+                         sip_contact_t **return_current_contact,
                          sip_contact_t **return_previous_contact)
 {
   if (ob) {
@@ -396,7 +396,7 @@ int outbound_register_response(outbound_t *ob,
   if (terminating) {
     ob->ob_registering = ob->ob_registered = 0;
     return 0;                  /* Cleanup is done separately */
-  }  
+  }
 
   if (!response || !request)
     return 0;
@@ -449,7 +449,7 @@ int outbound_check_for_nat(outbound_t *ob,
   if (!ob->ob_by_stack)
     return ob_no_nat;
 
-  /* Application does not want us to do any NAT traversal */ 
+  /* Application does not want us to do any NAT traversal */
   if (!ob->ob_prefs.natify)
     return ob_no_nat;
 
@@ -615,7 +615,7 @@ int outbound_gruuize(outbound_t *ob, sip_t const *sip)
   }
 
   gruu = (char *)msg_header_find_param(m->m_common, "pub-gruu=");
-  
+
   if (gruu == NULL || gruu[0] == '\0')
     gruu = (char *)msg_header_find_param(m->m_common, "gruu=");
 
@@ -692,7 +692,7 @@ void outbound_start_keepalive(outbound_t *ob,
 
   ob->ob_keepalive.interval = interval;
 
-  if (!ob->ob_validated && ob->ob_keepalive.sipstun 
+  if (!ob->ob_validated && ob->ob_keepalive.sipstun
       && 0 /* Stun is disabled for now */) {
     nta_tport_keepalive(register_transaction);
   }
@@ -754,7 +754,7 @@ static int create_keepalive_message(outbound_t *ob, sip_t const *regsip)
       s = su_strdup(msg_home(msg), s);
       msg_header_add_param(msg_home(msg), ac->cp_common, s);
     }
-    
+
     if (features)
       msg_header_insert(msg, NULL, (void *)ac);
     else
@@ -917,36 +917,36 @@ static int process_response_to_keepalive_options(outbound_t *ob,
 
     if (status < 300 && ob->ob_keepalive.validated) {
       loglevel = 5;
-      if (ob->ob_validated) 
+      if (ob->ob_validated)
        loglevel = 99;          /* only once */
       ob->ob_validated = ob->ob_once_validated = 1;
     }
-    else if (status == 401 || status == 407 || status == 403) 
+    else if (status == 401 || status == 407 || status == 403)
       loglevel = 5, failed = 1;
     else
       loglevel = 3, failed = 1;
-      
+
     if (loglevel >= SU_LOG->log_level) {
       sip_contact_t const *m = ob->ob_rcontact;
 
       if  (m)
-       su_llog(SU_LOG, loglevel,       
+       su_llog(SU_LOG, loglevel,
                "outbound(%p): %s <" URL_PRINT_FORMAT ">\n",
                (void *)ob->ob_owner,
                failed ? "FAILED to validate" : "validated",
                URL_PRINT_ARGS(m->m_url));
       else
-       su_llog(SU_LOG, loglevel,       
+       su_llog(SU_LOG, loglevel,
                "outbound(%p): %s registration\n",
                (void *)ob->ob_owner,
                failed ? "FAILED to validate" : "validated");
 
       if (failed)
-       su_llog(SU_LOG, loglevel, "outbound(%p): FAILED with %u %s\n", 
+       su_llog(SU_LOG, loglevel, "outbound(%p): FAILED with %u %s\n",
                (void *)ob->ob_owner, status, phrase);
     }
 
-    if (failed) 
+    if (failed)
       ob->ob_oo->oo_probe_error(ob->ob_owner, ob, status, phrase, TAG_END());
   }
   else if (status == 408) {
@@ -1027,7 +1027,7 @@ static int keepalive_options_with_registration_probe(outbound_t *ob)
 /** Check if request should be processed by outbound */
 int outbound_targeted_request(sip_t const *sip)
 {
-  return 
+  return
     sip && sip->sip_request &&
     sip->sip_request->rq_method == sip_method_options &&
     sip->sip_accept &&
@@ -1036,7 +1036,7 @@ int outbound_targeted_request(sip_t const *sip)
 }
 
 /** Answer to the connectivity probe OPTIONS */
-int outbound_process_request(outbound_t *ob, 
+int outbound_process_request(outbound_t *ob,
                             nta_incoming_t *irq,
                             sip_t const *sip)
 {
@@ -1045,7 +1045,7 @@ int outbound_process_request(outbound_t *ob,
     return 0;
 
   if (ob->ob_keepalive.validating) {
-    SU_DEBUG_5(("outbound(%p): registration check OPTIONS received\n", 
+    SU_DEBUG_5(("outbound(%p): registration check OPTIONS received\n",
                (void *)ob->ob_owner));
     ob->ob_keepalive.validated = 1;
   }
@@ -1063,7 +1063,7 @@ int outbound_process_request(outbound_t *ob,
 /**@internal
  * Create contacts for outbound.
  *
- * There are two contacts: 
+ * There are two contacts:
  * one suitable for registrations (ob_rcontact) and another that can be used
  * in dialogs (ob_dcontact).
  */
@@ -1082,16 +1082,16 @@ int outbound_contacts_from_via(outbound_t *ob, sip_via_t const *via)
 
   v = v0; *v0 = *via; v0->v_next = NULL;
 
-  dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 1, 
+  dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 1,
                                   v, v->v_protocol, NULL);
 
   if (ob->ob_instance && ob->ob_reg_id != 0)
     snprintf(reg_id_param, sizeof reg_id_param, ";reg-id=%u", ob->ob_reg_id);
 
   rcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 0,
-                                  v, v->v_protocol, 
+                                  v, v->v_protocol,
                                   ob->ob_instance, reg_id_param, NULL);
-    
+
   v = sip_via_dup(home, v);
 
   if (!rcontact || !dcontact || !v) {
@@ -1171,14 +1171,14 @@ int outbound_set_contact(outbound_t *ob,
   if (terminating) {
     if (ob->ob_by_stack && application_contact == NULL)
       return 0;
-    
+
     if (ob->ob_contacts)
       previous = ob->ob_rcontact;
   }
   else if (application_contact) {
     rcontact = sip_contact_dup(home, application_contact);
 
-    if (!ob->ob_rcontact || 
+    if (!ob->ob_rcontact ||
        url_cmp_all(ob->ob_rcontact->m_url, application_contact->m_url)) {
       contact_uri_changed = 1;
       previous = ob->ob_contacts ? ob->ob_rcontact : NULL;
@@ -1188,10 +1188,10 @@ int outbound_set_contact(outbound_t *ob,
     return 0;    /* Xyzzy - nothing happens */
   }
   else if (v) {
-    char const *tport = !v->v_next ? v->v_protocol : NULL; 
+    char const *tport = !v->v_next ? v->v_protocol : NULL;
     char reg_id_param[20];
 
-    dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 1, 
+    dcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 1,
                                     v, tport, NULL);
     if (!dcontact)
       return -1;
@@ -1200,18 +1200,18 @@ int outbound_set_contact(outbound_t *ob,
       snprintf(reg_id_param, sizeof reg_id_param, ";reg-id=%u", ob->ob_reg_id);
 
     rcontact = ob->ob_oo->oo_contact(ob->ob_owner, home, 0,
-                                    v, v->v_protocol, 
+                                    v, v->v_protocol,
                                     ob->ob_instance, reg_id_param, NULL);
     if (!rcontact)
       return -1;
 
-    if (!ob->ob_rcontact || 
+    if (!ob->ob_rcontact ||
        url_cmp_all(ob->ob_rcontact->m_url, rcontact->m_url)) {
       contact_uri_changed = 1;
       previous = ob->ob_contacts ? ob->ob_rcontact : NULL;
     }
   }
-    
+
   ob->ob_by_stack = application_contact == NULL;
 
   ob->ob_contacts = rcontact != NULL;
index c1e13e6fa1fdd0363cf8d0a5dfd389f9dc540d41..2a239c5b298d389edbf7903681e190db52b48545 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef OUTBOUND_H
 /** Defined when <outbound.h> has been included. */
 #define OUTBOUND_H
-/**@IFILE outbound.h 
+/**@IFILE outbound.h
  *
  * @brief Interface to SIP NAT traversal and outbound
  *
@@ -73,8 +73,8 @@ int outbound_set_options(outbound_t *ob,
 int outbound_set_proxy(outbound_t *ob,
                       url_string_t *proxy);
 
-int outbound_get_contacts(outbound_t *ob, 
-                         sip_contact_t **return_current_contact, 
+int outbound_get_contacts(outbound_t *ob,
+                         sip_contact_t **return_current_contact,
                          sip_contact_t **return_previous_contact);
 
 int outbound_start_registering(outbound_t *ob);
@@ -110,7 +110,7 @@ void outbound_stop_keepalive(outbound_t *ob);
 
 int outbound_targeted_request(sip_t const *sip);
 
-int outbound_process_request(outbound_t *ob, 
+int outbound_process_request(outbound_t *ob,
                             nta_incoming_t *irq,
                             sip_t const *sip);
 
index aa95cafe983f3d610071074f707e09c2733aef27..37b7667792dbbabcf44a823c19163d98840d7632 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@file sofia-sip/nua.h  
+/**@file sofia-sip/nua.h
  * @brief Sofia-SIP User Agent Library API
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 
 SOFIA_BEGIN_DECLS
 
-#ifndef NUA_MAGIC_T 
+#ifndef NUA_MAGIC_T
 #define NUA_MAGIC_T void
 #endif
 /** Application context for NUA agent. */
 typedef NUA_MAGIC_T nua_magic_t;
 
-#ifndef NUA_HMAGIC_T 
+#ifndef NUA_HMAGIC_T
 #define NUA_HMAGIC_T void
 #endif
 /** Application context for NUA handle. */
@@ -112,9 +112,9 @@ typedef enum nua_event_e {
   nua_i_media_error,           /**< Offer-answer error indication */
 
   /* Responses */
-  nua_r_set_params,            /**< Answer to nua_set_params() or 
+  nua_r_set_params,            /**< Answer to nua_set_params() or
                                 * nua_get_hparams(). */
-  nua_r_get_params,            /**< Answer to nua_get_params() or 
+  nua_r_get_params,            /**< Answer to nua_get_params() or
                                 * nua_get_hparams(). */
   nua_r_shutdown,              /**< Answer to nua_shutdown() */
   nua_r_notifier,              /**< Answer to nua_notifier() */
@@ -140,7 +140,7 @@ typedef enum nua_event_e {
   nua_r_unsubscribe,           /**< Answer to outgoing un-SUBSCRIBE */
   nua_r_notify,                        /**< Answer to outgoing NOTIFY */
   nua_r_method,                        /**< Answer to unknown outgoing method */
+
   nua_r_authenticate,          /**< Answer to nua_authenticate() */
 
   /* Internal events: nua hides them from application */
@@ -152,7 +152,7 @@ typedef enum nua_event_e {
 
   /* NOTE: Post 1.12 release events come here (below) to keep ABI
      compatibility! */
-  nua_i_network_changed,        /**< Local IP(v6) address has changed. 
+  nua_i_network_changed,        /**< Local IP(v6) address has changed.
                                   @NEW_1_12_2 */
   nua_i_register               /**< Incoming REGISTER. @NEW_1_12_4. */
 } nua_event_t;
@@ -269,16 +269,16 @@ SOFIAPUBFUN char const *nua_substate_name(enum nua_substate substate);
 /** Convert string to enum nua_substate. @NEW_1_12_5. */
 SOFIAPUBFUN enum nua_substate nua_substate_make(char const *sip_substate);
 
-/** Send SIP REGISTER request to the registrar. */ 
+/** Send SIP REGISTER request to the registrar. */
 SOFIAPUBFUN void nua_register(nua_handle_t *nh, tag_type_t, tag_value_t, ...);
 
-/** Unregister. */ 
+/** Unregister. */
 SOFIAPUBFUN void nua_unregister(nua_handle_t *nh, tag_type_t, tag_value_t, ...);
 
 /** Place a call using SIP INVITE method. */
 SOFIAPUBFUN void nua_invite(nua_handle_t *nh, tag_type_t, tag_value_t, ...);
 
-/** Acknowledge a succesfull response to INVITE request. */ 
+/** Acknowledge a succesfull response to INVITE request. */
 SOFIAPUBFUN void nua_ack(nua_handle_t *nh, tag_type_t, tag_value_t, ...);
 
 /** Acknowledge a reliable preliminary response to INVITE request. */
@@ -320,7 +320,7 @@ SOFIAPUBFUN void nua_terminate(nua_handle_t *, tag_type_t, tag_value_t, ...);
 /** Transfer a call. */
 SOFIAPUBFUN void nua_refer(nua_handle_t *, tag_type_t, tag_value_t, ...);
 
-/** Update a call */ 
+/** Update a call */
 SOFIAPUBFUN void nua_update(nua_handle_t *, tag_type_t, tag_value_t, ...);
 
 /** Hangdown a call. */
@@ -342,9 +342,9 @@ SOFIAPUBFUN void nua_redirect(nua_handle_t *, tag_type_t, tag_value_t, ...);
 SOFIAPUBFUN void nua_method(nua_handle_t *, tag_type_t, tag_value_t, ...);
 
 /** Respond to a request with given status code and phrase. */
-SOFIAPUBFUN void nua_respond(nua_handle_t *nh, 
+SOFIAPUBFUN void nua_respond(nua_handle_t *nh,
                             int status, char const *phrase,
-                            tag_type_t, tag_value_t, 
+                            tag_type_t, tag_value_t,
                             ...);
 
 /** Check if event can be responded with nua_respond() */
@@ -377,7 +377,7 @@ SOFIAPUBFUN msg_t *nua_saved_event_request(nua_saved_event_t const *saved);
 /** Get current request message. */
 SOFIAPUBFUN  msg_t *nua_current_request(nua_t const *nua);
 
-SOFIAPUBFUN sip_replaces_t *nua_handle_make_replaces(nua_handle_t *nh, 
+SOFIAPUBFUN sip_replaces_t *nua_handle_make_replaces(nua_handle_t *nh,
                                                     su_home_t *home,
                                                     int early_only);
 
index d9f1918df240eb27c313a8cd818af2ce78d1d3c1..366f38ee3571c22f4aeab7a202fce62ae8a8ed85 100644 (file)
@@ -62,8 +62,8 @@ struct tp_magic_s
 /* -- Module prototypes ------------------------------------------------- */
 
 static msg_t *s2_msg(int flags);
-static int s2_complete_response(msg_t *response, 
-                               int status, char const *phrase, 
+static int s2_complete_response(msg_t *response,
+                               int status, char const *phrase,
                                msg_t *request);
 static char *s2_generate_tag(su_home_t *home);
 
@@ -132,7 +132,7 @@ struct event *s2_remove_event(struct event *e)
 
   e->prev = NULL, e->next = NULL;
 
-  return e; 
+  return e;
 }
 
 void s2_free_event(struct event *e)
@@ -163,7 +163,7 @@ struct event *s2_next_event(void)
 
     su_root_step(s2->root, 100);
   }
-} 
+}
 
 struct event *s2_wait_for_event(nua_event_t event, int status)
 {
@@ -180,7 +180,7 @@ struct event *s2_wait_for_event(nua_event_t event, int status)
 
     su_root_step(s2->root, 100);
   }
-} 
+}
 
 int s2_check_event(nua_event_t event, int status)
 {
@@ -206,7 +206,7 @@ int s2_check_callstate(enum nua_callstate state)
   return retval;
 }
 
-static void 
+static void
 s2_nua_callback(nua_event_t event,
                int status, char const *phrase,
                nua_t *nua, nua_magic_t *_t,
@@ -218,7 +218,7 @@ s2_nua_callback(nua_event_t event,
 
   if (event == nua_i_active || event == nua_i_terminated)
     return;
-  
+
   e = calloc(1, sizeof *e);
   nua_save_event(nua, e->event);
   e->nh = nua_handle_ref(nh);
@@ -241,7 +241,7 @@ s2_remove_message(struct message *m)
 
   m->prev = NULL, m->next = NULL;
 
-  return m; 
+  return m;
 }
 
 void
@@ -294,10 +294,10 @@ s2_wait_for_response(int status, sip_method_t method, char const *name)
 
       if (method == sip_method_unknown && name == NULL)
        break;
-      
+
       if (m->sip->sip_cseq == NULL)
        continue;
-      
+
       if (m->sip->sip_cseq->cs_method != method)
        continue;
       if (name == NULL)
@@ -311,7 +311,7 @@ s2_wait_for_response(int status, sip_method_t method, char const *name)
 
     su_root_step(s2->root, 100);
   }
-} 
+}
 
 int
 s2_check_response(int status, sip_method_t method, char const *name)
@@ -335,9 +335,9 @@ s2_next_request(void)
 
     su_root_step(s2->root, 100);
   }
-  
+
   return NULL;
-} 
+}
 
 struct message *
 s2_wait_for_request(sip_method_t method, char const *name)
@@ -358,9 +358,9 @@ s2_wait_for_request(sip_method_t method, char const *name)
 
     su_root_step(s2->root, 100);
   }
-  
+
   return NULL;
-} 
+}
 
 int
 s2_check_request(sip_method_t method, char const *name)
@@ -425,7 +425,7 @@ s2_respond_to(struct message *m, struct dialog *d,
 
   *tpn = *tport_name(m->tport);
 
-  rport = su_sprintf(home, "rport=%u", 
+  rport = su_sprintf(home, "rport=%u",
                     ntohs(((su_sockaddr_t *)
                            msg_addrinfo(m->msg)->ai_addr)->su_port));
 
@@ -433,7 +433,7 @@ s2_respond_to(struct message *m, struct dialog *d,
       sip->sip_via->v_rport &&
       sip->sip_via->v_rport[0] == '\0') {
     msg_header_add_param(home, sip->sip_via->v_common, rport);
-  }    
+  }
 
   tpn->tpn_port = rport + strlen("rport=");
 
@@ -446,9 +446,9 @@ s2_respond_to(struct message *m, struct dialog *d,
 }
 
 /** Add headers from the request to the response message. */
-static int 
-s2_complete_response(msg_t *response, 
-                    int status, char const *phrase, 
+static int
+s2_complete_response(msg_t *response,
+                    int status, char const *phrase,
                     msg_t *request)
 {
   su_home_t *home = msg_home(response);
@@ -469,7 +469,7 @@ s2_complete_response(msg_t *response,
   if (!response_sip->sip_to)
     response_sip->sip_to = sip_to_dup(home, request_sip->sip_to);
   if (!response_sip->sip_call_id)
-    response_sip->sip_call_id = 
+    response_sip->sip_call_id =
       sip_call_id_dup(home, request_sip->sip_call_id);
   if (!response_sip->sip_cseq)
     response_sip->sip_cseq = sip_cseq_dup(home, request_sip->sip_cseq);
@@ -496,11 +496,11 @@ s2_complete_response(msg_t *response,
   return 0;
 }
 
-/* Send request (updating dialog). 
+/* Send request (updating dialog).
  *
  * Return zero upon success, nonzero upon failure.
  */
-int 
+int
 s2_request_to(struct dialog *d,
              sip_method_t method, char const *name,
              tport_t *tport,
@@ -546,7 +546,7 @@ s2_request_to(struct dialog *d,
 
   if (!d->local && sip->sip_from)
     d->local = sip_from_dup(d->home, sip->sip_from);
-  if (!d->contact && sip->sip_contact) 
+  if (!d->contact && sip->sip_contact)
     d->contact = sip_contact_dup(d->home, sip->sip_contact);
   if (!d->remote && sip->sip_to)
     d->remote = sip_to_dup(d->home, sip->sip_to);
@@ -558,7 +558,7 @@ s2_request_to(struct dialog *d,
     d->call_id = sip_call_id_dup(d->home, sip->sip_call_id);
   if (!d->lseq && sip->sip_cseq)
     d->lseq = sip->sip_cseq->cs_seq;
-  
+
   if (!d->local)
     d->local = sip_from_dup(d->home, s2->local);
   if (!d->contact)
@@ -643,7 +643,7 @@ s2_request_to(struct dialog *d,
     }
   }
 
-  sip_add_tl(msg, sip, 
+  sip_add_tl(msg, sip,
             TAG_IF(!sip->sip_from, SIPTAG_FROM(d->local)),
             TAG_IF(!sip->sip_contact, SIPTAG_CONTACT(d->contact)),
             TAG_IF(!sip->sip_to, SIPTAG_TO(d->remote)),
@@ -670,7 +670,7 @@ s2_request_to(struct dialog *d,
   }
 
   return tport ? 0 : -1;
-  
+
  error:
   ta_end(ta);
   return -1;
@@ -809,7 +809,7 @@ void s2_case(char const *number,
 
 /* ---------------------------------------------------------------------- */
 /* tport interface */
-static void 
+static void
 s2_stack_recv(struct tester *s2,
              tport_t *tp,
              msg_t *msg,
@@ -844,16 +844,16 @@ s2_stack_error(struct tester *s2,
               int errcode,
               char const *remote)
 {
-  fprintf(stderr, "%s(%p): error %d (%s) from %s\n", 
+  fprintf(stderr, "%s(%p): error %d (%s) from %s\n",
          "nua_tester_error",
-         (void *)tp, errcode, su_strerror(errcode), 
+         (void *)tp, errcode, su_strerror(errcode),
          remote ? remote : "<unknown destination>");
 }
 
 static msg_t *
 s2_stack_alloc(struct tester *s2, int flags,
               char const data[], usize_t size,
-              tport_t const *tport, 
+              tport_t const *tport,
               tp_client_t *tpc)
 {
   return msg_create(s2->mclass, flags | s2->flags);
@@ -890,7 +890,7 @@ void s2_setup_base(char const *hostname)
 
   s2->local = sip_from_format(s2->home, "Bob <sip:bob@%s>",
                             hostname ? hostname : "example.net");
-  
+
   if (hostname == NULL)
     hostname = "127.0.0.1";
 
@@ -952,8 +952,8 @@ s2_setup_tport(char const * const *protocols,
 
   if (protocols == NULL)
     protocols = default_protocols;
-  
-  bound = tport_tbind(s2->master, tpn, protocols, 
+
+  bound = tport_tbind(s2->master, tpn, protocols,
                      TPTAG_SERVER(1),
                      ta_tags(ta));
   assert(bound != -1);
@@ -979,7 +979,7 @@ s2_setup_tport(char const * const *protocols,
 
     v = sip_via_format(s2->home, "SIP/2.0/%s %s:%s",
                       tpn->tpn_proto,
-                      tpn->tpn_host, 
+                      tpn->tpn_host,
                       tpn->tpn_port);
     assert(v != NULL);
     if (strncasecmp(tpn->tpn_proto, "tls", 3)) {
@@ -988,11 +988,11 @@ s2_setup_tport(char const * const *protocols,
                             tpn->tpn_port,
                             tpn->tpn_proto);
       if (s2->udp.contact == NULL && strcasecmp(tpn->tpn_proto, "udp") == 0) {
-       s2->udp.tport = tport_ref(tp); 
+       s2->udp.tport = tport_ref(tp);
        s2->udp.contact = m;
       }
       if (s2->tcp.contact == NULL && strcasecmp(tpn->tpn_proto, "tcp") == 0) {
-       s2->tcp.tport = tport_ref(tp); 
+       s2->tcp.tport = tport_ref(tp);
        s2->tcp.contact = m;
       }
     }
@@ -1007,7 +1007,7 @@ s2_setup_tport(char const * const *protocols,
                             tpn->tpn_host,
                             tpn->tpn_port);
       if (s2->tls.contact == NULL) {
-       s2->tls.tport = tport_ref(tp); 
+       s2->tls.tport = tport_ref(tp);
        s2->tls.contact = m;
       }
     }
@@ -1519,7 +1519,7 @@ nua_t *s2_nua_setup(tag_type_t tag, tag_value_t value, ...)
                NULL);
 
   ta_start(ta, tag, value);
-  s2->nua = 
+  s2->nua =
     nua_create(s2->root,
               s2_nua_callback,
               s2,
@@ -1534,7 +1534,7 @@ nua_t *s2_nua_setup(tag_type_t tag, tag_value_t value, ...)
 #endif
               ta_tags(ta));
   ta_end(ta);
-  
+
   return s2->nua;
 }
 
@@ -1600,7 +1600,7 @@ void s2_register_teardown(void)
     struct message *m;
 
     nua_unregister(nh, TAG_END());
-    
+
     m = s2_wait_for_request(SIP_METHOD_REGISTER); assert(m);
     s2_save_register(m);
     s2_respond_to(m, NULL,
index cfb02c0362fff3523e50a51aea23a75c1b35902e..9626c063a0c7417050cf3de2e5035477a30e88a9 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #ifndef S2TESTER_H
-#define S2TESTER_H 
+#define S2TESTER_H
 
 #define TP_STACK_T struct tester
 #define SU_ROOT_MAGIC_T struct tester
index 6b2f4f98052ac5887c5d868aba67fe5714f79e89..5274ed3866614837ab528fa1fb8e5ace0501f3fa 100644 (file)
@@ -17,7 +17,7 @@
        * sdp_print.c (sdp_printing_error): Fixed return
        for success to be NULL as defined in function
        documentation.
-       
+
 2005-09-29  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
   * Added SDPTAG_TYPEDEF().
index 1a363ca057bffc59700eefe6c63876ab8c0a1e98..900493935dc2f353ec88904b216afad3b802280b 100644 (file)
@@ -6,7 +6,7 @@ RFC 2327 omissions and errors:
   but example (RTP/AVP!) contains also "/"
 
 * bwtype is restricted to alpha-numeric, but the RFC text discusses
-  extensions like b=x-y:100 
+  extensions like b=x-y:100
 
 * att-field is restricted to alpha-numeric, but the RFC text discusses
   extensions like a=x-nokia-foo
index e579a483ff2c44b0ef0dbc292f247ebf79cea80d..b6cd00a34423ef0a9d97ab4e9ffd5cc2b175d08e 100644 (file)
@@ -12,12 +12,12 @@ tests="${2:-${sdp_path}/tests}"
 if test -r $tests/message-1.sdp ; then
 
 for n in 1 2 3 4 5 6 7 8 9 10 11;
-do 
+do
     echo -n "$n: "
     "$test_sdp" < "$tests/message-$n.sdp" && echo OK
 done
 
-else 
+else
     echo "sdp run-tests: no tests found in $tests, skipping."
     exit 77
 fi
index 2d69e3bbe4eace76e862a1da8a2a72f174d04b99..dda452c90e65096fc60d4fd0281f4e7c3f584f11 100644 (file)
@@ -99,37 +99,37 @@ typedef void *dup_f(char **bb, void const *src);
 static size_t list_xtra_all(xtra_f *xtra, void const *v);
 static void *list_dup_all(dup_f *dup, char **bb, void const *vsrc);
 
-static size_t session_xtra(sdp_session_t const *o); 
+static size_t session_xtra(sdp_session_t const *o);
 static sdp_session_t *session_dup(char **pp, sdp_session_t const *o);
 
-static size_t origin_xtra(sdp_origin_t const *o); 
+static size_t origin_xtra(sdp_origin_t const *o);
 static sdp_origin_t *origin_dup(char **pp, sdp_origin_t const *o);
 
-static size_t connection_xtra(sdp_connection_t const *o); 
+static size_t connection_xtra(sdp_connection_t const *o);
 static sdp_connection_t *connection_dup(char **pp, sdp_connection_t const *o);
 
-static size_t bandwidth_xtra(sdp_bandwidth_t const *o); 
+static size_t bandwidth_xtra(sdp_bandwidth_t const *o);
 static sdp_bandwidth_t *bandwidth_dup(char **pp, sdp_bandwidth_t const *o);
 
-static size_t time_xtra(sdp_time_t const *o); 
+static size_t time_xtra(sdp_time_t const *o);
 static sdp_time_t *time_dup(char **pp, sdp_time_t const *o);
 
-static size_t repeat_xtra(sdp_repeat_t const *o); 
+static size_t repeat_xtra(sdp_repeat_t const *o);
 static sdp_repeat_t *repeat_dup(char **pp, sdp_repeat_t const *o);
 
-static size_t zone_xtra(sdp_zone_t const *o); 
+static size_t zone_xtra(sdp_zone_t const *o);
 static sdp_zone_t *zone_dup(char **pp, sdp_zone_t const *o);
 
-static size_t key_xtra(sdp_key_t const *o); 
+static size_t key_xtra(sdp_key_t const *o);
 static sdp_key_t *key_dup(char **pp, sdp_key_t const *o);
 
-static size_t attribute_xtra(sdp_attribute_t const *o); 
+static size_t attribute_xtra(sdp_attribute_t const *o);
 static sdp_attribute_t *attribute_dup(char **pp, sdp_attribute_t const *o);
 
-static size_t list_xtra(sdp_list_t const *o); 
+static size_t list_xtra(sdp_list_t const *o);
 static sdp_list_t *list_dup(char **pp, sdp_list_t const *o);
 
-static size_t rtpmap_xtra(sdp_rtpmap_t const *o); 
+static size_t rtpmap_xtra(sdp_rtpmap_t const *o);
 static sdp_rtpmap_t *rtpmap_dup(char **pp, sdp_rtpmap_t const *o);
 
 static size_t media_xtra(sdp_media_t const *o);
@@ -182,12 +182,12 @@ static sdp_media_t *media_dup_all(char **pp,
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_origin_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_origin_t *sdp_origin_dup(su_home_t *h, sdp_origin_t const *o)
-{ 
+{
   SDP_DUP(origin, o);
 }
 
@@ -202,12 +202,12 @@ sdp_origin_t *sdp_origin_dup(su_home_t *h, sdp_origin_t const *o)
  * @note The duplicated list is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_connection_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_connection_t *sdp_connection_dup(su_home_t *h, sdp_connection_t const *c)
-{ 
+{
   SDP_LIST_DUP(connection, c);
 }
 
@@ -222,12 +222,12 @@ sdp_connection_t *sdp_connection_dup(su_home_t *h, sdp_connection_t const *c)
  * @note The duplicated list is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_bandwidth_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_bandwidth_t *sdp_bandwidth_dup(su_home_t *h, sdp_bandwidth_t const *b)
-{ 
+{
   SDP_LIST_DUP(bandwidth, b);
 }
 
@@ -242,12 +242,12 @@ sdp_bandwidth_t *sdp_bandwidth_dup(su_home_t *h, sdp_bandwidth_t const *b)
  * @note The duplicated list is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_time_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_time_t *sdp_time_dup(su_home_t *h, sdp_time_t const *t)
-{ 
+{
   SDP_LIST_DUP(time, t);
 }
 
@@ -262,12 +262,12 @@ sdp_time_t *sdp_time_dup(su_home_t *h, sdp_time_t const *t)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_repeat_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_repeat_t *sdp_repeat_dup(su_home_t *h, sdp_repeat_t const *r)
-{ 
+{
   SDP_DUP(repeat, r);
 }
 
@@ -282,12 +282,12 @@ sdp_repeat_t *sdp_repeat_dup(su_home_t *h, sdp_repeat_t const *r)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_zone_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_zone_t *sdp_zone_dup(su_home_t *h, sdp_zone_t const *z)
-{ 
+{
   SDP_DUP(zone, z);
 }
 
@@ -302,12 +302,12 @@ sdp_zone_t *sdp_zone_dup(su_home_t *h, sdp_zone_t const *z)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_key_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_key_t *sdp_key_dup(su_home_t *h, sdp_key_t const *k)
-{ 
+{
   SDP_DUP(key, k);
 }
 
@@ -322,12 +322,12 @@ sdp_key_t *sdp_key_dup(su_home_t *h, sdp_key_t const *k)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_attribute_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_attribute_t *sdp_attribute_dup(su_home_t *h, sdp_attribute_t const *a)
-{ 
+{
   SDP_LIST_DUP(attribute, a);
 }
 
@@ -342,12 +342,12 @@ sdp_attribute_t *sdp_attribute_dup(su_home_t *h, sdp_attribute_t const *a)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_list_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_list_t *sdp_list_dup(su_home_t *h, sdp_list_t const *l)
-{ 
+{
   SDP_LIST_DUP(list, l);
 }
 
@@ -362,12 +362,12 @@ sdp_list_t *sdp_list_dup(su_home_t *h, sdp_list_t const *l)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_rtpmap_t structure is
  * returned, otherwise NULL is returned.
  */
 sdp_rtpmap_t *sdp_rtpmap_dup(su_home_t *h, sdp_rtpmap_t const *rm)
-{ 
+{
   SDP_LIST_DUP(rtpmap, rm);
 }
 
@@ -384,11 +384,11 @@ sdp_rtpmap_t *sdp_rtpmap_dup(su_home_t *h, sdp_rtpmap_t const *rm)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_media_t structure is
  * returned, otherwise NULL is returned.
  */
-sdp_media_t *sdp_media_dup(su_home_t *h, sdp_media_t const *m, 
+sdp_media_t *sdp_media_dup(su_home_t *h, sdp_media_t const *m,
                           sdp_session_t *sdp)
 {
   sdp_media_t *rv; size_t size; char *p, *end;
@@ -412,11 +412,11 @@ sdp_media_t *sdp_media_dup(su_home_t *h, sdp_media_t const *m,
  * @note The duplicated list is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to a newly allocated list of sdp_media_t
  * structures is returned, otherwise NULL is returned.
  */
-sdp_media_t *sdp_media_dup_all(su_home_t *h, sdp_media_t const *m, 
+sdp_media_t *sdp_media_dup_all(su_home_t *h, sdp_media_t const *m,
                               sdp_session_t *sdp)
 {
   sdp_media_t *rv; size_t size; char *p, *end;
@@ -441,14 +441,14 @@ sdp_media_t *sdp_media_dup_all(su_home_t *h, sdp_media_t const *m,
  * @param dst_c Connection description used instead of duplicate of @a src_c.
  * @param src_c Connection description not to be duplicated
 
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_media_t structure is
  * returned, otherwise NULL is returned.
  *
  * @deprecated
  * This function is deprecated. Use sdp_media_dup() instead.
  */
-sdp_media_t *sdp_media_dup_ex(su_home_t *home, 
+sdp_media_t *sdp_media_dup_ex(su_home_t *home,
                              sdp_media_t const *src,
                              sdp_session_t *sdp,
                              sdp_connection_t *dst_c,
@@ -479,7 +479,7 @@ sdp_origin_t *origin_dup(char **pp, sdp_origin_t const *src)
   char *p;
   sdp_origin_t *o;
 
-  p = *pp; 
+  p = *pp;
   STRUCT_DUP(p, o, src);
   STR_DUP(p, o, src, o_username);
   PTR_DUP(p, o, src, o_address, connection_dup);
@@ -502,8 +502,8 @@ sdp_connection_t *connection_dup(char **pp, sdp_connection_t const *src)
   char *p;
   sdp_connection_t *c;
 
-  p = *pp; 
-  STRUCT_DUP(p, c, src); 
+  p = *pp;
+  STRUCT_DUP(p, c, src);
   c->c_next = NULL;
   STR_DUP(p, c, src, c_address);
 
@@ -666,12 +666,12 @@ static size_t media_xtra(sdp_media_t const *m)
   LST_XTRA(rv, m->m_bandwidths, bandwidth_xtra);
   PTR_XTRA(rv, m->m_key, key_xtra);
   LST_XTRA(rv, m->m_attributes, attribute_xtra);
-  
+
   return rv;
 }
 
 static
-sdp_media_t *media_dup(char **pp, 
+sdp_media_t *media_dup(char **pp,
                       sdp_media_t const *src,
                       sdp_session_t *sdp)
 {
@@ -692,11 +692,11 @@ sdp_media_t *media_dup(char **pp,
   PTR_DUP(p, m, src, m_key, key_dup);
   LST_DUP(p, m, src, m_attributes, attribute_dup);
 
-  /* note! we must not implicitly use 'src->m_session' as it 
+  /* note! we must not implicitly use 'src->m_session' as it
            might point to a temporary session */
   m->m_session = sdp;
-    
-  m->m_rejected = src->m_rejected; 
+
+  m->m_rejected = src->m_rejected;
   m->m_mode = src->m_mode;
 
   assert((size_t)(p - *pp) == media_xtra(src));
@@ -730,7 +730,7 @@ int media_xtra_ex(sdp_media_t const *m, sdp_connection_t const *c)
 }
 
 static
-sdp_media_t *media_dup_ex(char **pp, 
+sdp_media_t *media_dup_ex(char **pp,
                          sdp_media_t const *src,
                          sdp_session_t *sdp,
                          sdp_connection_t *dst_c,
@@ -759,12 +759,12 @@ sdp_media_t *media_dup_ex(char **pp,
     LST_DUP(p, m, src, m_bandwidths, bandwidth_dup);
     PTR_DUP(p, m, src, m_key, key_dup);
     LST_DUP(p, m, src, m_attributes, attribute_dup);
-    
-    /* note! we must not implicitly use 'src->m_session' as it 
+
+    /* note! we must not implicitly use 'src->m_session' as it
        might point to a temporary session */
     m->m_session = sdp;
-    
-    m->m_rejected = src->m_rejected; 
+
+    m->m_rejected = src->m_rejected;
     m->m_mode = src->m_mode;
 
     assert(m);
@@ -793,7 +793,7 @@ static size_t media_xtra_all(sdp_media_t const *m)
 }
 
 static
-sdp_media_t *media_dup_all(char **pp, 
+sdp_media_t *media_dup_all(char **pp,
                           sdp_media_t const *src,
                           sdp_session_t *sdp)
 {
@@ -827,7 +827,7 @@ sdp_list_t *list_dup(char **pp, sdp_list_t const *src)
   char *p;
   sdp_list_t *l;
 
-  p = *pp; 
+  p = *pp;
   STRUCT_DUP(p, l, src);
   l->l_next = NULL;
   STR_DUP(p, l, src, l_text);
@@ -853,7 +853,7 @@ sdp_rtpmap_t *rtpmap_dup(char **pp, sdp_rtpmap_t const *src)
   char *p;
   sdp_rtpmap_t *rm;
 
-  p = *pp; 
+  p = *pp;
   STRUCT_DUP(p, rm, src);
   rm->rm_next = NULL;
   STR_DUP(p, rm, src, rm_encoding);
@@ -954,7 +954,7 @@ sdp_session_t *session_dup(char **pp, sdp_session_t const *src)
   char *p;
   sdp_session_t *sdp;
 
-  p = *pp; 
+  p = *pp;
   STRUCT_DUP(p, sdp, src);
   sdp->sdp_next = NULL;
 
@@ -988,13 +988,13 @@ sdp_session_t *session_dup(char **pp, sdp_session_t const *src)
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_session_t structure is
  * returned, otherwise NULL is returned.
  */
 
 sdp_session_t *sdp_session_dup(su_home_t *h, sdp_session_t const *sdp)
-{ 
+{
   SDP_DUP(session, sdp);
 }
 
@@ -1026,7 +1026,7 @@ sdp_session_t *session_without_media_dup(char **pp, sdp_session_t const *src)
   char *p;
   sdp_session_t *sdp;
 
-  p = *pp; 
+  p = *pp;
   STRUCT_DUP(p, sdp, src);
   sdp->sdp_next = NULL;
 
@@ -1044,7 +1044,7 @@ sdp_session_t *session_without_media_dup(char **pp, sdp_session_t const *src)
   STR_DUP(p, sdp, src, sdp_charset);
 
   sdp->sdp_media = NULL;
-  
+
   assert((size_t)(p - *pp) == session_without_media_xtra(src));
   *pp = p;
   return sdp;
@@ -1065,14 +1065,14 @@ typedef sdp_session_t sdp_session_without_media_t;
  * @note The duplicated structure is allocated using a single call to
  * su_alloc() and it can be freed with su_free().
  *
- * @return 
+ * @return
  * If successful, a pointer to newly allocated sdp_session_t structure is
  * returned, otherwise NULL is returned.
  */
 
-sdp_session_t *sdp_session_dup_without_media(su_home_t *h, 
+sdp_session_t *sdp_session_dup_without_media(su_home_t *h,
                                             sdp_session_t const *sdp)
-{ 
+{
   SDP_DUP(session_without_media, sdp);
 }
 
@@ -1085,7 +1085,7 @@ size_t sdptag_session_xtra(tagi_t const *t, size_t offset)
 {
   sdp_session_t const *sdp = (sdp_session_t *)t->t_value;
 
-  if (sdp) 
+  if (sdp)
     return STRUCT_ALIGN(offset) + session_xtra(sdp);
   else
     return 0;
@@ -1097,7 +1097,7 @@ tagi_t *sdptag_session_dup(tagi_t *dst, tagi_t const *src, void **bb)
   sdp_session_t const *srcsdp;
   char *b;
 
-  assert(src); assert(*bb); 
+  assert(src); assert(*bb);
 
   b = *bb;
   b += STRUCT_ALIGN(b);
@@ -1121,9 +1121,9 @@ int sdptag_session_snprintf(tagi_t const *t, char b[], size_t size)
 
   assert(t);
 
-  if (!t || !t->t_value) { 
-    if (size && b) b[0] = 0; 
-    return 0; 
+  if (!t || !t->t_value) {
+    if (size && b) b[0] = 0;
+    return 0;
   }
 
   sdp = (sdp_session_t const *)t->t_value;
@@ -1131,14 +1131,14 @@ int sdptag_session_snprintf(tagi_t const *t, char b[], size_t size)
   print = sdp_print(NULL, sdp, b, size, 0);
 
   retval = sdp_message_size(print);
-  
+
   sdp_printer_free(print);
 
   return (int)retval;
 }
 
 /** Tag class for SDP tags. @HIDE */
-tag_class_t sdptag_session_class[1] = 
+tag_class_t sdptag_session_class[1] =
   {{
     sizeof(sdptag_session_class),
     /* tc_next */     NULL,
@@ -1157,7 +1157,7 @@ tag_class_t sdptag_session_class[1] =
 /* ---------------------------------------------------------------------- */
 
 /* Compare two string pointers */
-su_inline 
+su_inline
 int str0cmp(char const *a, char const *b)
 {
   if (a == NULL) a = "";
@@ -1166,7 +1166,7 @@ int str0cmp(char const *a, char const *b)
 }
 
 /* Compare two string pointers ignoring case. */
-su_inline 
+su_inline
 int str0casecmp(char const *a, char const *b)
 {
   if (a == NULL) a = "";
@@ -1174,16 +1174,16 @@ int str0casecmp(char const *a, char const *b)
   return strcasecmp(a, b);
 }
 
-/** Compare two session descriptions 
+/** Compare two session descriptions
  */
 int sdp_session_cmp(sdp_session_t const *a, sdp_session_t const *b)
 {
-  int rv; 
+  int rv;
   sdp_bandwidth_t const *ab, *bb;
   sdp_attribute_t const *aa, *ba;
   sdp_media_t const *am, *bm;
-  if ((rv = (a != NULL) - (b != NULL))) 
+
+  if ((rv = (a != NULL) - (b != NULL)))
     return rv;
   if (a == b)
     return 0;
@@ -1204,8 +1204,8 @@ int sdp_session_cmp(sdp_session_t const *a, sdp_session_t const *b)
   if ((rv = sdp_connection_cmp(a->sdp_connection, b->sdp_connection)))
     return rv;
 
-  for (ab = a->sdp_bandwidths, bb = b->sdp_bandwidths; 
-       ab || bb; 
+  for (ab = a->sdp_bandwidths, bb = b->sdp_bandwidths;
+       ab || bb;
        ab = ab->b_next, bb = bb->b_next)
     if ((rv = sdp_bandwidth_cmp(a->sdp_bandwidths, b->sdp_bandwidths)))
       return rv;
@@ -1215,14 +1215,14 @@ int sdp_session_cmp(sdp_session_t const *a, sdp_session_t const *b)
   if ((rv = sdp_key_cmp(a->sdp_key, b->sdp_key)))
     return rv;
 
-  for (aa = a->sdp_attributes, ba = b->sdp_attributes; 
-       aa || bb; 
+  for (aa = a->sdp_attributes, ba = b->sdp_attributes;
+       aa || bb;
        aa = aa->a_next, ba = ba->a_next)
     if ((rv = sdp_attribute_cmp(aa, ba)))
       return rv;
 
-  for (am = a->sdp_media, bm = b->sdp_media; 
-       am || bm; 
+  for (am = a->sdp_media, bm = b->sdp_media;
+       am || bm;
        am = am->m_next, bm = bm->m_next)
     if ((rv = sdp_media_cmp(am, bm)))
       return rv;
@@ -1230,13 +1230,13 @@ int sdp_session_cmp(sdp_session_t const *a, sdp_session_t const *b)
   return 0;
 }
 
-/** Compare two origin fields 
+/** Compare two origin fields
  */
 int sdp_origin_cmp(sdp_origin_t const *a, sdp_origin_t const *b)
 {
   int rv;
 
-  if ((rv = (a != NULL) - (b != NULL))) 
+  if ((rv = (a != NULL) - (b != NULL)))
     return rv;
   if (a == b)
     return 0;
@@ -1252,7 +1252,7 @@ int sdp_origin_cmp(sdp_origin_t const *a, sdp_origin_t const *b)
   return 0;
 }
 
-/** Compare two connection fields 
+/** Compare two connection fields
  */
 int sdp_connection_cmp(sdp_connection_t const *a, sdp_connection_t const *b)
 {
@@ -1285,7 +1285,7 @@ int sdp_bandwidth_cmp(sdp_bandwidth_t const *a, sdp_bandwidth_t const *b)
 
   if (a->b_modifier != b->b_modifier)
     return a->b_modifier < b->b_modifier ? -1 : 1;
-  if (a->b_modifier == sdp_bw_x && 
+  if (a->b_modifier == sdp_bw_x &&
       (rv = strcmp(a->b_modifier_name, b->b_modifier_name)))
     return rv;
 
@@ -1298,9 +1298,9 @@ int sdp_bandwidth_cmp(sdp_bandwidth_t const *a, sdp_bandwidth_t const *b)
 /** Compare two time fields */
 int sdp_time_cmp(sdp_time_t const *a, sdp_time_t const *b)
 {
-  int rv; 
+  int rv;
 
-  if ((rv = (a != NULL) - (b != NULL))) 
+  if ((rv = (a != NULL) - (b != NULL)))
     return rv;
   if (a == b)
     return 0;
@@ -1319,7 +1319,7 @@ int sdp_time_cmp(sdp_time_t const *a, sdp_time_t const *b)
 int sdp_repeat_cmp(sdp_repeat_t const *a, sdp_repeat_t const *b)
 {
   int i, n;
-  
+
   if (a == b)
     return 0;
   if ((a != NULL) != (b != NULL))
@@ -1329,12 +1329,12 @@ int sdp_repeat_cmp(sdp_repeat_t const *a, sdp_repeat_t const *b)
     return a->r_interval < b->r_interval ? -1 : 1;
   if (a->r_duration != b->r_duration)
     return a->r_duration < b->r_duration ? -1 : 1;
-  n = a->r_number_of_offsets < b->r_number_of_offsets 
+  n = a->r_number_of_offsets < b->r_number_of_offsets
     ? a->r_number_of_offsets : b->r_number_of_offsets;
   for (i = 0; i < n; i++)
     if (a->r_offsets[i] != b->r_offsets[i])
       return a->r_offsets[i] < b->r_offsets[i] ? -1 : 1;
-  
+
   if (a->r_number_of_offsets != b->r_number_of_offsets)
     return a->r_number_of_offsets < b->r_number_of_offsets ? -1 : 1;
 
@@ -1345,7 +1345,7 @@ int sdp_repeat_cmp(sdp_repeat_t const *a, sdp_repeat_t const *b)
 int sdp_zone_cmp(sdp_zone_t const *a, sdp_zone_t const *b)
 {
   int i, n;
-  
+
   if (a == b)
     return 0;
   if ((a != NULL) != (b != NULL))
@@ -1379,7 +1379,7 @@ int sdp_key_cmp(sdp_key_t const *a, sdp_key_t const *b)
 
   if (a->k_method != b->k_method)
     return a->k_method < b->k_method ? -1 : 1;
-  if (a->k_method == sdp_key_x && 
+  if (a->k_method == sdp_key_x &&
       (rv = str0cmp(a->k_method_name, b->k_method_name)))
     return rv;
   return str0cmp(a->k_material, b->k_material);
@@ -1427,7 +1427,7 @@ int sdp_rtpmap_cmp(sdp_rtpmap_t const *a, sdp_rtpmap_t const *b)
       a_param = a->rm_params;
     if (b->rm_params)
       b_param = b->rm_params;
-    
+
     rv = strcasecmp(a_param, b_param);
 
     if (rv)
@@ -1457,7 +1457,7 @@ int sdp_list_cmp(sdp_list_t const *a, sdp_list_t const *b)
 /** Compare two media (m=) fields */
 int sdp_media_cmp(sdp_media_t const *a, sdp_media_t const *b)
 {
-  int rv; 
+  int rv;
 
   sdp_connection_t const *ac, *bc;
   sdp_bandwidth_t const *ab, *bb;
@@ -1466,7 +1466,7 @@ int sdp_media_cmp(sdp_media_t const *a, sdp_media_t const *b)
 
   if (a == b)
     return 0;
-  if ((rv = (a != NULL) - (b != NULL))) 
+  if ((rv = (a != NULL) - (b != NULL)))
     return rv;
 
   if (a->m_type != b->m_type)
@@ -1493,8 +1493,8 @@ int sdp_media_cmp(sdp_media_t const *a, sdp_media_t const *b)
   if (a->m_mode != b->m_mode)
     return a->m_mode < b->m_mode ? -1 : 1;
 
-  for (arm = a->m_rtpmaps, brm = b->m_rtpmaps; 
-       arm || brm; 
+  for (arm = a->m_rtpmaps, brm = b->m_rtpmaps;
+       arm || brm;
        arm = arm->rm_next, brm = brm->rm_next)
     if ((rv = sdp_rtpmap_cmp(arm, brm)))
       return rv;
@@ -1505,14 +1505,14 @@ int sdp_media_cmp(sdp_media_t const *a, sdp_media_t const *b)
   if ((rv = str0cmp(a->m_information, b->m_information)))
     return rv;
 
-  for (ac = a->m_connections, bc = b->m_connections; 
-       ac || bc; 
+  for (ac = a->m_connections, bc = b->m_connections;
+       ac || bc;
        ac = ac->c_next, bc = bc->c_next)
   if ((rv = sdp_connection_cmp(ac, bc)))
     return rv;
 
-  for (ab = a->m_bandwidths, bb = b->m_bandwidths; 
-       ab || bb; 
+  for (ab = a->m_bandwidths, bb = b->m_bandwidths;
+       ab || bb;
        ab = ab->b_next, bb = bb->b_next)
     if ((rv = sdp_bandwidth_cmp(a->m_bandwidths, b->m_bandwidths)))
       return rv;
@@ -1520,8 +1520,8 @@ int sdp_media_cmp(sdp_media_t const *a, sdp_media_t const *b)
   if ((rv = sdp_key_cmp(a->m_key, b->m_key)))
     return rv;
 
-  for (aa = a->m_attributes, ba = b->m_attributes; 
-       aa || bb; 
+  for (aa = a->m_attributes, ba = b->m_attributes;
+       aa || bb;
        aa = aa->a_next, ba = ba->a_next)
     if ((rv = sdp_attribute_cmp(aa, ba)))
       return rv;
@@ -1556,8 +1556,8 @@ sdp_attribute_t *sdp_attribute_find(sdp_attribute_t const *a, char const *name)
 }
 
 /** Find named attribute from given lists (a or a2). */
-sdp_attribute_t *sdp_attribute_find2(sdp_attribute_t const *a, 
-                                    sdp_attribute_t const *a2, 
+sdp_attribute_t *sdp_attribute_find2(sdp_attribute_t const *a,
+                                    sdp_attribute_t const *a2,
                                     char const *name)
 {
   for (; a; a = a->a_next) {
@@ -1607,7 +1607,7 @@ sdp_attribute_t *sdp_attribute_by_mode(su_home_t *home, sdp_mode_t mode)
     name = "sendrecv";
   else
     return NULL;
-  
+
   a = su_salloc(home, sizeof(*a));
   if (a)
     a->a_name = name;
@@ -1615,7 +1615,7 @@ sdp_attribute_t *sdp_attribute_by_mode(su_home_t *home, sdp_mode_t mode)
   return a;
 }
 
-/** Find a mapped attribute. 
+/** Find a mapped attribute.
  *
  * A mapped attribute has form 'a=<name>:<pt> <value>' where pt is a RTP
  * payload type, integer in range 0..127. For example, "a=atmmap" [@RFC3108]
@@ -1627,7 +1627,7 @@ sdp_attribute_t *sdp_attribute_by_mode(su_home_t *home, sdp_mode_t mode)
  * @param pt payload type number (must be 0..127)
  * @param return_result return value parameter for mapped attribute value
  *
- * @return Pointer to a matching attribute structure, or NULL. 
+ * @return Pointer to a matching attribute structure, or NULL.
  *
  * If a matching attribute is found, @a return_result will point to part of
  * the attribute after the payload type and whitespace.
@@ -1670,7 +1670,7 @@ sdp_attribute_t *sdp_attribute_mapped_find(sdp_attribute_t const *a,
 }
 
 /** Append a (list of) attribute(s) to a list of attributes. */
-void sdp_attribute_append(sdp_attribute_t **list, 
+void sdp_attribute_append(sdp_attribute_t **list,
                          sdp_attribute_t const *a)
 {
   assert(list);
@@ -1684,13 +1684,13 @@ void sdp_attribute_append(sdp_attribute_t **list,
   *list = (sdp_attribute_t *)a;
 }
 
-/**Replace or append a attribute within a list of attributes. 
+/**Replace or append a attribute within a list of attributes.
  *
  * @retval 1 if replaced existing attribute
  * @retval 0 if attribute was appended
  * @retval -1 upon an error
  */
-int sdp_attribute_replace(sdp_attribute_t **list, 
+int sdp_attribute_replace(sdp_attribute_t **list,
                          sdp_attribute_t *a,
                          sdp_attribute_t **return_replaced)
 {
@@ -1712,7 +1712,7 @@ int sdp_attribute_replace(sdp_attribute_t **list,
   }
 
   replaced = *list, *list = a;
-  
+
   if (replaced) {
     a->a_next = replaced->a_next;
     replaced->a_next = NULL;
@@ -1727,7 +1727,7 @@ int sdp_attribute_replace(sdp_attribute_t **list,
 }
 
 /** Remove a named attribute from a list of attributes. */
-sdp_attribute_t *sdp_attribute_remove(sdp_attribute_t **list, 
+sdp_attribute_t *sdp_attribute_remove(sdp_attribute_t **list,
                                      char const *name)
 {
   sdp_attribute_t *a;
@@ -1876,7 +1876,7 @@ int sdp_rtpmap_match(sdp_rtpmap_t const *a, sdp_rtpmap_t const *b)
     return 1;
 
   if (!aparam) aparam = "1"; if (!bparam) bparam = "1";
-  
+
   if (strcasecmp(aparam, bparam))
     return 0;
 
index d351064c1db3a1fbd3ce31d2b8a64fa3ffd8fb7c..582db48ccd7cf2cff137aa4e1de868e7a99f1bc4 100644 (file)
@@ -69,7 +69,7 @@ send them to network, and then free the message:
    show_critical_error(sdp_printing_error(printer));
  }
  sdp_printer_free(printer);
-@endcode 
+@endcode
 
 @section sdp_example Example
 
@@ -79,7 +79,7 @@ version number in the origin line, and encodes the SDP description again to
 @a buf.
 
 @code
-size_t increment_sdp_version(char buf[], size_t bsize, 
+size_t increment_sdp_version(char buf[], size_t bsize,
                              char const *original, size_t osize)
 {
   su_home_t home[1] = { SU_HOME_INIT(home) };
@@ -89,7 +89,7 @@ size_t increment_sdp_version(char buf[], size_t bsize,
 
   if (sdp_session(parser)) {
     sdp_session_t *sdp = sdp_session(parser);
-    
+
     sdp->sdp_origin->o_version++;
 
     printer = sdp_print(home, sdp, buf, bsize, 0);
@@ -98,19 +98,19 @@ size_t increment_sdp_version(char buf[], size_t bsize,
       retval = sdp_message_size(printer);
     }
     else {
-      fprintf(stderr, "increment_sdp_version: %s\n", 
+      fprintf(stderr, "increment_sdp_version: %s\n",
               sdp_printing_error(printer));
     }
 
     sdp_printer_free(printer);
   }
   else {
-    fprintf(stderr, "increment_sdp_version: %s\n", 
+    fprintf(stderr, "increment_sdp_version: %s\n",
             sdp_parsing_error(parser));
   }
 
   sdp_parser_free(parser);
-      
+
   su_home_deinit(home);
 
   return retval;
index c4c0273dac94ee83ab7cdfeb5fbae5e22d397297..4d46bcaaabb307bab6078cf7dfa2dbf0567e0722 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**@ingroup sdp_parser
- * @CFILE sdp_parse.c 
+ * @CFILE sdp_parse.c
  * @brief Simple SDP parser interface.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -46,7 +46,7 @@
 #include <limits.h>
 #include <assert.h>
 
-/** @typedef struct sdp_parser_s sdp_parser_t; 
+/** @typedef struct sdp_parser_s sdp_parser_t;
  *
  * SDP parser handle.
  *
@@ -105,7 +105,7 @@ static int parsing_error(sdp_parser_t *p, char const *fmt, ...);
  * The function sdp_parse() parses an SDP message @a msg of size @a
  * msgsize. Parsing is done according to the given @a flags. The SDP message
  * may not contain a NUL.
- * 
+ *
  * The parsing result is stored to an #sdp_session_t structure.
  *
  * @param home    memory home
@@ -115,7 +115,7 @@ static int parsing_error(sdp_parser_t *p, char const *fmt, ...);
  *
  * The following flags are used by parser:
  *
- * @li #sdp_f_strict Parser should accept only messages conforming strictly 
+ * @li #sdp_f_strict Parser should accept only messages conforming strictly
  *                   to the specification.
  * @li #sdp_f_anynet Parser accepts unknown network or address types.
  * @li #sdp_f_insane Do not run sanity check.
@@ -139,7 +139,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
 
   if (msgsize == -1 || msg == NULL) {
     p = su_home_clone(home, sizeof(*p));
-    if (p) 
+    if (p)
       parsing_error(p, "invalid input message");
     else
       p = (sdp_parser_t*)&no_mem_error;
@@ -172,7 +172,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
     p->pr_session_mode = sdp_sendrecv;
 
     parse_message(p);
-    
+
     return p;
   }
 
@@ -216,7 +216,7 @@ sdp_session(sdp_parser_t *p)
  *
  * @param p SDP parser
  *
- * @return 
+ * @return
  * The function sdp_parsing_error() returns a C string describing parsing
  * error, or NULL if no error occurred.
  */
@@ -230,7 +230,7 @@ char const *sdp_parsing_error(sdp_parser_t *p)
  * The function sdp_parser_free() frees an SDP parser object along with
  * the memory blocks associated with it.
  *
- * @param p pointer to the SDP parser to be freed 
+ * @param p pointer to the SDP parser to be freed
  */
 void sdp_parser_free(sdp_parser_t *p)
 {
@@ -271,7 +271,7 @@ static void parse_key(sdp_parser_t *p, char *r, sdp_key_t **result);
 static void parse_session_attr(sdp_parser_t *p, char *r, sdp_attribute_t **result);
 static void parse_media(sdp_parser_t *p, char *r, sdp_media_t **result);
 static void parse_payload(sdp_parser_t *p, char *r, sdp_rtpmap_t **result);
-static void parse_media_attr(sdp_parser_t *p, char *r, sdp_media_t *m, 
+static void parse_media_attr(sdp_parser_t *p, char *r, sdp_media_t *m,
                             sdp_attribute_t **result);
 static int parse_rtpmap(sdp_parser_t *p, char *r, sdp_media_t *m);
 static int parse_fmtp(sdp_parser_t *p, char *r, sdp_media_t *m);
@@ -279,13 +279,13 @@ static void parse_text_list(sdp_parser_t *p, char *r, sdp_list_t **result);
 
 static void parse_descs(sdp_parser_t *p, char *r, char *m, sdp_media_t **result);
 
-static int parse_ul(sdp_parser_t *p, char **r, unsigned long *result, 
+static int parse_ul(sdp_parser_t *p, char **r, unsigned long *result,
                    unsigned long max_value);
-static int parse_ull(sdp_parser_t *p, char **r, uint64_t *result, 
+static int parse_ull(sdp_parser_t *p, char **r, uint64_t *result,
                     uint64_t max_value);
 static void parse_alloc_error(sdp_parser_t *p, const char *typename);
 static char *next(char **message, const char *sep, const char *strip);
-static char *token(char **message, const char *sep, const char *legal, 
+static char *token(char **message, const char *sep, const char *legal,
                   const char *strip);
 #if 0
 static void check_mandatory(sdp_parser_t *p, sdp_session_t *sdp);
@@ -301,7 +301,7 @@ static void check_mandatory(sdp_parser_t *p, sdp_session_t *sdp);
  */
 #define PARSE_ALLOC(p, t, v) \
  t *v = su_salloc(p->pr_home, sizeof(*v)); \
- if (!v && (parse_alloc_error(p, #t), 1)) return; 
+ if (!v && (parse_alloc_error(p, #t), 1)) return;
 
 /* -------------------------------------------------------------------------
  * Macro PARSE_CHECK_REST
@@ -314,10 +314,10 @@ static void check_mandatory(sdp_parser_t *p, sdp_session_t *sdp);
     return
 
 /* -------------------------------------------------------------------------
- * Function parse_message() - parse an SDP message 
+ * Function parse_message() - parse an SDP message
  *
  * Description:
- *   This function parses an SDP message, which is copied into the 
+ *   This function parses an SDP message, which is copied into the
  *   p->pr_message. The p->pr_message is modified during the parsing,
  *   and parts of it are returned in p->pr_session.
  *
@@ -384,7 +384,7 @@ static void parse_message(sdp_parser_t *p)
   for (;
        record && p->pr_ok;
        record = next(&message, CRLF, strip)) {
-    field = record[0]; 
+    field = record[0];
 
     rest = record + 2; rest += strspn(rest, strip);
 
@@ -476,9 +476,9 @@ static void parse_message(sdp_parser_t *p)
 
 int sdp_connection_is_inaddr_any(sdp_connection_t const *c)
 {
-  return 
-    c && 
-    c->c_nettype == sdp_net_in && 
+  return
+    c &&
+    c->c_nettype == sdp_net_in &&
     ((c->c_addrtype == sdp_addr_ip4 && strcmp(c->c_address, "0.0.0.0")) ||
      (c->c_addrtype == sdp_addr_ip6 && strcmp(c->c_address, "::")));
 }
@@ -506,7 +506,7 @@ static void post_session(sdp_parser_t *p, sdp_session_t *sdp)
       parsing_error(p, "Incorrect version");
     return;
   }
-  
+
   /* Go through all media and set mode */
   for (m = sdp->sdp_media; m; m = m->m_next) {
     if (m->m_port == 0) {
@@ -534,13 +534,13 @@ static void post_session(sdp_parser_t *p, sdp_session_t *sdp)
     return;
 }
 
-/** Validates that all mandatory fields exist 
+/** Validates that all mandatory fields exist
  *
  * Checks that all necessary fields (v=, o=) exists in the parsed sdp. If
- * strict, check that all mandatory fields (c=, o=, s=, t=) are present. 
+ * strict, check that all mandatory fields (c=, o=, s=, t=) are present.
  * This function also goes through all media, marks rejected media as such,
  * and updates the mode accordingly.
- * 
+ *
  * @retval 0 if parsed SDP description is valid
  * @retval -1 if some SDP line is missing
  * @retval -2 if c= line is missing
@@ -626,7 +626,7 @@ static void parse_origin(sdp_parser_t *p, char *r, sdp_origin_t **result)
    sess-version =        1*(DIGIT)
                          ;0 is a new session
 
-                        
+
    */
   PARSE_ALLOC(p, sdp_origin_t, o);
 
@@ -873,7 +873,7 @@ static void parse_connection(sdp_parser_t *p, char *r, sdp_connection_t **result
     c->c_ttl = 0;
     c->c_groups = 1;
   }
-  else 
+  else
     parsing_error(p, "invalid address");
 }
 
@@ -916,7 +916,7 @@ static void parse_bandwidth(sdp_parser_t *p, char *r, sdp_bandwidth_t **result)
 
   if (STRICT(p))
     PARSE_CHECK_REST(p, r, "b");
-  
+
   {
     PARSE_ALLOC(p, sdp_bandwidth_t, b);
     *result = b;
@@ -974,7 +974,7 @@ static void parse_time(sdp_parser_t *p, char *r, sdp_time_t **result)
  * @param p      pointer to SDP parser object
  * @param r      pointer to record data
  * @param result pointer to which parsed record is assigned
- * 
+ *
  */
 static void parse_repeat(sdp_parser_t *p, char *d, sdp_repeat_t **result)
 {
@@ -1013,7 +1013,7 @@ static void parse_repeat(sdp_parser_t *p, char *d, sdp_repeat_t **result)
     return;
   }
   if (!(r = su_salloc(p->pr_home, offsetof(sdp_repeat_t, r_offsets[N - 1])))) {
-    parse_alloc_error(p, "sdp_repeat_t"); 
+    parse_alloc_error(p, "sdp_repeat_t");
     return;
   }
 
@@ -1035,7 +1035,7 @@ static void parse_repeat(sdp_parser_t *p, char *d, sdp_repeat_t **result)
 
     while (is_space(*d))
       d++;
-  } 
+  }
 
   *result = r;
 }
@@ -1090,7 +1090,7 @@ static void parse_zone(sdp_parser_t *p, char *r, sdp_zone_t **result)
     return;
   }
   if (!(z = su_salloc(p->pr_home, offsetof(sdp_zone_t, z_adjustments[N])))) {
-    parse_alloc_error(p, "sdp_zone_t"); 
+    parse_alloc_error(p, "sdp_zone_t");
     return;
   }
 
@@ -1109,7 +1109,7 @@ static void parse_zone(sdp_parser_t *p, char *r, sdp_zone_t **result)
 
     z->z_adjustments[n].z_at = at;
     z->z_adjustments[n].z_offset = offset;
-  } 
+  }
 
   *result = z;
 }
@@ -1205,7 +1205,7 @@ static void parse_session_attr(sdp_parser_t *p, char *r, sdp_attribute_t **resul
 
   if (*r)
     value = r;
-  else 
+  else
     PARSE_CHECK_REST(p, r, "a");
 
   if (strcasecmp(name, "charset") == 0) {
@@ -1213,7 +1213,7 @@ static void parse_session_attr(sdp_parser_t *p, char *r, sdp_attribute_t **resul
     return;
   }
 
-  if (p->pr_mode_manual) 
+  if (p->pr_mode_manual)
     ;
   else if (strcasecmp(name, "inactive") == 0)
     p->pr_session_mode = sdp_inactive;
@@ -1316,10 +1316,10 @@ static void parse_media(sdp_parser_t *p, char *r, sdp_media_t **result)
     parsing_error(p, "m= missing protocol");
     return;
   }
-  
+
   if (!STRICT(p) && strcasecmp(s, "RTP") == 0)
     m->m_proto = sdp_proto_rtp, m->m_proto_name = "RTP/AVP";
-  else 
+  else
     sdp_media_transport(m, s);
 
   /* RTP format list */
@@ -1331,7 +1331,7 @@ static void parse_media(sdp_parser_t *p, char *r, sdp_media_t **result)
   /* "normal" format list */
   if (*r) {
     sdp_list_t **fmt = &m->m_format;
-    
+
     while (r && *r) {
       PARSE_ALLOC(p, sdp_list_t, l);
       *fmt = l;
@@ -1382,7 +1382,7 @@ void sdp_media_transport(sdp_media_t *m, char const *s)
     m->m_proto = sdp_proto_tcp, m->m_proto_name = "TCP";
   else if (strcasecmp(s, "TLS") == 0)
     m->m_proto = sdp_proto_tls, m->m_proto_name = "TLS";
-  else 
+  else
     m->m_proto = sdp_proto_x, m->m_proto_name = s;
 }
 
@@ -1560,10 +1560,10 @@ static void parse_media_attr(sdp_parser_t *p, char *r, sdp_media_t *m,
 
   if (*r)
     value = r;
-  else 
+  else
     PARSE_CHECK_REST(p, r, "a");
 
-  if (p->pr_mode_manual) 
+  if (p->pr_mode_manual)
     ;
   else if (strcasecmp(name, "inactive") == 0) {
     m->m_mode = sdp_inactive;
@@ -1637,11 +1637,11 @@ static int parse_rtpmap(sdp_parser_t *p, char *r, sdp_media_t *m)
     return -2;
   }
 
-  if (*r == '/') 
+  if (*r == '/')
     params = ++r;
   else
     params = 0;
-    
+
   rm->rm_predef = 0;
   rm->rm_encoding = encoding;
   rm->rm_rate = rate;
@@ -1690,12 +1690,12 @@ static int parse_fmtp(sdp_parser_t *p, char *r, sdp_media_t *m)
  * Parameters:
  *   p      - pointer to SDP parser object
  *   record - pointer to first media field
- *   message - pointer to rest 
+ *   message - pointer to rest
  *   medias - pointer to which parsed media structures are assigned
  */
-static void parse_descs(sdp_parser_t *p, 
-                       char *record, 
-                       char *message, 
+static void parse_descs(sdp_parser_t *p,
+                       char *record,
+                       char *message,
                        sdp_media_t **medias)
 {
   char *rest;
@@ -1709,7 +1709,7 @@ static void parse_descs(sdp_parser_t *p,
     strip = SPACE TAB;         /* skip initial whitespace */
   else
     strip = "";
-  
+
   for (;
        record && p->pr_ok;
        record = next(&message, CRLF, strip)) {
@@ -1767,10 +1767,10 @@ static void parse_text_list(sdp_parser_t *p, char *r, sdp_list_t **result)
 /*
  * parse_ul: parse an unsigned long
  */
-static int parse_ul(sdp_parser_t *p, char **r, 
+static int parse_ul(sdp_parser_t *p, char **r,
                    unsigned long *result, unsigned long max)
 {
-  char *ul = *r; 
+  char *ul = *r;
 
   ul += strspn(ul, SPACE TAB);
 
@@ -1790,12 +1790,12 @@ unsigned longlong strtoull(char const *string, char **return_end, int base);
 /*
  * parse_ull: parse an unsigned long long
  */
-static int parse_ull(sdp_parser_t *p, char **r, 
+static int parse_ull(sdp_parser_t *p, char **r,
                     uint64_t *result, uint64_t max)
 {
   unsigned longlong ull;
 
-  char *s = *r; 
+  char *s = *r;
 
   s += strspn(s, SPACE TAB);
 
@@ -1810,9 +1810,9 @@ static int parse_ull(sdp_parser_t *p, char **r,
   return -1;
 }
 
-static char *token(char **message, 
-                  const char *sep, 
-                  const char *legal, 
+static char *token(char **message,
+                  const char *sep,
+                  const char *legal,
                   const char *strip)
 {
   size_t n;
@@ -1823,7 +1823,7 @@ static char *token(char **message,
 
   if (legal)
     n = strspn(retval, legal);
-  else 
+  else
     n = strcspn(retval, sep);
 
   if (n == 0)
@@ -1872,8 +1872,8 @@ static int parsing_error(sdp_parser_t *p, char const *fmt, ...)
 {
   int n;
   va_list ap;
-  va_start(ap, fmt); 
-  
+  va_start(ap, fmt);
+
   memset(p->pr_error, 0, sizeof(p->pr_error));
   n = vsnprintf(p->pr_error, sizeof(p->pr_error), fmt, ap);
   va_end(ap);
@@ -1885,6 +1885,6 @@ static int parsing_error(sdp_parser_t *p, char const *fmt, ...)
 
 static void parse_alloc_error(sdp_parser_t *p, const char *typename)
 {
-  parsing_error(p, "memory exhausted (while allocating memory for %s)", 
+  parsing_error(p, "memory exhausted (while allocating memory for %s)",
                typename);
 }
index 59d52c3c5903c7e1c0354120e5f9fc345e832c3a..536bf3e341ad9daa3c8e07f34d3a109b48a0d9e6 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@ingroup sdp_printer 
+/**@ingroup sdp_printer
  *
  * @CFILE sdp_print.c  Simple SDP printer interface.
  *
@@ -81,7 +81,7 @@ struct sdp_printer_s {
 static struct sdp_printer_s printer_memory_error = {
   sizeof(printer_memory_error),
   NULL,
-  "memory exhausted", 
+  "memory exhausted",
   sizeof(printer_memory_error.pr_buffer),
   sizeof(printer_memory_error.pr_buffer)
 };
@@ -90,14 +90,14 @@ static void print_session(sdp_printer_t *p, sdp_session_t const *session);
 
 /** Print a SDP description.
  *
- * Encode the contents of the SDP session structure #sdp_session_t 
+ * Encode the contents of the SDP session structure #sdp_session_t
  * to the @a msgbuf. The @a msgbuf has size @a msgsize
  * bytes. If @a msgbuf is @c NULL, the sdp_print() function allocates the
  * required buffer from the @a home heap.
  *
  * @param home     Memory home (may be NULL).
  * @param session  SDP session description structure to be encoded.
- * @param msgbuf   Buffer to which encoding is stored (may be NULL). 
+ * @param msgbuf   Buffer to which encoding is stored (may be NULL).
  * @param msgsize  Size of @a msgbuf.
  * @param flags    Flags specifying the encoding options.
  *
@@ -117,17 +117,17 @@ static void print_session(sdp_printer_t *p, sdp_session_t const *session);
  *
  * @li #sdp_f_mode_manual - Do not generate mode attributes
  *
- * @return 
+ * @return
  * Always return a handle to an #sdp_printer_t object.
  *
  * @sa #sdp_printer_t, #sdp_session_t, sdp_printing_error(),
  * sdp_message(), sdp_message_size(), sdp_printer_free(),
  * sdp_parse().
  */
-sdp_printer_t *sdp_print(su_home_t *home, 
-                        sdp_session_t const *session, 
-                        char msgbuf[], 
-                        isize_t msgsize, 
+sdp_printer_t *sdp_print(su_home_t *home,
+                        sdp_session_t const *session,
+                        char msgbuf[],
+                        isize_t msgsize,
                         int flags)
 {
   sdp_printer_t *p = su_salloc(home, sizeof(*p));
@@ -186,10 +186,10 @@ char const *sdp_printing_error(sdp_printer_t *p)
 /** @brief Get encoded SDP message.
  *
  * Return a pointer to a C string containing the SDP message.
- * 
+ *
  * @param p Pointer to an #sdp_printer_t object.
  *
- * @return 
+ * @return
  * Return a pointer to a C string containing the encoded SDP message, or
  * NULL upon an error.
  */
@@ -207,7 +207,7 @@ char const *sdp_message(sdp_printer_t *p)
  *
  * @param p Pointer to an #sdp_printer_t object.
  *
- * @return 
+ * @return
  * Number of bytes in SDP message excluding final NUL or 0 upon an error.
  */
 isize_t sdp_message_size(sdp_printer_t *p)
@@ -253,10 +253,10 @@ static void print_typed_time(sdp_printer_t *p, unsigned long t);
 static void print_key(sdp_printer_t *p, sdp_key_t const *k);
 static void print_attributes(sdp_printer_t *p, sdp_attribute_t const *a);
 static void print_charset(sdp_printer_t *p, sdp_text_t *charset);
-static void print_media(sdp_printer_t *p, sdp_session_t const *, 
+static void print_media(sdp_printer_t *p, sdp_session_t const *,
                        sdp_media_t const *m);
 
-static void print_text_list(sdp_printer_t*, 
+static void print_text_list(sdp_printer_t*,
                            const char *, sdp_list_t const *l);
 
 static void sdp_printf(sdp_printer_t *p, const char *fmt, ...);
@@ -319,7 +319,7 @@ static void print_origin(sdp_printer_t *p, sdp_origin_t const *o)
     return;
   }
 
-  sdp_printf(p, "o=%s "LLU" "LLU" ", 
+  sdp_printf(p, "o=%s "LLU" "LLU" ",
             o->o_username,
             (ull)o->o_id,
             (ull)o->o_version);
@@ -411,7 +411,7 @@ static void print_connection2(sdp_printer_t *p, sdp_connection_t const *c)
     sdp_printf(p, "%s%s%s", nettype, c->c_address);
   else
     sdp_printf(p, "%s", c->c_address);
-    
+
   if (c->c_mcast || c->c_ttl) {
     sdp_printf(p, "/%u", c->c_ttl);
     if (c->c_groups > 1)
@@ -424,13 +424,13 @@ static void print_bandwidths(sdp_printer_t *p, sdp_bandwidth_t const *b)
 {
   for (; b ; b = b->b_next) {
     char const *name;
-    
+
     switch (b->b_modifier) {
     case sdp_bw_ct: name = "CT"; break;
     case sdp_bw_as: name = "AS"; break;
     default:        name = b->b_modifier_name; break;
     }
-    
+
     sdp_printf(p, "b=%s:%lu" CRLF, name, b->b_value);
   }
 }
@@ -463,9 +463,9 @@ static void print_zone(sdp_printer_t *p, sdp_zone_t const *z)
 
   for (i = 0; i < z->z_number_of_adjustments; i++) {
     int negative = z->z_adjustments[i].z_offset < 0L;
-    sdp_printf(p, "%s%lu %s", 
+    sdp_printf(p, "%s%lu %s",
               i > 0 ? " " : "",
-              z->z_adjustments[i].z_at, 
+              z->z_adjustments[i].z_at,
               negative ? "-" : "");
     if (negative)
       print_typed_time(p, -z->z_adjustments[i].z_offset);
@@ -523,7 +523,7 @@ static void print_key(sdp_printer_t *p, sdp_key_t const *k)
     return;
   }
 
-  sdp_printf(p, "k=%s%s%s" CRLF, method, 
+  sdp_printf(p, "k=%s%s%s" CRLF, method,
             have_material ? ":" : "",
             have_material ? k->k_material : "");
 }
@@ -537,7 +537,7 @@ static void print_attributes(sdp_printer_t *p, sdp_attribute_t const *a)
   }
 }
 
-static void 
+static void
 print_attributes_without_mode(sdp_printer_t *p, sdp_attribute_t const *a)
 {
   for (;a; a = a->a_next) {
@@ -559,7 +559,7 @@ static void print_charset(sdp_printer_t *p, sdp_text_t *charset)
   sdp_printf(p, "a=charset%s%s" CRLF, charset ? ":" : "", charset ? charset : "");
 }
 
-static void print_media(sdp_printer_t *p, 
+static void print_media(sdp_printer_t *p,
                        sdp_session_t const *sdp,
                        sdp_media_t const *m)
 {
@@ -582,7 +582,7 @@ static void print_media(sdp_printer_t *p,
     case sdp_media_image  :     media = "image"; break;
     default:                    media = m->m_type_name;
     }
-    
+
     switch (m->m_proto) {
     case sdp_proto_tcp:   proto = "tcp"; break;
     case sdp_proto_udp:   proto = "udp"; break;
@@ -592,11 +592,11 @@ static void print_media(sdp_printer_t *p,
     case sdp_proto_tls:   proto = "tls"; break;
     default:              proto = m->m_proto_name; break;
     }
-    
+
     if (m->m_number_of_ports <= 1)
       sdp_printf(p, "m=%s %u %s", media, m->m_port, proto);
     else
-      sdp_printf(p, "m=%s %u/%u %s", 
+      sdp_printf(p, "m=%s %u/%u %s",
                 media, m->m_port, m->m_number_of_ports, proto);
 
     if (m->m_rtpmaps) {
@@ -625,7 +625,7 @@ static void print_media(sdp_printer_t *p,
     if (m->m_connections)
 #ifdef nomore
     if (m->m_connections != sdp->sdp_connection)
-#endif      
+#endif
       print_connection_list(p, m->m_connections);
     if (m->m_bandwidths)
       print_bandwidths(p, m->m_bandwidths);
@@ -636,10 +636,10 @@ static void print_media(sdp_printer_t *p,
       if (!rm->rm_predef || p->pr_all_rtpmaps)
        sdp_printf(p, "a=rtpmap:%u %s/%lu%s%s" CRLF,
                   rm->rm_pt, rm->rm_encoding, rm->rm_rate,
-                  rm->rm_params ? "/" : "", 
+                  rm->rm_params ? "/" : "",
                   rm->rm_params ? rm->rm_params : "");
       if (rm->rm_fmtp)
-       sdp_printf(p, "a=fmtp:%u %s" CRLF, 
+       sdp_printf(p, "a=fmtp:%u %s" CRLF,
                   rm->rm_pt, rm->rm_fmtp);
     }
 
@@ -670,7 +670,7 @@ static void print_media(sdp_printer_t *p,
   }
 }
 
-static void print_text_list(sdp_printer_t *p, 
+static void print_text_list(sdp_printer_t *p,
                            const char *fmt, sdp_list_t const *l)
 {
   for (;l; l = l->l_next) {
@@ -698,11 +698,11 @@ static void sdp_printf(sdp_printer_t *p, const char *fmt, ...)
 
   while (p->pr_ok) {
     int n;
-    
-    va_start(ap, fmt); 
+
+    va_start(ap, fmt);
     n = vsnprintf(p->pr_buffer + p->pr_used, p->pr_bsiz - p->pr_used, fmt, ap);
     va_end(ap);
-    
+
     if (n > -1 && (size_t)n < p->pr_bsiz - p->pr_used) {
       p->pr_used += n;
       break;
@@ -716,7 +716,7 @@ static void sdp_printf(sdp_printer_t *p, const char *fmt, ...)
        }
        p->pr_owns_buffer = 0;
       }
-      else if (p->pr_may_realloc) {    
+      else if (p->pr_may_realloc) {
        char *buffer;
        size_t size;
        if (p->pr_bsiz < SDP_BLOCK)
index ddbc06f028ee4cb293b8347ee6663cebd5db4ca6..2b3ce8c0025073dec893bd4a7c0f1d6876545ce9 100644 (file)
 /**@internal
  * @file sdp_tag.c
  * @brief SDP Tags
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Mon May 12 12:11:30 2003 ppessi
- * 
+ *
  */
 
 #include "config.h"
@@ -43,5 +43,5 @@
 tag_typedef_t sdptag_any = NSTAG_TYPEDEF(*);
 
 tag_typedef_t sdptag_session = {{
-  TAG_NAMESPACE, "session", sdptag_session_class 
+  TAG_NAMESPACE, "session", sdptag_session_class
 }};
index 657571a0e1fe450dd87695eabaa55fda55f4a28e..bb39bca54b138df10806a5b4aedcf80fd18e541b 100644 (file)
@@ -98,7 +98,7 @@ struct sdp_session_s
   sdp_media_t       *sdp_media;         /**< Media descriptors */
 };
 
-/** Session description identification */ 
+/** Session description identification */
 struct sdp_origin_s
 {
   int               o_size;            /**< sizeof sdp_origin_t */
@@ -150,7 +150,7 @@ struct sdp_bandwidth_s
 {
   int              b_size;             /**< Size fo sdp_bandwidth_t */
   sdp_bandwidth_t *b_next;             /**< Next bw description in list */
-  sdp_bandwidth_e  b_modifier;         /**< Meaning of value 
+  sdp_bandwidth_e  b_modifier;         /**< Meaning of value
                                             (total, or per application).  */
   sdp_text_t      *b_modifier_name;     /**< Modifier if not well-known */
   unsigned long    b_value;            /**< Bandwidth in kilobits per second */
@@ -197,7 +197,7 @@ typedef enum {
   sdp_key_clear,                       /**< Key is included untransformed */
   sdp_key_base64,                      /**< Key is encoded with base64 */
   sdp_key_uri,                         /**< URI used to obtain a key */
-  sdp_key_prompt                       /**< No key is included, 
+  sdp_key_prompt                       /**< No key is included,
                                             prompt user for key */
 } sdp_key_method_e;
 
@@ -249,19 +249,19 @@ typedef enum
 
 /** Session mode. @note Identical to rtp_mode_t. */
 typedef enum {
-  sdp_inactive = 0, 
-  sdp_sendonly = 1, 
-  sdp_recvonly = 2, 
+  sdp_inactive = 0,
+  sdp_sendonly = 1,
+  sdp_recvonly = 2,
   sdp_sendrecv = sdp_sendonly | sdp_recvonly
 } sdp_mode_t;
 
 /** Media announcement.
- * 
+ *
  * This structure describes one media type, e.g., audio.  The description
  * contains the transport address (IP address and port) used for the group,
  * the transport protocol used, the media formats or RTP payload types, and
  * optionally media-specific bandwidth specification, encryption key and
- * attributes. 
+ * attributes.
  *
  * There is a pointer (m_user) for the application data, too.
  */
@@ -286,9 +286,9 @@ struct sdp_media_s
   sdp_attribute_t  *m_attributes;      /**< Media attributes */
 
   void             *m_user;            /**< User data. */
-  
+
   /** Rejected media */
-  unsigned          m_rejected : 1;     
+  unsigned          m_rejected : 1;
   /** Inactive, recvonly, sendonly, sendrecv */
   /* sdp_mode_t */ unsigned m_mode : 2;
   unsigned          : 0;
@@ -303,7 +303,7 @@ struct sdp_list_s
 };
 
 /** Mapping from RTP payload to codec.
- * 
+ *
  * The sdp_rtpmap_t() structure defines a mapping from an RTP payload to a
  * particular codec.  In case of well-known payloads, the sdp_rtpmap_t()
  * structure may be predefined, that is, generated by SDP parser without
@@ -437,8 +437,8 @@ SOFIAPUBFUN sdp_attribute_t  *sdp_attribute_find(sdp_attribute_t const *a,
                                                 char const *name);
 
 /** Find named attribute from given lists. */
-SOFIAPUBFUN sdp_attribute_t *sdp_attribute_find2(sdp_attribute_t const *a, 
-                                                sdp_attribute_t const *a2, 
+SOFIAPUBFUN sdp_attribute_t *sdp_attribute_find2(sdp_attribute_t const *a,
+                                                sdp_attribute_t const *a2,
                                                 char const *name);
 
 /** Get session mode from attribute list. */
@@ -446,26 +446,26 @@ SOFIAPUBFUN sdp_mode_t sdp_attribute_mode(sdp_attribute_t const *a,
                                          sdp_mode_t defmode);
 
 /** Get session mode from attribute list. */
-SOFIAPUBFUN sdp_attribute_t *sdp_attribute_by_mode(su_home_t *, 
+SOFIAPUBFUN sdp_attribute_t *sdp_attribute_by_mode(su_home_t *,
                                                   sdp_mode_t mode);
 
 /** Find a mapped attribute. */
-SOFIAPUBFUN 
+SOFIAPUBFUN
 sdp_attribute_t *sdp_attribute_mapped_find(sdp_attribute_t const *a,
                                           char const *name,
                                           int pt, char **return_result);
 
 /** Append a attribute to a list of attributes. */
-SOFIAPUBFUN void sdp_attribute_append(sdp_attribute_t **list, 
+SOFIAPUBFUN void sdp_attribute_append(sdp_attribute_t **list,
                                      sdp_attribute_t const *a);
 
 /** Replace a attribute within a list of attributes. */
-SOFIAPUBFUN int sdp_attribute_replace(sdp_attribute_t **list, 
+SOFIAPUBFUN int sdp_attribute_replace(sdp_attribute_t **list,
                                      sdp_attribute_t *a,
                                      sdp_attribute_t **return_replaced);
 
 /** Remove a named attribute from a list of attributes. */
-SOFIAPUBFUN sdp_attribute_t *sdp_attribute_remove(sdp_attribute_t **list, 
+SOFIAPUBFUN sdp_attribute_t *sdp_attribute_remove(sdp_attribute_t **list,
                                                  char const *name);
 
 /* Return 1 if m= line struct matches with given type and name */
@@ -505,8 +505,8 @@ enum sdp_parse_flags_e {
   /** Accept only conforming SDP */
   sdp_f_strict = 1,
   /** Accept any network type. */
-  sdp_f_anynet = 2,            
-  /** Reallocate message. */ 
+  sdp_f_anynet = 2,
+  /** Reallocate message. */
   sdp_f_realloc = 4,
   /** Include well-known rtpmaps in message, too */
   sdp_f_all_rtpmaps = 8,
index e513414c46aee4c87c657dbbd0a0f55f6e1563a4..098064e0d77e730ed9b53de4ee0cb1fa62c92fca 100644 (file)
@@ -26,7 +26,7 @@
 /** Defined when <sofia-sip/sdp_tag.h> has been included. */
 #define SDP_TAG_H
 
-/**@file sofia-sip/sdp_tag.h   
+/**@file sofia-sip/sdp_tag.h
  * @brief SDP tags
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -65,12 +65,12 @@ sdptag_session_ref, sdptag_session_vr(&(x))
 
 #if SU_HAVE_INLINE
 su_inline
-tag_value_t sdptag_session_v(struct sdp_session_s const *v) { 
-  return (tag_value_t)v; 
+tag_value_t sdptag_session_v(struct sdp_session_s const *v) {
+  return (tag_value_t)v;
 }
 su_inline
-tag_value_t sdptag_session_vr(struct sdp_session_s const **vp) { 
-  return (tag_value_t)vp; 
+tag_value_t sdptag_session_vr(struct sdp_session_s const **vp) {
+  return (tag_value_t)vp;
 }
 #else
 #define sdptag_session_v(v)   (tag_value_t)(v)
index 0be9cad1359ca22f40c3291133cd08b0b392e943..98cac4c908ed5b83b1ecdbc56b12ddb3859caa52 100644 (file)
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
   char buffer[2048];
   int  n;
   su_home_t *home = su_home_create();
-  int exitcode = 1; 
+  int exitcode = 1;
   FILE *f;
 
   if (argv[1] && strcmp(argv[1], "-"))
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
       perror("test_sdp");
     }
     else {
-      fprintf(stderr, "test_sdp: maximum length of sdp messages is %u bytes\n", 
+      fprintf(stderr, "test_sdp: maximum length of sdp messages is %u bytes\n",
              (unsigned)sizeof(buffer));
     }
     exit(1);
index 224a14524d4abb492b1cbacf431aea88c4844add..8b3a70102cb335e4cc6eef1eb1be3a87f0931da8 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@internal
  *
- * @CFILE sdp_torture.c  
+ * @CFILE sdp_torture.c
  *
  * Torture testing sdp module.
  *
@@ -59,10 +59,10 @@ char const *name = "torture_sdp.c";
 
 FILE *null;
 
-static char const e0_msg[] = 
+static char const e0_msg[] =
 "foo";
 
-static char const e1_msg[] = 
+static char const e1_msg[] =
     "v=1\n"
     "s=/sdp_torture\n"
     "o=sdp_torture 0 0 IN IP4 0.0.0.0\n"
@@ -102,7 +102,7 @@ static int test_error(void)
   END();
 }
 
-static char const s0_msg[] = 
+static char const s0_msg[] =
     "v=0\n"
     "s=/sdp_torture\n"
     "o=sdp_torture 0 0 IN IP4 0.0.0.0\n"
@@ -136,7 +136,7 @@ static int test_session(void)
 
   su_home_check(home2);
   TEST_1(home2);
-  
+
   TEST_1((parser = sdp_parse(home, s0_msg, sizeof(s0_msg), sdp_f_config)));
   TEST_1((sdp_src = sdp_session(parser)));
   TEST_1(sdp_src->sdp_media);
@@ -179,7 +179,7 @@ static int test_session(void)
   /* destroy the first home instance */
   su_home_check(home);
   su_home_unref(home);
-    
+
   /* access all cloned data by printing it */
   printer = sdp_print(home2, sdp_target, buffer, sizeof(buffer), 0);
   if (printer != NULL) {
@@ -188,7 +188,7 @@ static int test_session(void)
     if (tstflags & tst_verbatim) {
       printf("sdp_torture.c: parsed SDP message:\"%s\".\n", msg);
     }
-      
+
     sdp_printer_free(printer);
   }
 
@@ -224,7 +224,7 @@ static int test_session(void)
   END();
 }
 
-static char const s1_msg[] = 
+static char const s1_msg[] =
   "v=0\r\n"
   "o=- 2435697 2435697 IN IP4 172.21.137.44\r\n"
   "s=-\r\n"
@@ -238,7 +238,7 @@ static char const s1_msg[] =
   "a=fmtp:97 mode-set=\"0,1,2,3,4\"\r\n"
   "a=ptime:400\r\n";
 
-static char const s2_msg[] = 
+static char const s2_msg[] =
   "v=0\r\n"
   "o=- 308519342 2 IN IP4 172.168.1.55\r\n"
   "s=-\r\n"
@@ -413,7 +413,7 @@ static int test_session2(void)
           &sdp_rtpmap_cn_reserved);
     TEST_1(!rm->rm_next);
   }
-  
+
   TEST_1((parser = sdp_parse(home, s2_msg, sizeof (s2_msg), 0)));
   TEST_1((sdp = sdp_session(parser)));
   TEST_1(m = sdp->sdp_media);
@@ -438,7 +438,7 @@ static int test_session2(void)
   END();
 }
 
-static char const s3_msg[] = 
+static char const s3_msg[] =
   "v=0\r\n"
   "o=- 2435697 2435697 IN IP4 172.21.137.44\r\n"
   "s=-\r\n"
@@ -461,7 +461,7 @@ static int test_sanity(void)
   su_home_check(home); TEST_1(home);
 
   TEST_1((parser = sdp_parse(home, s3_msg, sizeof(s3_msg) - 1, 0)));
-  
+
   TEST_1(sdp_sanity_check(parser) == 0);
 
   su_home_unref(home);
@@ -469,7 +469,7 @@ static int test_sanity(void)
   END();
 }
 
-static char const pint_msg[] = 
+static char const pint_msg[] =
   "v=0\r\n"
   "o=- 2353687640 2353687640 IN IP4 128.3.4.5\r\n"
   "s=marketing\r\n"
@@ -479,7 +479,7 @@ static char const pint_msg[] =
   "m=audio 1 voice -\r\n"
   ;
 
-static char const pint_torture_msg[] = 
+static char const pint_torture_msg[] =
   "v=0\r\n"
   "o=- 2353687640 2353687640 IN IP4 128.3.4.5\r\n"
   "s=marketing\r\n"
@@ -514,7 +514,7 @@ static int test_pint(void)
   TEST_1((parser = sdp_parse(home, pint_torture_msg, sizeof(pint_torture_msg) - 1,
                             sdp_f_anynet)));
   TEST_1((sdp = sdp_session(parser)));
-  
+
   su_home_check(home);
   su_home_unref(home);
 
@@ -555,16 +555,16 @@ int test_list(void)
 }
 
 static
-sdp_rtpmap_t const rm0[1] = 
-  {{ 
+sdp_rtpmap_t const rm0[1] =
+  {{
       sizeof(rm0), NULL, "AMR", 8000, "1",
       "mode-set=4,5,6 interleaving crc use-redundancy=1",
       0, 96, 0
   }};
 
 static
-sdp_rtpmap_t const rm1[1] = 
-  {{ 
+sdp_rtpmap_t const rm1[1] =
+  {{
       sizeof(rm1), (sdp_rtpmap_t *)rm0, "PCMA", 8000, "1",
       NULL,
       1, 8, 0,
@@ -605,7 +605,7 @@ int test_rtpmap(void)
 
 static sdp_attribute_t const a0[1] =
   {{ sizeof(a0), NULL, "foo", "2"}};
-static sdp_attribute_t const a1[1] = 
+static sdp_attribute_t const a1[1] =
   {{ sizeof(a1), (sdp_attribute_t *)a0, "bar", "1" }};
 
 static int test_attribute(void)
@@ -648,12 +648,12 @@ static int test_attribute(void)
   replaced = (void *)-1;
   TEST(sdp_attribute_replace(&list, NULL, &replaced), -1);
   TEST_P(replaced, NULL);
-  TEST(sdp_attribute_replace(&list, a, &replaced), 0); 
+  TEST(sdp_attribute_replace(&list, a, &replaced), 0);
   TEST_P(replaced, NULL);
-  TEST(sdp_attribute_replace(&list, a_new, &replaced), 1); 
+  TEST(sdp_attribute_replace(&list, a_new, &replaced), 1);
   TEST_P(replaced, a);
 
-  TEST_VOID(sdp_attribute_append(&list, a)); 
+  TEST_VOID(sdp_attribute_append(&list, a));
 
   TEST_P(sdp_attribute_remove(&list, "bAr"), a_new);
   TEST_P(sdp_attribute_remove(&list, "BAR"), a);
@@ -672,7 +672,7 @@ static int test_connection(void)
   END();
 }
 
-static char const media_msg[] = 
+static char const media_msg[] =
 "v=0\n"
 "s=/sdp_torture\n"
 "o=sdp_torture 0 0 IN IP4 1.2.3.4\n"
@@ -689,13 +689,13 @@ static char const media_msg[] =
 "c=IN IP4 2.3.4.5\n";
 
 static sdp_media_t const m0[1] =
-  {{ sizeof(m0), 
-     NULL, 
+  {{ sizeof(m0),
+     NULL,
      NULL,
      sdp_media_audio,
-     NULL, 
-     1234, 
-     5, 
+     NULL,
+     1234,
+     5,
      sdp_proto_udp,
      "udp",
   }};
@@ -781,20 +781,20 @@ static int test_time(void)
   TEST_1(sdp_time_cmp(t1, t1) == 0);
   TEST_1(sdp_time_cmp(t1, t2) == 0);
   TEST_1(sdp_time_cmp(t2, t1) == 0);
-  TEST_1((t = t->t_next)); *t1 = *t; t1->t_next = NULL; 
+  TEST_1((t = t->t_next)); *t1 = *t; t1->t_next = NULL;
   TEST_1(sdp_time_cmp(t1, t2) > 0);
   TEST_1(sdp_time_cmp(t2, t1) < 0);
-  TEST_1((t = t->t_next)); *t2 = *t; t2->t_next = NULL; 
+  TEST_1((t = t->t_next)); *t2 = *t; t2->t_next = NULL;
   TEST_1(t2->t_zone); TEST_1(t2->t_repeat);
   TEST_1(sdp_time_cmp(t2, t2) == 0);
   TEST_1(sdp_time_cmp(t1, t2) > 0);
   TEST_1(sdp_time_cmp(t2, t1) < 0);
-  TEST_1((t = t->t_next)); *t1 = *t; t1->t_next = NULL; 
+  TEST_1((t = t->t_next)); *t1 = *t; t1->t_next = NULL;
   TEST_1(t1->t_zone); TEST_1(t1->t_repeat);
   TEST_1(sdp_time_cmp(t1, t1) == 0);
   TEST_1(sdp_time_cmp(t2, t2) == 0);
   TEST_1(sdp_time_cmp(t1, t2) == 0);
-  
+
   sdp_parser_free(parser);
 
   END();
@@ -829,9 +829,9 @@ static int test_build(void)
 
   TEST_1(home = su_home_create());
 
-  /* 
+  /*
    * Allocate an SDP structure using su_salloc().
-   * su_salloc() puts memory area size to the beginning of structure 
+   * su_salloc() puts memory area size to the beginning of structure
    * and zeroes rest of the structure.
    */
   TEST_1(sdp = su_salloc(home, sizeof(*sdp)));
@@ -850,7 +850,7 @@ static int test_build(void)
   o->o_id = rand();
   o->o_version = 1;
   o->o_address = c;
-  
+
   c->c_nettype = sdp_net_in;
   c->c_addrtype = sdp_addr_ip4;
   c->c_address = "172.21.40.40";
@@ -860,10 +860,10 @@ static int test_build(void)
   m->m_port = 5004;
   m->m_proto = sdp_proto_rtp; m->m_proto_name = "RTP/AVP";
   m->m_rtpmaps = rm;
-  
+
   rm->rm_predef = 1;
   rm->rm_pt = 8;
-  rm->rm_encoding = "PCMA"; 
+  rm->rm_encoding = "PCMA";
   rm->rm_rate = 8000;
 
   TEST_1(m1 = su_salloc(home, sizeof(*m1)));
index 2c96809f0d0cbe578ae58faf1bfbe960301e9f05..5458021d047641ea48aadafe6088bae243a3925f 100644 (file)
@@ -23,7 +23,7 @@ IF YOUR HEADER IS A STANDARD ONE
     You should add a typedef line like this:
 
      typedef struct sip_example_s sip_example_t;
-       
+
     Note that the typedefs are documented together with the
     implementation in the .c file.
 
@@ -50,16 +50,16 @@ IF YOUR HEADER IS A STANDARD ONE
   * Add entry to sip_extra_headers.txt:
    - In this case:
      example @NEW_2_0 /* Example header */
-   - The first is the base C name used for functions and types related to 
+   - The first is the base C name used for functions and types related to
      the type. The AWK script msg_parser.awk automatically creates the
      default prototypes and tags for the newly created header. It will
      complain about mismatches between header name and the base name.
 
-   - If the entry is before #### DEFAULT HEADER LIST ENDS HERE #### 
+   - If the entry is before #### DEFAULT HEADER LIST ENDS HERE ####
      the new header is added to the default parser
    - If after, the new header is added only to the extended parser.
 
-   - The extended parser will be used after call to 
+   - The extended parser will be used after call to
      sip_update_default_mclass(NULL)
 
   * Write parsing tests for your new headers in torture_sip.c:
@@ -79,10 +79,10 @@ IF YOUR HEADER IS A STANDARD ONE
       + sip_example_dup_xtra(), sip_example_dup_one()
 
   * If you added a .c file, add to the Makefile.am
-    - remember to run autogen.sh unless you have given --enable-maintainer-mode 
+    - remember to run autogen.sh unless you have given --enable-maintainer-mode
       to configure script
 
-  * Run "make check" after you are ready 
+  * Run "make check" after you are ready
 
   * Run "make check" after you are ready. Really.
 
@@ -95,10 +95,10 @@ IF YOUR HEADERS ARE COMPLETELY NON-STANDARD
     - There is an example package sofia-sip-2543.tar.gz, available from
       sofia-sip.sourceforge.net
 
-      See the extension package for 1) 
+      See the extension package for 1)
 
-    - Create a header template for your header just like 
-      sofia-sip/rfc2543.h.in (found in <sofia-sip/rfc2543.h> package), 
+    - Create a header template for your header just like
+      sofia-sip/rfc2543.h.in (found in <sofia-sip/rfc2543.h> package),
       e.g, sip_example.h.in:
 
 ---8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<---
@@ -107,11 +107,11 @@ IF YOUR HEADERS ARE COMPLETELY NON-STANDARD
  * Template for <sip_example.h>.
  */
 \f
-#ifndef SIP_EXAMPLE_H 
+#ifndef SIP_EXAMPLE_H
 /** Defined when <sip_example.h> has been included. */
-#define SIP_EXAMPLE_H 
+#define SIP_EXAMPLE_H
 
-/**@file sip_example.h 
+/**@file sip_example.h
 *
  * @brief Example header.
  *
index 73de9a8bb7bd241c2b3d4811841a17e25fb4ff69..93f094cdae318c4e54e9821e285e7cfe066c32d6 100644 (file)
@@ -1,7 +1,7 @@
 2006-01-25  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-       * Doxyfile (INPUT): Missing sip_dll.c broke refdoc 
-       build. Now changed so that individual are not listed 
+       * Doxyfile (INPUT): Missing sip_dll.c broke refdoc
+       build. Now changed so that individual are not listed
        anymore in INPUT.
 
 2006-01-10  Kai Vehmanen  <kai.vehmanen@nokia.com>
@@ -52,7 +52,7 @@
 
        * sip_basic.c: Not encoding comment in Contact. Always using
        name-addr form for Route headers.
+
 2005-07-18  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * Initial import of the module to Sofia-SIP tree.
index ca6472b73276b4bf4eb991685751648047876c2c..10e13798546f0c59db7ba9ea1124e7b450d881b9 100644 (file)
@@ -1,7 +1,7 @@
 PROJECT_NAME         = "sip"
 OUTPUT_DIRECTORY     = ../docs/html/sip
 
-INPUT               = @srcdir@/sofia-sip sofia-sip @srcdir@/sip.docs @srcdir@/sip_parser.docs @srcdir@ . 
+INPUT               = @srcdir@/sofia-sip sofia-sip @srcdir@/sip.docs @srcdir@/sip_parser.docs @srcdir@ .
 
 @INCLUDE_PATH = . @srcdir@
 @INCLUDE = ../docs/Doxyfile.conf
index 341dce991a6dca69842a7a3854c1f82e6500f989..9052f13b76e9c30a73aea6639bf98dfd7e87bc88 100644 (file)
@@ -1,19 +1,19 @@
 /* SIP grammar from RFC3261
- * 
+ *
  *    alphanum  =  ALPHA / DIGIT
- * 
+ *
  *    reserved    =  ";" / "/" / "?" / ":" / "@" / "&" / "=" / "+"
  *                   / "$" / ","
  *    unreserved  =  alphanum / mark
  *    mark        =  "-" / "_" / "." / "!" / "~" / "*" / "'"
  *                   / "(" / ")"
  *    escaped     =  "%" HEXDIG HEXDIG
- * 
+ *
  *    LWS  =  [*WSP CRLF] 1*WSP ; linear whitespace
  *    SWS  =  [LWS] ; sep whitespace
- * 
+ *
  *    HCOLON  =  *( SP / HTAB ) ":" SWS
- * 
+ *
  *    TEXT-UTF8-TRIM  =  1*TEXT-UTF8char *(*LWS TEXT-UTF8char)
  *    TEXT-UTF8char   =  %x21-7E / UTF8-NONASCII
  *    UTF8-NONASCII   =  %xC0-DF 1UTF8-CONT
@@ -22,9 +22,9 @@
  *                    /  %xF8-Fb 4UTF8-CONT
  *                    /  %xFC-FD 5UTF8-CONT
  *    UTF8-CONT       =  %x80-BF
- * 
+ *
  *    LHEX  =  DIGIT / %x61-66 ;lowercase a-f
- * 
+ *
  *    token       =  1*(alphanum / "-" / "." / "!" / "%" / "*"
  *                   / "_" / "+" / "`" / "'" / "~" )
  *    separators  =  "(" / ")" / "<" / ">" / "@" /
@@ -37,7 +37,7 @@
  *                   ":" / "\" / DQUOTE /
  *                   "/" / "[" / "]" / "?" /
  *                   "{" / "}" )
- * 
+ *
  *    STAR    =  SWS "*" SWS ; asterisk
  *    SLASH   =  SWS "/" SWS ; slash
  *    EQUAL   =  SWS "=" SWS ; equal
  *    COLON   =  SWS ":" SWS ; colon
  *    LDQUOT  =  SWS DQUOTE; open double quotation mark
  *    RDQUOT  =  DQUOTE SWS ; close double quotation mark
- * 
+ *
  *    comment  =  LPAREN *(ctext / quoted-pair / comment) RPAREN
  *    ctext    =  %x21-27 / %x2A-5B / %x5D-7E / UTF8-NONASCII
  *                / LWS
- * 
+ *
  *    quoted-string  =  SWS DQUOTE *(qdtext / quoted-pair ) DQUOTE
  *    qdtext         =  LWS / %x21 / %x23-5B / %x5D-7E
  *                      / UTF8-NONASCII
- * 
+ *
  *    quoted-pair  =  "\" (%x00-09 / %x0B-0C
  *                    / %x0E-7F)
- * 
+ *
  *    SIP-URI          =  "sip:" [ userinfo ] hostport
  *                        uri-parameters [ headers ]
  *    SIPS-URI         =  "sips:" [ userinfo ] hostport
@@ -84,7 +84,7 @@
  *    hexseq         =  hex4 *( ":" hex4)
  *    hex4           =  1*4HEXDIG
  *    port           =  1*DIGIT
- * 
+ *
  *    uri-parameters    =  *( ";" uri-parameter)
  *    uri-parameter     =  transport-param / user-param / method-param
  *                         / ttl-param / maddr-param / lr-param / other-param
  *    pvalue            =  1*paramchar
  *    paramchar         =  param-unreserved / unreserved / escaped
  *    param-unreserved  =  "[" / "]" / "/" / ":" / "&" / "+" / "$"
- * 
+ *
  *    headers         =  "?" header *( "&" header )
  *    header          =  hname "=" hvalue
  *    hname           =  1*( hnv-unreserved / unreserved / escaped )
  *    hvalue          =  *( hnv-unreserved / unreserved / escaped )
  *    hnv-unreserved  =  "[" / "]" / "/" / "?" / ":" / "+" / "$"
- * 
+ *
  *    SIP-message    =  Request / Response
  *    Request        =  Request-Line
  *                      *( message-header )
  *                      / ";" / ":" / "@" / "&" / "=" / "+" )
  *    query          =  *uric
  *    SIP-Version    =  "SIP" "/" 1*DIGIT "." 1*DIGIT
- * 
+ *
  *    message-header  =  (Accept
  *                    /  Accept-Encoding
  *                    /  Accept-Language
  *                    /  Warning
  *                    /  WWW-Authenticate
  *                    /  extension-header) CRLF
- * 
+ *
  *    INVITEm           =  %x49.4E.56.49.54.45 ; INVITE in caps
  *    ACKm              =  %x41.43.4B ; ACK in caps
  *    OPTIONSm          =  %x4F.50.54.49.4F.4E.53 ; OPTIONS in caps
  *                         *( message-header )
  *                         CRLF
  *                         [ message-body ]
- * 
+ *
  *    Status-Line     =  SIP-Version SP Status-Code SP Reason-Phrase CRLF
  *    Status-Code     =  Informational
  *                   /   Redirection
  *    extension-code  =  3DIGIT
  *    Reason-Phrase   =  *(reserved / unreserved / escaped
  *                       / UTF8-NONASCII / UTF8-CONT / SP / HTAB)
- * 
+ *
  *    Informational  =  "100"  ;  Trying
  *                  /   "180"  ;  Ringing
  *                  /   "181"  ;  Call Is Being Forwarded
  *                  /   "182"  ;  Queued
  *                  /   "183"  ;  Session Progress
- * 
+ *
  *    Success  =  "200"  ;  OK
- * 
+ *
  *    Redirection  =  "300"  ;  Multiple Choices
  *                /   "301"  ;  Moved Permanently
  *                /   "302"  ;  Moved Temporarily
  *                /   "305"  ;  Use Proxy
  *                /   "380"  ;  Alternative Service
- * 
+ *
  *    Client-Error  =  "400"  ;  Bad Request
  *                 /   "401"  ;  Unauthorized
  *                 /   "402"  ;  Payment Required
  *                 /   "488"  ;  Not Acceptable Here
  *                 /   "491"  ;  Request Pending
  *                 /   "493"  ;  Undecipherable
- * 
+ *
  *    Server-Error  =  "500"  ;  Internal Server Error
  *                 /   "501"  ;  Not Implemented
  *                 /   "502"  ;  Bad Gateway
  *                 /   "504"  ;  Server Time-out
  *                 /   "505"  ;  SIP Version not supported
  *                 /   "513"  ;  Message Too Large
- * 
+ *
  *    Global-Failure  =  "600"  ;  Busy Everywhere
  *                   /   "603"  ;  Decline
  *                   /   "604"  ;  Does not exist anywhere
  *                   /   "606"  ;  Not Acceptable
- * 
+ *
  *    Accept         =  "Accept" HCOLON
  *                       [ accept-range *(COMMA accept-range) ]
  *    accept-range   =  media-range *(SEMI accept-param)
  *                      / ( "1" [ "." 0*3("0") ] )
  *    generic-param  =  token [ EQUAL gen-value ]
  *    gen-value      =  token / host / quoted-string
- * 
+ *
  *    Accept-Encoding  =  "Accept-Encoding" HCOLON
  *                         [ encoding *(COMMA encoding) ]
  *    encoding         =  codings *(SEMI accept-param)
  *    codings          =  content-coding / "*"
  *    content-coding   =  token
- * 
+ *
  *    Accept-Language  =  "Accept-Language" HCOLON
  *                         [ language *(COMMA language) ]
  *    language         =  language-range *(SEMI accept-param)
  *    language-range   =  ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) / "*" )
- * 
+ *
  *    Alert-Info   =  "Alert-Info" HCOLON alert-param *(COMMA alert-param)
  *    alert-param  =  LAQUOT absoluteURI RAQUOT *( SEMI generic-param )
- * 
+ *
  *    Allow  =  "Allow" HCOLON [Method *(COMMA Method)]
- * 
+ *
  *    Authorization     =  "Authorization" HCOLON credentials
  *    credentials       =  ("Digest" LWS digest-response)
  *                         / other-response
  *    other-response    =  auth-scheme LWS auth-param
  *                         *(COMMA auth-param)
  *    auth-scheme       =  token
- * 
+ *
  *    Authentication-Info  =  "Authentication-Info" HCOLON ainfo
  *                            *(COMMA ainfo)
  *    ainfo                =  nextnonce / message-qop
  *    nextnonce            =  "nextnonce" EQUAL nonce-value
  *    response-auth        =  "rspauth" EQUAL response-digest
  *    response-digest      =  LDQUOT *LHEX RDQUOT
- * 
+ *
  *    Call-ID  =  ( "Call-ID" / "i" ) HCOLON callid
  *    callid   =  word [ "@" word ]
- * 
+ *
  *    Call-Info   =  "Call-Info" HCOLON info *(COMMA info)
  *    info        =  LAQUOT absoluteURI RAQUOT *( SEMI info-param)
  *    info-param  =  ( "purpose" EQUAL ( "icon" / "info"
  *                   / "card" / token ) ) / generic-param
- * 
+ *
  *    Contact        =  ("Contact" / "m" ) HCOLON
  *                      ( STAR / (contact-param *(COMMA contact-param)))
  *    contact-param  =  (name-addr / addr-spec) *(SEMI contact-params)
  *    name-addr      =  [ display-name ] LAQUOT addr-spec RAQUOT
  *    addr-spec      =  SIP-URI / SIPS-URI / absoluteURI
  *    display-name   =  *(token LWS)/ quoted-string
- * 
+ *
  *    contact-params     =  c-p-q / c-p-expires
  *                          / contact-extension
  *    c-p-q              =  "q" EQUAL qvalue
  *    c-p-expires        =  "expires" EQUAL delta-seconds
  *    contact-extension  =  generic-param
  *    delta-seconds      =  1*DIGIT
- * 
+ *
  *    Content-Disposition   =  "Content-Disposition" HCOLON
  *                             disp-type *( SEMI disp-param )
  *    disp-type             =  "render" / "session" / "icon" / "alert"
  *                             / other-handling )
  *    other-handling        =  token
  *    disp-extension-token  =  token
- * 
+ *
  *    Content-Encoding  =  ( "Content-Encoding" / "e" ) HCOLON
  *                         content-coding *(COMMA content-coding)
- * 
+ *
  *    Content-Language  =  "Content-Language" HCOLON
  *                         language-tag *(COMMA language-tag)
  *    language-tag      =  primary-tag *( "-" subtag )
  *    primary-tag       =  1*8ALPHA
  *    subtag            =  1*8ALPHA
- * 
+ *
  *    Content-Length  =  ( "Content-Length" / "l" ) HCOLON 1*DIGIT
  *    Content-Type     =  ( "Content-Type" / "c" ) HCOLON media-type
  *    media-type       =  m-type SLASH m-subtype *(SEMI m-parameter)
  *    m-parameter      =  m-attribute EQUAL m-value
  *    m-attribute      =  token
  *    m-value          =  token / quoted-string
- * 
+ *
  *    CSeq  =  "CSeq" HCOLON 1*DIGIT LWS Method
- * 
+ *
  *    Date          =  "Date" HCOLON SIP-date
  *    SIP-date      =  rfc1123-date
  *    rfc1123-date  =  wkday "," SP date1 SP time SP "GMT"
  *    month         =  "Jan" / "Feb" / "Mar" / "Apr"
  *                     / "May" / "Jun" / "Jul" / "Aug"
  *                     / "Sep" / "Oct" / "Nov" / "Dec"
- * 
+ *
  *    Error-Info  =  "Error-Info" HCOLON error-uri *(COMMA error-uri)
  *    error-uri   =  LAQUOT absoluteURI RAQUOT *( SEMI generic-param )
- * 
+ *
  *    Expires     =  "Expires" HCOLON delta-seconds
  *    From        =  ( "From" / "f" ) HCOLON from-spec
  *    from-spec   =  ( name-addr / addr-spec )
  *                   *( SEMI from-param )
  *    from-param  =  tag-param / generic-param
  *    tag-param   =  "tag" EQUAL token
- * 
+ *
  *    In-Reply-To  =  "In-Reply-To" HCOLON callid *(COMMA callid)
- * 
+ *
  *    Max-Forwards  =  "Max-Forwards" HCOLON 1*DIGIT
- * 
+ *
  *    MIME-Version  =  "MIME-Version" HCOLON 1*DIGIT "." 1*DIGIT
- * 
+ *
  *    Min-Expires  =  "Min-Expires" HCOLON delta-seconds
- * 
+ *
  *    Organization  =  "Organization" HCOLON [TEXT-UTF8-TRIM]
- * 
+ *
  *    Priority        =  "Priority" HCOLON priority-value
  *    priority-value  =  "emergency" / "urgent" / "normal"
  *                       / "non-urgent" / other-priority
  *    other-priority  =  token
- * 
+ *
  *    Proxy-Authenticate  =  "Proxy-Authenticate" HCOLON challenge
  *    challenge           =  ("Digest" LWS digest-cln *(COMMA digest-cln))
  *                           / other-challenge
  *    qop-options         =  "qop" EQUAL LDQUOT qop-value
  *                           *("," qop-value) RDQUOT
  *    qop-value           =  "auth" / "auth-int" / token
- * 
+ *
  *    Proxy-Authorization  =  "Proxy-Authorization" HCOLON credentials
- * 
+ *
  *    Proxy-Require  =  "Proxy-Require" HCOLON option-tag
  *                      *(COMMA option-tag)
  *    option-tag     =  token
- * 
+ *
  *    Record-Route  =  "Record-Route" HCOLON rec-route *(COMMA rec-route)
  *    rec-route     =  name-addr *( SEMI rr-param )
  *    rr-param      =  generic-param
- * 
+ *
  *    Reply-To      =  "Reply-To" HCOLON rplyto-spec
  *    rplyto-spec   =  ( name-addr / addr-spec )
  *                     *( SEMI rplyto-param )
  *    rplyto-param  =  generic-param
  *    Require       =  "Require" HCOLON option-tag *(COMMA option-tag)
- * 
+ *
  *    Retry-After  =  "Retry-After" HCOLON delta-seconds
  *                    [ comment ] *( SEMI retry-param )
- * 
+ *
  *    retry-param  =  ("duration" EQUAL delta-seconds)
  *                    / generic-param
- * 
+ *
  *    Route        =  "Route" HCOLON route-param *(COMMA route-param)
  *    route-param  =  name-addr *( SEMI rr-param )
- * 
+ *
  *    Server           =  "Server" HCOLON server-val *(LWS server-val)
  *    server-val       =  product / comment
  *    product          =  token [SLASH product-version]
  *    product-version  =  token
- * 
+ *
  *    Subject  =  ( "Subject" / "s" ) HCOLON [TEXT-UTF8-TRIM]
- * 
+ *
  *    Supported  =  ( "Supported" / "k" ) HCOLON
  *                  [option-tag *(COMMA option-tag)]
- * 
+ *
  *    Timestamp  =  "Timestamp" HCOLON 1*(DIGIT)
  *                   [ "." *(DIGIT) ] [ LWS delay ]
  *    delay      =  *(DIGIT) [ "." *(DIGIT) ]
- * 
+ *
  *    To        =  ( "To" / "t" ) HCOLON ( name-addr
  *                 / addr-spec ) *( SEMI to-param )
  *    to-param  =  tag-param / generic-param
- * 
+ *
  *    Unsupported  =  "Unsupported" HCOLON option-tag *(COMMA option-tag)
  *    User-Agent  =  "User-Agent" HCOLON server-val *(LWS server-val)
- * 
+ *
  *    Via               =  ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
  *    via-parm          =  sent-protocol LWS sent-by *( SEMI via-params )
  *    via-params        =  via-ttl / via-maddr
  *                         / other-transport
  *    sent-by           =  host [ COLON port ]
  *    ttl               =  1*3DIGIT ; 0 to 255
- * 
+ *
  *    Warning        =  "Warning" HCOLON warning-value *(COMMA warning-value)
  *    warning-value  =  warn-code SP warn-agent SP warn-text
  *    warn-code      =  3DIGIT
  *                      ;  the Warning header, for use in debugging
  *    warn-text      =  quoted-string
  *    pseudonym      =  token
- * 
+ *
  *    WWW-Authenticate  =  "WWW-Authenticate" HCOLON challenge
- * 
+ *
  *    extension-header  =  header-name HCOLON header-value
  *    header-name       =  token
  *    header-value      =  *(TEXT-UTF8char / UTF8-CONT / LWS)
index de29fae6222db9cce6cd3c08e7638c0c09461ecb..ac6c41b592abdec80bc41d27b7cb1f4428518b72 100644 (file)
@@ -36,8 +36,8 @@ shift
 rc=0
 
 for n in "$@";
-do 
-    if "$msg_test" < "$n" > /dev/null ; then 
+do
+    if "$msg_test" < "$n" > /dev/null ; then
        true
     else
        echo "$n: ERROR"; rc=1
index 7a5aeb78de55d80c0544eb57dbf216b0be5afd1f..0ca2c88915a161610b45daf393e4b5024355e368 100755 (executable)
@@ -41,20 +41,20 @@ fi
 test=./test_sip_msg
 
 # These are messages that the parser should pass
-good="-t test1.txt test2.txt test3.txt test4.txt 
-      -u test5.txt -t test6.txt test7.txt -u test8.txt -t test9.txt 
-      test14.txt test20.txt test23.txt test24.txt test31.txt 
+good="-t test1.txt test2.txt test3.txt test4.txt
+      -u test5.txt -t test6.txt test7.txt -u test8.txt -t test9.txt
+      test14.txt test20.txt test23.txt test24.txt test31.txt
       own1.txt own2.txt own3.txt own4.txt own5.txt own6.txt"
 # These are messages that the parser should fail
-bad="test10.txt test11.txt test12.txt test13.txt test15.txt 
-     test16.txt test17.txt test18.txt test19.txt 
-     test21.txt test22.txt 
+bad="test10.txt test11.txt test12.txt test13.txt test15.txt
+     test16.txt test17.txt test18.txt test19.txt
+     test21.txt test22.txt
      test26.txt test29.txt test33.txt
-     test35.txt 
+     test35.txt
      test40.txt"
 # These are ugly messages that parser should pass
-ugly="-t test25.txt -u test27.txt test28.txt -t test30.txt 
-      -u test32.txt test34.txt -t test36.txt -u test37.txt 
+ugly="-t test25.txt -u test27.txt test28.txt -t test30.txt
+      -u test32.txt test34.txt -t test36.txt -u test37.txt
       test38.txt test39.txt test41.txt test42.txt"
 
 # These are messages that parser should pass, but it does not
@@ -64,12 +64,12 @@ baddish=""
 
 flag=-t
 for n in $good $ugly;
-do 
+do
     if test $n = -t ; then
        flag=$n
     elif test $n = -u ; then
        flag=
-    elif "$test" $flag < "$srcdir/tests/$n" > /dev/null ; then 
+    elif "$test" $flag < "$srcdir/tests/$n" > /dev/null ; then
        echo "PASS: $n"
     else
        echo "ERROR: $n"; rc=1
@@ -77,8 +77,8 @@ do
 done
 
 for n in $bad;
-do 
-    if "$test" -t < "$srcdir/tests/$n" > /dev/null 2>/dev/null ; then 
+do
+    if "$test" -t < "$srcdir/tests/$n" > /dev/null 2>/dev/null ; then
        echo "ERROR: $n (no error detected)"; rc=1
     else
        echo "PASS: $n"
index af349299986a2a4eec549c98d82b1cc6fb88e5d7..3e73b0384abb17d28a95fb19c00c5de92e656deb 100644 (file)
@@ -44,7 +44,7 @@
  * that drives the parsing process and invokes the SIP parser for each
  * header. As there are no framing between SIP messages, the parser
  * considers any received data, be it a UDP datagram or a TCP stream, as a
- * @em message @em stream, which may consist of one or more SIP messages. 
+ * @em message @em stream, which may consist of one or more SIP messages.
  * The parser works by first separating stream into fragments, then building
  * a complete message based on parsing result. After a message is completed,
  * it can be given to the message stream customer (typically a protocol
@@ -57,7 +57,7 @@
  * one-by-one from the message. After the parser encounters an empty line
  * separating the headers and the message body (payload), it invokes a
  * function parsing the separator and payload fragment(s). When the message
- * is complete, the parser can hand the message over to the protocol engine. 
+ * is complete, the parser can hand the message over to the protocol engine.
  * Then it is ready to start again with first fragment of the next message.
  *
  * @image html sip-parser.gif Separating byte stream to messages
@@ -70,7 +70,7 @@
  * fragment chain, and a whole other stuff is held by the generic message
  * type, #msg_t, defined in <sofia-sip/msg.h>. The internal structure of #msg_t is
  * known only within @b msg module and it is hidden from other modules.
- * 
+ *
  * The abstract message module @b msg also drives the reverse process,
  * invoking the encoding method of each fragment so that the whole outgoing
  * SIP message is encoded properly.
@@ -96,7 +96,7 @@
  * For instance, the @From header has following syntax:
  *
  * @code
- * from           = ("From" | "f") ":" 
+ * from           = ("From" | "f") ":"
  *                  ( name-addr | addr-spec ) *( ";" addr-params )
  * name-addr      = [ display-name ] "<" addr-spec ">"
  * addr-spec      = SIP-URL | URI
  * access certain headers at the SIP message level, for example, accessing
  * directly the @From header instead of going through all headers and
  * examining their name. The structured view to the SIP message is provided
- * via a C struct with type #sip_t. 
+ * via a C struct with type #sip_t.
  *
  * In other words, a single message is represented by two types, first type
  * (#msg_t) is private to the msg module and inaccessable by an application
  *   int                 sip_flags;
  *
  *   sip_error_t        *sip_error;       // Erroneous headers
- * 
+ *
  *   sip_request_t      *sip_request;      // Request line
  *   sip_status_t       *sip_status;       // Status line
  *
  * pointers to the headers according to their type. If there are multiple
  * headers of the same type (like there are two @Via headers in the above
  * message), the headers are put into a single-linked list.
- * 
+ *
  * Each fragment has pointers to successing and preceding fragment. It also
  * contains pointer to the corresponding data within the I/O buffer and its
  * length.
- * 
+ *
  * The main purpose of the fragment chain is to preserve the original order
  * of the headers.  If there were an third @Via header after @CSeq in the
  * message, the fragment representing it would be after the @CSeq header in
 
 /**@ingroup sip_headers
  * @defgroup sip_header_x SIP Header X - Conventions
- * 
+ *
  * For a SIP header X, there are types, functions, macros and global data
  * declared in <sofia-sip/sip_protos.h> and <sofia-sip/sip_hclass.h> as
  * follows:
  *  - sip_X_init() initializes a dynamic instance of #sip_X_t,
  *  - sip_is_X() tests if header object is instance of header X,
  *  - sip_X_make() creates a header X object by decoding given string,
- *  - sip_X_format() creates a header X object by decoding given 
+ *  - sip_X_format() creates a header X object by decoding given
  *    printf() list,
- *  - sip_X_dup() duplicates (deeply copies) the header X, 
+ *  - sip_X_dup() duplicates (deeply copies) the header X,
  *  - sip_X_copy() copies the header X,
- *  - #msg_hclass_t #sip_X_class[] contains the @em header @em class 
+ *  - #msg_hclass_t #sip_X_class[] contains the @em header @em class
  *    for header X.
- * 
+ *
  * All header structures contain the common part, a #sip_common_t structure
  * (@a X_common[]), a link to the next header in list (@a X_next), and
  * various fields describing the header value (in this case, @a X_value).
  *   struct msg_common_s {
  *     msg_header_t       *h_succ;   // Pointer to succeeding fragment
  *     msg_header_t      **h_prev;   // Pointer to preceeding fragment
- *     msg_hclass_t       *h_class;  // Header class 
+ *     msg_hclass_t       *h_class;  // Header class
  *     void const         *h_data;   // Encoded data
  *     usize_t             h_len;    // Encoding length (including CRLF)
  *   } X_common[1];
  * parameters. The content of parameters is not parsed, they are just
  * separated from each other and then stored in an dynamically allocated
  * array of string pointers. Pointer to the array is stored to @a X_params.
- * 
+ *
  * For more complex header structures, see #sip_contact_t or #sip_rack_t.
  *
  * @{
@@ -318,18 +318,18 @@ typedef struct sip_X_s sip_X_t;
 
 /**@var msg_hclass_t sip_X_class[];
  * @brief Header class for SIP X.
- * 
+ *
  * The header class sip_X_class defines how a SIP
  * X is parsed and printed.  It also
  * contains methods used by SIP parser and other functions
  * to manipulate the sip_X_t header structure.
- * 
+ *
  */
 SIP_DLL extern msg_hclass_t sip_X_class[];
 
-enum { 
+enum {
  /** Hash of X. @internal */
- sip_X_hash = hash 
+ sip_X_hash = hash
 };
 
 /** Parse a X. @internal */
@@ -339,28 +339,28 @@ msg_parse_f sip_X_d;
 msg_print_f sip_X_e;
 
 /**Initializer for structure sip_X_t.
- * 
+ *
  * A static sip_X_t structure must be initialized
  * with the SIP_X_INIT() macro. For instance,
- * @code 
- * 
+ * @code
+ *
  *  sip_X_t sip_X = SIP_X_INIT;
- * 
+ *
  * @endcode
  * @HI
  */
 #define SIP_X_INIT() SIP_HDR_INIT(X)
 
 /**Initialize a structure sip_X_t.
- * 
+ *
  * An sip_X_t structure can be initialized with the
  * sip_X_init() function/macro. For instance,
  * @code
- * 
+ *
  *  sip_X_t sip_X;
- * 
+ *
  *  sip_X_init(&sip_X);
- * 
+ *
  * @endcode
  * @HI
  */
@@ -375,13 +375,13 @@ su_inline sip_X_t *sip_X_init(sip_X_t x[1])
 #endif
 
 /**Test if header object is instance of sip_X_t.
- * 
+ *
  * The function sip_is_X() returns true (nonzero) if
  * the header class is an instance of X
  * object and false (zero) otherwise.
- * 
+ *
  * @param header pointer to the header structure to be tested
- * 
+ *
  * @return
  * The function sip_is_X() returns true (nonzero) if
  * the header object is an instance of header X and
@@ -399,27 +399,27 @@ int sip_is_X(sip_header_t const *header);
 #define sip_X_p(h) sip_is_X((h))
 
 /**Duplicate (deep copy) @c sip_X_t.
- * 
+ *
  * The function sip_X_dup() duplicates a header
  * structure @a hdr.  If the header structure @a hdr
  * contains a reference (@c hdr->x_next) to a list of
  * headers, all the headers in the list are duplicated, too.
- * 
+ *
  * @param home  memory home used to allocate new structure
  * @param hdr   header structure to be duplicated
- * 
+ *
  * When duplicating, all parameter lists and non-constant
  * strings attached to the header are copied, too.  The
  * function uses given memory @a home to allocate all the
  * memory areas used to copy the header.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   X = sip_X_dup(home, sip->sip_X);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function sip_X_dup() returns a pointer to the
  * newly duplicated sip_X_t header structure, or NULL
@@ -428,29 +428,29 @@ int sip_is_X(sip_header_t const *header);
 sip_X_t *sip_X_dup(su_home_t *home, sip_X_t const *hdr);
 
 /**Copy a sip_X_t header structure.
- * 
+ *
  * The function sip_X_copy() copies a header structure @a
  * hdr.  If the header structure @a hdr contains a reference (@c
  * hdr->h_next) to a list of headers, all the headers in that
  * list are copied, too. The function uses given memory @a home
  * to allocate all the memory areas used to copy the header
  * structure @a hdr.
- * 
+ *
  * @param home    memory home used to allocate new structure
  * @param hdr     pointer to the header structure to be duplicated
- * 
+ *
  * When copying, only the header structure and parameter lists
  * attached to it are duplicated.  The new header structure
  * retains all the references to the strings within the old @a
  * header, including the encoding of the old header, if present.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   X = sip_X_copy(home, sip->sip_X);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * The function sip_X_copy() returns a pointer to
  * newly copied header structure, or NULL upon an error.
@@ -458,18 +458,18 @@ sip_X_t *sip_X_dup(su_home_t *home, sip_X_t const *hdr);
 sip_X_t *sip_X_copy(su_home_t *home, sip_X_t const *hdr);
 
 /**Make a header structure sip_X_t.
- * 
+ *
  * The function sip_X_make() makes a new
  * sip_X_t header structure.  It allocates a new
  * header structure, and decodes the string @a s as the
  * value of the structure.
- * 
+ *
  * @param home memory home used to allocate 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
  * sip_header_make().
- * 
+ *
  * @return
  * The function sip_X_make() returns a pointer to
  * newly maked sip_X_t header structure, or NULL upon
@@ -485,25 +485,25 @@ sip_X_t *sip_X_make(su_home_t *home, char const *s);
 #endif
 
 /**Make a X from formatting result.
- * 
+ *
  * The function sip_X_format() makes a new
  * X object using formatting result as its
  * value.  The function first prints the arguments according to
  * the format @a fmt specified.  Then it allocates a new header
  * structure, and uses the formatting result as the header
  * value.
- * 
+ *
  * @param home   memory home used to allocate new header structure.
  * @param fmt    string used as a printf()-style format
  * @param ...    argument list for format
- * 
+ *
  * @note This function is usually implemented as a macro calling
  * msg_header_format().
- * 
+ *
  * @return
  * The function sip_X_format() returns a pointer to newly
  * makes header structure, or NULL upon an error.
- * 
+ *
  * @HIDE
  */
 #if SU_HAVE_INLINE
@@ -517,11 +517,11 @@ su_inline sip_X_t *sip_X_format(su_home_t *home, char const *fmt, ...)
 {
   sip_header_t *h;
   va_list ap;
-  
+
   va_start(ap, fmt);
   h = sip_header_vformat(home, sip_X_class, fmt, ap);
   va_end(ap);
+
   return h->sh_X;
 }
 #endif
@@ -534,7 +534,7 @@ su_inline sip_X_t *sip_X_format(su_home_t *home, char const *fmt, ...)
  * leading and trailing whitespace has been removed from the string @a s.
  *
  * @param home   memory home used to allocate new header structure.
- * @param h      sip_X_t header structure 
+ * @param h      sip_X_t header structure
  * @param s      string to be decoded
  * @param bsiz   length of string @a s
  *
@@ -555,15 +555,15 @@ int sip_X_d(su_home_t *home, sip_header_t *h, char *s, int bsiz);
  * @param bsiz   size of the encoding buffer
  * @param h      header to be encoded.
  * @param flags  flags controlling the encoding
- * 
- * @note 
+ *
+ * @note
  * The encoding buffer size @b must be @b bigger than, not equal to,
  * the actual encoding result.
  *
  * @return
  * The function sip_X_e() returns the number of characters required for the
  * encoding.
- * 
+ *
  */
 int sip_X_e(char buf[], int bsiz, sip_header_t const *h, int flags);
 
@@ -577,7 +577,7 @@ int sip_X_e(char buf[], int bsiz, sip_header_t const *h, int flags);
 
 /**@defgroup sip_tag SIP Tags
  *
- * SIP headers in tag item lists and tagged argument lists. 
+ * SIP headers in tag item lists and tagged argument lists.
  *
  * The include file <sofia-sip/sip_tag.h> defines tags and tag items for including SIP
  * headers in tag item lists or tagged argument lists. For each header,
@@ -592,7 +592,7 @@ int sip_X_e(char buf[], int bsiz, sip_header_t const *h, int flags);
  * @code
  * sip_payload_t *payload;
  * ...
- * sip_add_tl(msg, sip, 
+ * sip_add_tl(msg, sip,
  *            SIPTAG_CONTENT_TYPE_STR("text/plain"),
  *            SIPTAG_USER_AGENT(agent->user_agent),
  *            SIPTAG_PAYLOAD(payload),
index 8c35db4b5201ab110f115c1d9913ea0ada5e5493..9acd3f00f361fe48fdbf9b2fb8bdd44467cd5153 100644 (file)
@@ -69,6 +69,6 @@ ALIASES += \
  "ReplyTo=@ref sip_reply_to \"Reply-To\"" \
  "SuppressBodyIfMatch=@ref sip_suppress_body_if_match \"Suppress-Body-If-Match\"" \
  "SuppressNotifyIfMatch=@ref sip_suppress_notify_if_match \"Suppress-Notify-If-Match\"" \
- "RemotePartyID=@ref sip_remote_party_id \"Remote-Party-ID\"" \  
- "PAssertedIdentity=@ref sip_p_asserted_identity \"P-Asserted-Identity\"" \  
- "PPreferredIdentity=@ref sip_p_preferred_identity \"P-Preferred-Identity\"" \  
+ "RemotePartyID=@ref sip_remote_party_id \"Remote-Party-ID\"" \
+ "PAssertedIdentity=@ref sip_p_asserted_identity \"P-Asserted-Identity\"" \
+ "PPreferredIdentity=@ref sip_p_preferred_identity \"P-Preferred-Identity\"" \
index 2ce1c34e4628ae758b7eaf19933d1404a58e3c97..1d3eefa160dcad040b4d20c44ecde8f550de7ea7 100644 (file)
@@ -15,7 +15,7 @@
 #
 
 #
-# When updating this file, please update 
+# When updating this file, please update
 # NTATAG_BAD_RESP_MASK()/NTATAG_BAD_REQ_MASK() documentation, too.
 #
 
@@ -55,7 +55,7 @@ Path = sip_mask_registrar
 
 #
 # Headers that must be valid in UA, proxy or registrar
-# 
+#
 Contact = sip_mask_ua | sip_mask_proxy | sip_mask_registrar
 Require = sip_mask_ua | sip_mask_registrar | sip_mask_timer
 Record-Route = sip_mask_ua | sip_mask_proxy
index c13ec0467ae638a412084e0181c882991107bbd3..0bca27f2e908d77967c9b142a5f16d8f0c255a19 100644 (file)
@@ -64,7 +64,7 @@
  *
  * The request line is first line in a SIP request message.  Its syntax defined
  * in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Request-Line   =  Method SP Request-URI SP SIP-Version CRLF
  *    Request-URI    =  SIP-URI / SIPS-URI / absoluteURI
@@ -117,7 +117,7 @@ static msg_xtra_f sip_request_dup_xtra;
 static msg_dup_f sip_request_dup_one;
 #define sip_request_update NULL
 
-msg_hclass_t sip_request_class[] = 
+msg_hclass_t sip_request_class[] =
 SIP_HEADER_CLASS(request, NULL, "", rq_common, single_critical, request);
 
 /**Parse @ref sip_request "request line" from a a SIP message. */
@@ -181,7 +181,7 @@ char *sip_request_dup_one(sip_header_t *dst, sip_header_t const *src,
 
 /**@ingroup sip_request
  *
- * Create a @ref sip_request "request line" object. 
+ * Create a @ref sip_request "request line" object.
  *
  * Create a request line object with
  * method enum @a method, method name @a name, request URI @a uri, and
@@ -201,7 +201,7 @@ char *sip_request_dup_one(sip_header_t *dst, sip_header_t const *src,
  *   rq = sip_request_create(home, SIP_METHOD_OPTIONS, requestURI, NULL);
  * @endcode
 
- * @note 
+ * @note
  * If you provide an non-NULL @a version string, it is not copied. The
  * version string @b MUST remain constant.
  */
@@ -210,7 +210,7 @@ sip_request_t *sip_request_create(su_home_t *home,
                                  url_string_t const *uri,
                                  char const *version)
 {
-  size_t xtra; 
+  size_t xtra;
   sip_request_t *rq;
 
   if (method)
@@ -231,7 +231,7 @@ sip_request_t *sip_request_create(su_home_t *home,
 
     rq->rq_method      = method;
     rq->rq_method_name = name;
-    if (!method) 
+    if (!method)
       MSG_STRING_DUP(b, rq->rq_method_name, name);
 
     URL_DUP(b, end, rq->rq_url, uri->us_url);
@@ -249,7 +249,7 @@ sip_request_t *sip_request_create(su_home_t *home,
  *
  * The status line is first line in a response message.  It is defined in
  * @RFC3261 as follows:
- * 
+ *
  * @code
  *    Status-Line     =  SIP-Version SP Status-Code SP Reason-Phrase CRLF
  *    Status-Code     =  Informational
@@ -270,7 +270,7 @@ sip_request_t *sip_request_create(su_home_t *home,
 /**@ingroup sip_status
  * @typedef typedef struct sip_status_s sip_status_t;
  *
- * The structure #sip_status_t contains representation of SIP 
+ * The structure #sip_status_t contains representation of SIP
  * @ref sip_status "status line".
  *
  * The #sip_status_t is defined as follows:
@@ -292,7 +292,7 @@ static msg_dup_f sip_status_dup_one;
 #define sip_status_insert msg_status_insert
 #define sip_status_update NULL
 
-msg_hclass_t sip_status_class[] = 
+msg_hclass_t sip_status_class[] =
 SIP_HEADER_CLASS(status, NULL, "", st_common, single_critical, status);
 
 /** Parse status line */
@@ -366,7 +366,7 @@ char *sip_status_dup_one(sip_header_t *dst, sip_header_t const *src,
  * @param phrase  status phrase (may be NULL)
  * @param version version string (defaults to "SIP/2.0" if NULL)
  *
- * @note 
+ * @note
  * If you provide an non-NULL @a version string, it is not copied. The
  * string @b MUST remain constant.
  *
@@ -426,29 +426,29 @@ sip_status_t *sip_status_create(su_home_t *home,
 
 #define sip_payload_d       msg_payload_d
 #define sip_payload_e       msg_payload_e
-#define sip_payload_dup_xtra msg_payload_dup_xtra 
+#define sip_payload_dup_xtra msg_payload_dup_xtra
 #define sip_payload_dup_one  msg_payload_dup_one
 #define sip_payload_update   NULL
 
-msg_hclass_t sip_payload_class[] = 
+msg_hclass_t sip_payload_class[] =
 SIP_HEADER_CLASS(payload, NULL, "", pl_common, single, payload);
 
 /**@ingroup sip_payload
  *
- * Create a @ref sip_payload "SIP payload" structure. 
+ * Create a @ref sip_payload "SIP payload" structure.
  *
  * Create a new SIP payload structure. it
  * copies the given data to the the payload data, and NUL terminates it (it
  * allocates one extra byte for NUL).  If a NULL pointer is given as @a data,
  * sip_payload_create() allocates and zeroes a data buffer of @a len bytes.
  *
- * @param home memory home 
- * @param data payload data 
+ * @param home memory home
+ * @param data payload data
  * @param len  payload length
  *
  * @return A pointer to newly created
  * payload structure, if successful, and NULL upon an error.
- */ 
+ */
 sip_payload_t *sip_payload_create(su_home_t *home, void const *data, isize_t len)
 {
   msg_hclass_t *hc = sip_payload_class;
@@ -504,11 +504,11 @@ sip_payload_t *sip_payload_create(su_home_t *home, void const *data, isize_t len
 #define sip_separator_e msg_separator_e
 #define sip_separator_insert msg_separator_insert
 
-msg_hclass_t sip_separator_class[] = 
+msg_hclass_t sip_separator_class[] =
 SIP_HEADER_CLASS(separator, NULL, "", sep_common, single, any);
 
 /**@ingroup sip_separator
- * 
+ *
  * Create a @ref sip_separator "SIP separator line" structure.
  */
 sip_separator_t *sip_separator_create(su_home_t *home)
@@ -529,7 +529,7 @@ sip_separator_t *sip_separator_create(su_home_t *home)
  * The unknown headers are handled with #sip_unknown_t structure. The
  * unknown header name is stored in @a un_name field and the header field
  * following the colon is stored in @a un_value field.
- * 
+ *
  * @note It is possible to speed up parsing process by creating a parser
  * which does understand only a minimum number of headers. If such a parser
  * is used, some well-known headers are regarded as unknown and put into
@@ -544,19 +544,19 @@ sip_separator_t *sip_separator_create(su_home_t *home)
  * The #sip_unknown_t is defined as follows:
  * @code
  * typedef struct msg_unknown_s {
- *   msg_common_t    un_common[1];  // Common fragment info 
- *   msg_unknown_t  *un_next;       // Link to next unknown header 
- *   char const     *un_name;       // Header name 
- *   char const     *un_value;      // Header field value 
+ *   msg_common_t    un_common[1];  // Common fragment info
+ *   msg_unknown_t  *un_next;       // Link to next unknown header
+ *   char const     *un_name;       // Header name
+ *   char const     *un_value;      // Header field value
  * } sip_unknown_t;
  * @endcode
  */
 
-#define sip_unknown_dup_xtra msg_unknown_dup_xtra 
+#define sip_unknown_dup_xtra msg_unknown_dup_xtra
 #define sip_unknown_dup_one  msg_unknown_dup_one
 #define sip_unknown_update NULL
 
-msg_hclass_t sip_unknown_class[] = 
+msg_hclass_t sip_unknown_class[] =
 SIP_HEADER_CLASS(unknown, "", "", un_common, append, unknown);
 
 issize_t sip_unknown_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -574,7 +574,7 @@ issize_t sip_unknown_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
 /**@SIP_HEADER sip_error Erroneous Headers
  *
  * The erroneous headers are stored in #sip_error_t structure.
- * 
+ *
  * @note Other headers (like duplicate @ContentLength headers) may be put
  * into the list of erroneous headers (@c sip->sip_error). If the list of
  * erroneous headers is processed, the header type must be validated first
@@ -588,8 +588,8 @@ issize_t sip_unknown_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
  * The #sip_error_t is defined as follows:
  * @code
  * typedef struct msg_error_s {
- *   msg_common_t    er_common[1];  // Common fragment info 
- *   msg_error_t    *er_next;       // Link to next header 
+ *   msg_common_t    er_common[1];  // Common fragment info
+ *   msg_error_t    *er_next;       // Link to next header
  *   char const     *er_name;       // Name of bad header (if any)
  * } sip_error_t;
  * @endcode
@@ -611,7 +611,7 @@ issize_t sip_error_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
 
 /* ====================================================================== */
 /*
- * addr           = ("To" | "t" | "From" | "f") ":" 
+ * addr           = ("To" | "t" | "From" | "f") ":"
  *                  ( name-addr | addr-spec ) *( ";" addr-params )
  * name-addr      = [ display-name ] "<" addr-spec ">"
  * addr-spec      = SIP-URL | URI
@@ -631,7 +631,7 @@ issize_t sip_error_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
  * @param inout_s        pointer to pointer to string to be parsed
  * @param return_display value-result parameter for @e display-name
  * @param return_url     value-result parameter for @e addr-spec
- * @param return_params  value-result paramater for @e parameters 
+ * @param return_params  value-result paramater for @e parameters
  * @param return_comment value-result parameter for @e comment
  *
  * @note After succesful call to the function @c sip_name_addr_d(), *ss
@@ -658,7 +658,7 @@ issize_t sip_name_addr_d(su_home_t *home,
 
   if (*s == '\0')              /* Empty string */
     return -1;
-  
+
   if (return_display && *s == '"') {
     /* Quoted string */
     if (msg_quoted_d(&s, &display) == -1)
@@ -669,24 +669,24 @@ issize_t sip_name_addr_d(su_home_t *home,
       return -1;
     s++[0] = '\0';             /* NUL terminate quoted string... */
     n = strcspn(s, ">");
-    addr_spec = s; s += n; 
+    addr_spec = s; s += n;
     if (*s) *s++ = '\0'; else return -1;
-  } 
+  }
   else {
-    if (return_display) 
+    if (return_display)
       n = span_token_lws(s);
     else
       n = 0;
 
     if (s[n] == '<') {
       /* OK, we got a display name */
-      display = s; s += n + 1; 
+      display = s; s += n + 1;
       /* NUL terminate display name */
       while (n > 0 && IS_LWS(display[n - 1]))
        n--;
       if (n > 0)
        display[n] = '\0';
-      else 
+      else
        display = "";
 
       n = strcspn(s, ">");
@@ -696,7 +696,7 @@ issize_t sip_name_addr_d(su_home_t *home,
       /* addr-spec only */
       addr_spec = s;
       /**@sa
-       * Discussion about comma, semicolon and question mark in 
+       * Discussion about comma, semicolon and question mark in
        * @RFC3261 section 20.10.
        */
       if (return_params)
@@ -714,8 +714,8 @@ issize_t sip_name_addr_d(su_home_t *home,
 
   if (return_display)
     *return_display = display;
-  
-  /* Now, url may still not be NUL terminated, e.g., if 
+
+  /* Now, url may still not be NUL terminated, e.g., if
    * it is like "Contact: url:foo,sip:bar,sip:zunk"
    */
   c = *s; *s = '\0';           /* terminate temporarily */
@@ -753,7 +753,7 @@ issize_t sip_name_addr_d(su_home_t *home,
  * @param params   pointer to parameter list (may be NULL)
  * @param comment  comment string encoded after others (may be NULL)
  *
- * @return 
+ * @return
  * Returns number of characters in encoding, excluding the
  * final NUL.
  *
@@ -761,9 +761,9 @@ issize_t sip_name_addr_d(su_home_t *home,
  * The encoding result may be incomplete if the buffer size is not large
  * enough to store the whole encoding result.
  */
-issize_t sip_name_addr_e(char b[], isize_t bsiz, 
-                        int flags, 
-                        char const *display, 
+issize_t sip_name_addr_e(char b[], isize_t bsiz,
+                        int flags,
+                        char const *display,
                         int brackets, url_t const url[],
                         msg_param_t const params[],
                         char const *comment)
@@ -772,8 +772,8 @@ issize_t sip_name_addr_e(char b[], isize_t bsiz,
   char const *u;
   char *b0 = b, *end = b + bsiz;
 
-  brackets = brackets || display || 
-    (url && (url->url_params || 
+  brackets = brackets || display ||
+    (url && (url->url_params ||
             url->url_headers ||
             ((u = url->url_user) && u[strcspn(u, ";,?")]) ||
             ((u = url->url_password) && u[strcspn(u, ",")])));
@@ -798,7 +798,7 @@ issize_t sip_name_addr_e(char b[], isize_t bsiz,
   }
 
   MSG_TERM_E(b, end);
-    
+
   return b - b0;
 }
 
@@ -867,12 +867,12 @@ static issize_t sip_addr_d(su_home_t *home,
 {
   sip_addr_t *a = (sip_addr_t *)h;
   char const *comment = NULL;
-  if (sip_name_addr_d(home, 
-                     &s, 
-                     &a->a_display, 
-                     a->a_url, 
+  if (sip_name_addr_d(home,
+                     &s,
+                     &a->a_display,
+                     a->a_url,
                      &a->a_params,
-                     &comment) == -1 
+                     &comment) == -1
       || *s /* XXX - something extra? */)
     return -1;
 
@@ -887,7 +887,7 @@ static int sip_addr_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
 
   return sip_name_addr_e(b, bsiz,
                         flags,
-                        a->a_display, 
+                        a->a_display,
                         MSG_IS_CANONIC(flags), a->a_url,
                         a->a_params,
                         NULL);
@@ -909,7 +909,7 @@ isize_t sip_addr_dup_xtra(sip_header_t const *h, isize_t offset)
 {
   sip_addr_t const *a = (sip_addr_t const *)h;
 
-  return sip_name_addr_xtra(a->a_display, 
+  return sip_name_addr_xtra(a->a_display,
                            a->a_url,
                            a->a_params,
                            offset);
@@ -955,7 +955,7 @@ sip_addr_make_url(su_home_t *home, msg_hclass_t *hc, url_string_t const *us)
   sip_header_t *h;
 
   n = url_xtra(us->us_url);
-  h = sip_header_alloc(home, hc, n);    
+  h = sip_header_alloc(home, hc, n);
 
   if (h) {
     sip_addr_t *a = (sip_to_t *)h;
@@ -1009,7 +1009,7 @@ int sip_addr_tag(su_home_t *home, sip_addr_t *a, char const *tag)
  * The @b Call-ID header uniquely identifies a particular invitation or all
  * registrations of a particular client. It is defined in @RFC3261 as
  * follows:
- * 
+ *
  * @code
  *    Call-ID  =  ( "Call-ID" / "i" ) HCOLON callid
  *    callid   =  word [ "@" word ]
@@ -1042,16 +1042,16 @@ static msg_xtra_f sip_call_id_dup_xtra;
 static msg_dup_f sip_call_id_dup_one;
 #define sip_call_id_update NULL
 
-msg_hclass_t sip_call_id_class[] = 
+msg_hclass_t sip_call_id_class[] =
 SIP_HEADER_CLASS(call_id, "Call-ID", "i", i_common, single, call_id);
 
 issize_t sip_call_id_d(su_home_t *home,
                       sip_header_t *h,
-                      char *s, 
+                      char *s,
                       isize_t slen)
 {
   sip_call_id_t *i = (sip_call_id_t *)h;
-  
+
   i->i_id = s; /* XXX - why not sip_word_at_word_d(&s); */
   i->i_hash = msg_hash_string(s);
 
@@ -1106,7 +1106,7 @@ char *sip_call_id_dup_one(sip_header_t *dst, sip_header_t const *src,
 
 /**@ingroup sip_call_id
  *
- * Create a @CallID header object. 
+ * Create a @CallID header object.
  *
  * Create a Call-ID header object with a new unique value. It uses
  * su_guid_generate() function to generate the value. If the local host name
@@ -1127,7 +1127,7 @@ sip_call_id_t *sip_call_id_create(su_home_t *home, char const *domain)
   size_t xtra = su_guid_strlen + 1 + (domain ? strlen(domain) + 1 : 0);
 
   i = (sip_call_id_t *)sip_header_alloc(home, sip_call_id_class, xtra);
-  
+
   if (i) {
     char *b;
     su_guid_t guid[1];
@@ -1158,11 +1158,11 @@ sip_call_id_t *sip_call_id_create(su_home_t *home, char const *domain)
 
 /* ====================================================================== */
 
-/**@SIP_HEADER sip_cseq CSeq Header 
+/**@SIP_HEADER sip_cseq CSeq Header
  *
  * The CSeq header (command sequence) uniquely identifies transactions
  * within a dialog.  It is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    CSeq              =  "CSeq" HCOLON 1*DIGIT LWS Method
  *    Method            =  INVITEm / ACKm / OPTIONSm / BYEm
@@ -1195,7 +1195,7 @@ static msg_xtra_f sip_cseq_dup_xtra;
 static msg_dup_f sip_cseq_dup_one;
 #define sip_cseq_update NULL
 
-msg_hclass_t sip_cseq_class[] = 
+msg_hclass_t sip_cseq_class[] =
 SIP_HEADER_CLASS(cseq, "CSeq", "", cs_common, single, cseq);
 
 issize_t sip_cseq_d(su_home_t *home,
@@ -1253,9 +1253,9 @@ char *sip_cseq_dup_one(sip_header_t *dst, sip_header_t const *src,
   return b;
 }
 
-/**@ingroup sip_cseq 
+/**@ingroup sip_cseq
  *
- * Create a @CSeq header object. 
+ * Create a @CSeq header object.
  *
  * Create a @CSeq header object with the
  * sequence number @a seq, method enum @a method and method name @a
@@ -1295,7 +1295,7 @@ sip_cseq_t *sip_cseq_create(su_home_t *home,
   xtra = (method ? 0 : (strlen(method_name) + 1));
 
   cs = (sip_cseq_t *)sip_header_alloc(home, sip_cseq_class, xtra);
-  
+
   if (cs) {
     cs->cs_seq = seq;
     cs->cs_method = method;
@@ -1312,7 +1312,7 @@ sip_cseq_t *sip_cseq_create(su_home_t *home,
  *
  * The Contact header contain a list of URLs used to redirect future
  * requests.  Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Contact            =  ("Contact" / "m" ) HCOLON
  *                          ( STAR / (contact-param *(COMMA contact-param)))
@@ -1351,10 +1351,10 @@ sip_cseq_t *sip_cseq_create(su_home_t *home,
  *   char const         *m_comment;     // Comment
  *
  *   char const         *m_q;           // Priority
- *   char const         *m_expires;     // Expiration time 
+ *   char const         *m_expires;     // Expiration time
  * } sip_contact_t;
  * @endcode
- * 
+ *
  * @note The <comment> field @ref sip_contact_s::m_comment "m_comment" is
  * deprecated: it is parsed but not included in encoding.
  */
@@ -1398,7 +1398,7 @@ issize_t sip_contact_d(su_home_t *home,
   while (*s == ',')   /* Ignore empty entries (comma-whitespace) */
     *s = '\0', s += span_lws(s + 1) + 1;
 
-  if (sip_name_addr_d(home, &s, &m->m_display, m->m_url, 
+  if (sip_name_addr_d(home, &s, &m->m_display, m->m_url,
                      &m->m_params, &m->m_comment) == -1)
     return -1;
 
@@ -1414,7 +1414,7 @@ issize_t sip_contact_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
   assert(sip_is_contact(h));
 
   return sip_name_addr_e(b, bsiz, flags,
-                        m->m_display, always_lt_gt, m->m_url, 
+                        m->m_display, always_lt_gt, m->m_url,
                         m->m_params,
                         NULL /* m->m_comment */);
 }
@@ -1446,7 +1446,7 @@ char *sip_contact_dup_one(sip_header_t *dst, sip_header_t const *src,
 }
 
 /** Update parameter in #sip_contact_t */
-static int sip_contact_update(msg_common_t *h, 
+static int sip_contact_update(msg_common_t *h,
                              char const *name, isize_t namelen,
                              char const *value)
 {
@@ -1460,7 +1460,7 @@ static int sip_contact_update(msg_common_t *h,
     /* XXX - check for invalid value? */
     m->m_q = value;
   }
-  else if (namelen == strlen("expires") && 
+  else if (namelen == strlen("expires") &&
           !strncasecmp(name, "expires", namelen)) {
     m->m_expires = value;
   }
@@ -1468,7 +1468,7 @@ static int sip_contact_update(msg_common_t *h,
   return 0;
 }
 
-/**@ingroup sip_contact 
+/**@ingroup sip_contact
  *
  * Add a parameter to a @Contact header object
  *
@@ -1524,8 +1524,8 @@ int sip_contact_add_param(su_home_t *home,
  * @endcode
  */
 
-msg_hclass_t sip_content_length_class[] = 
-SIP_HEADER_CLASS(content_length, "Content-Length", "l", l_common, 
+msg_hclass_t sip_content_length_class[] =
+SIP_HEADER_CLASS(content_length, "Content-Length", "l", l_common,
                 single_critical, any);
 
 issize_t sip_content_length_d(su_home_t *home,
@@ -1547,9 +1547,9 @@ issize_t sip_content_length_e(char b[], isize_t bsiz, sip_header_t const *h, int
   return snprintf(b, bsiz, "%lu", (unsigned long)l->l_length);
 }
 
-/**@ingroup sip_content_length 
+/**@ingroup sip_content_length
  *
- * Create a @ContentLength header object. 
+ * Create a @ContentLength header object.
  *
  * Create a @ContentLength
  * header object with the value @a n.  The memory for the header is
@@ -1566,7 +1566,7 @@ sip_content_length_t *sip_content_length_create(su_home_t *home, uint32_t n)
 {
   sip_content_length_t *l = (sip_content_length_t *)
     sip_header_alloc(home, sip_content_length_class, 0);
-  
+
   if (l)
     l->l_length = n;
 
@@ -1580,7 +1580,7 @@ sip_content_length_t *sip_content_length_create(su_home_t *home, uint32_t n)
  * The Date header field reflects the time when the request or response was
  * first sent.  Its syntax is defined in @RFC3261 and @RFC2616 section 14.18 as
  * follows:
- * 
+ *
  * @code
  *    Date          =  "Date" HCOLON SIP-date
  *    SIP-date      =  rfc1123-date
@@ -1614,7 +1614,7 @@ sip_content_length_t *sip_content_length_create(su_home_t *home, uint32_t n)
  * @endcode
  */
 
-msg_hclass_t sip_date_class[] = 
+msg_hclass_t sip_date_class[] =
 SIP_HEADER_CLASS(date, "Date", "", d_common, single, any);
 
 issize_t sip_date_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -1635,7 +1635,7 @@ issize_t sip_date_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 }
 
 /**@ingroup sip_date
- * @brief Create an @Date header object. 
+ * @brief Create an @Date header object.
  *
  * Create a @Date header object with
  * the date @a date.  If @date is 0, current time (as returned by sip_now())
@@ -1651,7 +1651,7 @@ issize_t sip_date_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 sip_date_t *sip_date_create(su_home_t *home, sip_time_t date)
 {
   sip_date_t *d = (sip_date_t *)sip_header_alloc(home, sip_date_class, 0);
-  
+
   if (d) {
     if (date == 0)
       date = sip_now();
@@ -1667,11 +1667,11 @@ sip_date_t *sip_date_create(su_home_t *home, sip_time_t date)
  *
  * The Expires header field gives the date and time after which the message
  * content expires.  Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Expires     =  "Expires" HCOLON delta-seconds
  * @endcode
- * 
+ *
  * Note that the first SIP revision (@RFC2543) also allowed absolute time in
  * Expires.
  *
@@ -1695,15 +1695,15 @@ sip_date_t *sip_date_create(su_home_t *home, sip_time_t date)
  * @endcode
  */
 
-msg_hclass_t sip_expires_class[] = 
+msg_hclass_t sip_expires_class[] =
 SIP_HEADER_CLASS(expires, "Expires", "", ex_common, single, any);
 
 issize_t sip_expires_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
 {
   sip_expires_t *expires = (sip_expires_t *)h;
 
-  if (msg_date_delta_d((char const **)&s, 
-                      &expires->ex_date, 
+  if (msg_date_delta_d((char const **)&s,
+                      &expires->ex_date,
                       &expires->ex_delta) < 0 || *s)
     return -1;
   else
@@ -1721,7 +1721,7 @@ issize_t sip_expires_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 }
 
 /**@ingroup sip_expires
- * @brief Create an @Expires header object. 
+ * @brief Create an @Expires header object.
  *
  * Create an @Expires header object with the expiration time @a delta.
  *
@@ -1749,7 +1749,7 @@ sip_expires_t *sip_expires_create(su_home_t *home, sip_time_t delta)
  *
  * The From header indicates the initiator of the request.  It is defined in
  * @RFC3261 as follows:
- * 
+ *
  * @code
  *    From        =  ( "From" / "f" ) HCOLON from-spec
  *    from-spec   =  ( name-addr / addr-spec )
@@ -1776,13 +1776,13 @@ sip_expires_t *sip_expires_create(su_home_t *home, sip_time_t delta)
  *   url_t              a_url[1];       // URL
  *   msg_param_t const *a_params;       // List of from-param
  *   char const        *a_comment;      // Comment
- *   char const        *a_tag;          // Tag parameter 
+ *   char const        *a_tag;          // Tag parameter
  * } sip_from_t;
  * @endcode
  *
  */
 
-msg_hclass_t sip_from_class[] = 
+msg_hclass_t sip_from_class[] =
 SIP_HEADER_CLASS(from, "From", "f", a_params, single, addr);
 
 issize_t sip_from_d(su_home_t *home,
@@ -1844,10 +1844,10 @@ int sip_from_add_param(su_home_t *home,
  * be provided either as a single token ("deadbeer") or as in parameter form
  * ("tag=deadbeer"). In both cases the tag is duplicated using the memory
  * home @a home.
- * 
- * @param home memory home used to allocate new tag 
+ *
+ * @param home memory home used to allocate new tag
  * @param from @From header to modify
- * @param tag  tag token or parameter to be added 
+ * @param tag  tag token or parameter to be added
  *
  * @retval 0 when successful
  * @retval -1 upon an error.
@@ -1870,7 +1870,7 @@ int sip_to_tag(su_home_t *home, sip_to_t *to, char const *tag)
  * The Max-Forwards header is used to limit the number of proxies or
  * gateways that can forward the request.  The Max-Forwards syntax is
  * defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Max-Forwards  =  "Max-Forwards" HCOLON 1*DIGIT
  * @endcode
@@ -1895,8 +1895,8 @@ int sip_to_tag(su_home_t *home, sip_to_t *to, char const *tag)
  * @endcode
  */
 
-msg_hclass_t sip_max_forwards_class[] = 
-SIP_HEADER_CLASS(max_forwards, "Max-Forwards", "", mf_common, 
+msg_hclass_t sip_max_forwards_class[] =
+SIP_HEADER_CLASS(max_forwards, "Max-Forwards", "", mf_common,
                 single, any);
 
 issize_t sip_max_forwards_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -1917,7 +1917,7 @@ issize_t sip_max_forwards_e(char b[], isize_t bsiz, sip_header_t const *h, int f
  * The Min-Expires header is used to limit the number of proxies or
  * gateways that can forward the request.  The Min-Expires syntax is
  * defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Min-Expires  =  "Min-Expires" HCOLON delta-seconds
  * @endcode
@@ -1941,8 +1941,8 @@ issize_t sip_max_forwards_e(char b[], isize_t bsiz, sip_header_t const *h, int f
  * @endcode
  */
 
-msg_hclass_t sip_min_expires_class[] = 
-SIP_HEADER_CLASS(min_expires, "Min-Expires", "", me_common, 
+msg_hclass_t sip_min_expires_class[] =
+SIP_HEADER_CLASS(min_expires, "Min-Expires", "", me_common,
                 single, any);
 
 issize_t sip_min_expires_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -1960,12 +1960,12 @@ issize_t sip_min_expires_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_retry_after Retry-After Header
- * 
+ *
  * The Retry-After response-header field @RFC3261 section 20.33 can be used to
  * indicate how long the service is expected to be unavailable or when the
  * called party anticipates being available again. Its syntax is defined in
  * @RFC3261 as follows:
- * 
+ *
  * @code
  *      Retry-After  =  "Retry-After" HCOLON delta-seconds
  *                      [ comment ] *( SEMI retry-param )
@@ -1977,9 +1977,9 @@ issize_t sip_min_expires_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  */
 
 /**@ingroup sip_retry_after
- * @typedef struct sip_retry_after_s sip_retry_after_t; 
+ * @typedef struct sip_retry_after_s sip_retry_after_t;
  *
- * The structure #sip_retry_after_t contains representation of an 
+ * The structure #sip_retry_after_t contains representation of an
  * @RetryAfter header.
  *
  * The #sip_retry_after_t is defined as follows:
@@ -1999,7 +1999,7 @@ static msg_xtra_f sip_retry_after_dup_xtra;
 static msg_dup_f sip_retry_after_dup_one;
 static msg_update_f sip_retry_after_update;
 
-msg_hclass_t sip_retry_after_class[] = 
+msg_hclass_t sip_retry_after_class[] =
 SIP_HEADER_CLASS(retry_after, "Retry-After", "", af_params, single,
                 retry_after);
 
@@ -2031,7 +2031,7 @@ issize_t sip_retry_after_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
   b += snprintf(b, bsiz, "%lu", af->af_delta);
 
   if (af->af_comment) {
-    if (!compact) 
+    if (!compact)
       MSG_CHAR_E(b, end, ' ');
     MSG_CHAR_E(b, end, '(');
     MSG_STRING_E(b, end, af->af_comment);
@@ -2042,9 +2042,9 @@ issize_t sip_retry_after_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 
   if (af->af_params)
     MSG_PARAMS_E(b, end, af->af_params, f);
-    
+
   MSG_TERM_E(b, end);
-    
+
   return b - b0;
 }
 
@@ -2098,7 +2098,7 @@ static int sip_retry_after_update(msg_common_t *h,
 
 /**Parse a @Route or a @RecordRoute header.
  *
- * @retval 0 when successful, 
+ * @retval 0 when successful,
  * @retval -1 upon an error.
  */
 issize_t sip_any_route_d(su_home_t *home,
@@ -2113,7 +2113,7 @@ issize_t sip_any_route_d(su_home_t *home,
   while (*s == ',')   /* Ignore empty entries (comma-whitespace) */
     *s = '\0', s += span_lws(s + 1) + 1;
 
-  if (sip_name_addr_d(home, &s, &r->r_display, 
+  if (sip_name_addr_d(home, &s, &r->r_display,
                      r->r_url, &r->r_params, NULL) < 0)
     return -1;
 
@@ -2124,14 +2124,14 @@ issize_t sip_any_route_e(char b[], isize_t bsiz, sip_header_t const *h, int flag
 {
   sip_route_t const *r = (sip_route_t *)h;
 
-  return sip_name_addr_e(b, bsiz, flags, 
+  return sip_name_addr_e(b, bsiz, flags,
                         r->r_display, 1, r->r_url, r->r_params, NULL);
 }
 
 isize_t sip_any_route_dup_xtra(sip_header_t const *h, isize_t offset)
 {
   sip_route_t const *r = (sip_route_t *)h;
-  return sip_name_addr_xtra(r->r_display, 
+  return sip_name_addr_xtra(r->r_display,
                            r->r_url,
                            r->r_params,
                            offset);
@@ -2152,7 +2152,7 @@ char *sip_any_route_dup_one(sip_header_t *dst, sip_header_t const *src,
 #define sip_any_route_update NULL
 
 
-/** Create a route. 
+/** Create a route.
  *
  * Create a route or record-route entry
  * from two URLs; first one provides the URL, second maddr parameter and
@@ -2170,8 +2170,8 @@ sip_route_t *sip_any_route_create(su_home_t *home,
 {
   sip_header_t *h;
   sip_route_t *rr;
-  url_t url[1]; 
-  size_t xtra, n, n_url, n_params, n_addr; 
+  url_t url[1];
+  size_t xtra, n, n_url, n_params, n_addr;
   char *b, *param;
 
   *url = *rq_url;
@@ -2183,10 +2183,10 @@ sip_route_t *sip_any_route_create(su_home_t *home,
 
   n_params = maddr && maddr->url_params ? strlen(maddr->url_params) : 0;
 
-  if (maddr && (!maddr->url_params || 
+  if (maddr && (!maddr->url_params ||
                !url_param(maddr->url_params, "maddr", NULL, 0)))
     n_addr = (n_params != 0) + strlen("maddr=") + strlen(maddr->url_host);
-  else 
+  else
     n_addr = 0;
 
   xtra = n_url + n_params + n_addr + (n_params || n_addr);
@@ -2220,9 +2220,9 @@ sip_route_t *sip_any_route_create(su_home_t *home,
 
 /**@SIP_HEADER sip_route Route Header
  *
- * The Route headers is used to store the route set of a transaction.  
+ * The Route headers is used to store the route set of a transaction.
  * The Route header is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Route        =  "Route" HCOLON route-param *(COMMA route-param)
  *    route-param  =  name-addr *( SEMI rr-param )
@@ -2248,7 +2248,7 @@ sip_route_t *sip_any_route_create(su_home_t *home,
  * @endcode
  */
 
-msg_hclass_t sip_route_class[] = 
+msg_hclass_t sip_route_class[] =
 SIP_HEADER_CLASS(route, "Route", "", r_params, append, any_route);
 
 issize_t sip_route_d(su_home_t *home,
@@ -2265,7 +2265,7 @@ issize_t sip_route_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
   return sip_any_route_e(b, bsiz, h, flags);
 }
 
-/**@ingroup sip_route 
+/**@ingroup sip_route
  * @brief Create a @Route header object.
  *
  * Creates a route entry from two URLs; first one provides the URL, second
@@ -2279,11 +2279,11 @@ issize_t sip_route_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
  * Returns a pointer to newly created @Route header object when successful,
  * or NULL upon an error.
  */
-sip_route_t *sip_route_create(su_home_t *home, 
-                             url_t const *url, 
+sip_route_t *sip_route_create(su_home_t *home,
+                             url_t const *url,
                              url_t const *maddr)
 {
-  return sip_any_route_create(home, sip_route_class, url, maddr);  
+  return sip_any_route_create(home, sip_route_class, url, maddr);
 }
 
 /* ====================================================================== */
@@ -2292,8 +2292,8 @@ sip_route_t *sip_route_create(su_home_t *home,
  *
  * The Record-Route headers are used to establish a route for transactions
  * belonging to a session.  The Record-Route header is defined in @RFC3261
- * as follows: 
- * 
+ * as follows:
+ *
  * @code
  *    Record-Route  =  "Record-Route" HCOLON rec-route *(COMMA rec-route)
  *    rec-route     =  name-addr *( SEMI rr-param )
@@ -2321,7 +2321,7 @@ sip_route_t *sip_route_create(su_home_t *home,
  * @endcode
  */
 
-msg_hclass_t sip_record_route_class[] = 
+msg_hclass_t sip_record_route_class[] =
 SIP_HEADER_CLASS(record_route, "Record-Route", "",
                 r_params, prepend, any_route);
 
@@ -2339,9 +2339,9 @@ issize_t sip_record_route_e(char b[], isize_t bsiz, sip_header_t const *h, int f
   return sip_any_route_e(b, bsiz, h, flags);
 }
 
-/** @ingroup sip_record_route 
+/** @ingroup sip_record_route
  *
- * Create a record-route. 
+ * Create a record-route.
  *
  * Create a record-route entry from two URLs; first one provides the URL,
  * second maddr parameter and port.
@@ -2367,7 +2367,7 @@ sip_record_route_t *sip_record_route_create(su_home_t *home,
  *
  * The To header field specifies the "logical" recipient of the
  * request.  It is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    To        =  ( "To" / "t" ) HCOLON ( name-addr
  *                 / addr-spec ) *( SEMI to-param )
@@ -2391,13 +2391,13 @@ sip_record_route_t *sip_record_route_create(su_home_t *home,
  *   url_t              a_url[1];       // URL
  *   msg_param_t const *a_params;       // List of to-params
  *   char const        *a_comment;      // Comment
- *   char const        *a_tag;          // Tag parameter 
+ *   char const        *a_tag;          // Tag parameter
  * } sip_to_t;
  * @endcode
  *
  */
 
-msg_hclass_t sip_to_class[] = 
+msg_hclass_t sip_to_class[] =
 SIP_HEADER_CLASS(to, "To", "t", a_params, single, addr);
 
 issize_t sip_to_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -2458,7 +2458,7 @@ int sip_to_add_param(su_home_t *home,
  * headers can be used to prevent request looping and ensure replies take
  * the same path as the requests.  The Via syntax is defined in @RFC3261
  * as follows:
- * 
+ *
  * @code
  *    Via               =  ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
  *    via-parm          =  sent-protocol LWS sent-by *( SEMI via-params )
@@ -2514,7 +2514,7 @@ int sip_to_add_param(su_home_t *home,
  *   char const         *v_port;        // Port number
  *   msg_param_t const  *v_params;      // List of via-params
  *   char const         *v_comment;     // Comment
- * 
+ *
  *   char const         *v_ttl;         // "ttl" parameter
  *   char const         *v_maddr;       // "maddr" parameter
  *   char const         *v_received;    // "received" parameter
@@ -2529,7 +2529,7 @@ static msg_xtra_f sip_via_dup_xtra;
 static msg_dup_f sip_via_dup_one;
 static msg_update_f sip_via_update;
 
-msg_hclass_t sip_via_class[] = 
+msg_hclass_t sip_via_class[] =
 SIP_HEADER_CLASS(via, "Via", "v", v_params, prepend, via);
 
 issize_t sip_via_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -2570,14 +2570,14 @@ issize_t sip_via_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
   MSG_CHAR_E(b, end, ' ');
   MSG_STRING_E(b, end, v->v_host);
   if (v->v_port) {
-    MSG_CHAR_E(b, end, ':');   
+    MSG_CHAR_E(b, end, ':');
     MSG_STRING_E(b, end, v->v_port);
   }
   MSG_PARAMS_E(b, end, v->v_params, flags);
 #if 0
   /* Comment is deprecated in @RFC3265 - accept it, but do not send */
   if (v->v_comment) {
-    if (!MSG_IS_COMPACT(flags)) 
+    if (!MSG_IS_COMPACT(flags))
       MSG_CHAR_E(b, end, ' ');
     MSG_CHAR_E(b, end, '(');
     MSG_STRING_E(b, end, v->v_comment);
@@ -2585,7 +2585,7 @@ issize_t sip_via_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
   }
 #endif
   MSG_TERM_E(b, end);
-    
+
   return b - b0;
 }
 
@@ -2602,7 +2602,7 @@ isize_t sip_via_dup_xtra(sip_header_t const *h, isize_t offset)
   return offset;
 }
 
-/** Duplicate one #sip_via_t object */ 
+/** Duplicate one #sip_via_t object */
 char *sip_via_dup_one(sip_header_t *dst, sip_header_t const *src,
                      char *b, isize_t xtra)
 {
@@ -2621,7 +2621,7 @@ char *sip_via_dup_one(sip_header_t *dst, sip_header_t const *src,
   return b;
 }
 
-static int sip_via_update(msg_common_t *h, 
+static int sip_via_update(msg_common_t *h,
                          char const *name, isize_t namelen,
                          char const *value)
 {
@@ -2685,7 +2685,7 @@ int sip_via_add_param(su_home_t *home,
 
 /**@ingroup sip_via
  *
- * Create a @Via object. 
+ * Create a @Via object.
  *
  * Create a new @Via header object with
  * given parameters.  If @a transport is NULL, the default transport
@@ -2701,10 +2701,10 @@ int sip_via_add_param(su_home_t *home,
  * @return
  * A pointer to newly created
  * @Via header object when successful or NULL upon an error.
- */ 
+ */
 sip_via_t *sip_via_create(su_home_t *home,
                           char const *host,
-                          char const *port, 
+                          char const *port,
                           char const *transport,
                           /* char const *params */
                           ...)
@@ -2728,8 +2728,8 @@ sip_via_t *sip_via_create(su_home_t *home,
     char const *param;
     va_start(params, transport);
 
-    for (param = va_arg(params, char const *); 
-         param; 
+    for (param = va_arg(params, char const *);
+         param;
          param = va_arg(params, char const *)) {
       if ((param = su_strdup(home, param))) {
        if (msg_header_replace_param(home, v->v_common, param) < 0)
@@ -2746,7 +2746,7 @@ sip_via_t *sip_via_create(su_home_t *home,
 /**@ingroup sip_via
  *
  * Get port number corresponding to a @Via line.
- * 
+ *
  * If @a using_rport is non-null, try rport.
  * If *using_rport is non-zero, try rport even if <protocol> is not UDP.
  * If <protocol> is UDP, set *using_rport to zero.
@@ -2760,7 +2760,7 @@ char const *sip_via_port(sip_via_t const *v, int *using_rport)
     char const *port;
 
     if (v->v_rport && !v->v_maddr /* multicast */) {
-      if (v->v_protocol == sip_transport_udp || 
+      if (v->v_protocol == sip_transport_udp ||
          strcasecmp(v->v_protocol, sip_transport_udp) == 0)
        port = v->v_rport, *using_rport = 0;
       else if (*using_rport)
index 79d3c540dcd55f9b5db781361044ca0eaaef9a03..a5236c7879b71ecd7859cd95c65205bfeb367a1b 100644 (file)
  * @endcode
  *
  *
- * The parsed Request-Disposition header 
+ * The parsed Request-Disposition header
  * is stored in #sip_request_disposition_t structure.
  */
 
 /**@ingroup sip_request_disposition
  * @typedef typedef struct sip_request_disposition_s sip_request_disposition_t;
  *
- * The structure #sip_request_disposition_t contains representation of 
+ * The structure #sip_request_disposition_t contains representation of
  * @RequestDisposition header.
  *
  * The #sip_request_disposition_t is defined as follows:
index cf9e1ec40351a4b1b50c68a706b064534e55fbd7..e17d803453b1244f813b974c94b009726772b875 100644 (file)
@@ -56,7 +56,7 @@
  * The Event header is used to indicate the which event or class of events
  * the message contains or subscribes. Its syntax is defined in @RFC3265 as
  * follows:
- * 
+ *
  * @code
  *   Event             =  ( "Event" / "o" ) HCOLON event-type
  *                         *( SEMI event-param )
@@ -72,7 +72,7 @@
  */
 
 /**@ingroup sip_event
- * @typedef struct sip_event_s sip_event_t; 
+ * @typedef struct sip_event_s sip_event_t;
  *
  * The structure #sip_event_t contains representation of an @Event header.
  *
@@ -93,7 +93,7 @@ static msg_xtra_f sip_event_dup_xtra;
 static msg_dup_f sip_event_dup_one;
 static msg_update_f sip_event_update;
 
-msg_hclass_t sip_event_class[] = 
+msg_hclass_t sip_event_class[] =
 SIP_HEADER_CLASS(event, "Event", "o", o_params, single, event);
 
 issize_t sip_event_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -134,7 +134,7 @@ isize_t sip_event_dup_xtra(sip_header_t const *h, isize_t offset)
   return offset;
 }
 
-/** Duplicate one #sip_event_t object */ 
+/** Duplicate one #sip_event_t object */
 char *sip_event_dup_one(sip_header_t *dst, sip_header_t const *src,
                        char *b, isize_t xtra)
 {
@@ -150,7 +150,7 @@ char *sip_event_dup_one(sip_header_t *dst, sip_header_t const *src,
 }
 
 /** Update parameters in @Event header. */
-static int sip_event_update(msg_common_t *h, 
+static int sip_event_update(msg_common_t *h,
                           char const *name, isize_t namelen,
                           char const *value)
 {
@@ -173,9 +173,9 @@ static int sip_event_update(msg_common_t *h,
  * The Allow-Events header is used to indicate which events or classes of
  * events the notifier supports. Its syntax is defined in @RFC3265 as
  * follows:
- * 
+ *
  * @code
- *    Allow-Events = ( "Allow-Events" / "u" ) HCOLON event-type 
+ *    Allow-Events = ( "Allow-Events" / "u" ) HCOLON event-type
  *                                           *(COMMA event-type)
  * @endcode
  *
@@ -190,9 +190,9 @@ static int sip_event_update(msg_common_t *h,
  */
 
 /**@ingroup sip_allow_events
- * @typedef struct msg_list_s sip_allow_events_t; 
+ * @typedef struct msg_list_s sip_allow_events_t;
  *
- * The structure #sip_allow_events_t contains representation of an 
+ * The structure #sip_allow_events_t contains representation of an
  * @AllowEvents header.
  *
  * The #sip_allow_events_t is defined as follows:
@@ -206,7 +206,7 @@ static int sip_event_update(msg_common_t *h,
  * @endcode
  */
 
-msg_hclass_t sip_allow_events_class[] = 
+msg_hclass_t sip_allow_events_class[] =
 SIP_HEADER_CLASS_LIST(allow_events, "Allow-Events", "u", list);
 
 issize_t sip_allow_events_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -220,14 +220,14 @@ issize_t sip_allow_events_e(char b[], isize_t bsiz, sip_header_t const *h, int f
   return msg_list_e(b, bsiz, h, f);
 }
 
-/** Append an event to a @AllowEvents header. 
+/** Append an event to a @AllowEvents header.
  *
  * @note This function @b does @b duplicate @p event.
  *
  * @deprecated Use msg_header_replace_item() directly.
  */
-int sip_allow_events_add(su_home_t *home, 
-                        sip_allow_events_t *ae, 
+int sip_allow_events_add(su_home_t *home,
+                        sip_allow_events_t *ae,
                         char const *event)
 {
   event = su_strdup(home, event);
@@ -243,7 +243,7 @@ int sip_allow_events_add(su_home_t *home,
  * The Subscription-State header is used to indicate in which state a
  * subscription is. Its syntax is defined in @RFC3265 section 4.2.4 as
  * follows:
- * 
+ *
  * @code
  *    Subscription-State   = "Subscription-State" HCOLON substate-value
  *                           *( SEMI subexp-params )
@@ -271,7 +271,7 @@ int sip_allow_events_add(su_home_t *home,
 /**@ingroup sip_subscription_state
  * @typedef struct sip_subscription_state_s sip_subscription_state_t;
  *
- * The structure #sip_subscription_state_t contains representation of an 
+ * The structure #sip_subscription_state_t contains representation of an
  * @SubscriptionState header.
  *
  * The #sip_subscription_state_t is defined as follows:
@@ -281,9 +281,9 @@ int sip_allow_events_add(su_home_t *home,
  *   sip_common_t       ss_common[1];
  *   sip_unknown_t     *ss_next;
  *   // Subscription state: "pending", "active" or "terminated"
- *   char const        *ss_substate;        
+ *   char const        *ss_substate;
  *   msg_param_t const *ss_params;      // List of parameters
- *   char const        *ss_reason;      // Reason of terminating 
+ *   char const        *ss_reason;      // Reason of terminating
  *   char const        *ss_expires;     // Subscription lifetime in seconds
  *   char const        *ss_retry_after; // Value of retry-after parameter
  * } sip_subscription_state_t;
@@ -294,24 +294,24 @@ static msg_xtra_f sip_subscription_state_dup_xtra;
 static msg_dup_f sip_subscription_state_dup_one;
 static msg_update_f sip_subscription_state_update;
 
-msg_hclass_t sip_subscription_state_class[] = 
-SIP_HEADER_CLASS(subscription_state, "Subscription-State", "", 
-                ss_params, single, 
+msg_hclass_t sip_subscription_state_class[] =
+SIP_HEADER_CLASS(subscription_state, "Subscription-State", "",
+                ss_params, single,
                 subscription_state);
 
-issize_t sip_subscription_state_d(su_home_t *home, sip_header_t *h, 
+issize_t sip_subscription_state_d(su_home_t *home, sip_header_t *h,
                                  char *s, isize_t slen)
 {
    sip_subscription_state_t *ss = h->sh_subscription_state;
    ss->ss_substate = s;
-   
+
    s += span_token(s); /* forwards the pointer to the end of substate-value */
    if (s == ss->ss_substate)
      return -1;
-   if (IS_LWS(*s)) { 
+   if (IS_LWS(*s)) {
      *s = '\0'; s += span_lws(s + 1) + 1;
    }
-   
+
    /* check if parameters are present and if so parse them */
    if (*s  == ';') {
      if ( msg_params_d(home, &s, &ss->ss_params) < 0)
@@ -327,34 +327,34 @@ issize_t sip_subscription_state_e(char b[], isize_t bsiz, sip_header_t const *h,
 {
   char *end = b + bsiz, *b0 = b;
   sip_subscription_state_t const *ss = h->sh_subscription_state;
-   
+
   assert(sip_is_subscription_state(h));
-   
+
   MSG_STRING_E(b, end, ss->ss_substate);
-  MSG_PARAMS_E(b, end, ss->ss_params, flags);   
+  MSG_PARAMS_E(b, end, ss->ss_params, flags);
 
-  return b - b0;   
+  return b - b0;
 }
 
 isize_t sip_subscription_state_dup_xtra(sip_header_t const *h, isize_t offset)
 {
    sip_subscription_state_t const *ss = h->sh_subscription_state;
-   
+
    /* Calculates memory size occupied */
    MSG_PARAMS_SIZE(offset, ss->ss_params);
    offset += MSG_STRING_SIZE(ss->ss_substate);
-   
-   return offset;   
+
+   return offset;
 }
 
-/** Duplicate one #sip_subscription_state_t object */ 
+/** Duplicate one #sip_subscription_state_t object */
 char *sip_subscription_state_dup_one(sip_header_t *dst, sip_header_t const *src,
                                     char *b, isize_t xtra)
 {
   sip_subscription_state_t *ss_dst = dst->sh_subscription_state;
   sip_subscription_state_t const *ss_src = src->sh_subscription_state;
   char *end = b + xtra;
-   
+
   b = msg_params_dup(&ss_dst->ss_params, ss_src->ss_params, b, xtra);
   MSG_STRING_DUP(b, ss_dst->ss_substate, ss_src->ss_substate);
   assert(b <= end); (void)end;
@@ -362,7 +362,7 @@ char *sip_subscription_state_dup_one(sip_header_t *dst, sip_header_t const *src,
   return b;
 }
 
-static int sip_subscription_state_update(msg_common_t *h, 
+static int sip_subscription_state_update(msg_common_t *h,
                                         char const *name, isize_t namelen,
                                         char const *value)
 {
@@ -399,7 +399,7 @@ static int sip_subscription_state_update(msg_common_t *h,
  * The Publication header is used to indicate the which publication or class
  * of publications the message contains. Its syntax is defined
  * in (draft-niemi-simple-publish-00.txt) as follows:
- * 
+ *
  * @code
  *   Publication          =  ( "Publication") HCOLON publish-package
  *                         *( SEMI publish-param )
@@ -418,7 +418,7 @@ static int sip_subscription_state_update(msg_common_t *h,
 /**@ingroup sip_publication
  * @brief Structure for Publication header.
  */
-struct sip_publication_s 
+struct sip_publication_s
 {
   sip_common_t        pub_common;          /**< Common fragment info */
   sip_error_t        *pub_next;                    /**< Link to next (dummy) */
@@ -431,8 +431,8 @@ struct sip_publication_s
 static msg_xtra_f sip_publication_dup_xtra;
 static msg_dup_f sip_publication_dup_one;
 
-msg_hclass_t sip_publication_class[] = 
-SIP_HEADER_CLASS(publication, "Publication", "", pub_params, single, 
+msg_hclass_t sip_publication_class[] =
+SIP_HEADER_CLASS(publication, "Publication", "", pub_params, single,
                 publication);
 
 su_inline void sip_publication_update(sip_publication_t *pub);
@@ -475,7 +475,7 @@ isize_t sip_publication_dup_xtra(sip_header_t const *h, isize_t offset)
   return offset;
 }
 
-/** Duplicate one #sip_publication_t object */ 
+/** Duplicate one #sip_publication_t object */
 char *sip_publication_dup_one(sip_header_t *dst, sip_header_t const *src,
                        char *b, isize_t xtra)
 {
@@ -512,9 +512,9 @@ su_inline void sip_publication_update(sip_publication_t *pub)
  * The Allow-Publication header is used to indicate which publications or classes of
  * publications the server supports.  Its syntax is defined in [niemi]
  * (draft-niemi-simple-publish-00.txt) as follows:
- * 
+ *
  * @code
- *   Allow-Publications   = "Allow-Publications" HCOLON publish-type 
+ *   Allow-Publications   = "Allow-Publications" HCOLON publish-type
  *                          * ( COMMA publish-type )
  * @endcode
  *
@@ -523,7 +523,7 @@ su_inline void sip_publication_update(sip_publication_t *pub)
  * is stored in #sip_allow_publications_t structure.
  */
 
-msg_hclass_t sip_allow_publications_class[] = 
+msg_hclass_t sip_allow_publications_class[] =
 SIP_HEADER_CLASS_LIST(allow_publications, "Allow-Publications", "", list);
 
 issize_t sip_allow_publications_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -538,8 +538,8 @@ issize_t sip_allow_publications_e(char b[], isize_t bsiz, sip_header_t const *h,
 }
 
 /** Append an publication to a Allow-Publications header. */
-int sip_allow_publications_add(su_home_t *home, 
-                              sip_allow_publications_t *ae, 
+int sip_allow_publications_add(su_home_t *home,
+                              sip_allow_publications_t *ae,
                               char const *e)
 {
   e = su_strdup(home, e);
index a5f9db2bb44a7b45c3055a3c39ce85a5c2543642..ddf5398733719c8105f1c620e2ed4eee3ddddd64 100644 (file)
 
 /**@CFILE sip_extra.c
  * @brief Non-critical SIP headers
- * 
+ *
  * This file contains implementation of @CallInfo, @ErrorInfo,
  * @Organization, @Priority, @RetryAfter, @Server, @Subject,
  * @Timestamp, and @UserAgent headers.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
- * 
+ *
  * @date Created: Tue Jun 13 02:57:51 2000 ppessi
  */
 
@@ -66,17 +66,17 @@ static char *sip_info_dup_one(sip_header_t *dst,
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_call_info Call-Info Header
- * 
+ *
  * The Call-Info header provides additional information about the caller or
  * callee. Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Call-Info   =  "Call-Info" HCOLON info *(COMMA info)
  *    info        =  LAQUOT absoluteURI RAQUOT *( SEMI info-param)
  *    info-param  =  ( "purpose" EQUAL ( "icon" / "info"
  *                   / "card" / token ) ) / generic-param
  * @endcode
- * 
+ *
  *
  * The parsed Call-Info header is stored in #sip_call_info_t structure.
  */
@@ -84,7 +84,7 @@ static char *sip_info_dup_one(sip_header_t *dst,
 /**@ingroup sip_call_info
  * @typedef struct sip_call_info_s sip_call_info_t;
  *
- * The structure #sip_call_info_t contains representation of an 
+ * The structure #sip_call_info_t contains representation of an
  * @CallInfo header.
  *
  * The #sip_call_info_t is defined as follows:
@@ -130,10 +130,10 @@ issize_t sip_call_info_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 
 /** @internal
  * Update parameter in a @CallInfo object.
- * 
+ *
  */
 static
-int sip_call_info_update(msg_common_t *h, 
+int sip_call_info_update(msg_common_t *h,
                          char const *name, isize_t namelen,
                          char const *value)
 {
@@ -142,7 +142,7 @@ int sip_call_info_update(msg_common_t *h,
   if (name == NULL) {
     ci->ci_purpose = NULL;
   }
-  else if (namelen == strlen("purpose") && 
+  else if (namelen == strlen("purpose") &&
           !strncasecmp(name, "purpose", namelen)) {
     ci->ci_purpose = value;
   }
@@ -153,15 +153,15 @@ int sip_call_info_update(msg_common_t *h,
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_error_info Error-Info Header
- * 
+ *
  * The Error-Info header provides a pointer to additional information about
  * the error status response. Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Error-Info  =  "Error-Info" HCOLON error-uri *(COMMA error-uri)
  *    error-uri   =  LAQUOT absoluteURI RAQUOT *( SEMI generic-param )
  * @endcode
- * 
+ *
  *
  * The parsed Error-Info header is stored in #sip_error_info_t structure.
  */
@@ -169,7 +169,7 @@ int sip_call_info_update(msg_common_t *h,
 /**@ingroup sip_error_info
  * @typedef struct sip_error_info_s sip_error_info_t;
  *
- * The structure #sip_error_info_t contains representation of an 
+ * The structure #sip_error_info_t contains representation of an
  * @ErrorInfo header.
  *
  * The #sip_error_info_t is defined as follows:
@@ -184,7 +184,7 @@ int sip_call_info_update(msg_common_t *h,
  * @endcode
  */
 
-msg_hclass_t sip_error_info_class[] = 
+msg_hclass_t sip_error_info_class[] =
 SIP_HEADER_CLASS(error_info, "Error-Info", "",
                 ei_params, append, info);
 
@@ -377,11 +377,11 @@ static char *sip_reply_to_dup_one(sip_header_t *dst, sip_header_t const *src,
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_in_reply_to In-Reply-To Header
- * 
- * The @b In-Reply-To request header field enumerates the 
+ *
+ * The @b In-Reply-To request header field enumerates the
  * @ref sip_call_id "Call-IDs" that this call references or returns.
  * Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    In-Reply-To  =  "In-Reply-To" HCOLON callid *(COMMA callid)
  * @endcode
@@ -392,8 +392,8 @@ static char *sip_reply_to_dup_one(sip_header_t *dst, sip_header_t const *src,
 /**@ingroup sip_in_reply_to
  * @typedef struct msg_list_s sip_in_reply_to_t;
  *
- * The structure #sip_in_reply_to_t contains representation of SIP 
- * @InReplyTo header. 
+ * The structure #sip_in_reply_to_t contains representation of SIP
+ * @InReplyTo header.
  *
  * The #sip_in_reply_to_t is defined as follows:
  * @code
@@ -406,7 +406,7 @@ static char *sip_reply_to_dup_one(sip_header_t *dst, sip_header_t const *src,
  * @endcode
  */
 
-msg_hclass_t sip_in_reply_to_class[] = 
+msg_hclass_t sip_in_reply_to_class[] =
 SIP_HEADER_CLASS_LIST(in_reply_to, "In-Reply-To", "", list);
 
 issize_t sip_in_reply_to_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -423,23 +423,23 @@ issize_t sip_in_reply_to_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_organization Organization Header
- * 
+ *
  * The Organization header field conveys the name of the organization to
  * which the entity issuing the request or response belongs. Its syntax is
  * defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Organization  =  "Organization" HCOLON [TEXT-UTF8-TRIM]
  * @endcode
- * 
+ *
  *
  * The parsed Organization header is stored in #sip_organization_t structure.
  */
 
 /**@ingroup sip_organization
- * @typedef struct msg_generic_s sip_organization_t; 
+ * @typedef struct msg_generic_s sip_organization_t;
  *
- * The structure #sip_organization_t contains representation of a SIP 
+ * The structure #sip_organization_t contains representation of a SIP
  * @Organization header.
  *
  * The #sip_organization_t is defined as follows:
@@ -453,7 +453,7 @@ issize_t sip_in_reply_to_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  * @endcode
  */
 
-msg_hclass_t sip_organization_class[] = 
+msg_hclass_t sip_organization_class[] =
 SIP_HEADER_CLASS_G(organization, "Organization", "", single);
 
 issize_t sip_organization_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -470,25 +470,25 @@ issize_t sip_organization_e(char b[], isize_t bsiz, sip_header_t const *h, int f
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_priority Priority Header
- * 
+ *
  * The Priority request-header field indicates the urgency of the request as
  * perceived by the client. Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Priority        =  "Priority" HCOLON priority-value
  *    priority-value  =  "emergency" / "urgent" / "normal"
  *                       / "non-urgent" / other-priority
  *    other-priority  =  token
  * @endcode
- * 
+ *
  *
  * The parsed Priority header is stored in #sip_priority_t structure.
  */
 
 /**@ingroup sip_priority
- * @typedef struct msg_generic_s sip_priority_t; 
+ * @typedef struct msg_generic_s sip_priority_t;
  *
- * The structure #sip_priority_t contains representation of a SIP 
+ * The structure #sip_priority_t contains representation of a SIP
  * @Priority header.
  *
  * The #sip_priority_t is defined as follows:
@@ -502,13 +502,13 @@ issize_t sip_organization_e(char b[], isize_t bsiz, sip_header_t const *h, int f
  * @endcode
  */
 
-msg_hclass_t sip_priority_class[] = 
+msg_hclass_t sip_priority_class[] =
 SIP_HEADER_CLASS_G(priority, "Priority", "", single);
 
 issize_t sip_priority_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
 {
   sip_priority_t *priority = (sip_priority_t *)h;
-  
+
   if (msg_token_d(&s, &priority->g_string) < 0)
     return -1;
 
@@ -527,11 +527,11 @@ issize_t sip_priority_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_server Server Header
- * 
+ *
  * The Server response-header field contains information about the software
  * used by the user agent server to handle the request. Its syntax is
  * defined in @RFC2616 section 14.38 and @RFC3261 as follows:
- * 
+ *
  * @code
  *    Server           =  "Server" HCOLON server-val *(LWS server-val)
  *    server-val       =  product / comment
@@ -543,9 +543,9 @@ issize_t sip_priority_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  */
 
 /**@ingroup sip_server
- * @typedef struct msg_generic_s sip_server_t; 
+ * @typedef struct msg_generic_s sip_server_t;
  *
- * The structure #sip_server_t contains representation of a SIP 
+ * The structure #sip_server_t contains representation of a SIP
  * @Server header.
  *
  * The #sip_server_t is defined as follows:
@@ -559,7 +559,7 @@ issize_t sip_priority_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  * @endcode
  */
 
-msg_hclass_t sip_server_class[] = 
+msg_hclass_t sip_server_class[] =
 SIP_HEADER_CLASS_G(server, "Server", "", single);
 
 issize_t sip_server_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -576,21 +576,21 @@ issize_t sip_server_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_subject Subject Header
- * 
+ *
  * The Subject header provides a summary or indicates the nature of the
  * request. Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Subject  =  ( "Subject" / "s" ) HCOLON [TEXT-UTF8-TRIM]
  * @endcode
- * 
+ *
  * The parsed Subject header is stored in #sip_subject_t structure.
  */
 
 /**@ingroup sip_subject
- * @typedef struct msg_generic_s sip_subject_t; 
+ * @typedef struct msg_generic_s sip_subject_t;
  *
- * The structure #sip_subject_t contains representation of a SIP 
+ * The structure #sip_subject_t contains representation of a SIP
  * @Subject header.
  *
  * The #sip_subject_t is defined as follows:
@@ -604,7 +604,7 @@ issize_t sip_server_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  * @endcode
  */
 
-msg_hclass_t sip_subject_class[] = 
+msg_hclass_t sip_subject_class[] =
 SIP_HEADER_CLASS_G(subject, "Subject", "s", single);
 
 issize_t sip_subject_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -621,24 +621,24 @@ issize_t sip_subject_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_timestamp Timestamp Header
- * 
+ *
  * The @b Timestamp header describes when the client sent the request to the
  * server, and it is used by the client to adjust its retransmission
  * intervals. Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Timestamp  =  "Timestamp" HCOLON 1*(DIGIT)
  *                   [ "." *(DIGIT) ] [ LWS delay ]
  *    delay      =  *(DIGIT) [ "." *(DIGIT) ]
  * @endcode
- * 
+ *
  * The parsed Timestamp header is stored in #sip_timestamp_t structure.
  */
 
 /**@ingroup sip_timestamp
- * @typedef struct sip_timestamp_s sip_timestamp_t; 
+ * @typedef struct sip_timestamp_s sip_timestamp_t;
  *
- * The structure #sip_timestamp_t contains representation of a SIP 
+ * The structure #sip_timestamp_t contains representation of a SIP
  * @Timestamp header.
  *
  * The #sip_timestamp_t is defined as follows:
@@ -660,7 +660,7 @@ static char *sip_timestamp_dup_one(sip_header_t *dst,
                                   isize_t xtra);
 #define sip_timestamp_update NULL
 
-msg_hclass_t sip_timestamp_class[] = 
+msg_hclass_t sip_timestamp_class[] =
 SIP_HEADER_CLASS(timestamp, "Timestamp", "", ts_common, single,
                 timestamp);
 
@@ -669,7 +669,7 @@ issize_t sip_timestamp_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen
   sip_timestamp_t *ts = (sip_timestamp_t*)h;
 
   ts->ts_stamp = s;
-  s += span_digit(s); 
+  s += span_digit(s);
   if (s == ts->ts_stamp)
     return -1;
   if (*s == '.') { s += span_digit(s + 1) + 1; }
@@ -685,7 +685,7 @@ issize_t sip_timestamp_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen
     *s++ = '\0';
   else
     return -1;
-  
+
   return 0;
 }
 
@@ -703,7 +703,7 @@ issize_t sip_timestamp_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
   }
 
   MSG_TERM_E(b, end);
-    
+
   return b - b0;
 }
 
@@ -739,25 +739,25 @@ char *sip_timestamp_dup_one(sip_header_t *dst,
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_user_agent User-Agent Header
- * 
+ *
  * The User-Agent header contains information about the client user agent
  * originating the request. Its syntax is defined in [H14.43, S10.45] as
  * follows:
- * 
+ *
  * @code
  *    User-Agent       =  "User-Agent" HCOLON server-val *(LWS server-val)
  *    server-val       =  product / comment
  *    product          =  token [SLASH product-version]
  *    product-version  =  token
  * @endcode
- * 
+ *
  * The parsed User-Agent header is stored in #sip_user_agent_t structure.
  */
 
 /**@ingroup sip_user_agent
- * @typedef struct msg_generic_s sip_user_agent_t; 
+ * @typedef struct msg_generic_s sip_user_agent_t;
  *
- * The structure #sip_user_agent_t contains representation of a SIP 
+ * The structure #sip_user_agent_t contains representation of a SIP
  * @UserAgent header.
  *
  * The #sip_user_agent_t is defined as follows:
@@ -771,7 +771,7 @@ char *sip_timestamp_dup_one(sip_header_t *dst,
  * @endcode
  */
 
-msg_hclass_t sip_user_agent_class[] = 
+msg_hclass_t sip_user_agent_class[] =
 SIP_HEADER_CLASS_G(user_agent, "User-Agent", "", single);
 
 issize_t sip_user_agent_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -788,10 +788,10 @@ issize_t sip_user_agent_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_etag SIP-ETag Header
- * 
+ *
  * The @b SIP-ETag header field identifies the published event state. Its
  * syntax is defined in @RFC3903 as follows:
- * 
+ *
  * @code
  *      SIP-ETag           = "SIP-ETag" HCOLON entity-tag
  *      entity-tag         = token
@@ -801,9 +801,9 @@ issize_t sip_user_agent_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  */
 
 /**@ingroup sip_etag
- * @typedef struct msg_generic_s sip_etag_t; 
+ * @typedef struct msg_generic_s sip_etag_t;
  *
- * The structure #sip_etag_t contains representation of a SIP 
+ * The structure #sip_etag_t contains representation of a SIP
  * @SIPETag header.
  *
  * The #sip_etag_t is defined as follows:
@@ -817,7 +817,7 @@ issize_t sip_user_agent_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  * @endcode
  */
 
-msg_hclass_t sip_etag_class[] = 
+msg_hclass_t sip_etag_class[] =
 SIP_HEADER_CLASS_G(etag, "SIP-ETag", "", single);
 
 issize_t sip_etag_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -835,11 +835,11 @@ issize_t sip_etag_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_if_match SIP-If-Match Header
- * 
+ *
  * The @b SIP-If-Match header field identifies the specific entity of event
  * state that the request is refreshing, modifying or removing. Its syntax
  * is defined in @RFC3903 as follows:
- * 
+ *
  * @code
  *      SIP-If-Match       = "SIP-If-Match" HCOLON entity-tag
  *      entity-tag         = token
@@ -849,9 +849,9 @@ issize_t sip_etag_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  */
 
 /**@ingroup sip_if_match
- * @typedef struct msg_generic_s sip_if_match_t; 
+ * @typedef struct msg_generic_s sip_if_match_t;
  *
- * The structure #sip_if_match_t contains representation of a SIP 
+ * The structure #sip_if_match_t contains representation of a SIP
  * @SIPIfMatch header.
  *
  * The #sip_if_match_t is defined as follows:
@@ -865,7 +865,7 @@ issize_t sip_etag_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  * @endcode
  */
 
-msg_hclass_t sip_if_match_class[] = 
+msg_hclass_t sip_if_match_class[] =
 SIP_HEADER_CLASS_G(if_match, "SIP-If-Match", "", single);
 
 issize_t sip_if_match_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -943,11 +943,11 @@ char *sip_info_dup_one(sip_header_t *dst,
  *
  * @sa @RFC3265, draft-niemi-sip-subnot-etags-01.txt
  *
- * @EXP_1_12_5. 
- * In order to use @b Suppress-Body-If-Match header, 
+ * @EXP_1_12_5.
+ * In order to use @b Suppress-Body-If-Match header,
  * initialize the SIP parser with, e.g.,
  * sip_update_default_mclass(sip_extend_mclass(NULL)).
- * 
+ *
  * @note
  * The #sip_t structure does not contain a @a
  * sip_suppress_body_if_match field, but sip_suppress_body_if_match()
@@ -1015,11 +1015,11 @@ issize_t sip_suppress_body_if_match_e(char b[], isize_t bsiz,
  *
  * @sa @RFC3265, draft-niemi-sip-subnot-etag-01
  *
- * @EXP_1_12_5. 
- * In order to use @b Suppress-Notify-If-Match header, 
+ * @EXP_1_12_5.
+ * In order to use @b Suppress-Notify-If-Match header,
  * initialize the SIP parser with, e.g.,
  * sip_update_default_mclass(sip_extend_mclass(NULL)).
- * 
+ *
  * @note
  * The #sip_t struct does not contain @a sip_suppress_notify_if_match field,
  * but sip_suppress_notify_if_match() function should be used for accessing
@@ -1175,12 +1175,12 @@ issize_t sip_remote_party_id_e(char b[], isize_t bsiz,
 }
 
 /** Calculate size of extra data required for duplicating one
- *  sip_remote_party_id_t header. 
+ *  sip_remote_party_id_t header.
  */
 isize_t sip_remote_party_id_dup_xtra(sip_header_t const *h, isize_t offset)
 {
   sip_remote_party_id_t const *rpid = (sip_remote_party_id_t *)h;
-  return sip_name_addr_xtra(rpid->rpid_display, 
+  return sip_name_addr_xtra(rpid->rpid_display,
                            rpid->rpid_url,
                            rpid->rpid_params,
                            offset);
@@ -1200,7 +1200,7 @@ char *sip_remote_party_id_dup_one(sip_header_t *dst,
                           b, xtra);
 }
 
-static int sip_remote_party_id_update(msg_common_t *h, 
+static int sip_remote_party_id_update(msg_common_t *h,
                                      char const *name, isize_t namelen,
                                      char const *value)
 {
@@ -1248,7 +1248,7 @@ static int sip_remote_party_id_update(msg_common_t *h,
  *
  * @sa @RFC3325, @PPreferredIdentity
  *
- * @NEW_1_12_7. In order to use @b P-Asserted-Identity header, 
+ * @NEW_1_12_7. In order to use @b P-Asserted-Identity header,
  * initialize the SIP parser before calling nta_agent_create() or
  * nua_create() with, e.g.,
  * sip_update_default_mclass(sip_extend_mclass(NULL)).
@@ -1318,7 +1318,7 @@ isize_t sip_p_asserted_identity_dup_xtra(sip_header_t const *h, isize_t offset)
 {
   sip_p_asserted_identity_t const *paid = (sip_p_asserted_identity_t *)h;
 
-  return sip_name_addr_xtra(paid->paid_display, 
+  return sip_name_addr_xtra(paid->paid_display,
                            paid->paid_url,
                            NULL,
                            offset);
@@ -1402,4 +1402,4 @@ issize_t sip_p_preferred_identity_e(char b[], isize_t bsiz,
   return sip_p_asserted_identity_e(b, bsiz, h, f);
 }
 
-#endif 
+#endif
index 7de56204189679cb5d16c55b67a4d1fcdc747949..b20e6f45114f2706bbea778a74b27c0f519fbbdf 100644 (file)
@@ -4,7 +4,7 @@
 # The parsed headers are accessed with function (or macro) like sip_refer_sub()
 # e.g., sip_refer_sub_t *rsub = sip_refer_sub(sip);
 #
-# The line format is: 
+# The line format is:
 # C-name @SINCE sip_t-like-comment
 #
 # Put all experimental things after EXPERIMENTAL HEADER LIST STARTS HERE...
index a072187cae8260db3b8bbf9bef3423501ac13de3..625a8bba5b955ee83585b28675eadea0941cf3e3 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@CFILE sip_feature.c 
+/**@CFILE sip_feature.c
  *
  * @brief Feature-related SIP header handling
  *
@@ -52,7 +52,7 @@
  * The Allow header lists the set of methods supported by the user agent
  * generating the message.  Its syntax is defined in @RFC3261 as
  * follows:
- * 
+ *
  * @code
  *    Allow  =  "Allow" HCOLON [Method *(COMMA Method)]
  * @endcode
@@ -67,7 +67,7 @@
  */
 
 /**@ingroup sip_allow
- * @typedef struct msg_list_s sip_allow_t; 
+ * @typedef struct msg_list_s sip_allow_t;
  *
  * The structure #sip_allow_t contains representation of an @Allow header.
  *
@@ -89,7 +89,7 @@
 #define sip_allow_dup_one  msg_list_dup_one
 static msg_update_f sip_allow_update;
 
-msg_hclass_t sip_allow_class[] = 
+msg_hclass_t sip_allow_class[] =
 SIP_HEADER_CLASS(allow, "Allow", "", k_items, list, allow);
 
 issize_t sip_allow_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -106,7 +106,7 @@ issize_t sip_allow_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
   return msg_list_e(b, bsiz, h, f);
 }
 
-static int sip_allow_update(msg_common_t *h, 
+static int sip_allow_update(msg_common_t *h,
                          char const *name, isize_t namelen,
                          char const *value)
 {
@@ -118,7 +118,7 @@ static int sip_allow_update(msg_common_t *h,
   else {
     sip_method_t method = sip_method_code(name);
 
-    if (method >= 0 && method < 32) 
+    if (method >= 0 && method < 32)
       k->k_bitmap |= 1 << method;
   }
 
@@ -152,7 +152,7 @@ int sip_is_allowed(sip_allow_t const *allow,
  * The Proxy-Require header is used to indicate proxy-sensitive features
  * that @b MUST be supported by the proxy.  Its syntax is defined in @RFC3261
  * as follows:
- * 
+ *
  * @code
  *    Proxy-Require  =  "Proxy-Require" HCOLON option-tag *(COMMA option-tag)
  * @endcode
@@ -162,9 +162,9 @@ int sip_is_allowed(sip_allow_t const *allow,
  */
 
 /**@ingroup sip_proxy_require
- * @typedef struct msg_list_s sip_proxy_require_t; 
+ * @typedef struct msg_list_s sip_proxy_require_t;
  *
- * The structure #sip_proxy_require_t contains representation of an 
+ * The structure #sip_proxy_require_t contains representation of an
  * @ProxyRequire header.
  *
  * The #sip_proxy_require_t is defined as follows:
@@ -178,7 +178,7 @@ int sip_is_allowed(sip_allow_t const *allow,
  * @endcode
  */
 
-msg_hclass_t sip_proxy_require_class[] = 
+msg_hclass_t sip_proxy_require_class[] =
 SIP_HEADER_CLASS_LIST(proxy_require, "Proxy-Require", "", list);
 
 issize_t sip_proxy_require_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -199,9 +199,9 @@ issize_t sip_proxy_require_e(char b[], isize_t bsiz, sip_header_t const *h, int
  *
  * The Require header is used by clients to tell user agent servers about
  * options that the client expects the server to support in order to
- * properly process the request.  Its syntax is defined in @RFC3261 
+ * properly process the request.  Its syntax is defined in @RFC3261
  * as follows:
- * 
+ *
  * @code
  *    Require       =  "Require" HCOLON option-tag *(COMMA option-tag)
  * @endcode
@@ -210,9 +210,9 @@ issize_t sip_proxy_require_e(char b[], isize_t bsiz, sip_header_t const *h, int
  */
 
 /**@ingroup sip_require
- * @typedef struct msg_list_s sip_require_t; 
+ * @typedef struct msg_list_s sip_require_t;
  *
- * The structure #sip_require_t contains representation of an 
+ * The structure #sip_require_t contains representation of an
  * @Require header.
  *
  * The #sip_require_t is defined as follows:
@@ -226,7 +226,7 @@ issize_t sip_proxy_require_e(char b[], isize_t bsiz, sip_header_t const *h, int
  * @endcode
  */
 
-msg_hclass_t sip_require_class[] = 
+msg_hclass_t sip_require_class[] =
 SIP_HEADER_CLASS_LIST(require, "Require", "", list);
 
 issize_t sip_require_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -247,7 +247,7 @@ issize_t sip_require_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  *
  * The Supported header enumerates all the capabilities of the client or
  * server.  Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Supported  =  ( "Supported" / "k" ) HCOLON
  *                  [option-tag *(COMMA option-tag)]
@@ -258,9 +258,9 @@ issize_t sip_require_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  */
 
 /**@ingroup sip_supported
- * @typedef struct msg_list_s sip_supported_t; 
+ * @typedef struct msg_list_s sip_supported_t;
  *
- * The structure #sip_supported_t contains representation of an 
+ * The structure #sip_supported_t contains representation of an
  * @Supported header.
  *
  * The #sip_supported_t is defined as follows:
@@ -275,7 +275,7 @@ issize_t sip_require_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  */
 
 
-msg_hclass_t sip_supported_class[] = 
+msg_hclass_t sip_supported_class[] =
 SIP_HEADER_CLASS_LIST(supported, "Supported", "k", list);
 
 issize_t sip_supported_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -296,7 +296,7 @@ issize_t sip_supported_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  *
  * The Unsupported header lists the features not supported by the server.
  * Its syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Unsupported  =  "Unsupported" HCOLON [option-tag *(COMMA option-tag)]
  * @endcode
@@ -306,9 +306,9 @@ issize_t sip_supported_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  */
 
 /**@ingroup sip_unsupported
- * @typedef struct msg_list_s sip_unsupported_t; 
+ * @typedef struct msg_list_s sip_unsupported_t;
  *
- * The structure #sip_unsupported_t contains representation of an 
+ * The structure #sip_unsupported_t contains representation of an
  * @Unsupported header.
  *
  * The #sip_unsupported_t is defined as follows:
@@ -322,7 +322,7 @@ issize_t sip_supported_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  * @endcode
  */
 
-msg_hclass_t sip_unsupported_class[] = 
+msg_hclass_t sip_unsupported_class[] =
 SIP_HEADER_CLASS_LIST(unsupported, "Unsupported", "", list);
 
 issize_t sip_unsupported_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -341,13 +341,13 @@ issize_t sip_unsupported_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
  *
  * @retval NULL if all the required features are supported
  * @retval pointer to a @Unsupported header or
- *         #SIP_NONE if @a home is NULL  
+ *         #SIP_NONE if @a home is NULL
  */
 sip_unsupported_t *sip_has_unsupported(su_home_t *home,
-                                      sip_supported_t const *support, 
+                                      sip_supported_t const *support,
                                       sip_require_t const *require)
 {
-  return sip_has_unsupported_any(home, support, NULL, NULL, 
+  return sip_has_unsupported_any(home, support, NULL, NULL,
                                 require, NULL, NULL);
 }
 
@@ -364,24 +364,24 @@ sip_has_unsupported2(su_home_t *home,
                     sip_require_t const *support_by_require,
                     sip_require_t const *require)
 {
-  return 
-    sip_has_unsupported_any(home, 
-                           support, support_by_require, NULL, 
+  return
+    sip_has_unsupported_any(home,
+                           support, support_by_require, NULL,
                            require, NULL, NULL);
 }
 
 
 /** Check if required features are not supported.
  *
- * The supported features can be listed in @Supported, @Require or 
+ * The supported features can be listed in @Supported, @Require or
  * @ProxyRequire headers (in @a supported, @a by_require, or @a
  * by_proxy_require parameters, respectively)
  *
  * @param home (optional) home pointer for allocating @Unsupported header
  * @param supported @Supported features (may be NULL) [IN]
- * @param by_require  supported features listed by 
- *                    @Require (may be NULL) [IN] 
- * @param by_proxy_require supported features listed 
+ * @param by_require  supported features listed by
+ *                    @Require (may be NULL) [IN]
+ * @param by_proxy_require supported features listed
  *                         by @ProxyRequire (may be NULL) [IN]
  *
  * @param require   list of required features (may be NULL) [IN]
@@ -390,7 +390,7 @@ sip_has_unsupported2(su_home_t *home,
  *
  * @retval NULL if all the required features are supported
  * @retval pointer to a @Unsupported header or
- *         #SIP_NONE if @a home is NULL 
+ *         #SIP_NONE if @a home is NULL
  */
 sip_unsupported_t *
 sip_has_unsupported_any(su_home_t *home,
@@ -446,11 +446,11 @@ sip_has_unsupported_any(su_home_t *home,
 
       if (feature) {
        if (home) {
-         if (unsupported == NULL) 
+         if (unsupported == NULL)
            unsupported = sip_unsupported_make(home, feature);
          else
-           msg_params_add(home, 
-                          (msg_param_t **)&unsupported->k_items, 
+           msg_params_add(home,
+                          (msg_param_t **)&unsupported->k_items,
                           feature);
        }
        else {
@@ -463,7 +463,7 @@ sip_has_unsupported_any(su_home_t *home,
       }
     }
   }
-  
+
   return unsupported;
 }
 
@@ -471,7 +471,7 @@ sip_has_unsupported_any(su_home_t *home,
 int sip_has_feature(msg_list_t const *supported, char const *feature)
 {
   size_t i;
-  
+
   if (!feature || !feature[0])
     return 1;                  /* Empty feature is always supported */
 
@@ -498,7 +498,7 @@ int sip_has_supported(sip_supported_t const *supported, char const *feature)
  * syntax very similar to the @RecordRoute header field. It is used in
  * conjunction with SIP REGISTER requests and with 200 class messages in
  * response to REGISTER (REGISTER responses).
- * 
+ *
  * @code
  *    Path        =  "Path" HCOLON path-value *(COMMA path-value)
  *    path-value  =  name-addr *( SEMI rr-param )
@@ -547,7 +547,7 @@ issize_t sip_path_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
  * contain a route vector that will direct requests through a specific
  * sequence of proxies. A registrar may use a Service-Route header field to
  * inform a UA of a service route that, if used by the UA, will provide
- * services from a proxy or set of proxies associated with that registrar. 
+ * services from a proxy or set of proxies associated with that registrar.
  * The Service-Route header field may be included by a registrar in the
  * response to a REGISTER request. The syntax for the Service-Route header
  * field is:
@@ -565,7 +565,7 @@ issize_t sip_path_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
 /**@ingroup sip_service_route
  * @typedef typedef struct sip_route_s sip_service_route_t;
  *
- * The structure #sip_service_route_t contains representation of SIP 
+ * The structure #sip_service_route_t contains representation of SIP
  * @ServiceRoute header.
  *
  * The #sip_service_route_t is defined as follows:
@@ -581,7 +581,7 @@ issize_t sip_path_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
  */
 
 msg_hclass_t sip_service_route_class[] =
-SIP_HEADER_CLASS(service_route, "Service-Route", "", 
+SIP_HEADER_CLASS(service_route, "Service-Route", "",
                 r_params, append, any_route);
 
 issize_t sip_service_route_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
index e3e6ba039f33df8026d84749fcd670ed769f7887..66100a9d3e4e678f67e1e6c7d711789f18192281 100644 (file)
@@ -85,7 +85,7 @@ sip_header_t *sip_header_d(su_home_t *home, msg_t const *msg, char const *b)
   return msg_header_d(home, msg, b);
 }
 
-/** Encode a SIP header. 
+/** Encode a SIP header.
  *
  * @deprecated Use msg_header_e() instead.
  */
@@ -94,7 +94,7 @@ issize_t sip_header_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
   return msg_header_e(b, bsiz, (msg_header_t const *)h, flags);
 }
 
-sip_header_t *sip_header_format(su_home_t *home, 
+sip_header_t *sip_header_format(su_home_t *home,
                                msg_hclass_t *hc,
                                char const *fmt,
                                ...)
index 4e39f3be81d1ab37159f4f2426dec04b2d0bbd45..90cce374de5b51399d7502eb33b9484210dc7573 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@CFILE sip_mime.c 
+/**@CFILE sip_mime.c
  *
  * MIME-related SIP headers
  *
@@ -54,7 +54,7 @@
  * The @b Accept request-header field can be used to specify certain media
  * types which are acceptable for the response. Its syntax is defined in
  * [H14.1, S10.6] as follows:
- * 
+ *
  * @code
  *    Accept         =  "Accept" HCOLON
  *                       [ accept-range *(COMMA accept-range) ]
@@ -97,7 +97,7 @@
 #define sip_accept_dup_one  msg_accept_dup_one
 #define sip_accept_update   msg_accept_update
 
-msg_hclass_t sip_accept_class[] = 
+msg_hclass_t sip_accept_class[] =
 SIP_HEADER_CLASS(accept, "Accept", "", ac_params, apndlist, accept);
 
 issize_t sip_accept_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -118,9 +118,9 @@ issize_t sip_accept_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
  * The Accept-Disposition header field is used to indicate what content
  * disposition types are acceptable to a client or server.  Its syntax is
  * defined in draft-lennox-sip-reg-payload-01.txt section 3.2 as follows:
- * 
+ *
  * @code
- *    Accept-Disposition = "Accept-Disposition" ":" 
+ *    Accept-Disposition = "Accept-Disposition" ":"
  *                         #( (disposition-type | "*") *( ";" generic-param ) )
  * @endcode
  *
@@ -129,8 +129,8 @@ issize_t sip_accept_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
  * is stored in #sip_accept_disposition_t structure.
  */
 
-msg_hclass_t sip_accept_disposition_class[] = 
-SIP_HEADER_CLASS(accept_disposition, "Accept-Disposition", "", 
+msg_hclass_t sip_accept_disposition_class[] =
+SIP_HEADER_CLASS(accept_disposition, "Accept-Disposition", "",
                 ad_params, apndlist, accept_disposition);
 
 issize_t sip_accept_disposition_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -163,7 +163,7 @@ issize_t sip_accept_disposition_e(char b[], isize_t bsiz, sip_header_t const *h,
   MSG_STRING_E(b, end, ad->ad_type);
   MSG_PARAMS_E(b, end, ad->ad_params, flags);
   MSG_TERM_E(b, end);
-    
+
   return b - b0;
 }
 #endif
@@ -175,7 +175,7 @@ issize_t sip_accept_disposition_e(char b[], isize_t bsiz, sip_header_t const *h,
  * The Accept-Encoding header is similar to Accept, but restricts the
  * content-codings that are acceptable in the response.  Its syntax is
  * defined in [H14.3, S10.7] as follows:
- * 
+ *
  * @code
  *    Accept-Encoding  =  "Accept-Encoding" HCOLON
  *                         [ encoding *(COMMA encoding) ]
@@ -202,7 +202,7 @@ issize_t sip_accept_disposition_e(char b[], isize_t bsiz, sip_header_t const *h,
  *   sip_accept_encoding_t *aa_next;   // Pointer to next @AcceptEncoding header
  *   char const            *aa_value;  // Encoding token
  *   msg_param_t const     *aa_params; // List of parameters
- *   char const            *aa_q;      // Value of q parameter 
+ *   char const            *aa_q;      // Value of q parameter
  * } sip_accept_encoding_t;
  * @endcode
  */
@@ -211,8 +211,8 @@ issize_t sip_accept_disposition_e(char b[], isize_t bsiz, sip_header_t const *h,
 #define sip_accept_encoding_dup_one  msg_accept_any_dup_one
 #define sip_accept_encoding_update   msg_accept_any_update
 
-msg_hclass_t sip_accept_encoding_class[] = 
-SIP_HEADER_CLASS(accept_encoding, "Accept-Encoding", "", 
+msg_hclass_t sip_accept_encoding_class[] =
+SIP_HEADER_CLASS(accept_encoding, "Accept-Encoding", "",
                 aa_params, apndlist, accept_encoding);
 
 issize_t sip_accept_encoding_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -242,7 +242,7 @@ issize_t sip_accept_encoding_e(char b[], isize_t bsiz, sip_header_t const *h, in
  * the server in which language it would prefer to receive reason phrases,
  * session descriptions or status responses carried as message bodies.  Its
  * syntax is defined in [H14.4, S10.8] as follows:
- * 
+ *
  * @code
  *    Accept-Language  =  "Accept-Language" HCOLON
  *                         [ language *(COMMA language) ]
@@ -268,7 +268,7 @@ issize_t sip_accept_encoding_e(char b[], isize_t bsiz, sip_header_t const *h, in
  *   sip_accept_language_t *aa_next;   // Pointer to next <language>
  *   char const            *aa_value;  // Language-range
  *   msg_param_t const     *aa_params; // List of accept-parameters
- *   char const            *aa_q;      // Value of q parameter 
+ *   char const            *aa_q;      // Value of q parameter
  * } sip_accept_language_t;
  * @endcode
  */
@@ -277,8 +277,8 @@ issize_t sip_accept_encoding_e(char b[], isize_t bsiz, sip_header_t const *h, in
 #define sip_accept_language_dup_one  msg_accept_any_dup_one
 #define sip_accept_language_update   msg_accept_any_update
 
-msg_hclass_t sip_accept_language_class[] = 
-SIP_HEADER_CLASS(accept_language, "Accept-Language", "", 
+msg_hclass_t sip_accept_language_class[] =
+SIP_HEADER_CLASS(accept_language, "Accept-Language", "",
                 aa_params, apndlist, accept_language);
 
 issize_t sip_accept_language_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -307,7 +307,7 @@ issize_t sip_accept_language_e(char b[], isize_t bsiz, sip_header_t const *h, in
  * in the case of multipart messages, a message body part is to be
  * interpreted by the UAC or UAS.  Its syntax is defined in @RFC3261
  * as follows:
- * 
+ *
  * @code
  *    Content-Disposition   =  "Content-Disposition" HCOLON
  *                             disp-type *( SEMI disp-param )
@@ -320,7 +320,7 @@ issize_t sip_accept_language_e(char b[], isize_t bsiz, sip_header_t const *h, in
  *    other-handling        =  token
  *    disp-extension-token  =  token
  * @endcode
- * 
+ *
  * The Content-Disposition header was extended by
  * draft-lennox-sip-reg-payload-01.txt section 3.1 as follows:
  *
@@ -342,7 +342,7 @@ issize_t sip_accept_language_e(char b[], isize_t bsiz, sip_header_t const *h, in
  */
 
 /**@ingroup sip_content_disposition
- * @typedef struct msg_content_disposition_s sip_content_disposition_t; 
+ * @typedef struct msg_content_disposition_s sip_content_disposition_t;
  *
  * The structure #sip_content_disposition_t contains representation of an
  * @ContentDisposition header.
@@ -366,11 +366,11 @@ static msg_xtra_f sip_content_disposition_dup_xtra;
 static msg_dup_f sip_content_disposition_dup_one;
 #define sip_content_disposition_update msg_content_disposition_update
 
-msg_hclass_t sip_content_disposition_class[] = 
+msg_hclass_t sip_content_disposition_class[] =
 SIP_HEADER_CLASS(content_disposition, "Content-Disposition", "", cd_params,
                 single, content_disposition);
 
-issize_t sip_content_disposition_d(su_home_t *home, sip_header_t *h, 
+issize_t sip_content_disposition_d(su_home_t *home, sip_header_t *h,
                                   char *s, isize_t slen)
 {
   return msg_content_disposition_d(home, h, s, slen);
@@ -388,9 +388,9 @@ isize_t sip_content_disposition_dup_xtra(sip_header_t const *h, isize_t offset)
   return msg_content_disposition_dup_xtra(h, offset);
 }
 
-/** Duplicate one #sip_content_disposition_t object */ 
+/** Duplicate one #sip_content_disposition_t object */
 static
-char *sip_content_disposition_dup_one(sip_header_t *dst, 
+char *sip_content_disposition_dup_one(sip_header_t *dst,
                                      sip_header_t const *src,
                                      char *b, isize_t xtra)
 {
@@ -405,7 +405,7 @@ char *sip_content_disposition_dup_one(sip_header_t *dst,
  * The Content-Encoding header indicates what additional content codings
  * have been applied to the entity-body.  Its syntax is defined in @RFC3261
  * as follows:
- * 
+ *
  * @code
  * Content-Encoding  =  ( "Content-Encoding" / "e" ) HCOLON
  *                      content-coding *(COMMA content-coding)
@@ -417,7 +417,7 @@ char *sip_content_disposition_dup_one(sip_header_t *dst,
  */
 
 /**@ingroup sip_content_encoding
- * @typedef struct msg_list_s sip_content_encoding_t; 
+ * @typedef struct msg_list_s sip_content_encoding_t;
  *
  * The structure #sip_content_encoding_t contains representation of an
  * @ContentEncoding header.
@@ -433,7 +433,7 @@ char *sip_content_disposition_dup_one(sip_header_t *dst,
  * @endcode
  */
 
-msg_hclass_t sip_content_encoding_class[] = 
+msg_hclass_t sip_content_encoding_class[] =
 SIP_HEADER_CLASS_LIST(content_encoding, "Content-Encoding", "e", list);
 
 issize_t sip_content_encoding_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -454,7 +454,7 @@ issize_t sip_content_encoding_e(char b[], isize_t bsiz, sip_header_t const *h, i
  * the intended audience for the enclosed entity. Note that this might not
  * be equivalent to all the languages used within the entity-body. Its
  * syntax is defined in @RFC3261 as follows:
- * 
+ *
  * @code
  *    Content-Language  =  "Content-Language" HCOLON
  *                         language-tag *(COMMA language-tag)
@@ -483,7 +483,7 @@ issize_t sip_content_encoding_e(char b[], isize_t bsiz, sip_header_t const *h, i
  * @endcode
  */
 
-msg_hclass_t sip_content_language_class[] = 
+msg_hclass_t sip_content_language_class[] =
 SIP_HEADER_CLASS_LIST(content_language, "Content-Language", "", list);
 
 issize_t sip_content_language_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -503,7 +503,7 @@ issize_t sip_content_language_e(char b[], isize_t bsiz, sip_header_t const *h, i
  * The Content-Type header indicates the media type of the message-body sent
  * to the recipient.  Its syntax is defined in [H3.7, S] as
  * follows:
- * 
+ *
  * @code
  * Content-Type     =  ( "Content-Type" / "c" ) HCOLON media-type
  * media-type       =  m-type SLASH m-subtype *(SEMI m-parameter)
@@ -548,8 +548,8 @@ static msg_xtra_f sip_content_type_dup_xtra;
 static msg_dup_f sip_content_type_dup_one;
 #define sip_content_type_update NULL
 
-msg_hclass_t sip_content_type_class[] = 
-SIP_HEADER_CLASS(content_type, "Content-Type", "c", c_params, 
+msg_hclass_t sip_content_type_class[] =
+SIP_HEADER_CLASS(content_type, "Content-Type", "c", c_params,
                 single, content_type);
 
 issize_t sip_content_type_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -568,7 +568,7 @@ isize_t sip_content_type_dup_xtra(sip_header_t const *h, isize_t offset)
   return msg_content_type_dup_xtra((msg_header_t *)h, offset);
 }
 
-/** Duplicate one #sip_content_type_t object */ 
+/** Duplicate one #sip_content_type_t object */
 static
 char *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src,
                               char *b, isize_t xtra)
@@ -585,7 +585,7 @@ char *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src,
  * MIME-Version header indicates what version of the MIME protocol was used
  * to construct the message.  Its syntax is defined in [H19.4.1, S10.28]
  * as follows:
- * 
+ *
  * @code
  *    MIME-Version  =  "MIME-Version" HCOLON 1*DIGIT "." 1*DIGIT
  * @endcode
@@ -594,7 +594,7 @@ char *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src,
  */
 
 /**@ingroup sip_mime_version
- * @typedef struct msg_generic_s sip_mime_version_t; 
+ * @typedef struct msg_generic_s sip_mime_version_t;
  *
  * The structure #sip_mime_version_t contains representation of an
  * @MIMEVersion header.
@@ -610,7 +610,7 @@ char *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src,
  * @endcode
  */
 
-msg_hclass_t sip_mime_version_class[] = 
+msg_hclass_t sip_mime_version_class[] =
 SIP_HEADER_CLASS_G(mime_version, "MIME-Version", "", single);
 
 issize_t sip_mime_version_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -626,11 +626,11 @@ issize_t sip_mime_version_e(char b[], isize_t bsiz, sip_header_t const *h, int f
 /* ====================================================================== */
 
 /**@SIP_HEADER sip_warning Warning Header
- * 
+ *
  * The Warning response-header field is used to carry additional information
  * about the status of a response. Its syntax is defined in @RFC3261 as
  * follows:
- * 
+ *
  * @code
  *    Warning        =  "Warning" HCOLON warning-value *(COMMA warning-value)
  *    warning-value  =  warn-code SP warn-agent SP warn-text
@@ -646,7 +646,7 @@ issize_t sip_mime_version_e(char b[], isize_t bsiz, sip_header_t const *h, int f
  */
 
 /**@ingroup sip_warning
- * @typedef struct msg_warning_s sip_warning_t; 
+ * @typedef struct msg_warning_s sip_warning_t;
  *
  * The structure #sip_warning_t contains representation of an
  * @Warning header.
@@ -669,7 +669,7 @@ issize_t sip_mime_version_e(char b[], isize_t bsiz, sip_header_t const *h, int f
 #define sip_warning_dup_one msg_warning_dup_one
 #define sip_warning_update NULL
 
-msg_hclass_t sip_warning_class[] = 
+msg_hclass_t sip_warning_class[] =
 SIP_HEADER_CLASS(warning, "Warning", "", w_common, append, warning);
 
 issize_t sip_warning_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
index 1051354b84c70d0a825f0d329396981bc2fcf85b..ee182dd1f9da1dd46be6ca092eb7d9845bb2caa2 100644 (file)
@@ -152,7 +152,7 @@ msg_mclass_t *sip_extend_mclass(msg_mclass_t *input)
   return mclass;
 }
 
-/** Extract the SIP message body, including separator line. 
+/** Extract the SIP message body, including separator line.
  *
  * @param msg  message object [IN]
  * @param sip  public SIP message structure [IN/OUT]
@@ -162,13 +162,13 @@ msg_mclass_t *sip_extend_mclass(msg_mclass_t *input)
  *
  * @retval -1 error
  * @retval 0  cannot proceed
- * @retval m 
+ * @retval m
  */
 issize_t sip_extract_body(msg_t *msg, sip_t *sip, char b[], isize_t bsiz, int eos)
 {
   ssize_t m = 0;
   size_t body_len;
-  
+
   if (!(sip->sip_flags & MSG_FLG_BODY)) {
     /* We are looking at a potential empty line */
     m = msg_extract_separator(msg, (msg_pub_t *)sip, b, bsiz, eos);
@@ -203,10 +203,10 @@ issize_t sip_extract_body(msg_t *msg, sip_t *sip, char b[], isize_t bsiz, int eo
     return bsiz;
   }
 
-  if ((m = msg_extract_payload(msg, (msg_pub_t *)sip, 
+  if ((m = msg_extract_payload(msg, (msg_pub_t *)sip,
                               NULL, body_len, b, bsiz, eos)) == -1)
     return -1;
-  
+
   sip->sip_flags |= MSG_FLG_FRAGS;
   if (bsiz >= body_len)
     sip->sip_flags |= MSG_FLG_COMPLETE;
@@ -216,7 +216,7 @@ issize_t sip_extract_body(msg_t *msg, sip_t *sip, char b[], isize_t bsiz, int eo
 
 /** Parse SIP version.
  *
- * Parse a SIP version string. Update the 
+ * Parse a SIP version string. Update the
  * pointer at @a ss to first non-LWS character after the version string.
  *
  * @param ss   string to be parsed [IN/OUT]
@@ -231,7 +231,7 @@ int sip_version_d(char **ss, char const **ver)
   char const *result;
   size_t const version_size = sizeof(sip_version_2_0) - 1;
 
-  if (strncasecmp(s, sip_version_2_0, version_size) == 0 && 
+  if (strncasecmp(s, sip_version_2_0, version_size) == 0 &&
       !IS_TOKEN(s[version_size])) {
     result = sip_version_2_0;
     s += version_size;
@@ -259,7 +259,7 @@ int sip_version_d(char **ss, char const **ver)
       memmove(s + l1 + 1, s + n - l2, l2);
       s[l1 + 1 + l2] = 0;
 
-      /* Compare again with compacted version */ 
+      /* Compare again with compacted version */
       if (strcasecmp(s, sip_version_2_0) == 0)
        result = sip_version_2_0;
     }
@@ -268,10 +268,10 @@ int sip_version_d(char **ss, char const **ver)
   }
 
   while (IS_WS(*s)) *s++ = '\0';
-  
+
   *ss = s;
 
-  if (ver) 
+  if (ver)
     *ver = result;
 
   return 0;
@@ -344,7 +344,7 @@ char const *sip_method_name(sip_method_t method, char const *name)
 
 /**Parse a SIP method name.
  *
- * Parse a SIP method name and return a code corresponding to the method. 
+ * Parse a SIP method name and return a code corresponding to the method.
  * The address of the first non-LWS character after method name is stored in
  * @a *ss.
  *
@@ -375,11 +375,11 @@ sip_method_t sip_method_d(char **ss, char const **return_name)
   switch (c) {
   case 'A': if (MATCH(s, "ACK")) code = sip_method_ack; break;
   case 'B': if (MATCH(s, "BYE")) code = sip_method_bye; break;
-  case 'C': 
-    if (MATCH(s, "CANCEL")) 
-      code = sip_method_cancel; 
+  case 'C':
+    if (MATCH(s, "CANCEL"))
+      code = sip_method_cancel;
     break;
-  case 'I': 
+  case 'I':
     if (MATCH(s, "INVITE"))
       code = sip_method_invite;
     else if (MATCH(s, "INFO"))
@@ -388,19 +388,19 @@ sip_method_t sip_method_d(char **ss, char const **return_name)
   case 'M': if (MATCH(s, "MESSAGE")) code = sip_method_message; break;
   case 'N': if (MATCH(s, "NOTIFY")) code = sip_method_notify; break;
   case 'O': if (MATCH(s, "OPTIONS")) code = sip_method_options; break;
-  case 'P': 
-    if (MATCH(s, "PRACK")) code = sip_method_prack; 
-    else if (MATCH(s, "PUBLISH")) code = sip_method_publish; 
+  case 'P':
+    if (MATCH(s, "PRACK")) code = sip_method_prack;
+    else if (MATCH(s, "PUBLISH")) code = sip_method_publish;
     break;
-  case 'R': 
-    if (MATCH(s, "REGISTER")) 
-      code = sip_method_register; 
+  case 'R':
+    if (MATCH(s, "REGISTER"))
+      code = sip_method_register;
     else if (MATCH(s, "REFER"))
-      code = sip_method_refer; 
+      code = sip_method_refer;
     break;
-  case 'S': 
-    if (MATCH(s, "SUBSCRIBE")) 
-      code = sip_method_subscribe; 
+  case 'S':
+    if (MATCH(s, "SUBSCRIBE"))
+      code = sip_method_subscribe;
     break;
   case 'U':
     if (MATCH(s, "UPDATE"))
@@ -410,7 +410,7 @@ sip_method_t sip_method_d(char **ss, char const **return_name)
 
 #undef MATCH
 
-  if (IS_NON_WS(s[n])) 
+  if (IS_NON_WS(s[n]))
     /* Unknown method */
     code = sip_method_unknown;
 
@@ -467,14 +467,14 @@ issize_t sip_transport_d(char **ss, char const **ttransport)
        !TRANSPORT_MATCH(sip_transport_tcp) &&
        !TRANSPORT_MATCH(sip_transport_sctp) &&
        !TRANSPORT_MATCH(sip_transport_tls))) {
-    /* Protocol name */ 
+    /* Protocol name */
     transport = pn = s;
     skip_token(&s);
     pn_len = s - pn;
     skip_lws(&s);
     if (pn_len == 0 || *s++ != '/') return -1;
     skip_lws(&s);
-    
+
     /* Protocol version */
     pv = s;
     skip_token(&s);
@@ -482,13 +482,13 @@ issize_t sip_transport_d(char **ss, char const **ttransport)
     skip_lws(&s);
     if (pv_len == 0 || *s++ != '/') return -1;
     skip_lws(&s);
-    
+
     /* Transport protocol */
     pt = s;
     skip_token(&s);
     pt_len = s - pt;
     if (pt_len == 0) return -1;
-    
+
     /* Remove whitespace between protocol name and version */
     if (pn + pn_len + 1 != pv) {
       pn[pn_len] = '/';
@@ -500,7 +500,7 @@ issize_t sip_transport_d(char **ss, char const **ttransport)
       pv[pv_len] = '/';
       pt = memmove(pv + pv_len + 1, pt, pt_len);
       pt[pt_len] = '\0';
-      
+
       /* extra whitespace? */
       if (!strcasecmp(transport, sip_transport_udp))
        transport = sip_transport_udp;
@@ -580,9 +580,9 @@ char *sip_word_at_word_d(char **ss)
   return rv;
 }
 
-/**Add message separator, then test if message is complete. 
+/**Add message separator, then test if message is complete.
  *
- * Add sip_content_length and sip_separator if they are missing. 
+ * Add sip_content_length and sip_separator if they are missing.
  * The test that all necessary message components ( @From, @To,
  * @CSeq, @CallID, @ContentLength and message separator are present.
  *
@@ -622,7 +622,7 @@ int sip_complete_message(msg_t *msg)
     if (mplen == -1)
       return -1;
     len = (size_t)mplen;
-  } 
+  }
 
   if (sip->sip_payload)
     len += sip->sip_payload->pl_len;
@@ -640,14 +640,14 @@ int sip_complete_message(msg_t *msg)
       sip_fragment_clear(sip->sip_content_length->l_common);
     }
   }
-  
-  if (!sip->sip_cseq || 
+
+  if (!sip->sip_cseq ||
       !sip->sip_call_id ||
       !sip->sip_to ||
       !sip->sip_from ||
       !sip->sip_separator ||
       !sip->sip_content_length)
     return -1;
-  
+
   return 0;
 }
index 0b3188c8f7d1aac0e6a70f1900ecae46f553ead4..576b3f51b293544e0088d465288f0acc72fab2b8 100644 (file)
@@ -7,7 +7,7 @@
  * new parser is added.
  *
  * The @b sip module contains interface to the SIP headers and message
- * objects. The interface is abstracted using objects known as 
+ * objects. The interface is abstracted using objects known as
  * @ref msg_hclass_s "header classes" and @ref msg_mclass_s "message classes".
  *
  * The @ref msg_mclass_s "message class" defines how a message is handled:
  * classes. It also contains function pointers used by the parser to handle
  * message body and other details that vary between protocols.
  *
- * A @ref msg_hclass_s "header class" defines how a single header is parsed. 
+ * A @ref msg_hclass_s "header class" defines how a single header is parsed.
  * Each header has its own header class. There are also header classes for
  * message elements that are not really headers, like @ref sip_request
- * "request" and @ref sip_status "status line", 
- * @ref sip_separator "separator between headers" and 
+ * "request" and @ref sip_status "status line",
+ * @ref sip_separator "separator between headers" and
  * @ref sip_payload "message body"
  * (which is also known as payload). There is also a header classes
- * for @ref sip_unknown "unknown headers" and 
+ * for @ref sip_unknown "unknown headers" and
  * @ref sip_error "headers that contained parsing errors".
  *
  *
  *
  * Create a header template for your header just like sip_rfc2543.h.in,
  * e.g, sip_example.h.in:
- * 
+ *
  *@code
 /**@file sip_example.h.in
  *
  * Template for <sofia-sip/sip_example.h>.
  */
 \f
-#ifndef SIP_EXAMPLE_H 
+#ifndef SIP_EXAMPLE_H
 /** Defined when <sofia-sip/sip_example.h> has been included. */
-#define SIP_EXAMPLE_H 
+#define SIP_EXAMPLE_H
 
-/**@file sofia-sip/sip_example.h 
+/**@file sofia-sip/sip_example.h
 *
  * @brief Example header.
  *
index 6f86f8202d124a5abcb7dd3b4dd42968a82d5273..05ffd745b8c0b6b388f08facc96d9b8a6e46604a 100644 (file)
@@ -29,7 +29,7 @@
  *
  */
 
-/**@CFILE sip_parser_table.c 
+/**@CFILE sip_parser_table.c
  * @brief SIP parser table
  *
  * #AUTO#
index 2f321c6135a1d6059bca5e09866a45de1ba604a3..5226ee4d4d00cba2619318a61981447ea21ff7f1 100644 (file)
@@ -55,7 +55,7 @@
  * The RAck header indicates the sequence number of the provisional response
  * which is being acknowledged.  Its syntax is defined in
  * @RFC3262 section 10 as follows:
- * 
+ *
  * @code
  *    RAck          =  "RAck" HCOLON response-num LWS CSeq-num LWS Method
  *    response-num  =  1*DIGIT
@@ -91,7 +91,7 @@ static msg_xtra_f sip_rack_dup_xtra;
 static msg_dup_f sip_rack_dup_one;
 #define sip_rack_update NULL
 
-msg_hclass_t sip_rack_class[] = 
+msg_hclass_t sip_rack_class[] =
 SIP_HEADER_CLASS(rack, "RAck", "", ra_common, single, rack);
 
 issize_t sip_rack_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -121,7 +121,7 @@ issize_t sip_rack_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 
   assert(sip_is_rack(h));
 
-  return snprintf(b, bsiz, "%u %u %s", 
+  return snprintf(b, bsiz, "%u %u %s",
                  ra->ra_response, ra->ra_cseq, ra->ra_method_name);
 }
 
@@ -135,7 +135,7 @@ isize_t sip_rack_dup_xtra(sip_header_t const *h, isize_t offset)
     return offset;
 }
 
-/** Duplicate one #sip_rack_t object */ 
+/** Duplicate one #sip_rack_t object */
 char *sip_rack_dup_one(sip_header_t *dst, sip_header_t const *src,
                        char *b, isize_t xtra)
 {
@@ -162,9 +162,9 @@ char *sip_rack_dup_one(sip_header_t *dst, sip_header_t const *src,
 
 /**@SIP_HEADER sip_rseq RSeq Header
  *
- * The RSeq header identifies provisional responses within a transaction. 
+ * The RSeq header identifies provisional responses within a transaction.
  * Its syntax is defined in @RFC3262 section 10 as follows:
- * 
+ *
  * @code
  *    RSeq          =  "RSeq" HCOLON response-num
  *    response-num  =  1*DIGIT
@@ -189,7 +189,7 @@ char *sip_rack_dup_one(sip_header_t *dst, sip_header_t const *src,
  * @endcode
  */
 
-msg_hclass_t sip_rseq_class[] = 
+msg_hclass_t sip_rseq_class[] =
 SIP_HEADER_CLASS(rseq, "RSeq", "", rs_common, single, any);
 
 issize_t sip_rseq_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
index bb7d9800cb2c6085927553817b05b44eb74b0cfc..4e3ca984c4cc5bc917c382b87f8ef6af1c7eb6b6 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**@CFILE sip_pref_util.c
- * 
+ *
  * SIP callercaps and callerprefs utility functions.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -48,8 +48,8 @@
 static double parse_number(char const *str, char **return_end);
 
 /** Parse a single preference */
-int sip_prefs_parse(union sip_pref *sp, 
-                   char const **in_out_s, 
+int sip_prefs_parse(union sip_pref *sp,
+                   char const **in_out_s,
                    int *return_negation)
 {
   char const *s;
@@ -66,7 +66,7 @@ int sip_prefs_parse(union sip_pref *sp,
     return 0;
 
   if (old_type == sp_init) {
-    if (s[0] == '\0' || 
+    if (s[0] == '\0' ||
        strcasecmp(s, "TRUE") == 0 ||
        strcasecmp(s, "\"TRUE\"") == 0) {
       /* Boolean */
@@ -76,7 +76,7 @@ int sip_prefs_parse(union sip_pref *sp,
       *return_negation = 0;
       *in_out_s = s + strlen(s);
       return 1;
-    } else if (strcasecmp(s, "FALSE") == 0 || 
+    } else if (strcasecmp(s, "FALSE") == 0 ||
               strcasecmp(s, "\"FALSE\"") == 0) {
       /* Boolean */
       sp->sp_type = sp_literal;
@@ -88,7 +88,7 @@ int sip_prefs_parse(union sip_pref *sp,
     } else if (s[0] == '"' && s[1] != '\0') {
       for (s++; IS_LWS(s[0]); s++);
     } else
-      old_type = sp_error;      
+      old_type = sp_error;
   } else if (!s[0]) {
     sp->sp_type = sp_init;
     return 0;
@@ -106,7 +106,7 @@ int sip_prefs_parse(union sip_pref *sp,
     char s0, *e;
 
     for (s++; IS_LWS(s[0]); s++);
-    
+
     s0 = s[0];
 
     if (s0 == '=')
@@ -150,9 +150,9 @@ int sip_prefs_parse(union sip_pref *sp,
   else
     old_type = sp_error;
 
-  if (old_type != sp_init && old_type != sp->sp_type) 
+  if (old_type != sp_init && old_type != sp->sp_type)
     sp->sp_type = sp_error;
-    
+
   *in_out_s = s;
 
   return sp->sp_type != sp_error;
@@ -199,7 +199,7 @@ static double parse_number(char const *str, char **return_end)
 
 
 /** Return true if preferences match */
-int sip_prefs_match(union sip_pref const *a, 
+int sip_prefs_match(union sip_pref const *a,
                    union sip_pref const *b)
 {
   if (!a || !b)
@@ -208,20 +208,20 @@ int sip_prefs_match(union sip_pref const *a,
     return 0;
   switch (a->sp_type) {
   default:
-  case sp_error: 
+  case sp_error:
     return 0;
   case sp_literal:
-    return 
+    return
       a->sp_literal.spl_length == b->sp_literal.spl_length &&
       strncasecmp(a->sp_literal.spl_value, b->sp_literal.spl_value,
                  a->sp_literal.spl_length) == 0;
   case sp_string:
-    return 
+    return
       a->sp_string.sps_length == b->sp_string.sps_length &&
       strncmp(a->sp_string.sps_value, b->sp_string.sps_value,
              a->sp_string.sps_length) == 0;
   case sp_range:
-    return 
+    return
       a->sp_range.spr_lower <= b->sp_range.spr_upper &&
       a->sp_range.spr_upper >= b->sp_range.spr_lower;
   }
@@ -260,7 +260,7 @@ int sip_prefs_matching(char const *pvalue,
 
   memset(np, 0, sizeof np);
 
-  /* Usually nvalue is from Accept/Reject-Contact, 
+  /* Usually nvalue is from Accept/Reject-Contact,
      pvalue is from Contact */
   while (sip_prefs_parse(np, &nvalue, &n_negated)) {
     memset(pp, 0, sizeof pp);
@@ -291,7 +291,7 @@ int sip_prefs_matching(char const *pvalue,
   return 0;
 }
 
-/** Check if the parameter is a valid feature tag. 
+/** Check if the parameter is a valid feature tag.
  *
  * A feature tag is a parameter starting with a single plus, or a well-known
  * feature tag listed in @RFC3841: "audio", "automata", "application",
@@ -377,7 +377,7 @@ int sip_contact_is_immune(sip_contact_t const *m)
 }
 
 /**Check if @Contact matches by @AcceptContact.
- * 
+ *
  * Matching @AcceptContact and @Contact headers is done as explained in
  * @RFC3841 section 7.2.4. The caller score can be calculated from the
  * returned S and N values.
@@ -393,9 +393,9 @@ int sip_contact_is_immune(sip_contact_t const *m)
  *
  * @param m   pointer to @Contact header structure
  * @param cp   pointer to @AcceptContact header structure
- * @param return_N   return-value parameter for number of 
+ * @param return_N   return-value parameter for number of
  *                   feature tags in @AcceptContact
- * @param return_S   return-value parameter for number of 
+ * @param return_S   return-value parameter for number of
  *                   matching feature tags
  * @param return_error   return-value parameter for parsing error
  *
@@ -428,7 +428,7 @@ int sip_contact_is_immune(sip_contact_t const *m)
  * sip_contact_is_immune(), sip_contact_immunize(), sip_is_callerpref(),
  * sip_prefs_matching().
  */
-int sip_contact_accept(sip_contact_t const *m, 
+int sip_contact_accept(sip_contact_t const *m,
                       sip_accept_contact_t const *cp,
                       unsigned *return_S,
                       unsigned *return_N,
@@ -459,9 +459,9 @@ int sip_contact_accept(sip_contact_t const *m,
       eq = strcspn(acc, "=");
       acc += eq + (acc[eq] == '=');
 
-      if (!sip_prefs_matching(cap, acc, return_error)) 
+      if (!sip_prefs_matching(cap, acc, return_error))
        return 0;
-      
+
       S++;
     }
   }
@@ -469,7 +469,7 @@ int sip_contact_accept(sip_contact_t const *m,
   *return_S = S; /* Matched feature tags */
   *return_N = N; /* Number of feature tags in @AcceptContact */
 
-  return 1; 
+  return 1;
 }
 
 
@@ -484,7 +484,7 @@ int sip_contact_accept(sip_contact_t const *m,
  * @sa sip_contact_score(), sip_contact_accept(), sip_contact_immunize(),
  * sip_contact_is_immune(), @RFC3841, @RejectContact, @Contact
  */
-int sip_contact_reject(sip_contact_t const *m, 
+int sip_contact_reject(sip_contact_t const *m,
                       sip_reject_contact_t const *reject)
 {
   unsigned S, N;
@@ -506,7 +506,7 @@ int sip_contact_reject(sip_contact_t const *m,
  *
  * @retval pointer to immunized copy if successful
  * @retval NULL upon an error
- * 
+ *
  * @sa @RFC3841, sip_is_callerpref(), sip_contact_score(),
  * sip_contact_accept(), sip_contact_reject(), @Contact
  */
@@ -541,7 +541,7 @@ sip_contact_t *sip_contact_immunize(su_home_t *home, sip_contact_t const *m)
 /** Calculate score for contact.
  *
  * The caller preference score is an integer in range of 0 to 1000.
- * 
+ *
  * @retval -1 if the contact is rejected
  * @retval 1000 if contact is immune to caller preferences
  * @retval 0..1000 reflecting @RFC3841 score in 0.000 - 1.000.
@@ -563,14 +563,14 @@ int sip_contact_score(sip_contact_t const *m,
     return 1000;               /* Immune */
 
   for (; rc; rc = rc->cp_next)
-    if (sip_contact_reject(m, rc)) 
+    if (sip_contact_reject(m, rc))
       break;
   if (rc)
     return -1;                 /* Rejected */
 
   for (; ac; ac = ac->cp_next) {
     unsigned S, N;
-       
+
     if (!sip_contact_accept(m, ac, &S, &N, &error)) {
       if (ac->cp_require)
        return 0;               /* Discarded */
@@ -586,11 +586,11 @@ int sip_contact_score(sip_contact_t const *m,
        return 0;               /* Dropped */
     }
 
-    if (S > 0 && N > 0) 
+    if (S > 0 && N > 0)
       S_total += sip_q_value(ac->cp_q) * (scale * S / N + (2 * S >= N));
   }
 
-  if (!M) 
+  if (!M)
     return 0;
 
   S_total /= M;
index 86e11fd8ae5ce3682d21bd49223a31ea7ab781e4..0c5b42254df18333255f5103c545d02c99e54a81 100644 (file)
@@ -52,7 +52,7 @@
  * The Reason header is used to indicate why a SIP request was issued or why
  * a provisional response was sent. It can be used with HRPF scenarios. It
  * is defined in @RFC3326 as follows:
- * 
+ *
  * @code
  *   Reason            =  "Reason" HCOLON reason-value *(COMMA reason-value)
  *   reason-value      =  protocol *(SEMI reason-params)
@@ -64,7 +64,7 @@
  *   reason-text       =  "text" EQUAL quoted-string
  *   reason-extension  =  generic-param
  * @endcode
- * 
+ *
  * The parsed Reason header is stored in #sip_reason_t structure.
  */
 
  * @code
  * typedef struct sip_reason_s
  * {
- *   sip_common_t        re_common[1]; // Common fragment info 
- *   sip_reason_t       *re_next;      // Link to next <reason-value> 
- *   char const         *re_protocol;  // Protocol 
- *   msg_param_t const  *re_params;    // List of reason parameters 
- *   char const         *re_cause;     // Value of cause parameter 
- *   char const         *re_text;      // Value of text parameter 
+ *   sip_common_t        re_common[1]; // Common fragment info
+ *   sip_reason_t       *re_next;      // Link to next <reason-value>
+ *   char const         *re_protocol;  // Protocol
+ *   msg_param_t const  *re_params;    // List of reason parameters
+ *   char const         *re_cause;     // Value of cause parameter
+ *   char const         *re_text;      // Value of text parameter
  * } sip_reason_t;
  * @endcode
  */
@@ -91,7 +91,7 @@ static msg_xtra_f sip_reason_dup_xtra;
 static msg_dup_f sip_reason_dup_one;
 static msg_update_f sip_reason_update;
 
-msg_hclass_t sip_reason_class[] = 
+msg_hclass_t sip_reason_class[] =
 SIP_HEADER_CLASS(reason, "Reason", "", re_params, append, reason);
 
 issize_t sip_reason_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -103,9 +103,9 @@ issize_t sip_reason_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
     *s = '\0', s += span_lws(s + 1) + 1;
 
   re->re_protocol = s;
-  if ((n = span_token(s)) == 0) 
+  if ((n = span_token(s)) == 0)
     return -1;
-  s += n; while (IS_LWS(*s)) *s++ = '\0'; 
+  s += n; while (IS_LWS(*s)) *s++ = '\0';
   if (*s == ';' && msg_params_d(home, &s, &re->re_params) < 0)
     return -1;
 
@@ -134,7 +134,7 @@ isize_t sip_reason_dup_xtra(sip_header_t const *h, isize_t offset)
   return offset;
 }
 
-/** Duplicate one #sip_reason_t object */ 
+/** Duplicate one #sip_reason_t object */
 char *sip_reason_dup_one(sip_header_t *dst, sip_header_t const *src,
                        char *b, isize_t xtra)
 {
@@ -150,7 +150,7 @@ char *sip_reason_dup_one(sip_header_t *dst, sip_header_t const *src,
 }
 
 /** Update parameter values for @Reason header */
-static int sip_reason_update(msg_common_t *h, 
+static int sip_reason_update(msg_common_t *h,
                             char const *name, isize_t namelen,
                             char const *value)
 {
index a9b0a3b3bb105f1b9e44bc9b798fbd38ba6a69df..9aaa54bb3b016a3d630565d3aa4fc1957f5e2bf3 100644 (file)
@@ -280,7 +280,7 @@ char *sip_referred_by_dup_one(sip_header_t *dst, sip_header_t const *src,
   return b;
 }
 
-static int sip_referred_by_update(msg_common_t *h, 
+static int sip_referred_by_update(msg_common_t *h,
                           char const *name, isize_t namelen,
                           char const *value)
 {
@@ -338,10 +338,10 @@ static int sip_referred_by_update(msg_common_t *h,
  * {
  *   sip_common_t        rp_common[1];   // Common fragment info
  *   sip_error_t        *rp_next;       // Dummy link to next
- *   char const         *rp_call_id;     // @CallID of dialog to replace 
- *   msg_param_t const  *rp_params;      // List of parameters 
- *   char const         *rp_to_tag;      // Value of "to-tag" parameter 
- *   char const         *rp_from_tag;    // Value of "from-tag" parameter 
+ *   char const         *rp_call_id;     // @CallID of dialog to replace
+ *   msg_param_t const  *rp_params;      // List of parameters
+ *   char const         *rp_to_tag;      // Value of "to-tag" parameter
+ *   char const         *rp_from_tag;    // Value of "from-tag" parameter
  *   unsigned            rp_early_only;  // early-only parameter
  * } sip_replaces_t;
  * @endcode
@@ -414,7 +414,7 @@ char *sip_replaces_dup_one(sip_header_t *dst, sip_header_t const *src,
 }
 
 /** Update parameters in @Replaces header. */
-static int sip_replaces_update(msg_common_t *h, 
+static int sip_replaces_update(msg_common_t *h,
                               char const *name, isize_t namelen,
                               char const *value)
 {
@@ -456,7 +456,7 @@ static int sip_replaces_update(msg_common_t *h,
  *  exten           = generic-param
  *
  * The parsed Refer-Sub header is stored in #sip_refer_sub_t structure.
- * 
+ *
  * @NEW_1_12_5. Note that #sip_t does not contain @a sip_refer_sub field,
  * but sip_refer_sub() accessor function should be used for accessing @b
  * Refer-Sub header structure.
@@ -478,10 +478,10 @@ static int sip_replaces_update(msg_common_t *h,
  *   sip_common_t        rs_common[1];   // Common fragment info
  *   sip_error_t        *rs_next;       // Dummy link to next
  *   char const         *rs_value;       // "true" or "false"
- *   msg_param_t const  *rs_params;      // List of extension parameters 
+ *   msg_param_t const  *rs_params;      // List of extension parameters
  * } sip_refer_sub_t;
  * @endcode
- * 
+ *
  * @NEW_1_12_5.
  */
 
@@ -502,7 +502,7 @@ issize_t sip_refer_sub_d(su_home_t *home,
   if (msg_token_d(&s, &rs->rs_value) < 0)
     return -1;
 
-  if (strcasecmp(rs->rs_value, "false") && 
+  if (strcasecmp(rs->rs_value, "false") &&
       strcasecmp(rs->rs_value, "true"))
     return -1;
 
index 3bd85f4676dd34540d46bb5d0913bdbb6eacc428..744535e3d7bd6574d5be96c842136cf38b31b0d8 100644 (file)
@@ -28,7 +28,7 @@
  *
  * This file contains implementation of headers related to HTTP authentication
  * (@RFC2617):
- * @ref sip_authorization "Authorization", 
+ * @ref sip_authorization "Authorization",
  * @ref sip_authentication_info "Authentication-Info",
  * @ref sip_proxy_authenticate "Proxy-Authenticate",
  * @ref sip_proxy_authentication_info "Proxy-Authentication-Info",
@@ -42,7 +42,7 @@
  * @ref sip_security_verify "Security-Verify" headers.
  *
  * The implementation of @ref sip_privacy "Privacy" header (@RFC3323) is
- * also here. 
+ * also here.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  *
  * The #sip_authorization_t is defined as follows:
  * @code
  * typedef struct msg_auth_s {
- *   msg_common_t       au_common[1];  // Common fragment info 
- *   msg_auth_t        *au_next;       // Link to next header 
- *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest" 
+ *   msg_common_t       au_common[1];  // Common fragment info
+ *   msg_auth_t        *au_next;       // Link to next header
+ *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest"
  *   msg_param_t const *au_params;     // Comma-separated parameters
  * } sip_authorization_t;
  * @endcode
@@ -188,9 +188,9 @@ issize_t sip_authorization_e(char b[], isize_t bsiz, sip_header_t const *h, int
  * The #sip_proxy_authenticate_t is defined as follows:
  * @code
  * typedef struct msg_auth_s {
- *   msg_common_t       au_common[1];  // Common fragment info 
- *   msg_auth_t        *au_next;       // Link to next header 
- *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest" 
+ *   msg_common_t       au_common[1];  // Common fragment info
+ *   msg_auth_t        *au_next;       // Link to next header
+ *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest"
  *   msg_param_t const *au_params;     // Comma-separated parameters
  * } sip_proxy_authenticate_t;
  * @endcode
@@ -244,9 +244,9 @@ issize_t sip_proxy_authenticate_e(char b[], isize_t bsiz, sip_header_t const *h,
  * The #sip_proxy_authorization_t is defined as follows:
  * @code
  * typedef struct msg_auth_s {
- *   msg_common_t       au_common[1];  // Common fragment info 
- *   msg_auth_t        *au_next;       // Link to next header 
- *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest" 
+ *   msg_common_t       au_common[1];  // Common fragment info
+ *   msg_auth_t        *au_next;       // Link to next header
+ *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest"
  *   msg_param_t const *au_params;     // Comma-separated parameters
  * } sip_proxy_authorization_t;
  * @endcode
@@ -299,9 +299,9 @@ issize_t sip_proxy_authorization_e(char b[], isize_t bsiz, sip_header_t const *h
  * The #sip_www_authenticate_t is defined as follows:
  * @code
  * typedef struct msg_auth_s {
- *   msg_common_t       au_common[1];  // Common fragment info 
- *   msg_auth_t        *au_next;       // Link to next header 
- *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest" 
+ *   msg_common_t       au_common[1];  // Common fragment info
+ *   msg_auth_t        *au_next;       // Link to next header
+ *   char const        *au_scheme;     // Auth-scheme like "Basic" or "Digest"
  *   msg_param_t const *au_params;     // Comma-separated parameters
  * } sip_www_authenticate_t;
  * @endcode
@@ -441,7 +441,7 @@ issize_t sip_proxy_authentication_info_d(su_home_t *home, sip_header_t *h,
   return msg_list_d(home, (msg_header_t *)h, s, slen);
 }
 
-issize_t sip_proxy_authentication_info_e(char b[], isize_t bsiz, 
+issize_t sip_proxy_authentication_info_e(char b[], isize_t bsiz,
                                         sip_header_t const *h, int f)
 {
   assert(sip_is_proxy_authentication_info(h)); /* This is soo popular */
@@ -455,7 +455,7 @@ issize_t sip_proxy_authentication_info_e(char b[], isize_t bsiz,
 typedef struct sip_security_agree_s sip_security_agree_t;
 #define sh_security_agree sh_security_client
 
-static 
+static
 issize_t sip_security_agree_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
 {
   sip_security_agree_t *sa = (sip_security_agree_t *)h;
@@ -465,16 +465,16 @@ issize_t sip_security_agree_d(su_home_t *home, sip_header_t *h, char *s, isize_t
   while (*s == ',')   /* Ignore empty entries (comma-whitespace) */
     *s = '\0', s += span_lws(s + 1) + 1;
 
-  if ((n = span_token(s)) == 0) 
+  if ((n = span_token(s)) == 0)
     return -1;
-  sa->sa_mec = s; s += n; while (IS_LWS(*s)) *s++ = '\0'; 
+  sa->sa_mec = s; s += n; while (IS_LWS(*s)) *s++ = '\0';
   if (*s == ';' && msg_params_d(home, &s, &sa->sa_params) < 0)
     return -1;
 
   return msg_parse_next_field(home, h, s, slen);
 }
 
-static 
+static
 issize_t sip_security_agree_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
 {
   char *end = b + bsiz, *b0 = b;
@@ -486,7 +486,7 @@ issize_t sip_security_agree_e(char b[], isize_t bsiz, sip_header_t const *h, int
   return b - b0;
 }
 
-static 
+static
 isize_t sip_security_agree_dup_xtra(sip_header_t const *h, isize_t offset)
 {
   sip_security_agree_t const *sa = h->sh_security_agree;
@@ -497,8 +497,8 @@ isize_t sip_security_agree_dup_xtra(sip_header_t const *h, isize_t offset)
   return offset;
 }
 
-/** Duplicate one sip_security_agree_t object */ 
-static 
+/** Duplicate one sip_security_agree_t object */
+static
 char *sip_security_agree_dup_one(sip_header_t *dst, sip_header_t const *src,
                                 char *b, isize_t xtra)
 {
@@ -513,7 +513,7 @@ char *sip_security_agree_dup_one(sip_header_t *dst, sip_header_t const *src,
   return b;
 }
 
-static int sip_security_agree_update(msg_common_t *h, 
+static int sip_security_agree_update(msg_common_t *h,
                                     char const *name, isize_t namelen,
                                     char const *value)
 {
@@ -589,8 +589,8 @@ static int sip_security_agree_update(msg_common_t *h,
  * @code
  * typedef struct sip_security_agree_s
  * {
- *   sip_common_t        sa_common[1]; // Common fragment info 
- *   sip_security_client_t *sa_next;   // Link to next mechanism 
+ *   sip_common_t        sa_common[1]; // Common fragment info
+ *   sip_security_client_t *sa_next;   // Link to next mechanism
  *   char const         *sa_mec;       // Security mechanism
  *   msg_param_t const  *sa_params;    // List of mechanism parameters
  *   char const         *sa_q;         // Value of q (preference) parameter
@@ -601,8 +601,8 @@ static int sip_security_agree_update(msg_common_t *h,
  * @endcode
  */
 
-msg_hclass_t sip_security_client_class[] = 
-SIP_HEADER_CLASS(security_client, "Security-Client", "", 
+msg_hclass_t sip_security_client_class[] =
+SIP_HEADER_CLASS(security_client, "Security-Client", "",
                 sa_params, append, security_agree);
 
 issize_t sip_security_client_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -638,8 +638,8 @@ issize_t sip_security_client_e(char b[], isize_t bsiz, sip_header_t const *h, in
  * @code
  * typedef struct sip_security_agree_s
  * {
- *   sip_common_t        sa_common[1]; // Common fragment info 
- *   sip_security_server_t *sa_next;   // Link to next mechanism 
+ *   sip_common_t        sa_common[1]; // Common fragment info
+ *   sip_security_server_t *sa_next;   // Link to next mechanism
  *   char const         *sa_mec;       // Security mechanism
  *   msg_param_t const  *sa_params;    // List of mechanism parameters
  *   char const         *sa_q;         // Value of q (preference) parameter
@@ -650,8 +650,8 @@ issize_t sip_security_client_e(char b[], isize_t bsiz, sip_header_t const *h, in
  * @endcode
  */
 
-msg_hclass_t sip_security_server_class[] = 
-SIP_HEADER_CLASS(security_server, "Security-Server", "", 
+msg_hclass_t sip_security_server_class[] =
+SIP_HEADER_CLASS(security_server, "Security-Server", "",
                 sa_params, append, security_agree);
 
 issize_t sip_security_server_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -687,8 +687,8 @@ issize_t sip_security_server_e(char b[], isize_t bsiz, sip_header_t const *h, in
  * @code
  * typedef struct sip_security_agree_s
  * {
- *   sip_common_t        sa_common[1]; // Common fragment info 
- *   sip_security_verify_t *sa_next;   // Link to next mechanism 
+ *   sip_common_t        sa_common[1]; // Common fragment info
+ *   sip_security_verify_t *sa_next;   // Link to next mechanism
  *   char const         *sa_mec;       // Security mechanism
  *   msg_param_t const  *sa_params;    // List of mechanism parameters
  *   char const         *sa_q;         // Value of q (preference) parameter
@@ -700,8 +700,8 @@ issize_t sip_security_server_e(char b[], isize_t bsiz, sip_header_t const *h, in
  */
 
 
-msg_hclass_t sip_security_verify_class[] = 
-SIP_HEADER_CLASS(security_verify, "Security-Verify", "", 
+msg_hclass_t sip_security_verify_class[] =
+SIP_HEADER_CLASS(security_verify, "Security-Verify", "",
                 sa_params, append, security_agree);
 
 issize_t sip_security_verify_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -718,10 +718,10 @@ issize_t sip_security_verify_e(char b[], isize_t bsiz, sip_header_t const *h, in
 /* RFC 3323 */
 
 /**@SIP_HEADER sip_privacy Privacy Header
- * 
+ *
  * The Privacy header is used by User-Agent to request privacy services from
  * the network. Its syntax is defined in @RFC3323 as follows:
- * 
+ *
  * @code
  *    Privacy-hdr  =  "Privacy" HCOLON priv-value *(";" priv-value)
  *    priv-value   =   "header" / "session" / "user" / "none" / "critical"
@@ -740,9 +740,9 @@ issize_t sip_security_verify_e(char b[], isize_t bsiz, sip_header_t const *h, in
  * The #sip_privacy_t is defined as follows:
  * @code
  * typedef struct sip_privacy_s {
- *   sip_common_t       priv_common[1];        // Common fragment info 
- *   sip_error_t       *priv_next;             // Dummy link 
- *   msg_param_t const *priv_values;           // List of privacy values 
+ *   sip_common_t       priv_common[1];        // Common fragment info
+ *   sip_error_t       *priv_next;             // Dummy link
+ *   msg_param_t const *priv_values;           // List of privacy values
  * } sip_privacy_t;
  * @endcode
  */
@@ -752,10 +752,10 @@ msg_dup_f sip_privacy_dup_one;
 
 #define sip_privacy_update NULL
 
-msg_hclass_t sip_privacy_class[] = 
+msg_hclass_t sip_privacy_class[] =
 SIP_HEADER_CLASS(privacy, "Privacy", "", priv_values, single, privacy);
 
-static 
+static
 issize_t sip_privacy_token_scan(char *start)
 {
   char *s = start;
@@ -811,7 +811,7 @@ issize_t sip_privacy_e(char b[], isize_t bsiz, sip_header_t const *h, int f)
   }
 
   MSG_TERM_E(b, end);
-    
+
   return b - b0;
 }
 
index 32d25233028fc334ec0a731cd495dd2957b107e4..52e9c60a17b621698f63d1908cb5f6ee60ffa5cb 100644 (file)
@@ -52,9 +52,9 @@
 
 /**@SIP_HEADER sip_session_expires Session-Expires Header
  *
- * The Session-Expires header is used to convey the lifetime of the session. 
+ * The Session-Expires header is used to convey the lifetime of the session.
  * Its syntax is defined in @RFC4028 as follows:
- * 
+ *
  * @code
  *      Session-Expires  =  ("Session-Expires" | "x") HCOLON delta-seconds
  *                           *(SEMI se-params)
@@ -78,7 +78,7 @@
  *  sip_common_t    x_common[1];
  *  sip_unknown_t  *x_next;
  *  unsigned long   x_delta; //Delta Seconds
- *  msg_param_t    *x_params; 
+ *  msg_param_t    *x_params;
  *  char const     *x_refresher; //Who will send the refresh UAS or UAC
  * } sip_session_expires_t;
  * @endcode
@@ -89,7 +89,7 @@ static msg_dup_f sip_session_expires_dup_one;
 static msg_update_f sip_session_expires_update;
 
 msg_hclass_t sip_session_expires_class[] =
-SIP_HEADER_CLASS(session_expires, "Session-Expires", "x", x_params, single, 
+SIP_HEADER_CLASS(session_expires, "Session-Expires", "x", x_params, single,
                 session_expires);
 
 issize_t sip_session_expires_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
@@ -113,7 +113,7 @@ issize_t sip_session_expires_e(char b[], isize_t bsiz, sip_header_t const *h, in
   sip_session_expires_t const *o = h->sh_session_expires;
 
   n = snprintf(b, bsiz, "%lu", o->x_delta);
-  b += n; 
+  b += n;
   MSG_PARAMS_E(b, end, o->x_params, flags);
 
   return b - b0;
@@ -124,11 +124,11 @@ isize_t sip_session_expires_dup_xtra(sip_header_t const *h, isize_t offset)
   sip_session_expires_t const *o = h->sh_session_expires;
 
   MSG_PARAMS_SIZE(offset, o->x_params);
-   
+
   return offset;
 }
 
-/** Duplicate one #sip_session_expires_t object */ 
+/** Duplicate one #sip_session_expires_t object */
 char *sip_session_expires_dup_one(sip_header_t *dst, sip_header_t const *src,
                                  char *b, isize_t xtra)
 {
@@ -144,7 +144,7 @@ char *sip_session_expires_dup_one(sip_header_t *dst, sip_header_t const *src,
 }
 
 /** Update parameters in @SessionExpires header. */
-static int sip_session_expires_update(msg_common_t *h, 
+static int sip_session_expires_update(msg_common_t *h,
                                      char const *name, isize_t namelen,
                                      char const *value)
 {
@@ -153,7 +153,7 @@ static int sip_session_expires_update(msg_common_t *h,
   if (name == NULL) {
     x->x_refresher = NULL;
   }
-  else if (namelen == strlen("refresher") && 
+  else if (namelen == strlen("refresher") &&
           !strncasecmp(name, "refresher", namelen)) {
     x->x_refresher = value;
   }
@@ -167,7 +167,7 @@ static int sip_session_expires_update(msg_common_t *h,
  *
  * The Min-SE header is used to indicate the minimum value for the session
  * interval. Its syntax is defined in @RFC4028 as follows:
- * 
+ *
  * @code
  *      MMin-SE  =  "Min-SE" HCOLON delta-seconds *(SEMI generic-param)
  * @endcode
@@ -221,7 +221,7 @@ issize_t sip_min_se_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
   sip_min_se_t const *o = (sip_min_se_t *)h;
 
   n = snprintf(b, bsiz, "%lu", o->min_delta);
-  b += n; 
+  b += n;
   MSG_PARAMS_E(b, end, o->min_params, flags);
 
   return b - b0;
@@ -232,11 +232,11 @@ isize_t sip_min_se_dup_xtra(sip_header_t const *h, isize_t offset)
   sip_min_se_t const *o = (sip_min_se_t *)h;
 
   MSG_PARAMS_SIZE(offset, o->min_params);
-   
+
   return offset;
 }
 
-/** Duplicate one #sip_min_se_t object */ 
+/** Duplicate one #sip_min_se_t object */
 char *sip_min_se_dup_one(sip_header_t *dst, sip_header_t const *src,
                        char *b, isize_t xtra)
 {
index 3d92cd88eeaff5db3537f2fbfa0de0ed2aeee695..f75da713ebad3aa6d261944ca2c202a989b8afb7 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@ingroup sip_status_codes
  * @CFILE sip_status.c
- * 
+ *
  * SIP status codes and standard phrases.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
 #include <stddef.h>
 #include <sofia-sip/sip_status.h>
 
-char const 
+char const
   sip_100_Trying[] =                   "Trying",
   sip_180_Ringing[] =                  "Ringing",
   sip_181_Call_is_being_forwarded[] =  "Call Is Being Forwarded",
   sip_182_Queued[] =                   "Queued",
   sip_183_Session_progress[] =         "Session Progress",
-  
+
   sip_200_OK[] =                       "OK",
   sip_202_Accepted[] =                 "Accepted",
-  
+
   sip_300_Multiple_choices[] =         "Multiple Choices",
   sip_301_Moved_permanently[] =        "Moved Permanently",
   sip_302_Moved_temporarily[] =        "Moved Temporarily",
   sip_305_Use_proxy[] =                "Use Proxy",
   sip_380_Alternative_service[] =      "Alternative Service",
-  
+
   sip_400_Bad_request[] =              "Bad Request",
   sip_401_Unauthorized[] =             "Unauthorized",
   sip_402_Payment_required[] =         "Payment Required",
@@ -75,7 +75,7 @@ char const
   sip_421_Extension_required[] =       "Extension Required",
   sip_422_Session_timer[] =            "Session Interval Too Small",
   sip_423_Interval_too_brief[] =       "Interval Too Brief",
-  
+
   sip_480_Temporarily_unavailable[] =  "Temporarily Unavailable",
   sip_481_No_transaction[] =           "Call/Transaction Does Not Exist",
   sip_482_Loop_detected[] =            "Loop Detected",
@@ -114,13 +114,13 @@ char const
  * empty string "" is returned.
  *
  * @param status well-known status code in range 100..699
- * 
+ *
  * @return
  * A response message corresponding to status code, or NULL upon an error.
  */
 char const *sip_status_phrase(int status)
 {
-  if (status < 100 || status > 699) 
+  if (status < 100 || status > 699)
     return NULL;
 
   switch (status) {
index ec88be25cf8b9e790991db6a5ee3ee22a44a3f14..7ba015894a5db3f2dacb6e9d269c73a2ab580490 100644 (file)
@@ -87,7 +87,7 @@ tag_type_t sip_tag_list[] =
 };
 
 /** List of all string tags for SIP headers  */
-tag_type_t sip_tag_str_list[] = 
+tag_type_t sip_tag_str_list[] =
 {
   siptag_#xxxxxx#_str,
   NULL
index 4c2aa3aba88e3f2fdec86c2469e81a0c77a7a61f..9b93bf5c4726dee74d4be0c0570763cfa82d6754 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**@SIP_TAG
- * 
+ *
  * @CFILE sip_tag_class.c  SIP Tag classes
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -54,7 +54,7 @@
  * Tags in this class are not automatically added to the message with
  * sip_add_tl() or sip_add_tagis().
  */
-tag_class_t sipexthdrtag_class[1] = 
+tag_class_t sipexthdrtag_class[1] =
   {{
     sizeof(siphdrtag_class),
     /* tc_next */     NULL,
@@ -72,7 +72,7 @@ tag_class_t sipexthdrtag_class[1] =
 
 
 /** Tag class for SIP header tags. @HIDE */
-tag_class_t siphdrtag_class[1] = 
+tag_class_t siphdrtag_class[1] =
   {{
     sizeof(siphdrtag_class),
     /* tc_next */     NULL,
@@ -89,7 +89,7 @@ tag_class_t siphdrtag_class[1] =
   }};
 
 /** Tag class for SIP header string tags. @HIDE */
-tag_class_t sipstrtag_class[1] = 
+tag_class_t sipstrtag_class[1] =
   {{
     sizeof(sipstrtag_class),
     /* tc_next */     NULL,
@@ -106,7 +106,7 @@ tag_class_t sipstrtag_class[1] =
   }};
 
 /** Tag class for SIP message tags. @HIDE */
-tag_class_t sipmsgtag_class[1] = 
+tag_class_t sipmsgtag_class[1] =
   {{
     sizeof(sipmsgtag_class),
     /* tc_next */     NULL,
@@ -125,16 +125,16 @@ tag_class_t sipmsgtag_class[1] =
 /** Filter a for SIP header tag.
  *
  * @param[in] dst tag list for filtering result. May be NULL.
- * @param[in] f   filter tag 
- * @param[in] src tag item from source list. 
- * @param[in,out] bb pointer to pointer of mempory area used to dup 
+ * @param[in] f   filter tag
+ * @param[in] src tag item from source list.
+ * @param[in,out] bb pointer to pointer of mempory area used to dup
  *                   the filtering result
  *
  * This function is also used to calculate size for filtering result.
  */
 tagi_t *siptag_filter(tagi_t *dst,
                      tagi_t const f[],
-                     tagi_t const *src, 
+                     tagi_t const *src,
                      void **bb)
 {
   tagi_t stub[2] = {{ NULL }};
@@ -154,7 +154,7 @@ tagi_t *siptag_filter(tagi_t *dst,
       return dst;
 
     hh = (sip_header_t const **)
-      msg_hclass_offset((msg_mclass_t *)sip->sip_common->h_class, 
+      msg_hclass_offset((msg_mclass_t *)sip->sip_common->h_class,
                        (msg_pub_t *)sip, hc);
 
     /* Is header present in the SIP message? */
@@ -242,7 +242,7 @@ int sip_add_tagis(msg_t *msg, sip_t *sip, tagi_t const **inout_list)
            msg_header_remove(msg, (msg_pub_t *)sip, *hh);
        }
        continue;
-      } 
+      }
 
       if (tag == siptag_header)
        hc = h->sh_class;
@@ -288,13 +288,13 @@ static char const *append_escaped(su_strlst_t *l,
  *
  * @par Example
  * @code
- * url->url_headers = 
+ * url->url_headers =
  *   sip_headers_as_url_query(home, SIPTAG_REPLACES(replaces), TAG_END());
  * @endcode
- * 
+ *
  * @since New in @VERSION_1_12_4.
  *
- * @sa 
+ * @sa
  * url_query_as_header_string(), sip_url_query_as_taglist(),
  * nta_msg_request_complete(),
  * @RFC3261 section 19.1.1 "Headers", #url_t, url_s#url_headers
@@ -383,12 +383,12 @@ char const *append_escaped(su_strlst_t *l,
     for (;*n; n++)
       if (isupper(*n))
        *n = tolower(*n);
-    
+
     slen = strlen(s); elen = url_esclen(s, HNV_RESERVED);
 
     if ((size_t)elen == slen)
       return su_strlst_append(l, s);
-    
+
     escaped = su_alloc(lhome, elen + 1);
     if (escaped)
       return su_strlst_append(l, url_escape(escaped, s, HNV_RESERVED));
@@ -403,9 +403,9 @@ char const *append_escaped(su_strlst_t *l,
  * Unknown headers are encoded as SIPTAG_HEADER_STR().
  *
  * @param home memory home used to alloate string (if NULL, malloc() it)
- * @param query query part from SIP URL 
+ * @param query query part from SIP URL
  * @param parser optional SIP parser used
- * 
+ *
  * @sa sip_add_tl(), sip_add_tagis(), SIPTAG_HEADER_STR(),
  * sip_headers_as_url_query(), url_query_as_header_string(),
  * @RFC3261 section 19.1.1 "Headers", #url_t, url_s#url_headers
index 9ad9d2809bd679d910b47558b139e9e762da9e29..77fababe6b7d811d19e83f181c262c1e5e1c8d9f 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@CFILE sip_time.c 
+/**@CFILE sip_time.c
  * @brief SIP time handling
  *
  * Functions for handling time and dates in SIP.
@@ -53,7 +53,7 @@ sip_time_t sip_now(void)
 
 /**@ingroup sip_expires
  *
- * Calculate the expiration time for a SIP @Contact. 
+ * Calculate the expiration time for a SIP @Contact.
  *
  * @param m     @Contact header
  * @param ex    @Expires header
@@ -66,8 +66,8 @@ sip_time_t sip_now(void)
  *
  * @note If @a now is 0, the function gets the current time using sip_now().
  *
- * @return 
- *   The expiration time in seconds. 
+ * @return
+ *   The expiration time in seconds.
  */
 sip_time_t sip_contact_expires(sip_contact_t const *m,
                               sip_expires_t const *ex,
@@ -92,7 +92,7 @@ sip_time_t sip_contact_expires(sip_contact_t const *m,
   }
 
   if (time) {
-    if (date) 
+    if (date)
       now = date->d_time;
     else if (now == 0)
       now = sip_now();
index 0b017d53907c9ed06b82c23c95ccbb23729a2378..3bec98f95d3358285ebc865e72002f32ab82f2db 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**@CFILE sip_util.c
- * 
+ *
  * SIP utility functions.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -59,7 +59,7 @@
 #include <limits.h>
 #include <ctype.h>
 
-/** 
+/**
  * Compare two SIP addresses ( @From or @To headers).
  *
  * @retval nonzero if matching.
 int sip_addr_match(sip_addr_t const *a, sip_addr_t const *b)
 {
   return
-    (a->a_tag == NULL || b->a_tag == NULL || 
+    (a->a_tag == NULL || b->a_tag == NULL ||
      strcmp(a->a_tag, b->a_tag) == 0)
     &&
-    str0casecmp(a->a_host, b->a_host) == 0 
+    str0casecmp(a->a_host, b->a_host) == 0
     &&
-    str0cmp(a->a_user, b->a_user) == 0 
+    str0cmp(a->a_user, b->a_user) == 0
     &&
     str0cmp(a->a_url->url_scheme, b->a_url->url_scheme);
 }
@@ -142,14 +142,14 @@ sip_contact_t * sip_contact_create(su_home_t *home,
  * parameter is included in the URI unless the transport protocol is UDP.
  *
  * @param home      memory home
- * @param v         @Via header field structure 
+ * @param v         @Via header field structure
  *                  (with <sent-protocol> and <sent-by> parameters)
  * @param user      username for @Contact URI (may be NULL)
  *
  * @retval contact header structure
  * @retval NULL upon an error
  *
- * @sa sip_contact_create_from_via_with_transport(), 
+ * @sa sip_contact_create_from_via_with_transport(),
  *     sip_contact_string_from_via()
  */
 sip_contact_t *
@@ -297,12 +297,12 @@ int sip_transport_has_tls(char const *transport_name)
 }
 
 /**Perform sanity check on a SIP message
- * 
- * Check that the SIP message has all the mandatory fields. 
+ *
+ * Check that the SIP message has all the mandatory fields.
  *
  * @param sip SIP message to be checked
  *
- * @return 
+ * @return
  * When the SIP message fulfills the minimum requirements, return zero,
  * otherwise a negative status code.
  */
@@ -331,7 +331,7 @@ sip_sanity_check(sip_t const *sip)
        return -1;
       break;
 
-    case url_tel: 
+    case url_tel:
       if (!ruri->url_user || strlen(ruri->url_user) == 0)
        return -1;
       break;
@@ -354,7 +354,7 @@ sip_sanity_check(sip_t const *sip)
  * string is modified when parsing. The home is used to allocate extra
  * memory required when parsing, e.g., for parameter list or when there
  * string contains multiple header fields.
- * 
+ *
  * @deprecated
  * Use msg_header_make() or header-specific make functions, e.g.,
  * sip_via_make().
@@ -370,9 +370,9 @@ issize_t sip_header_field_d(su_home_t *home, sip_header_t *h, char *s, isize_t s
 
     for (n = slen; n >= 1 && IS_LWS(s[n - 1]); n--)
       ;
-    
+
     s[n] = '\0';
-    
+
     assert(SIP_HDR_TEST(h));
 
     return h->sh_class->hc_parse(home, h, s, slen);
@@ -416,9 +416,9 @@ char *sip_header_as_string(su_home_t *home, sip_header_t const *h)
     if (n > -1 && n + 1 <= len)
       break;
     if (n > -1)                        /* glibc >2.1 */
-      len = n + 1;             
+      len = n + 1;
     else                       /* glibc 2.0 */
-      len *= 2;                        
+      len *= 2;
   }
 
   return rv;
@@ -434,7 +434,7 @@ isize_t sip_header_size(sip_header_t const *h)
     return h->sh_class->hc_dxtra(h, h->sh_class->hc_size);
 }
 
-/** Duplicate a url or make a url out of string. 
+/** Duplicate a url or make a url out of string.
  * @deprecated Use url_hdup() instead.
  */
 url_t *sip_url_dup(su_home_t *home, url_t const *o)
@@ -443,13 +443,13 @@ url_t *sip_url_dup(su_home_t *home, url_t const *o)
 }
 
 /**Calculate Q value.
- * 
+ *
  * Convert q-value string @a q to numeric value
  * in range (0..1000).  Q values are used, for instance, to describe
  * relative priorities of registered contacts.
  *
  * @param q q-value string <code>("1" | "." 1,3DIGIT)</code>
- * 
+ *
  * @return An integer in range 0 .. 1000.
  */
 unsigned sip_q_value(char const *q)
@@ -466,7 +466,7 @@ unsigned sip_q_value(char const *q)
     return 1000;
   if (q[0] == '\0')
     return 0;
-  if (q[0] != '.')      
+  if (q[0] != '.')
     return 500;    /* Garbage... */
 
   if (q[1] >= '0' && q[1] <= '9') {
@@ -478,7 +478,7 @@ unsigned sip_q_value(char const *q)
        if (q[4] > '5' && q[4] <= '9')
          /* Round upwards */
          value += 1;
-       else if (q[4] == '5') 
+       else if (q[4] == '5')
          value += value & 1; /* Round to even */
       }
     }
@@ -490,7 +490,7 @@ unsigned sip_q_value(char const *q)
 
 /**@ingroup sip_route
  *
- * Get first route header and remove it from its fragment chain. 
+ * Get first route header and remove it from its fragment chain.
  *
  */
 sip_route_t *sip_route_remove(msg_t *msg, sip_t *sip)
@@ -505,14 +505,14 @@ sip_route_t *sip_route_remove(msg_t *msg, sip_t *sip)
 
 /**@ingroup sip_route
  *
- * Get last route header and remove it from its fragment chain. 
+ * Get last route header and remove it from its fragment chain.
  *
  */
 sip_route_t *sip_route_pop(msg_t *msg, sip_t *sip)
 {
   sip_route_t *r;
 
-  for (r = sip->sip_route; r; r = r->r_next) 
+  for (r = sip->sip_route; r; r = r->r_next)
     if (r->r_next == NULL) {
       msg_header_remove(msg, (msg_pub_t *)sip, (msg_header_t *)r);
       return r;
@@ -524,13 +524,13 @@ sip_route_t *sip_route_pop(msg_t *msg, sip_t *sip)
 
 /**@ingroup sip_route
  *
- * Get first route header and rewrite the RequestURI. 
+ * Get first route header and rewrite the RequestURI.
  */
 sip_route_t *sip_route_follow(msg_t *msg, sip_t *sip)
 {
   if (sip->sip_route) {
-    /* XXX - in case of outbound proxy, route may contain our address */ 
-      
+    /* XXX - in case of outbound proxy, route may contain our address */
+
     sip_route_t *r = sip_route_remove(msg, sip);
     sip_request_t *rq = sip->sip_request;
 
@@ -546,12 +546,12 @@ sip_route_t *sip_route_follow(msg_t *msg, sip_t *sip)
 }
 
 /**@ingroup sip_route
- * 
+ *
  * Check if route header has lr param.
  *
  * "lr" param can be either URL or header parameter.
  */
-int 
+int
 sip_route_is_loose(sip_route_t const *r)
 {
   if (!r)
@@ -566,7 +566,7 @@ sip_route_is_loose(sip_route_t const *r)
  *
  * Reverse a route header (@Route, @RecordRoute, @Path, @ServiceRoute).
  */
-sip_route_t *sip_route_reverse_as(su_home_t *home, 
+sip_route_t *sip_route_reverse_as(su_home_t *home,
                                  msg_hclass_t *hc,
                                  sip_route_t const *route)
 {
@@ -580,8 +580,8 @@ sip_route_t *sip_route_reverse_as(su_home_t *home,
     *r->r_url = *route->r_url;
     /* Fix broken (Record-)Routes without <> */
     if (r->r_url->url_params == NULL
-       && r->r_params 
-       && r->r_params[0] 
+       && r->r_params
+       && r->r_params[0]
        && (r->r_params[0][0] == 'l' || r->r_params[0][0] == 'L')
        && (r->r_params[0][1] == 'r' || r->r_params[0][1] == 'R')
        && (r->r_params[0][2] == '=' || r->r_params[0][2] == 0))
@@ -590,7 +590,7 @@ sip_route_t *sip_route_reverse_as(su_home_t *home,
     else
       r->r_params = route->r_params;
     tmp = (sip_route_t *)msg_header_dup_as(home, hc, (msg_header_t *)r);
-    if (!tmp) 
+    if (!tmp)
       goto error;
     tmp->r_next = reverse;
     reverse = tmp;
@@ -606,7 +606,7 @@ sip_route_t *sip_route_reverse_as(su_home_t *home,
 
 /**@ingroup sip_route
  *
- * Reverse a @Route header. 
+ * Reverse a @Route header.
  *
  * Reverse A route header like @RecordRoute or @Path.
  */
@@ -634,8 +634,8 @@ sip_route_t *sip_route_fixdup_as(su_home_t *home,
     *r->r_url = *route->r_url;
     /* Fix broken (Record-)Routes without <> */
     if (r->r_url->url_params == NULL
-       && r->r_params 
-       && r->r_params[0] 
+       && r->r_params
+       && r->r_params[0]
        && (r->r_params[0][0] == 'l' || r->r_params[0][0] == 'L')
        && (r->r_params[0][1] == 'r' || r->r_params[0][1] == 'R')
        && (r->r_params[0][2] == '=' || r->r_params[0][2] == 0))
@@ -658,7 +658,7 @@ sip_route_t *sip_route_fixdup_as(su_home_t *home,
 
 /**@ingroup sip_route
  *
- * Fix and duplicate a @Route header. 
+ * Fix and duplicate a @Route header.
  *
  * Copy a route header like @RecordRoute or @Path as @Route.
  *
@@ -698,14 +698,14 @@ sip_route_t *sip_route_fix(sip_route_t *route)
 
   for (r = route; r; r = r->r_next) {
     /* Keep track of first header structure on this header line */
-    if (!h 
+    if (!h
        || (char *)h->sh_data + h->sh_len != r->r_common->h_data
        || r->r_common->h_len)
       h = (sip_header_t *)r;
 
     if (r->r_url->url_params == NULL
-       && r->r_params 
-       && r->r_params[0] 
+       && r->r_params
+       && r->r_params[0]
        && (r->r_params[0][0] == 'l' || r->r_params[0][0] == 'L')
        && (r->r_params[0][1] == 'r' || r->r_params[0][1] == 'R')
        && (r->r_params[0][2] == '=' || r->r_params[0][2] == 0)) {
@@ -723,7 +723,7 @@ sip_route_t *sip_route_fix(sip_route_t *route)
 
 /**@ingroup sip_via
  *
- * Get first via header and remove it from its fragment chain. 
+ * Get first via header and remove it from its fragment chain.
  */
 sip_via_t *sip_via_remove(msg_t *msg, sip_t *sip)
 {
@@ -731,7 +731,7 @@ sip_via_t *sip_via_remove(msg_t *msg, sip_t *sip)
 
   if (sip == NULL)
     return NULL;
-  
+
   for (v = sip->sip_via; v; v = v->v_next) {
     sip_fragment_clear(v->v_common);
 
@@ -762,12 +762,12 @@ unsigned long sip_payload_serialize(msg_t *msg, sip_payload_t *pl)
   return total;
 }
 
-/** 
+/**
  * Remove extra parameters from an AOR URL.
  *
  * The extra parameters listed in the @RFC3261 table 1 include port number,
  * method, maddr, ttl, transport, lr and headers.
- * 
+ *
  * @note The funtion modifies the @a url and the strings attached to it.
  *
  * @retval 0 when successful
@@ -783,9 +783,9 @@ int sip_aor_strip(url_t *url)
 
   if (url->url_params)
     url_strip_transport(url);
-    
+
   if (url->url_params)
-    url->url_params = 
+    url->url_params =
       url_strip_param_string((char *)url->url_params, "lr");
 
   return 0;
@@ -809,7 +809,7 @@ int sip_security_verify_compare(sip_security_server_t const *s,
   for (;;s = s->sa_next, v = v->sa_next) {
     if (s == NULL || v == NULL)
       return (s == NULL) - (v == NULL);
-    
+
     if ((retval = str0cmp(s->sa_mec, v->sa_mec)))
       return retval;
 
@@ -827,7 +827,7 @@ int sip_security_verify_compare(sip_security_server_t const *s,
     }
 
     for (i = 0, j = 0;; i++, j++) {
-      if (digest && v_params[j] && 
+      if (digest && v_params[j] &&
          strncasecmp(v_params[j], "d-ver=", 6) == 0) {
        if (return_d_ver)
          *return_d_ver = v_params[j] + strlen("d-ver=");
@@ -835,8 +835,8 @@ int sip_security_verify_compare(sip_security_server_t const *s,
       }
 
       retval = str0cmp(s_params[i], v_params[j]);
-      
-      if (retval || s_params[i] == NULL || v_params[j] == NULL) 
+
+      if (retval || s_params[i] == NULL || v_params[j] == NULL)
        break;
     }
 
@@ -845,7 +845,7 @@ int sip_security_verify_compare(sip_security_server_t const *s,
   }
 }
 
-/** Select best mechanism from @SecurityClient header. 
+/** Select best mechanism from @SecurityClient header.
  *
  * @note We assume that @SecurityServer header in @a s is sorted by
  * preference.
@@ -871,11 +871,11 @@ sip_security_client_select(sip_security_client_t const *client,
 
 /**Checks if the response with given response code terminates dialog or
  * dialog usage.
- * 
+ *
  * @return -1 if the response with given code terminates whole dialog.
  * @return 1 if the response terminates the dialog usage.
  * @return 0 if the response does not terminate dialog or dialog usage.
- * 
+ *
  * @return
  * The @a *return_graceful_terminate_usage is set to 1, if application
  * should gracefully terminate its dialog usage. It is set to 0, if no
@@ -892,25 +892,25 @@ int sip_response_terminates_dialog(int response_code,
   enum { no_effect, terminate_usage = 1, terminate_dialog = -1 };
   int dummy;
 
-  if (!return_graceful_terminate_usage) 
+  if (!return_graceful_terminate_usage)
     return_graceful_terminate_usage = &dummy;
 
   if (response_code < 300)
     return *return_graceful_terminate_usage = 0;
 
-  /*  
+  /*
       3xx responses: Redirection mid-dialog is not well understood in SIP,
       but whatever effect it has impacts the entire dialog and all of
       its usages equally.  In our example scenario, both the
       subscription and the invite usage would be redirected by this
       single response.
   */
-  if (response_code < 400) 
+  if (response_code < 400)
     return *return_graceful_terminate_usage = 0;
 
   if (response_code < 500) switch (response_code) {
   default:
-  case 400: /** @par 400 and unrecognized 4xx responses 
+  case 400: /** @par 400 and unrecognized 4xx responses
 
       These responses affect only the NOTIFY transaction, not the
       subscription, the dialog it resides in (beyond affecting the local
@@ -921,16 +921,16 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 401: 
+  case 401:
   case 407: /** @par 401 Unauthorized and 407 Proxy Authentication Required
 
       This request, not the subscription or dialog, is being challenged. The
       usages and dialog are not terminated.
-    */ 
+    */
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 402: /** @par 402 Payment Required 
+  case 402: /** @par 402 Payment Required
 
       This is a reserved response code. If encountered, it should be
       treated as an unrecognized 4xx.
@@ -938,7 +938,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 403: /** @par 403 Forbidden 
+  case 403: /** @par 403 Forbidden
 
       This response terminates the subscription, but has no effect on
       any other usages of the dialog. In our example scenario, the
@@ -948,8 +948,8 @@ int sip_response_terminates_dialog(int response_code,
     */
     *return_graceful_terminate_usage = 0;
     return 0;
-    
-  case 404: /** @par 404 Not Found 
+
+  case 404: /** @par 404 Not Found
 
       This response destroys the dialog and all usages sharing it. The
       Request-URI that is being 404ed is the remote target set by the
@@ -958,7 +958,7 @@ int sip_response_terminates_dialog(int response_code,
     */
     return terminate_dialog;
 
-  case 405: /** @par 405 Method Not Allowed 
+  case 405: /** @par 405 Method Not Allowed
 
       In our example scenario, this response destroys the subscription,
       but not the invite usage or the dialog. It's an aberrant case for
@@ -977,9 +977,9 @@ int sip_response_terminates_dialog(int response_code,
       return 0;
     }
 
-  case 406: /** @par 406 Not Acceptable 
+  case 406: /** @par 406 Not Acceptable
 
-      These responses concern details of the message in the transaction. 
+      These responses concern details of the message in the transaction.
       Subsequent requests in this same usage may succeed. Neither the
       usage nor dialog is terminated, other usages sharing this dialog
       are unaffected.
@@ -987,7 +987,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 408: /** @par 408 Request Timeout 
+  case 408: /** @par 408 Request Timeout
 
       Receiving a 408 will have the same effect on
       usages and dialogs as a real transaction timeout as described in
@@ -995,7 +995,7 @@ int sip_response_terminates_dialog(int response_code,
     */
     return terminate_usage;
 
-  case 410: /** @par 410 Gone 
+  case 410: /** @par 410 Gone
 
       This response destroys the dialog and all usages sharing
       it.  The Request-URI that is being rejected is the remote target
@@ -1007,13 +1007,13 @@ int sip_response_terminates_dialog(int response_code,
     */
     return terminate_dialog;
 
-  case 412: /* Conditional Request Failed: */ 
+  case 412: /* Conditional Request Failed: */
   case 413: /* Request Entity Too Large: */
   case 414: /* Request-URI Too Long: */
   case 415: /* Unsupported Media Type: */
-    /** @par 412, 413, 414 and 415 
+    /** @par 412, 413, 414 and 415
 
-      These responses concern details of the message in the transaction. 
+      These responses concern details of the message in the transaction.
       Subsequent requests in this same usage may succeed. Neither the usage
       nor dialog is terminated, other usages sharing this dialog are
       unaffected.
@@ -1021,7 +1021,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 416: /** @par 416 Unsupported URI Scheme 
+  case 416: /** @par 416 Unsupported URI Scheme
 
       Similar to 404 and 410, this response
       came to a request whose Request-URI was provided by the peer in a
@@ -1038,7 +1038,7 @@ int sip_response_terminates_dialog(int response_code,
       @CSeq.  No other usages of the dialog are affected.
     */
 
-  case 420: /* Bad Extension */ 
+  case 420: /* Bad Extension */
   case 421: /* Extension Required */
 
     /** @par 420 Bad Extension and 421 Extension Required
@@ -1060,7 +1060,7 @@ int sip_response_terminates_dialog(int response_code,
       usages are unaffected.
     */
 
-  case 423: /** @par 423 Interval Too Brief 
+  case 423: /** @par 423 Interval Too Brief
 
       This response won't happen in our example
       scenario, but if it came in response to a re-SUBSCRIBE, the
@@ -1075,11 +1075,11 @@ int sip_response_terminates_dialog(int response_code,
       affected by a change in its local @CSeq.  No other usages of the
       dialog are affected. */
 
-  case 429: /** @par 429 Provide Referrer Identity 
+  case 429: /** @par 429 Provide Referrer Identity
 
       This response won't be returned to a NOTIFY as in our example
       scenario, but when it is returned to a REFER, it is objecting to
-      the REFER request itself, not any usage the REFER occurs within. 
+      the REFER request itself, not any usage the REFER occurs within.
       The usage is unaffected. Any other usages sharing this dialog are
       unaffected. The dialog is only affected by a change in its local
       @CSeq.
@@ -1087,7 +1087,7 @@ int sip_response_terminates_dialog(int response_code,
 
   case 436: case 437: case 438:
     /** @par 436 Bad Identity-Info, 437 Unsupported Certificate, 438 Invalid \
-     *  Identity Header 
+     *  Identity Header
      *
      * These responses object to the request, not the usage.
      * The usage is not affected.  The dialog is only affected by a
@@ -1110,7 +1110,7 @@ int sip_response_terminates_dialog(int response_code,
     return terminate_usage;
 
 
-  case 481: /** @par 481 Call/Transaction Does Not Exist 
+  case 481: /** @par 481 Call/Transaction Does Not Exist
 
       This response indicates that the peer has lost its copy of the dialog
       state. The dialog and any usages sharing it are destroyed.
@@ -1136,7 +1136,7 @@ int sip_response_terminates_dialog(int response_code,
     return terminate_usage;
 
 
-  case 482: /** @par 482 Loop Detected 
+  case 482: /** @par 482 Loop Detected
 
       This response is aberrant mid-dialog.  It will
       only occur if the @RecordRoute header field was improperly
@@ -1144,12 +1144,12 @@ int sip_response_terminates_dialog(int response_code,
       initial usage, or if a mid-dialog request forks and merges (which
       should never happen).  Future requests using this dialog state
       will also fail.  The dialog and any usages sharing it are
-      destroyed.  
+      destroyed.
     */
     return terminate_dialog;
 
 
-  case 483: /** @par 483 Too Many Hops 
+  case 483: /** @par 483 Too Many Hops
 
       Similar to 482, receiving this mid-dialog is
       aberrant.  Unlike 482, recovery may be possible by increasing
@@ -1158,7 +1158,7 @@ int sip_response_terminates_dialog(int response_code,
       than it used for an initial request).  If the request isn't tried
       with an increased @MaxForwards, then the agent should attempt to
       gracefully terminate this usage and all other usages that share
-      its dialog.  
+      its dialog.
     */
     *return_graceful_terminate_usage = 1;
     return 0;
@@ -1174,7 +1174,7 @@ int sip_response_terminates_dialog(int response_code,
     */
     return terminate_dialog;
 
-  case 486: /** @par 486 Busy Here 
+  case 486: /** @par 486 Busy Here
 
       This response is non-sensical in our example scenario,
       or in any scenario where this response comes inside an established
@@ -1190,7 +1190,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 487: /** @par 487 Request Terminated 
+  case 487: /** @par 487 Request Terminated
 
       This response speaks to the disposition of a
       particular request (transaction).  The usage in which that request
@@ -1201,7 +1201,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 488: /** @par 488 Not Acceptable Here 
+  case 488: /** @par 488 Not Acceptable Here
 
       This response is objecting to the request,
       not the usage.  The usage is not affected.  The dialog is only
@@ -1211,7 +1211,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 489: /** @par 489 Bad Event 
+  case 489: /** @par 489 Bad Event
 
       In our example scenario, @RFC3265 declares that the
       subscription usage in which the NOTIFY is sent is terminated.  The
@@ -1224,7 +1224,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return method == sip_method_notify ? terminate_usage : no_effect;
 
-  case 491: /** @par 491 Request Pending 
+  case 491: /** @par 491 Request Pending
 
       This response addresses in-dialog request glare.
       Its affect is scoped to the request.  The usage in which the
@@ -1235,7 +1235,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 493: /** @par 493 Undecipherable 
+  case 493: /** @par 493 Undecipherable
 
       This response objects to the request, not the
       usage.  The usage is not affected.  The dialog is only affected by
@@ -1245,7 +1245,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 494: /** @par 494 Security Agreement Required 
+  case 494: /** @par 494 Security Agreement Required
 
       This response is objecting to the
       request, not the usage.  The usage is not affected.  The dialog is
@@ -1278,7 +1278,7 @@ int sip_response_terminates_dialog(int response_code,
     /* Do not change *return_graceful_terminate_usage */
     return 0;
 
-  case 501: /** @par 501 Not Implemented 
+  case 501: /** @par 501 Not Implemented
 
       This would be a degenerate response in our
       example scenario since the NOTIFY is being sent as part of an
@@ -1294,7 +1294,7 @@ int sip_response_terminates_dialog(int response_code,
     /* Do not change *return_graceful_terminate_usage */
     return 0;
 
-  case 502: /** @par 502 Bad Gateway 
+  case 502: /** @par 502 Bad Gateway
 
       This response is aberrant mid-dialog. It will only occur if the
       @RecordRoute header field was improperly constructed by the
@@ -1304,7 +1304,7 @@ int sip_response_terminates_dialog(int response_code,
     */
     return terminate_dialog;
 
-  case 503: /** @par 503 Service Unavailable 
+  case 503: /** @par 503 Service Unavailable
 
       As per @RFC3263, the logic handling locating SIP servers for
       transactions may handle 503 requests (effectively sequentially
@@ -1321,7 +1321,7 @@ int sip_response_terminates_dialog(int response_code,
     /* Do not change *return_graceful_terminate_usage */
     return 0;
 
-  case 504: /** @par 504 Server Time-out 
+  case 504: /** @par 504 Server Time-out
 
       It is not obvious under what circumstances this
       response would be returned to a request in an existing dialog.  If
@@ -1342,7 +1342,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 580: /** @par 580 Precondition Failure 
+  case 580: /** @par 580 Precondition Failure
 
       This response is objecting to the request,
       not the usage.  The usage is not affected.  The dialog is only
@@ -1360,7 +1360,7 @@ int sip_response_terminates_dialog(int response_code,
 
       Unlike 400 Bad Request, a 600 response code says something about
       the recipient user, not the request that was made. This end user
-      is stating an unwillingness to communicate. 
+      is stating an unwillingness to communicate.
 
       If the response contains a @RetryAfter header field value, the
       user is indicating willingness to communicate later and the
@@ -1378,7 +1378,7 @@ int sip_response_terminates_dialog(int response_code,
     /* Do not change graceful_terminate */
     return 0;
 
-  case 603: /** @par 603 Decline 
+  case 603: /** @par 603 Decline
 
       This response declines the action indicated by the
       associated request.  It can be used, for example, to decline a
@@ -1389,7 +1389,7 @@ int sip_response_terminates_dialog(int response_code,
     *return_graceful_terminate_usage = 0;
     return 0;
 
-  case 604: /** @par 604 Does Not Exist Anywhere 
+  case 604: /** @par 604 Does Not Exist Anywhere
 
       Like 404, this response destroys the
       dialog and all usages sharing it.  The Request-URI that is being
@@ -1399,7 +1399,7 @@ int sip_response_terminates_dialog(int response_code,
     */
     return terminate_dialog;
 
-  case 606: /** @par 606 Not Acceptable 
+  case 606: /** @par 606 Not Acceptable
 
       This response is objecting to aspects of the
       associated request, not the usage the request appears in.  The
index a297b99cd20cbff182ce3d37c77a3f387f6a9cf9..1a235ca4c88ca464a9bcad38b226aa810c9b8081 100644 (file)
@@ -26,8 +26,8 @@
 /** Defined when <sofia-sip/sip.h> has been included. */
 #define SIP_H
 
-/**@file sofia-sip/sip.h 
- * 
+/**@file sofia-sip/sip.h
+ *
  * SIP objects.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -185,7 +185,7 @@ typedef struct sip_caller_prefs_s   sip_reject_contact_t;
 typedef msg_list_t                 sip_require_t;
 typedef struct sip_retry_after_s    sip_retry_after_t;
 typedef struct sip_route_s                 sip_route_t;
-typedef struct sip_rseq_s           sip_rseq_t;     
+typedef struct sip_rseq_s           sip_rseq_t;
 typedef struct msg_generic_s        sip_server_t;
 typedef struct sip_session_expires_s
                                     sip_session_expires_t;
@@ -256,7 +256,7 @@ struct sip_s {
   sip_rack_t                *sip_rack;          /**< RAck */
 
   /* Caller Preferences */
-  sip_request_disposition_t *sip_request_disposition; 
+  sip_request_disposition_t *sip_request_disposition;
                                                 /**< Request-Disposition (d) */
   sip_accept_contact_t      *sip_accept_contact;/**< Accept-Contact (a) */
   sip_reject_contact_t      *sip_reject_contact;/**< Reject-Contact (j) */
@@ -288,7 +288,7 @@ struct sip_s {
   /* RFC 3265 */
   sip_event_t               *sip_event;                /**< Event (o) */
   sip_allow_events_t        *sip_allow_events;  /**< Allow-Events (u) */
-  sip_subscription_state_t  *sip_subscription_state; 
+  sip_subscription_state_t  *sip_subscription_state;
                                /**< Subscription-State */
 
   sip_proxy_authenticate_t  *sip_proxy_authenticate;
@@ -297,7 +297,7 @@ struct sip_s {
                                /**< Proxy-Authentication-Info */
   sip_proxy_authorization_t *sip_proxy_authorization;
                                /**< Proxy-Authorization */
-  sip_authorization_t       *sip_authorization;       
+  sip_authorization_t       *sip_authorization;
                                /**< Authorization */
   sip_www_authenticate_t    *sip_www_authenticate;
                                /**< WWW-Authenticate */
@@ -333,17 +333,17 @@ struct sip_s {
   /* Entity headers */
   sip_mime_version_t        *sip_mime_version; /**< MIME-Version */
   sip_content_type_t        *sip_content_type; /**< Content-Type (c) */
-  sip_content_encoding_t    *sip_content_encoding; 
+  sip_content_encoding_t    *sip_content_encoding;
                                /**< Content-Encoding (e) */
   sip_content_language_t    *sip_content_language; /**< Content-Language */
-  sip_content_disposition_t *sip_content_disposition; 
+  sip_content_disposition_t *sip_content_disposition;
                                /**< Content-Disposition */
   sip_content_length_t      *sip_content_length;/**< Content-Length (l) */
 
   /* === Headers end here */
 
   sip_unknown_t             *sip_unknown;       /**< Unknown headers */
-  sip_separator_t           *sip_separator;     
+  sip_separator_t           *sip_separator;
                                /**< Separator between headers and payload */
   sip_payload_t             *sip_payload;      /**< Message payload */
   msg_multipart_t           *sip_multipart;     /**< Multipart MIME payload */
@@ -386,7 +386,7 @@ struct sip_addr_s
   url_t              a_url[1];     /**< URL */
   msg_param_t const *a_params;     /**< Parameter table  */
   char const        *a_comment;            /**< Comment */
+
   char const        *a_tag;        /**< Tag parameter */
 };
 
@@ -416,7 +416,7 @@ struct sip_allow_s
   msg_common_t       k_common[1];   /**< Common fragment info */
   msg_list_t        *k_next;       /**< Link to next */
   msg_param_t       *k_items;      /**< List of allowed items */
-  uint32_t           k_bitmap;     /**< Bitmap of allowed methods. 
+  uint32_t           k_bitmap;     /**< Bitmap of allowed methods.
                                       @NEW_1_12_5. */
 };
 
@@ -432,10 +432,10 @@ struct sip_authentication_info_s
   msg_param_t const  *ai_params;    /**< List of authentication info */
 };
 
-/**@ingroup sip_call_id 
+/**@ingroup sip_call_id
  * @brief Structure for @CallID (and @InReplyTo) header fields.
  */
-struct sip_call_id_s {         
+struct sip_call_id_s {
   sip_common_t   i_common[1];      /**< Common fragment info */
   sip_call_id_t *i_next;           /**< Link to next (In-Reply-To) */
   char const    *i_id;             /**< ID value */
@@ -531,7 +531,7 @@ struct sip_error_info_s
 /**@ingroup sip_event
  * @brief Structure for @Event header.
  */
-struct sip_event_s 
+struct sip_event_s
 {
   sip_common_t        o_common[1];  /**< Common fragment info */
   sip_error_t        *o_next;      /**< Link to next (dummy) */
@@ -686,7 +686,7 @@ struct sip_route_s
   msg_param_t const  *r_params;            /**< List of route parameters */
 };
 
-/**@ingroup sip_rseq 
+/**@ingroup sip_rseq
  * @brief Structure for @RSeq header.
  */
 struct sip_rseq_s
@@ -696,7 +696,7 @@ struct sip_rseq_s
   unsigned long       rs_response;     /**< Sequence number of response */
 };
 
-/**@ingroup sip_session_expires 
+/**@ingroup sip_session_expires
  * @brief Structure for @SessionExpires header.
  */
 struct sip_session_expires_s
@@ -709,7 +709,7 @@ struct sip_session_expires_s
                                         * parameter: UAS or UAC */
 };
 
-/**@ingroup sip_min_se 
+/**@ingroup sip_min_se
  * @brief Structure for @MinSE header.
  */
 struct sip_min_se_s
@@ -720,7 +720,7 @@ struct sip_min_se_s
   msg_param_t const  *min_params;      /**< List of extension parameters */
 };
 
-/**@ingroup sip_subscription_state 
+/**@ingroup sip_subscription_state
  * @brief Structure for @SubscriptionState header.
  */
 struct sip_subscription_state_s
@@ -728,7 +728,7 @@ struct sip_subscription_state_s
   sip_common_t        ss_common[1];   /**< Common fragment info */
   sip_error_t        *ss_next;       /**< Dummy link to next */
   /** Subscription state: "pending", "active" or "terminated" */
-  char const         *ss_substate; 
+  char const         *ss_substate;
   msg_param_t const  *ss_params;      /**< List of parameters */
   char const         *ss_reason;      /**< Reason for termination  */
   char const         *ss_expires;     /**< Subscription lifetime */
@@ -738,7 +738,7 @@ struct sip_subscription_state_s
 /**@ingroup sip_timestamp
  * @brief Structure for @Timestamp header.
  */
-struct sip_timestamp_s 
+struct sip_timestamp_s
 {
   sip_common_t        ts_common[1]; /**< Common fragment info */
   sip_error_t        *ts_next;     /**< Dummy link to next */
@@ -773,7 +773,7 @@ struct sip_via_s
 struct sip_security_agree_s
 {
   sip_common_t        sa_common[1]; /**< Common fragment info */
-  struct sip_security_agree_s 
+  struct sip_security_agree_s
                      *sa_next;     /**< Link to next mechanism */
   char const         *sa_mec;      /**< Security mechanism */
   msg_param_t const  *sa_params;    /**< List of mechanism parameters */
@@ -798,7 +798,7 @@ struct sip_privacy_s
  */
 union sip_header_u
 {
-  sip_common_t               sh_common[1]; 
+  sip_common_t               sh_common[1];
   struct
   {
     sip_common_t             shn_common;
@@ -832,7 +832,7 @@ union sip_header_u
   sip_cseq_t                 sh_cseq[1];
   sip_rseq_t                 sh_rseq[1];
   sip_rack_t                 sh_rack[1];
-                             
+
   sip_subject_t              sh_subject[1];
   sip_priority_t             sh_priority[1];
 
@@ -851,7 +851,7 @@ union sip_header_u
   sip_accept_t               sh_accept[1];
   sip_accept_encoding_t      sh_accept_encoding[1];
   sip_accept_language_t      sh_accept_language[1];
-                             
+
   sip_allow_t                sh_allow[1];
   sip_require_t              sh_require[1];
   sip_proxy_require_t        sh_proxy_require[1];
@@ -864,8 +864,8 @@ union sip_header_u
 
   sip_proxy_authenticate_t   sh_proxy_authenticate[1];
   sip_proxy_authentication_info_t sh_proxy_authentication_info[1];
-  sip_proxy_authorization_t  sh_proxy_authorization[1]; 
-                             
+  sip_proxy_authorization_t  sh_proxy_authorization[1];
+
   sip_authorization_t        sh_authorization[1];
   sip_www_authenticate_t     sh_www_authenticate[1];
   sip_authentication_info_t  sh_authentication_info[1];
@@ -882,7 +882,7 @@ union sip_header_u
   sip_request_disposition_t  sh_request_disposition[1];
   sip_accept_contact_t       sh_accept_contact[1];
   sip_reject_contact_t       sh_reject_contact[1];
-   
+
   sip_session_expires_t      sh_session_expires[1];
   sip_min_se_t               sh_min_se[1];
 
@@ -899,7 +899,7 @@ union sip_header_u
 
   sip_etag_t                 sh_etag[1];
   sip_if_match_t             sh_if_match[1];
-    
+
   /* Entity headers */
   sip_mime_version_t         sh_mime_version[1];
   sip_content_type_t         sh_content_type[1];
index ee10ac87003f387361c0015b85b1712ea416f660..e710a73e2655ebba1b2258b6d2896dec47334bee 100644 (file)
@@ -1,11 +1,11 @@
-/** -*- C -*- 
+/** -*- C -*-
  *
  * @file sofia-sip/sip_hclasses.h.in
  *
  * Template for <sip_hclasses.h>.
  */
 \f
-/* 
+/*
  * This file is part of the Sofia-SIP package
  *
  * Copyright (C) 2005 Nokia Corporation.
@@ -35,9 +35,9 @@
 
 /**@file sofia-sip/sip_hclasses.h
  * @brief Declarations of SIP header classes.
- * 
+ *
  * #AUTO#
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Thu Jan 23 19:26:31 2003 ppessi
 SOFIA_BEGIN_DECLS
 \f
 
-enum { 
-  /**@ingroup sip_#xxxxxx# @internal 
+enum {
+  /**@ingroup sip_#xxxxxx# @internal
    *
    * Hash of @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#".
    *
    * @since New in #version#.
    */
-  sip_#xxxxxx#_hash = #hash# 
+  sip_#xxxxxx#_hash = #hash#
 };
 
 /**Header class for @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#".
- * 
+ *
  * The header class sip_#xxxxxx#_class defines how a SIP
  * @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" is parsed and printed.
  * It also contains methods used by SIP parser and other functions to
index d76c67c4ee18017d84a45452b23c9501b2ab6753..c75500d19d91a90bda8da1bf90f16013b09e32ce 100644 (file)
@@ -24,9 +24,9 @@
 
 #ifndef SIP_HEADER_H
 /**Defined when <sofia-sip/sip_header.h> has been included.*/
-#define SIP_HEADER_H 
+#define SIP_HEADER_H
 
-/**@file sofia-sip/sip_header.h 
+/**@file sofia-sip/sip_header.h
  *
  * SIP parser library prototypes.
  *
@@ -96,7 +96,7 @@ SOFIAPUBFUN int sip_add_dup_as(msg_t *msg, sip_t *sip,
                               msg_hclass_t *hc, sip_header_t const *o);
 
 /** Add duplicates of headers to the SIP message. */
-SOFIAPUBFUN int sip_add_headers(msg_t *msg, sip_t *sip, 
+SOFIAPUBFUN int sip_add_headers(msg_t *msg, sip_t *sip,
                                void const *extra, va_list headers);
 
 /** Add duplicates of headers from taglist to the SIP message. */
@@ -127,11 +127,11 @@ SOFIAPUBFUN int sip_complete_message(msg_t *msg);
 
 /* Use __attribute__ to allow argument checking for sip_header_format() */
 #if !defined(__GNUC__) && !defined(__attribute__)
-#define __attribute__(x) 
+#define __attribute__(x)
 #endif
 
 /** Make a SIP header with formatting provided. */
-SOFIAPUBFUN sip_header_t *sip_header_format(su_home_t *home, 
+SOFIAPUBFUN sip_header_t *sip_header_format(su_home_t *home,
                                            msg_hclass_t *hc,
                                            char const *fmt,
                                            ...)
@@ -154,15 +154,15 @@ SOFIAPUBVAR char const sip_method_name_subscribe[];
 SOFIAPUBVAR char const sip_method_name_notify[];
 SOFIAPUBVAR char const sip_method_name_refer[];
 
-/** @internal UDP transport version string. */ 
+/** @internal UDP transport version string. */
 SOFIAPUBVAR char const sip_transport_udp[];
-/** @internal TCP transport version string. */ 
+/** @internal TCP transport version string. */
 SOFIAPUBVAR char const sip_transport_tcp[];
-/** @internal SCTP transport version string. */ 
+/** @internal SCTP transport version string. */
 SOFIAPUBVAR char const sip_transport_sctp[];
-/** @internal TLS transport version string. */ 
+/** @internal TLS transport version string. */
 SOFIAPUBVAR char const sip_transport_tls[];
-/** @internal SIP version string. */ 
+/** @internal SIP version string. */
 SOFIAPUBVAR char const sip_version_2_0[];
 
 #define SIP_VERSION_CURRENT sip_version_2_0
@@ -217,12 +217,12 @@ SOFIAPUBFUN sip_call_id_t *sip_call_id_create(su_home_t *home,
                                              char const *domain);
 
 /** Create a @CSeq header object.  */
-SOFIAPUBFUN sip_cseq_t *sip_cseq_create(su_home_t *, uint32_t seq, 
+SOFIAPUBFUN sip_cseq_t *sip_cseq_create(su_home_t *, uint32_t seq,
                                        unsigned method, char const *name);
 
 /** Create a @Contact header object. */
-SOFIAPUBFUN sip_contact_t * sip_contact_create(su_home_t *, 
-                                              url_string_t const *url, 
+SOFIAPUBFUN sip_contact_t * sip_contact_create(su_home_t *,
+                                              url_string_t const *url,
                                               char const *param,
                                               /* char const *params, */
                                               ...);
@@ -245,7 +245,7 @@ SOFIAPUBFUN sip_date_t *sip_date_create(su_home_t *, sip_time_t t);
 SOFIAPUBFUN sip_expires_t *sip_expires_create(su_home_t *, sip_time_t delta);
 
 /** Create a @Route header object. */
-SOFIAPUBFUN sip_route_t *sip_route_create(su_home_t *home, url_t const *url, 
+SOFIAPUBFUN sip_route_t *sip_route_create(su_home_t *home, url_t const *url,
                                          url_t const *maddr);
 
 /** Create a @RecordRoute header object. */
@@ -263,10 +263,10 @@ SOFIAPUBFUN sip_to_t *sip_to_create(su_home_t *, url_string_t const *url);
 
 SOFIAPUBFUN int sip_to_tag(su_home_t *, sip_to_t *to, char const *tag);
 
-/** Create a @Via object. */ 
+/** Create a @Via object. */
 SOFIAPUBFUN sip_via_t *sip_via_create(su_home_t *h,
                                      char const *host,
-                                     char const *port, 
+                                     char const *port,
                                      char const *transport,
                                      /* char const *params */
                                      ...);
@@ -277,7 +277,7 @@ su_inline char const *sip_via_transport(sip_via_t const *v)
 {
   char const *tp = v->v_protocol;
   if (tp) {
-    tp = strchr(tp, '/'); 
+    tp = strchr(tp, '/');
     if (tp) {
       tp = strchr(tp + 1, '/');
       if (tp)
@@ -297,12 +297,12 @@ sip_payload_t *sip_payload_create(su_home_t *, void const *data, isize_t len);
 
 /**@ingroup sip_payload
  *
- * Initialize a SIP payload structure with pointer to data and its length. 
+ * Initialize a SIP payload structure with pointer to data and its length.
  *
  * The SIP_PAYLOAD_INIT2() macro initializes a #sip_payload_t header
  * structure with a pointer to data and its length in octets. For
  * instance,
- * @code 
+ * @code
  *  sip_payload_t txt_payload = SIP_PAYLOAD_INIT2(txt, strlen(txt));
  * @endcode
  *
@@ -310,7 +310,7 @@ sip_payload_t *sip_payload_create(su_home_t *, void const *data, isize_t len);
  * from heap is not required, for instance, when the resulting payload
  * structure is immediately copied.
  *
- * @HIDE 
+ * @HIDE
  */
 #define SIP_PAYLOAD_INIT2(data, length) \
   {{{ 0, 0, sip_payload_class, data, length }, NULL, data, length }}
@@ -321,7 +321,7 @@ SOFIAPUBFUN sip_separator_t *sip_separator_create(su_home_t *home);
 /** Check that a required feature is supported. */
 SOFIAPUBFUN
 sip_unsupported_t *sip_has_unsupported(su_home_t *,
-                                      sip_supported_t const *support, 
+                                      sip_supported_t const *support,
                                       sip_require_t const *require);
 
 SOFIAPUBFUN
@@ -349,7 +349,7 @@ SOFIAPUBFUN
 int sip_has_feature(msg_list_t const *supported, char const *feature);
 
 /** Return true if the method is listed in @Allow header. */
-SOFIAPUBFUN int sip_is_allowed(sip_allow_t const *allow, 
+SOFIAPUBFUN int sip_is_allowed(sip_allow_t const *allow,
                               sip_method_t method, char const *name);
 
 /** Check if the well-known method is listed in @Allow header. @NEW_1_12_6. */
@@ -404,7 +404,7 @@ enum sip_bad_mask {
    *
    * @MinExpires, @Authorization, @Path, @Supported, @Contact, @Require, and
    * @Expires.
-   * 
+   *
    */
   sip_mask_registrar = (1 << 4),
 
@@ -419,7 +419,7 @@ enum sip_bad_mask {
   /** Bit marking essential headers for SIP events.
    *
    * @Event, @Expires, and @SubscriptionState.
-   * 
+   *
    * @sa @RFC3265.
    */
   sip_mask_events = (1 << 6),
@@ -427,7 +427,7 @@ enum sip_bad_mask {
   /** Bit marking essential headers for session timer extension.
    *
    * @SessionExpires, and @MinSE.
-   * 
+   *
    * @RFC4028
    */
   sip_mask_timer = (1 << 7),
@@ -435,7 +435,7 @@ enum sip_bad_mask {
   /** Bit marking essential headers for privacy extension.
    *
    * @Privacy.
-   * 
+   *
    * @sa @RFC3323
    */
   sip_mask_privacy = (1 << 8),
@@ -443,7 +443,7 @@ enum sip_bad_mask {
   /** Bit marking essential headers for caller preference extension.
    *
    * @RequestDisposition, @AcceptContact, and @RejectContact.
-   * 
+   *
    * @sa @RFC3841.
    */
   sip_mask_pref = (1 << 9),
@@ -451,13 +451,13 @@ enum sip_bad_mask {
   /** Bit marking essential headers for PUBLISH servers and clients.
    *
    * @SIPETag, and @SIPIfMatch.
-   * 
+   *
    * @sa @RFC3903.
    */
   sip_mask_publish = (1 << 10)
 
   /* NOTE:
-   * When adding bits, please update nta_agent_create() and 
+   * When adding bits, please update nta_agent_create() and
    * NTATAG_BAD_RESP_MASK()/NTATAG_BAD_REQ_MASK() documentation.
    */
 };
@@ -482,15 +482,15 @@ SOFIAPUBFUN issize_t sip_header_field_d(su_home_t *, sip_header_t *, char *, isi
 /** Calculate the size of a SIP header and associated memory areas. */
 SOFIAPUBFUN isize_t sip_header_size(sip_header_t const *h);
 
-/** Duplicate (deep copy) a SIP header or whole list. */ 
+/** Duplicate (deep copy) a SIP header or whole list. */
 SOFIAPUBFUN sip_header_t *sip_header_dup(su_home_t *, sip_header_t const *);
 
 /** Copy a SIP header or whole list. */
 SOFIAPUBFUN sip_header_t *sip_header_copy(su_home_t *, sip_header_t const *o);
 
 /** Add an event to @AllowEvents header. */
-SOFIAPUBFUN int sip_allow_events_add(su_home_t *, 
-                                    sip_allow_events_t *ae, 
+SOFIAPUBFUN int sip_allow_events_add(su_home_t *,
+                                    sip_allow_events_t *ae,
                                     char const *e);
 
 /** Add a parameter to a @Contact header object. */
@@ -501,7 +501,7 @@ SOFIAPUBFUN int sip_to_add_param(su_home_t *, sip_to_t *, char const *);
 
 SOFIAPUBFUN int sip_from_add_param(su_home_t *, sip_from_t *, char const *);
 
-/** Add a parameter to a @Via header object. */ 
+/** Add a parameter to a @Via header object. */
 SOFIAPUBFUN int sip_via_add_param(su_home_t *, sip_via_t *, char const *);
 
 #define sip_from_make_url     sip_from_create
@@ -510,4 +510,4 @@ SOFIAPUBFUN int sip_via_add_param(su_home_t *, sip_via_t *, char const *);
 
 SOFIA_END_DECLS
 
-#endif 
+#endif
index 133ba481eeffef64dafdd82ef046f81199d5331a..1c6a6cd33e6b4fa803447eb7fbe2c36d31116fd8 100644 (file)
 
 #ifndef SIP_PARSER_H
 /** Defined when <sofia-sip/sip_parser.h> has been included.*/
-#define SIP_PARSER_H 
+#define SIP_PARSER_H
 
 
-/**@ingroup sip_parser 
+/**@ingroup sip_parser
  * @file sofia-sip/sip_parser.h
  *
  * SIP parser provider interface.
@@ -130,11 +130,11 @@ SOFIAPUBFUN issize_t sip_name_addr_d(su_home_t *home,
                                     msg_param_t const **return_params,
                                     char const **return_comment);
 
-SOFIAPUBFUN issize_t sip_name_addr_e(char b[], isize_t bsiz, 
-                                    int flags, 
-                                    char const *display, 
+SOFIAPUBFUN issize_t sip_name_addr_e(char b[], isize_t bsiz,
+                                    int flags,
+                                    char const *display,
                                     int always_ltgt, url_t const url[],
-                                    msg_param_t const params[], 
+                                    msg_param_t const params[],
                                     char const *comment);
 
 SOFIAPUBFUN isize_t sip_name_addr_xtra(char const *display, url_t const *addr,
@@ -143,7 +143,7 @@ SOFIAPUBFUN isize_t sip_name_addr_xtra(char const *display, url_t const *addr,
 
 SOFIAPUBFUN char *sip_name_addr_dup(char const **d_display, char const *display,
                                    url_t *d_addr, url_t const *addr,
-                                   msg_param_t const **d_params, 
+                                   msg_param_t const **d_params,
                                    msg_param_t const params[],
                                    char *b, isize_t xtra);
 
@@ -167,7 +167,7 @@ SOFIAPUBFUN char *sip_name_addr_dup(char const **d_display, char const *display,
 #define sip_generic_dup_one    msg_generic_dup_one
 
 
-#define        sip_auth_d              msg_auth_d         
+#define        sip_auth_d              msg_auth_d
 #define        sip_auth_e              msg_auth_e
 
 #define sip_header_dup_as      msg_header_dup_as
@@ -205,12 +205,12 @@ SOFIAPUBFUN char *sip_name_addr_dup(char const **d_display, char const *display,
 
 SOFIAPUBFUN int sip_generic_xtra(sip_generic_t const *g);
 
-SOFIAPUBFUN sip_generic_t *sip_generic_dup(su_home_t *home, 
-                                          msg_hclass_t *hc, 
+SOFIAPUBFUN sip_generic_t *sip_generic_dup(su_home_t *home,
+                                          msg_hclass_t *hc,
                                           sip_generic_t const *u);
 
 SOFIAPUBFUN sip_generic_t *sip_generic_copy(su_home_t *home,
-                                           msg_hclass_t *hc, 
+                                           msg_hclass_t *hc,
                                            sip_generic_t const *o);
 
 SOFIA_END_DECLS
index 41ebd6f412ce8604d61400824785141bab6cab58..5734ffc3a0dee0d9e56e9a3ef32933f11e58dde3 100644 (file)
 
 #ifndef SIP_PROTOS_H
 /** Defined when <sofia-sip/sip_protos.h> has been included. */
-#define SIP_PROTOS_H 
-  
+#define SIP_PROTOS_H
+
 /**@file sofia-sip/sip_protos.h
- * 
+ *
  * SIP prototypes and macros for each header.
- * 
+ *
  * #AUTO#
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  *
  */
@@ -86,7 +86,7 @@ int sip_header_insert(msg_t *msg, sip_t *sip, sip_header_t *h)
   return msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)h);
 }
 
-/** Remove a header from a SIP message. */ 
+/** Remove a header from a SIP message. */
 su_inline
 int sip_header_remove(msg_t *msg, sip_t *sip, sip_header_t *h)
 {
@@ -131,22 +131,22 @@ SOFIAPUBFUN issize_t sip_#xxxxxx#_e(char b[], isize_t bsiz,
 
 /**Access a SIP @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#"
  * structure #sip_#xxxxxx#_t from #sip_t.
- * 
+ *
  * @since New in #version#.
  */
 #define sip_#xxxxxx#(sip) \
   ((sip_#xxxxxx#_t *)msg_header_access((msg_pub_t*)(sip), sip_#xxxxxx#_class))
 
 /**Initializer for structure #sip_#xxxxxx#_t.
- * 
+ *
  * A static #sip_#xxxxxx#_t structure for
  * @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" must be initialized with
- * the SIP_#XXXXXX#_INIT() macro. 
+ * the SIP_#XXXXXX#_INIT() macro.
  * For instance,
- * @code 
- * 
+ * @code
+ *
  *  sip_#xxxxxx#_t sip_#xxxxxx# = SIP_#XXXXXX#_INIT;
- * 
+ *
  * @endcode
  * @HI
  *
@@ -155,16 +155,16 @@ SOFIAPUBFUN issize_t sip_#xxxxxx#_e(char b[], isize_t bsiz,
 #define SIP_#XXXXXX#_INIT() SIP_HDR_INIT(#xxxxxx#)
 
 /**Initialize a structure #sip_#xxxxxx#_t.
- * 
+ *
  * An #sip_#xxxxxx#_t structure for
  * @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" can be initialized with the
  * sip_#xxxxxx#_init() function/macro. For instance,
  * @code
- * 
+ *
  *  sip_#xxxxxx#_t sip_#xxxxxx#;
- * 
+ *
  *  sip_#xxxxxx#_init(&sip_#xxxxxx#);
- * 
+ *
  * @endcode
  * @HI
  *
@@ -181,14 +181,14 @@ su_inline sip_#xxxxxx#_t *sip_#xxxxxx#_init(sip_#xxxxxx#_t x[1])
 #endif
 
 /**Test if header object is instance of #sip_#xxxxxx#_t.
- * 
+ *
  * Check if the header class is an instance of
  * @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" object and return true (nonzero),
  * otherwise return false (zero).
- * 
+ *
  * @param header pointer to the header structure to be tested
- * 
- * @retval 1 (true) if the @a header is an instance of header #xxxxxx# 
+ *
+ * @retval 1 (true) if the @a header is an instance of header #xxxxxx#
  * @retval 0 (false) otherwise
  *
  * @since New in #version#.
@@ -206,27 +206,27 @@ int sip_is_#xxxxxx#(sip_header_t const *header);
 
 
 /**Duplicate a list of @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" header structures #sip_#xxxxxx#_t.
- * 
+ *
  * Duplicate a header
  * structure @a hdr.  If the header structure @a hdr
  * contains a reference (@c hdr->x_next) to a list of
  * headers, all the headers in the list are duplicated, too.
- * 
+ *
  * @param home  memory home used to allocate new structure
  * @param hdr   header structure to be duplicated
- * 
+ *
  * When duplicating, all parameter lists and non-constant
  * strings attached to the header are copied, too.  The
  * function uses given memory @a home to allocate all the
  * memory areas used to copy the header.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = sip_#xxxxxx#_dup(home, sip->sip_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * A pointer to the
  * newly duplicated #sip_#xxxxxx#_t header structure, or NULL
@@ -237,42 +237,42 @@ int sip_is_#xxxxxx#(sip_header_t const *header);
 #if SU_HAVE_INLINE
 su_inline
 #endif
-sip_#xxxxxx#_t *sip_#xxxxxx#_dup(su_home_t *home, sip_#xxxxxx#_t const *hdr) 
+sip_#xxxxxx#_t *sip_#xxxxxx#_dup(su_home_t *home, sip_#xxxxxx#_t const *hdr)
      __attribute__((__malloc__));
 
 #if SU_HAVE_INLINE
 su_inline
 sip_#xxxxxx#_t *sip_#xxxxxx#_dup(su_home_t *home, sip_#xxxxxx#_t const *hdr)
-{ 
+{
   return (sip_#xxxxxx#_t *)
     msg_header_dup_as(home, sip_#xxxxxx#_class, (msg_header_t const *)hdr);
 }
 #endif
 
 /**Copy a list of @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" header structures #sip_#xxxxxx#_t.
- * 
+ *
  * The function sip_#xxxxxx#_copy() copies a header structure @a
  * hdr.  If the header structure @a hdr contains a reference (@c
  * hdr->h_next) to a list of headers, all the headers in that
  * list are copied, too. The function uses given memory @a home
  * to allocate all the memory areas used to copy the list of header
  * structure @a hdr.
- * 
+ *
  * @param home    memory home used to allocate new structure
  * @param hdr     pointer to the header structure to be copied
- * 
+ *
  * When copying, only the header structure and parameter lists attached to
  * it are duplicated. The new header structure retains all the references to
  * the strings within the old @a hdr header, including the encoding of the
  * old header, if present.
- * 
+ *
  * @par Example
  * @code
- * 
+ *
  *   #xxxxxx# = sip_#xxxxxx#_copy(home, sip->sip_#xxxxxx#);
- * 
+ *
  * @endcode
- * 
+ *
  * @return
  * A pointer to newly copied header structure, or NULL upon an error.
  *
@@ -281,28 +281,28 @@ sip_#xxxxxx#_t *sip_#xxxxxx#_dup(su_home_t *home, sip_#xxxxxx#_t const *hdr)
 #if SU_HAVE_INLINE
 su_inline
 #endif
-sip_#xxxxxx#_t *sip_#xxxxxx#_copy(su_home_t *home, sip_#xxxxxx#_t const *hdr) 
+sip_#xxxxxx#_t *sip_#xxxxxx#_copy(su_home_t *home, sip_#xxxxxx#_t const *hdr)
      __attribute__((__malloc__));
 
 #if SU_HAVE_INLINE
 su_inline
-sip_#xxxxxx#_t *sip_#xxxxxx#_copy(su_home_t *home, sip_#xxxxxx#_t const *hdr) 
-{ 
+sip_#xxxxxx#_t *sip_#xxxxxx#_copy(su_home_t *home, sip_#xxxxxx#_t const *hdr)
+{
   return (sip_#xxxxxx#_t *)
-    msg_header_copy_as(home, sip_#xxxxxx#_class, (msg_header_t const *)hdr); 
+    msg_header_copy_as(home, sip_#xxxxxx#_class, (msg_header_t const *)hdr);
 }
 #endif
 
 /**Make a @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" structure #sip_#xxxxxx#_t.
- * 
+ *
  * The function sip_#xxxxxx#_make() makes a new
  * #sip_#xxxxxx#_t header structure.  It allocates a new
  * header structure, and decodes the string @a s as the
  * value of the structure.
- * 
+ *
  * @param home memory home used to allocate new header structure.
  * @param s    string to be decoded as value of the new header structure
- * 
+ *
  * @return
  * A pointer to newly maked #sip_#xxxxxx#_t header structure, or NULL upon an
  * error.
@@ -310,7 +310,7 @@ sip_#xxxxxx#_t *sip_#xxxxxx#_copy(su_home_t *home, sip_#xxxxxx#_t const *hdr)
  * @since New in #version#.
  */
 #if SU_HAVE_INLINE
-su_inline 
+su_inline
 #endif
 sip_#xxxxxx#_t *sip_#xxxxxx#_make(su_home_t *home, char const *s)
      __attribute__((__malloc__));
@@ -323,20 +323,20 @@ su_inline sip_#xxxxxx#_t *sip_#xxxxxx#_make(su_home_t *home, char const *s)
 #endif
 
 /**Make a @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" from formatting result.
- * 
- * Make a new #sip_#xxxxxx#_t object using formatting result as its value. 
+ *
+ * Make a new #sip_#xxxxxx#_t object using formatting result as its value.
  * The function first prints the arguments according to the format @a fmt
  * specified. Then it allocates a new header structure, and parses the
  * formatting result to the structure #sip_#xxxxxx#_t.
- * 
+ *
  * @param home   memory home used to allocate new header structure.
  * @param fmt    string used as a printf()-style format
  * @param ...    argument list for format
- * 
+ *
  * @return
  * A pointer to newly
  * makes header structure, or NULL upon an error.
- * 
+ *
  * @HIDE
  *
  * @since New in #version#.
@@ -352,11 +352,11 @@ su_inline sip_#xxxxxx#_t *sip_#xxxxxx#_format(su_home_t *home, char const *fmt,
 {
   sip_header_t *h;
   va_list ap;
-  
+
   va_start(ap, fmt);
   h = sip_header_vformat(home, sip_#xxxxxx#_class, fmt, ap);
   va_end(ap);
+
   return (sip_#xxxxxx#_t *)h;
 }
 #endif
index 1ba2e6660e1ae33d488079e6f07822a96748ca3f..c5a738927f0d7e09042419f22e16e6f0f201629e 100644 (file)
 
 #ifndef SIP_STATUS_H
 /** Defined when <sofia-sip/sip_status.h> has been included. */
-#define SIP_STATUS_H 
+#define SIP_STATUS_H
 
 /**@addtogroup sip_status_codes
- * @{ 
+ * @{
  */
 /**@file sofia-sip/sip_status.h
  *
index d2d708a4562435d2824804e40273211b2b27d785..55abfbe87a65549e835608e1caa380c0cfd6c3fc 100644 (file)
@@ -107,7 +107,7 @@ SOFIAPUBVAR tag_typedef_t siptag_sip_ref;
 #if SU_INLINE_TAG_CAST
 su_inline
 tag_value_t siptag_sip_v(sip_t const *v) { return (tag_value_t)v; }
-su_inline 
+su_inline
 tag_value_t siptag_sip_vr(sip_t const **vp) { return (tag_value_t)vp; }
 #else
 #define siptag_sip_v(v)   (tag_value_t)(v)
@@ -117,8 +117,8 @@ tag_value_t siptag_sip_vr(sip_t const **vp) { return (tag_value_t)vp; }
 /**Tag list item for header string.
  *
  * The SIPTAG_HEADER() macro is used to include a tag item containing an
- * unknown SIP header in the tag list, e.g., 
- * @code 
+ * unknown SIP header in the tag list, e.g.,
+ * @code
  * sip_header_t *hdr;
  *
  * SIPTAG_HEADER(hdr).
@@ -190,7 +190,7 @@ SOFIAPUBVAR tag_typedef_t siptag_header_str_ref;
  *
  * @param x pointer to a #sip_#xxxxxx#_t structure, or NULL.
  *
- * The corresponding tag taking reference parameter is 
+ * The corresponding tag taking reference parameter is
  * SIPTAG_#XXXXXX#_REF().
  *
  * @since New in #version#.
@@ -202,7 +202,7 @@ SOFIAPUBVAR tag_typedef_t siptag_header_str_ref;
 SOFIAPUBVAR tag_typedef_t siptag_#xxxxxx#;
 
 /**@ingroup sip_#xxxxxx#
- * Tag list item for reference to a 
+ * Tag list item for reference to a
  * @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" pointer.
  */
 #define SIPTAG_#XXXXXX#_REF(x) siptag_#xxxxxx#_ref, siptag_#xxxxxx#_vr(&(x))
@@ -212,17 +212,17 @@ SOFIAPUBVAR tag_typedef_t siptag_#xxxxxx#_ref;
  *
  * Tag list item for string with @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" value.
  *
- * The SIPTAG_#XXXXXX#_STR() macro is used to include a tag item with a 
+ * The SIPTAG_#XXXXXX#_STR() macro is used to include a tag item with a
  * string containing value of a #sip_#xxxxxx#_t header in a tag list.
  *
- * @param s pointer to a string containing 
+ * @param s pointer to a string containing
  *    @ref sip_#xxxxxx# "#xxxxxxx_xxxxxxx#" value, or NULL.
  *
  * The string in SIPTAG_#XXXXXX#_STR() can be converted to a
  * #sip_#xxxxxx#_t header structure by giving the string @a s has
  * second argument to function sip_#xxxxxx#_make().
  *
- * The corresponding tag taking reference parameter is 
+ * The corresponding tag taking reference parameter is
  * SIPTAG_#XXXXXX#_STR_REF().
  *
  * @since New in #version#.
index 774eb7652a4c593b115d9c0a7ae088bf3a20b96f..32df99a5f6c6d2148694198ae33d961bd8686977 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef SIP_TAG_CLASS_H
 /** Defined when <sip_tag_class.h> have been included */
-#define SIP_TAG_CLASS_H 
+#define SIP_TAG_CLASS_H
 
 
 /**@SIP_TAG @{ */
@@ -81,9 +81,9 @@ SOFIAPUBVAR tag_class_t sipmsgtag_class[1];
 SOFIAPUBVAR tag_class_t sipexthdrtag_class[1];
 
 
-/**@internal Filter SIP header tag items. */ 
+/**@internal Filter SIP header tag items. */
 SOFIAPUBFUN tagi_t *siptag_filter(tagi_t *dst, tagi_t const f[],
-                                 tagi_t const *src, 
+                                 tagi_t const *src,
                                  void **bb);
 
 SOFIA_END_DECLS
index 68942be3b4c81e83387d27a16ff777d0a2a1bc1c..cbd12a3b4f5304892d171fd79ed25361b28eace3 100644 (file)
@@ -24,9 +24,9 @@
 
 #ifndef SIP_UTIL_H
 /** Defined when <sofia-sip/sip_util.h> has been included. */
-#define SIP_UTIL_H 
+#define SIP_UTIL_H
 
-/**@file sofia-sip/sip_util.h 
+/**@file sofia-sip/sip_util.h
  * @brief SIP utility functions
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
@@ -50,7 +50,7 @@ SOFIA_BEGIN_DECLS
 
 SOFIAPUBFUN
 sip_contact_t *
-sip_contact_create_from_via_with_transport(su_home_t *home, 
+sip_contact_create_from_via_with_transport(su_home_t *home,
                                           sip_via_t const *v,
                                           char const *user,
                                           char const *transport);
@@ -78,7 +78,7 @@ SOFIAPUBFUN unsigned sip_q_value(char const * q);
 
 SOFIAPUBFUN url_t *sip_url_dup(su_home_t *sh, url_t const *o);
 
-/**Add optional prefix and string to argument list if @a s is non-NULL. 
+/**Add optional prefix and string to argument list if @a s is non-NULL.
  * @HIDE
  */
 #define SIP_STRLOG(prefix, s) ((s) ? (prefix) : ""), ((s) ? (s) : "")
@@ -111,13 +111,13 @@ SOFIAPUBFUN sip_via_t *sip_via_remove(msg_t *msg, sip_t *sip);
 
 /** Check callerprefs. */
 SOFIAPUBFUN int sip_prefs_matching(char const *pvalue,
-                                  char const *nvalue,                 
+                                  char const *nvalue,
                                   int *return_parse_error);
 SOFIAPUBFUN int sip_is_callerpref(char const *param);
 
 /** Type of the SIP media tag */
-enum sp_type { 
-  sp_error = -1, 
+enum sp_type {
+  sp_error = -1,
   sp_init,
   sp_literal,
   sp_string,
@@ -133,7 +133,7 @@ union sip_pref
 
   /** Literal (tag="foo"). */
   struct sp_literal {
-    enum sp_type spl_type; 
+    enum sp_type spl_type;
     char const *spl_value;
     usize_t spl_length;
   } sp_literal;
@@ -155,8 +155,8 @@ union sip_pref
 };
 
 /** Parse a single preference */
-SOFIAPUBFUN int sip_prefs_parse(union sip_pref *sp, 
-                               char const **in_out_s, 
+SOFIAPUBFUN int sip_prefs_parse(union sip_pref *sp,
+                               char const **in_out_s,
                                int *return_negation);
 
 /** Match preferences */
@@ -170,13 +170,13 @@ SOFIAPUBFUN int sip_contact_is_immune(sip_contact_t const *m);
  */
 #define sip_contact_immune(m) sip_contact_is_immune(m)
 
-SOFIAPUBFUN sip_contact_t *sip_contact_immunize(su_home_t *home, 
+SOFIAPUBFUN sip_contact_t *sip_contact_immunize(su_home_t *home,
                                                sip_contact_t const *m);
 
-SOFIAPUBFUN int sip_contact_reject(sip_contact_t const *m, 
+SOFIAPUBFUN int sip_contact_reject(sip_contact_t const *m,
                                   sip_reject_contact_t const *rc);
 
-SOFIAPUBFUN int sip_contact_accept(sip_contact_t const *m, 
+SOFIAPUBFUN int sip_contact_accept(sip_contact_t const *m,
                                   sip_accept_contact_t const *cp,
                                   unsigned *return_S,
                                   unsigned *return_N,
@@ -195,7 +195,7 @@ SOFIAPUBFUN int sip_security_verify_compare(sip_security_server_t const *s,
                                            sip_security_verify_t const *v,
                                            char const **return_d_ver);
 
-SOFIAPUBFUN 
+SOFIAPUBFUN
 sip_security_client_t const *
 sip_security_client_select(sip_security_client_t const *client,
                           sip_security_server_t const *server);
index 84613a30bbfb426b9c77e92d814edc6903fb540c..6428d98262555b318c779f5abef89ee140764ce3 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@internal
  *
- * @CFILE test_date.c  
+ * @CFILE test_date.c
  *
  * Tester for SIP date parser
  *
@@ -46,7 +46,7 @@
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
+  fprintf(stderr,
          "usage: test_date [SIP-date] "
          "[YYYYy][DDd][HHh][MMm][SS[s]]\n");
   exit(exitcode);
@@ -70,7 +70,7 @@ int main(int ac, char *av[])
       fprintf(stderr, "test_date: %s is not valid time\n", s);
       exit(1);
     }
-      
+
     if ((s = av[2])) {
       for (delta = 0; *s; ) {
        t2 = 0;
@@ -96,7 +96,7 @@ int main(int ac, char *av[])
     char buf[80];
 
     msg_date_e(buf, sizeof(buf), t);
-    
+
     if (verbatim)
       printf("%08lx is %s\n", t, buf);
 
index 3a973afc62dbc4479b45703772ced90df63b67b0..2dd9168677be35c20a1a17d560314f821b0e7f5e 100644 (file)
@@ -75,7 +75,7 @@ int test_msg_class(msg_mclass_t const *mc)
   for (i = 0; i < N; i++) {
     /* Verify each header entry */
     msg_hclass_t *hc = mc->mc_hash[i].hr_class;
-    
+
     if (hc == NULL)
       continue;
 
@@ -94,7 +94,7 @@ int test_msg_class(msg_mclass_t const *mc)
 char * url_print(url_t *url, char buf[1024])
 {
   url_e(buf, 1024, url);
-  
+
   return buf;
 }
 
@@ -118,11 +118,11 @@ void print_contact(FILE *f, sip_contact_t *m)
     }
     fputs(buf, f);
     if (quoted_url) fputs(">", f);
-    
+
     if (m->m_params)
       for (p = m->m_params; *p; p++)
        fprintf(f, " ;%s", *p);
-    
+
     if (m->m_comment)
       fprintf(f, " (%s)", m->m_comment);
   }
@@ -140,7 +140,7 @@ void print_via(FILE *f, sip_via_t *v)
 
     fprintf(f, "%s %s", v->v_protocol, v->v_host);
     if (v->v_port)
-      fprintf(f, ":%s", v->v_port);      
+      fprintf(f, ":%s", v->v_port);
 
     if (v->v_params)
       for (p = v->v_params; *p; p++)
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
   size_t n;
   int m, tcp;
   sip_t *sip;
-  int exitcode = 0; 
+  int exitcode = 0;
   msg_mclass_t const *sip_mclass = sip_default_mclass();
   msg_t *msg = msg_create(sip_mclass, MSG_FLG_EXTRACT_COPY);
   msg_iovec_t iovec[1];
@@ -248,13 +248,13 @@ int main(int argc, char *argv[])
            sip->sip_status->st_version,
            sip->sip_status->st_status,
            sip->sip_status->st_phrase);
-  
+
   if (sip->sip_cseq)
     fprintf(stdout, "\tCSeq: %u %s (%d)\n",
            sip->sip_cseq->cs_seq,
            sip->sip_cseq->cs_method_name,
            sip->sip_cseq->cs_method);
-  
+
   if (sip->sip_call_id)
     fprintf(stdout, "\tCall-ID: %s (%x)\n",
            sip->sip_call_id->i_id,
@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
     fprintf(stdout, "\tFrom: %s@%s%s%s\n",
            sip->sip_from->a_user ? sip->sip_from->a_user : "[nobody]",
            sip->sip_from->a_host ? sip->sip_from->a_host : "[nowhere]",
-           sip->sip_from->a_tag ? " ;tag=" : "",       
+           sip->sip_from->a_tag ? " ;tag=" : "",
            sip->sip_from->a_tag ? sip->sip_from->a_tag : "");
 
   if (sip->sip_to)
index a3b2b8e6d93d3dc9d7950934a58e3993d7e9eeb6..c469540f6b638d03d1746e08051b613c9525df28 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@ingroup sip_test @internal
  *
- * @CFILE torture_sip.c  
+ * @CFILE torture_sip.c
  *
  * Unit-testing functions for SIP.
  *
@@ -111,7 +111,7 @@ static int test_identity(void)
 
   TEST_1(test_mclass = msg_mclass_clone(def0, 0, 0));
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "BYE sip:foo@bar SIP/2.0\r\n"
     "To: <sip:foo@bar>;tag=deadbeef\r\n"
     "From: <sip:bar@foo>;\r\n"
@@ -136,12 +136,12 @@ static int test_identity(void)
 
   msg_destroy(msg);
 
-  TEST_1(msg_mclass_insert_header(test_mclass, 
+  TEST_1(msg_mclass_insert_header(test_mclass,
                                  sip_p_asserted_identity_class, 0) > 0);
-  TEST_1(msg_mclass_insert_header(test_mclass, 
+  TEST_1(msg_mclass_insert_header(test_mclass,
                                  sip_p_preferred_identity_class, 0) > 0);
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "BYE sip:foo@bar SIP/2.0\r\n"
     "To: <sip:foo@bar>;tag=deadbeef\r\n"
     "From: <sip:bar@foo>;\r\n"
@@ -165,7 +165,7 @@ static int test_identity(void)
   TEST_1(!sip_remote_party_id(sip));
 
   TEST_1(home = msg_home(msg));
-  
+
   TEST_1((paid = sip_p_asserted_identity_make(home, "sip:joe@example.com")));
   TEST_1((paid = sip_p_asserted_identity_make
          (home, "Jaska <sip:joe@example.com>, Helmi <tel:+3587808000>")));
@@ -179,7 +179,7 @@ static int test_identity(void)
   /* Now with extensions */
   TEST_1(test_mclass = msg_mclass_clone(def1, 0, 0));
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "BYE sip:foo@bar SIP/2.0\r\n"
     "To: <sip:foo@bar>;tag=deadbeef\r\n"
     "From: <sip:bar@foo>;\r\n"
@@ -211,10 +211,10 @@ static int test_identity(void)
     su_home_t *home = su_home_clone(NULL, sizeof *home);
 
     char *s;
-    char const canonic[] = 
+    char const canonic[] =
       "\"Jaska Jokunen\" <sip:jaska.jokunen@example.com>;"
       "screen=yes;party=called;id-type=user;privacy=\"name,uri-network\"";
-    char const canonic2[] = 
+    char const canonic2[] =
       "Jaska Jokunen <sip:jaska.jokunen@example.com>;"
       "screen=yes;party=called;id-type=user;privacy=\"name,uri-network\"";
 
@@ -242,7 +242,7 @@ static int test_identity(void)
     TEST_S(d->rpid_display, rpid->rpid_display);
 
     su_home_check(home);
-    
+
     su_home_zap(home);
   }
 
@@ -313,7 +313,7 @@ int test_url_headers(void)
   TEST_P(t[0].t_tag, siptag_from);    TEST_1(f = (void *)t[0].t_value);
   TEST_P(t[1].t_tag, siptag_accept);  TEST_1(ac = (void *)t[1].t_value);
   TEST_P(t[2].t_tag, siptag_payload); TEST_1(body = (void *)t[2].t_value);
-  TEST_P(t[3].t_tag, siptag_accept); 
+  TEST_P(t[3].t_tag, siptag_accept);
 
   s = "xyzzy=foo";
 
@@ -339,7 +339,7 @@ int test_manipulation(void)
   msg_t *msg, *msg0;
   sip_t *sip;
 
-  msg0 = read_message(MSG_DO_EXTRACT_COPY, 
+  msg0 = read_message(MSG_DO_EXTRACT_COPY,
     "MESSAGE sip:foo@bar SIP/2.0\r\n"
     "To: Joe User <sip:foo@bar>\r\n"
     "From: \"Bar Owner\" <sip:bar@foo>;tag=foobar\r\n"
@@ -357,11 +357,11 @@ int test_manipulation(void)
   TEST_1(l = sip_content_length_make(msg_home(msg), "6"));
   TEST_1(pl = sip_payload_make(msg_home(msg), "hello!"));
 
-  TEST_1(msg_header_replace(msg, NULL, 
-                           (void *)sip->sip_content_length, 
+  TEST_1(msg_header_replace(msg, NULL,
+                           (void *)sip->sip_content_length,
                            (void *)l) >= 0);
-  TEST_1(msg_header_replace(msg, NULL, 
-                           (void *)sip->sip_payload, 
+  TEST_1(msg_header_replace(msg, NULL,
+                           (void *)sip->sip_payload,
                            (void *)pl) >= 0);
 
   TEST(msg_serialize(msg, NULL), 0);
@@ -440,7 +440,7 @@ int test_basic(void)
   BEGIN();
 
   TEST_1(home);
-  
+
   {
     sip_request_t *rq, *rq1;
 
@@ -452,7 +452,7 @@ int test_basic(void)
 
     su_free(home, rq);
     su_free(home, rq1);
-    
+
     rq = sip_request_make(home, "invite sip:joe@example.com SIP/2.0");
     TEST_1(rq);
     TEST(rq->rq_method, sip_method_unknown);
@@ -463,22 +463,22 @@ int test_basic(void)
     su_free(home, rq);
     su_free(home, rq1);
 
-    TEST_1(!sip_request_create(home, sip_method_unknown, NULL, 
+    TEST_1(!sip_request_create(home, sip_method_unknown, NULL,
                               (void *)"sip:joe@example.com", NULL));
-    TEST_1(rq = sip_request_create(home, sip_method_unknown, "invite", 
+    TEST_1(rq = sip_request_create(home, sip_method_unknown, "invite",
                                   (void *)"sip:joe@example.com", NULL));
     TEST(rq->rq_method, sip_method_unknown);
     TEST_S(rq->rq_method_name, "invite");
     su_free(home, rq);
 
-    TEST_1(rq = sip_request_create(home, sip_method_unknown, "INVITE", 
+    TEST_1(rq = sip_request_create(home, sip_method_unknown, "INVITE",
                                   (void *)"sip:joe@example.com", NULL));
     TEST(rq->rq_method, sip_method_invite);
     TEST_S(rq->rq_method_name, "INVITE");
 
     su_free(home, rq);
 
-    TEST_1(rq = sip_request_create(home, sip_method_invite, "foobar", 
+    TEST_1(rq = sip_request_create(home, sip_method_invite, "foobar",
                                   (void *)"sip:joe@example.com", NULL));
     TEST(rq->rq_method, sip_method_invite);
     TEST_S(rq->rq_method_name, "INVITE");
@@ -548,8 +548,8 @@ int test_basic(void)
     TEST_1(params);
     TEST_1(comment);
 
-    TEST_SIZE(sip_name_addr_e(ebuf, sizeof(ebuf), 0, display, 0, url, 
-                             params, comment), 
+    TEST_SIZE(sip_name_addr_e(ebuf, sizeof(ebuf), 0, display, 0, url,
+                             params, comment),
              strlen(na) - 1);
     TEST_1(strncmp(na, ebuf, strlen(na) - 1) == 0);
 
@@ -648,7 +648,7 @@ int test_basic(void)
 
     TEST_1(!sip_cseq_create(home, 123456789, sip_method_unknown, NULL));
 
-    TEST_1(cs = sip_cseq_create(home, 123456789, sip_method_unknown, 
+    TEST_1(cs = sip_cseq_create(home, 123456789, sip_method_unknown,
                                "invite"));
     TEST(cs->cs_seq, 123456789);
     TEST(cs->cs_method, sip_method_unknown);
@@ -663,9 +663,9 @@ int test_basic(void)
     sip_contact_t *m, *m0;
 
     TEST_1(!sip_contact_make(home, ",,"));
-    
-    TEST_1(m = sip_contact_create(home, (void *)"sip:joe@bar", 
-                                 "q=0.2", 
+
+    TEST_1(m = sip_contact_create(home, (void *)"sip:joe@bar",
+                                 "q=0.2",
                                  "+message",
                                  NULL));
     TEST_S(m->m_q, "0.2");
@@ -681,7 +681,7 @@ int test_basic(void)
 
     TEST_S(m->m_q, "0.5");
     TEST_S(m->m_expires, "0");
-    
+
     TEST_1(!sip_contact_create(home, (void *)"sip:joe@[baa",
                               "audio", "video", NULL));
 
@@ -717,7 +717,7 @@ int test_basic(void)
     TEST_1(ex = sip_expires_make(home, "4294967297")); /* XXX */
     su_free(home, ex);
 
-    TEST_1(ex = sip_expires_make(home, "Wed, 25 Mar 2004 14:49:29 GMT")); 
+    TEST_1(ex = sip_expires_make(home, "Wed, 25 Mar 2004 14:49:29 GMT"));
     su_free(home, ex);
 
     TEST_1(ex = sip_expires_create(home, 3600));
@@ -769,7 +769,7 @@ int test_basic(void)
     TEST_1(sip_route_fix(r));
     TEST_1(url_has_param(r->r_url, "lr"));
 
-    su_free(home, r); 
+    su_free(home, r);
     TEST_1(r = sip_route_create(home, r0->r_url, r0->r_url));
 
     su_free(home, r); su_free(home, r0);
@@ -796,9 +796,9 @@ int test_basic(void)
     TEST_1(!sip_via_make(home, "SIP// host:5060 (foo),"));
     TEST_1(!sip_via_make(home, "SIP/2.0/TCP host:5060 (foo) bar,"));
     TEST_1(!sip_via_make(home, "SIP/2.0/TCP [3ffe::1:5060 (foo),"));
-    
-    TEST_1(v = sip_via_create(home, "bar.com", 
-                             "50600", 
+
+    TEST_1(v = sip_via_create(home, "bar.com",
+                             "50600",
                              "SIP/2.0/UDP",
                              "hidden",
                              "rport=50601",
@@ -819,7 +819,7 @@ int test_basic(void)
     TEST_S(v->v_branch, "1");
     TEST_S(v->v_rport, "50601");
     TEST_S(v->v_comp, "sigcomp");
-    
+
     TEST_1(v0 = sip_via_dup(home, v));
 
     TEST(msg_header_add_param(home, v->v_common, "rport"), 0);
@@ -844,8 +844,8 @@ int test_basic(void)
     su_free(home, v);
     su_free(home, v0);
 
-    TEST_1(v = sip_via_create(home, "bar.com", 
-                             "50600", 
+    TEST_1(v = sip_via_create(home, "bar.com",
+                             "50600",
                              NULL,
                              "rport=50601",
                              "branch=1",
@@ -859,7 +859,7 @@ int test_basic(void)
   {
     sip_call_info_t *ci, *ci0;
 
-    TEST_1(ci = sip_call_info_make(home, 
+    TEST_1(ci = sip_call_info_make(home,
                                   "<http://www.nokia.com>;purpose=info"));
     TEST_S(ci->ci_purpose, "info");
     TEST_1(ci0 = sip_call_info_dup(home, ci));
@@ -941,7 +941,7 @@ int test_sip_msg_class(msg_mclass_t const *mc)
   for (i = 0; i < N; i++) {
     /* Verify each header entry */
     hc = mc->mc_hash[i].hr_class;
-    
+
     if (hc == NULL)
       continue;
 
@@ -969,7 +969,7 @@ msg_t *read_message(int flags, char const buffer[])
   msg_iovec_t iovec[2];
 
   n = strlen(buffer);
-  if (n == 0) 
+  if (n == 0)
     return NULL;
 
   msg = msg_create(test_mclass, flags);
@@ -996,7 +996,7 @@ static int test_encoding(void)
 
   TEST_1(home = su_home_new(sizeof *home));
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "SUBSCRIBE sip:foo@bar SIP/2.0\r\n"
     "To: Joe User <sip:foo@bar>\r\n"
     "From: \"Bar Owner\" <sip:bar@foo>;tag=foobar\r\n"
@@ -1073,7 +1073,7 @@ static int test_encoding(void)
   msg_destroy(msg), msg = NULL;
 
   /* Note: this should be canonic! */
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "SIP/2.0 200 Ok\r\n"
     "To: Joe User <sip:foo@bar>;tag=deadbeef\r\n"
     "From: sip:bar@foo;tag=foobar\r\n"
@@ -1094,7 +1094,7 @@ static int test_encoding(void)
     "Subscription-State: active;expires=1800\r\n"
     "Call-Info: <http://www.bar.com/xcap/joe/>;purpose=xcap\r\n"
     "Error-Info: <http://www.bar.com/xcap/joe/errors>;param=xcap\r\n"
-    "Server: None\r\n"              
+    "Server: None\r\n"
     "Timestamp: 3289129810.798259 0.084054\r\n"
     "SIP-ETag: foobar\r\n"
     "SIP-If-Match: foobar\r\n"
@@ -1104,8 +1104,8 @@ static int test_encoding(void)
     "Warning: 399 presence.bar:5060 \"Unimplemented filter\"\r\n"
     "RSeq: 421414\r\n"
     "Refer-To: <sip:hsdf@cdwf.xcfw.com?Subject=test&Organization=Bar>\r\n"
-    "Alert-Info: <http://alert.example.org/test.mp3>\r\n"                   
-    "Reply-To: Bob <sip:bob@example.com>\r\n"               
+    "Alert-Info: <http://alert.example.org/test.mp3>\r\n"
+    "Reply-To: Bob <sip:bob@example.com>\r\n"
     "WWW-Authenticate: Digest realm=\"foo\"\r\n"
     "Proxy-Authenticate: Digest realm=\"foo\"\r\n"
     "Security-Server: tls;q=0.2\r\n"
@@ -1141,7 +1141,7 @@ static int test_encoding(void)
   su_home_check(home);
   su_home_zap(home);
 
-  msg = read_message(0, 
+  msg = read_message(0,
                     "SIP/2.0 200 Ok\r\n"
                     "Via: SIP/2.0/UDP 135.180.130.133\r\n"
                     "Via: SIP/2.0/UDP 135.180.130.130:5060\r\n"
@@ -1153,7 +1153,7 @@ static int test_encoding(void)
                     "Record-Route: <sip:135.180.130.130;lr>\r\n"
                     "Content-Length: 0\r\n"
                     "\r\n");
-                   
+
   sip = sip_object(msg);
 
   TEST_1(msg); TEST_1(sip); TEST_1(!sip->sip_error);
@@ -1164,7 +1164,7 @@ static int test_encoding(void)
 
   TEST_1(c = sip->sip_status->st_common);
   TEST_M(c->h_data, "SIP/2.0 200 Ok\r\n", c->h_len);
-  
+
   TEST_1(c = sip->sip_to->a_common);
   TEST_M(c->h_data, "t:Joe User<sip:foo@bar>;tag=deadbeef\r\n", c->h_len);
 
@@ -1201,16 +1201,16 @@ static int test_encoding(void)
 int tag_test(void)
 {
   su_home_t *home = su_home_new(sizeof(*home));
-  sip_request_t *request = 
+  sip_request_t *request =
     sip_request_make(home, "INVITE sip:joe@example.com SIP/2.0");
-  sip_to_t *to = sip_to_make(home, 
+  sip_to_t *to = sip_to_make(home,
                             "Joe User <sip:joe.user@example.com;param=1>"
                             ";tag=12345678");
   sip_via_t *via = sip_via_make(home,
                                "SIP/2.0/UDP sip.example.com"
                                ";maddr=128.12.9.254"
                                ";branch=289412978y641.321312");
-  url_t *url = url_hdup(home, 
+  url_t *url = url_hdup(home,
     (url_t *)"sip:test:pass@example.com;baz=1?foo&bar");
 
   tagi_t *lst, *dup;
@@ -1224,15 +1224,15 @@ int tag_test(void)
   TEST_1(home && request && to && via);
 
   lst = tl_list(SIPTAG_REQUEST(request),
-               SIPTAG_TO(to), 
+               SIPTAG_TO(to),
                SIPTAG_VIA(via),
                URLTAG_URL(url),
                TAG_NULL());
 
   xtra = 0;
-  xtra += XTRA(xtra, request); 
-  xtra += XTRA(xtra, to); 
-  xtra += XTRA(xtra, via); 
+  xtra += XTRA(xtra, request);
+  xtra += XTRA(xtra, to);
+  xtra += XTRA(xtra, via);
   xtra += SU_ALIGN(xtra) + sizeof(*url) + url_xtra(url);
 
   TEST_SIZE(tl_len(lst), 5 * sizeof(tagi_t));
@@ -1255,7 +1255,7 @@ int tag_test(void)
   TEST_1(request->rq_common->h_class == sip_request_class);
   TEST_S(request->rq_method_name, "INVITE");
   TEST_S(request->rq_version, "SIP/2.0");
-  
+
   TEST_1(t_scan(siptag_to, home, "Example <sip:example.org>;tag=foo", &v));
   TEST_1(to = (void *)v);
   TEST_1(to->a_common->h_class == sip_to_class);
@@ -1283,7 +1283,7 @@ static int parser_tag_test(void)
 
   home = su_home_new(sizeof *home);
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
 "SIP/2.0 401 Unauthorized\r\n"
 "Via: SIP/2.0/UDP srlab.sr.ntc.nokia.com:5060;maddr=192.168.102.5\r\n"
 "Via: SIP/2.0/UDP 172.21.9.155\r\n"
@@ -1297,7 +1297,7 @@ static int parser_tag_test(void)
 "Proxy-Authenticate: Digest realm=\"IndigoSw\", domain=\"sip:indigosw.com\", "
 "nonce=\"V2VkIEF1ZyAxNSAxODoxMzozMiBCU1QgMjAwMVtCQDJkYjE5ZA==\", "
 "opaque=\"NzA3ZjJhYzU4MGY3MzU0MQ==\", stale=false, "
-"algorithm=md5, algorithm=sha1, qop=\"auth\"\r\n" 
+"algorithm=md5, algorithm=sha1, qop=\"auth\"\r\n"
 /* , qop=\"auth, auth-int\"\r */
 "\r\n");
 
@@ -1323,21 +1323,21 @@ static int parser_tag_test(void)
 
   TEST_P(sip->sip_content_length->l_common->h_succ, sip->sip_separator);
 
-  lst = tl_list(SIPTAG_VIA(sip->sip_via), 
-               SIPTAG_RECORD_ROUTE(sip->sip_record_route), 
-               TAG_SKIP(2), 
-               SIPTAG_CSEQ(sip->sip_cseq), 
-               SIPTAG_PAYLOAD(sip->sip_payload), 
+  lst = tl_list(SIPTAG_VIA(sip->sip_via),
+               SIPTAG_RECORD_ROUTE(sip->sip_record_route),
+               TAG_SKIP(2),
+               SIPTAG_CSEQ(sip->sip_cseq),
+               SIPTAG_PAYLOAD(sip->sip_payload),
                TAG_NULL());
-  filter1 = tl_list(SIPTAG_VIA(0), 
+  filter1 = tl_list(SIPTAG_VIA(0),
                    TAG_NULL());
-  filter2 = tl_list(SIPTAG_CALL_ID(0), 
+  filter2 = tl_list(SIPTAG_CALL_ID(0),
                    SIPTAG_FROM(0),
                    SIPTAG_ROUTE(0),
                    SIPTAG_CSEQ(0),
                    TAG_NULL());
-  filter3 = tl_list(SIPTAG_CSEQ(0), 
-                   SIPTAG_CONTENT_LENGTH(0), 
+  filter3 = tl_list(SIPTAG_CSEQ(0),
+                   SIPTAG_CONTENT_LENGTH(0),
                    TAG_NULL());
   filter4 = tl_list(SIPTAG_STATUS(0),
                    SIPTAG_VIA(0),
@@ -1381,23 +1381,23 @@ static int parser_tag_test(void)
   b3 = tl_afilter(home, filter3, lst);
 
   TEST_SIZE(tl_len(b3), 3 * sizeof(tagi_t));
-  TEST_SIZE(tl_xtra(b3, 0), 
+  TEST_SIZE(tl_xtra(b3, 0),
            sizeof(sip_content_length_t) + sizeof(sip_cseq_t));
 
   b4 = tl_afilter(home, filter4, lst);
   TEST_SIZE(tl_len(b4), 11 * sizeof(tagi_t));
   xtra = 0;
-  xtra += XTRA(xtra, sip->sip_status); 
-  xtra += XTRA(xtra, sip->sip_via); 
-  xtra += XTRA(xtra, sip->sip_via->v_next); 
+  xtra += XTRA(xtra, sip->sip_status);
+  xtra += XTRA(xtra, sip->sip_via);
+  xtra += XTRA(xtra, sip->sip_via->v_next);
   xtra += XTRA(xtra, sip->sip_record_route);
-  xtra += XTRA(xtra, sip->sip_from); 
-  xtra += XTRA(xtra, sip->sip_to); 
-  xtra += XTRA(xtra, sip->sip_call_id); 
-  xtra += XTRA(xtra, sip->sip_cseq); 
-  xtra += XTRA(xtra, sip->sip_www_authenticate); 
-  xtra += XTRA(xtra, sip->sip_proxy_authenticate); 
-  xtra += XTRA(xtra, sip->sip_content_length); 
+  xtra += XTRA(xtra, sip->sip_from);
+  xtra += XTRA(xtra, sip->sip_to);
+  xtra += XTRA(xtra, sip->sip_call_id);
+  xtra += XTRA(xtra, sip->sip_cseq);
+  xtra += XTRA(xtra, sip->sip_www_authenticate);
+  xtra += XTRA(xtra, sip->sip_proxy_authenticate);
+  xtra += XTRA(xtra, sip->sip_content_length);
   TEST_SIZE(tl_xtra(b4, 0), xtra);
 
   tl_vfree(filter1); tl_vfree(filter2); tl_vfree(filter3); tl_vfree(filter4);
@@ -1406,10 +1406,10 @@ static int parser_tag_test(void)
   su_home_check(home);
 
   su_free(home, b4);
-  su_free(home, b3); 
-  su_free(home, b2); 
+  su_free(home, b3);
+  su_free(home, b2);
   su_free(home, dup);
-  su_free(home, b1); 
+  su_free(home, b1);
 
   su_home_check(home);
 
@@ -1425,7 +1425,7 @@ static int response_phrase_test(void)
 {
   BEGIN();
   {
-    struct { int status; char const *phrase; } const errors[] = 
+    struct { int status; char const *phrase; } const errors[] =
       {
        { SIP_100_TRYING },
        { SIP_180_RINGING },
@@ -1507,10 +1507,10 @@ static int parser_test(void)
   sip_request_t        sip_request[1] = { SIP_REQUEST_INIT() };
   sip_status_t         sip_status[1]  = { SIP_STATUS_INIT() };
   sip_header_t         sip_unknown[1]  = { SIP_UNKNOWN_INIT() };
-  sip_separator_t      sip_separator[1] = { SIP_SEPARATOR_INIT() };     
+  sip_separator_t      sip_separator[1] = { SIP_SEPARATOR_INIT() };
   sip_payload_t        sip_payload[1] = { SIP_PAYLOAD_INIT() };
   sip_via_t            sip_via[1] = { SIP_VIA_INIT() };
-  sip_route_t          sip_route[1] = { SIP_ROUTE_INIT() };            
+  sip_route_t          sip_route[1] = { SIP_ROUTE_INIT() };
   sip_record_route_t   sip_record_route[1] = { SIP_RECORD_ROUTE_INIT() };
   sip_max_forwards_t   sip_max_forwards[1] = { SIP_MAX_FORWARDS_INIT() };
   sip_from_t           sip_from[1] = { SIP_FROM_INIT() };
@@ -1518,26 +1518,26 @@ static int parser_test(void)
   sip_call_id_t        sip_call_id[1] = { SIP_CALL_ID_INIT() };
   sip_cseq_t           sip_cseq[1] = { SIP_CSEQ_INIT() };
   sip_contact_t        sip_contact[1] = { SIP_CONTACT_INIT() };
-                                               
+
   sip_expires_t        sip_expires[1] = { SIP_EXPIRES_INIT() };
   sip_date_t           sip_date[1] = { SIP_DATE_INIT() };
   sip_retry_after_t    sip_retry_after[1] = { SIP_RETRY_AFTER_INIT() };
   sip_timestamp_t      sip_timestamp[1] = { SIP_TIMESTAMP_INIT() };
   sip_subject_t        sip_subject[1] = { SIP_SUBJECT_INIT() };
   sip_priority_t       sip_priority[1] = { SIP_PRIORITY_INIT() };
-                                       
+
   sip_call_info_t      sip_call_info[1] = { SIP_CALL_INFO_INIT() };
   sip_organization_t   sip_organization[1] = { SIP_ORGANIZATION_INIT() };
   sip_server_t         sip_server[1] = { SIP_SERVER_INIT() };
   sip_user_agent_t     sip_user_agent[1] = { SIP_USER_AGENT_INIT() };
   sip_in_reply_to_t    sip_in_reply_to[1] = { SIP_IN_REPLY_TO_INIT() };
-                                       
+
   sip_accept_t         sip_accept[1] = { SIP_ACCEPT_INIT() };
   sip_accept_encoding_t sip_accept_encoding[1] = { SIP_ACCEPT_ENCODING_INIT() };
   sip_accept_language_t sip_accept_language[1] = { SIP_ACCEPT_LANGUAGE_INIT() };
-   
+
   sip_session_expires_t sip_session_expires[1] = { SIP_SESSION_EXPIRES_INIT() };
-  sip_min_se_t sip_min_se[1] = { SIP_MIN_SE_INIT() };   
+  sip_min_se_t sip_min_se[1] = { SIP_MIN_SE_INIT() };
 
   sip_allow_t          sip_allow[1] = { SIP_ALLOW_INIT() };
   sip_require_t        sip_require[1] = { SIP_REQUIRE_INIT() };
@@ -1557,7 +1557,7 @@ static int parser_test(void)
   sip_www_authenticate_t sip_www_authenticate[1] = { SIP_WWW_AUTHENTICATE_INIT() };
   sip_error_info_t     sip_error_info[1] = { SIP_ERROR_INFO_INIT() };
   sip_warning_t        sip_warning[1] = { SIP_WARNING_INIT() };
-                      
+
   sip_mime_version_t   sip_mime_version[1] = { SIP_MIME_VERSION_INIT() };
   sip_content_type_t   sip_content_type[1] = { SIP_CONTENT_TYPE_INIT() };
   sip_content_encoding_t sip_content_encoding[1] = { SIP_CONTENT_ENCODING_INIT() };
@@ -1568,7 +1568,7 @@ static int parser_test(void)
 
   home = su_home_new(sizeof *home);
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "INVITE sip:John_Smith@tct.hut.fi SIP/2.0\r\n"
     "To: John Smith <sip:John_Smith@tct.hut.fi:5066;user=ip;maddr=131.228.16.2>\r\n"
     "  ; tag = deadbeef\r\n"
@@ -1600,24 +1600,24 @@ static int parser_test(void)
   TEST_1(sip->sip_via->v_next->v_next == NULL);
   TEST_1(sip_sanity_check(sip) == 0);
 
-  TEST_1(r = sip->sip_route); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
+  TEST_1(r = sip->sip_route); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
   TEST_1(!r->r_next);
 
   TEST_1(r = sip_route_fix(sip->sip_route)); TEST_1(!r->r_common->h_data);
   TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data);
-  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data); 
-  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data); 
+  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data);
+  TEST_1(r = r->r_next); TEST_1(!r->r_common->h_data);
   TEST_1(!r->r_next);
 
   /* Quiet lots of warnings */
@@ -1641,21 +1641,21 @@ static int parser_test(void)
   TEST_P(msg_header_offset(msg, sip, sip_call_id), &sip->sip_call_id);
   TEST_P(msg_header_offset(msg, sip, sip_cseq), &sip->sip_cseq);
   TEST_P(msg_header_offset(msg, sip, sip_contact), &sip->sip_contact);
-                                               
+
   TEST_P(msg_header_offset(msg, sip, sip_expires), &sip->sip_expires);
   TEST_P(msg_header_offset(msg, sip, sip_date), &sip->sip_date);
   TEST_P(msg_header_offset(msg, sip, sip_retry_after), &sip->sip_retry_after);
   TEST_P(msg_header_offset(msg, sip, sip_timestamp), &sip->sip_timestamp);
   TEST_P(msg_header_offset(msg, sip, sip_subject), &sip->sip_subject);
   TEST_P(msg_header_offset(msg, sip, sip_priority), &sip->sip_priority);
-                                       
+
   TEST_P(msg_header_offset(msg, sip, sip_call_info), &sip->sip_call_info);
   TEST_P(msg_header_offset(msg, sip, sip_organization),
         &sip->sip_organization);
   TEST_P(msg_header_offset(msg, sip, sip_server), &sip->sip_server);
   TEST_P(msg_header_offset(msg, sip, sip_user_agent), &sip->sip_user_agent);
   TEST_P(msg_header_offset(msg, sip, sip_in_reply_to), &sip->sip_in_reply_to);
-                                       
+
   TEST_P(msg_header_offset(msg, sip, sip_accept), &sip->sip_accept);
   TEST_P(msg_header_offset(msg, sip, sip_accept_encoding),
         &sip->sip_accept_encoding);
@@ -1664,8 +1664,8 @@ static int parser_test(void)
 
   TEST_P(msg_header_offset(msg, sip, sip_session_expires),
         &sip->sip_session_expires);
-  TEST_P(msg_header_offset(msg, sip, sip_min_se), &sip->sip_min_se);   
-   
+  TEST_P(msg_header_offset(msg, sip, sip_min_se), &sip->sip_min_se);
+
   TEST_P(msg_header_offset(msg, sip, sip_allow), &sip->sip_allow);
   TEST_P(msg_header_offset(msg, sip, sip_require), &sip->sip_require);
   TEST_P(msg_header_offset(msg, sip, sip_proxy_require),
@@ -1689,7 +1689,7 @@ static int parser_test(void)
         &sip->sip_www_authenticate);
   TEST_P(msg_header_offset(msg, sip, sip_error_info), &sip->sip_error_info);
   TEST_P(msg_header_offset(msg, sip, sip_warning), &sip->sip_warning);
-                      
+
   TEST_P(msg_header_offset(msg, sip, sip_mime_version), &sip->sip_mime_version);
   TEST_P(msg_header_offset(msg, sip, sip_content_type), &sip->sip_content_type);
   TEST_P(msg_header_offset(msg, sip, sip_content_encoding),
@@ -1706,7 +1706,7 @@ static int parser_test(void)
   TEST_SIZE(sip_payload_class->hc_params, 0);
   TEST_SIZE(sip_via_class->hc_params, offsetof(sip_via_t, v_params));
   TEST_SIZE(sip_route_class->hc_params, offsetof(sip_route_t, r_params));
-  TEST_SIZE(sip_record_route_class->hc_params, 
+  TEST_SIZE(sip_record_route_class->hc_params,
            offsetof(sip_record_route_t, r_params));
 
   TEST_SIZE(sip_max_forwards_class->hc_params, 0);
@@ -1715,73 +1715,73 @@ static int parser_test(void)
   TEST_SIZE(sip_call_id_class->hc_params, 0);
   TEST_SIZE(sip_cseq_class->hc_params, 0);
   TEST_SIZE(sip_contact_class->hc_params, offsetof(sip_contact_t, m_params));
-                                               
+
   TEST_SIZE(sip_expires_class->hc_params, 0);
   TEST_SIZE(sip_date_class->hc_params, 0);
-  TEST_SIZE(sip_retry_after_class->hc_params, 
+  TEST_SIZE(sip_retry_after_class->hc_params,
            offsetof(sip_retry_after_t, af_params));
   TEST_SIZE(sip_timestamp_class->hc_params, 0);
   TEST_SIZE(sip_subject_class->hc_params, 0);
   TEST_SIZE(sip_priority_class->hc_params, 0);
-                                       
-  TEST_SIZE(sip_call_info_class->hc_params, 
+
+  TEST_SIZE(sip_call_info_class->hc_params,
            offsetof(sip_call_info_t, ci_params));
   TEST_SIZE(sip_organization_class->hc_params, 0);
   TEST_SIZE(sip_server_class->hc_params, 0);
   TEST_SIZE(sip_user_agent_class->hc_params, 0);
 
-  TEST_SIZE(sip_in_reply_to_class->hc_params, 
+  TEST_SIZE(sip_in_reply_to_class->hc_params,
            offsetof(sip_in_reply_to_t, k_items));
   TEST_SIZE(sip_accept_class->hc_params, offsetof(sip_accept_t, ac_params));
-  TEST_SIZE(sip_accept_encoding_class->hc_params, 
+  TEST_SIZE(sip_accept_encoding_class->hc_params,
            offsetof(sip_accept_encoding_t, aa_params));
-  TEST_SIZE(sip_accept_language_class->hc_params, 
+  TEST_SIZE(sip_accept_language_class->hc_params,
            offsetof(sip_accept_language_t, aa_params));
-   
+
   TEST_SIZE(sip_session_expires_class->hc_params,
            offsetof(sip_session_expires_t, x_params));
   TEST_SIZE(sip_min_se_class->hc_params, offsetof(sip_min_se_t, min_params));
 
   TEST_SIZE(sip_allow_class->hc_params, offsetof(sip_allow_t, k_items));
   TEST_SIZE(sip_require_class->hc_params, offsetof(sip_require_t, k_items));
-  TEST_SIZE(sip_proxy_require_class->hc_params, 
+  TEST_SIZE(sip_proxy_require_class->hc_params,
            offsetof(sip_proxy_require_t, k_items));
-  TEST_SIZE(sip_supported_class->hc_params, 
+  TEST_SIZE(sip_supported_class->hc_params,
            offsetof(sip_supported_t, k_items));
-  TEST_SIZE(sip_unsupported_class->hc_params, 
+  TEST_SIZE(sip_unsupported_class->hc_params,
            offsetof(sip_unsupported_t, k_items));
 
 #if SIP_HAVE_ENCRYPTION
-  TEST_SIZE(sip_encryption_class->hc_params, 
+  TEST_SIZE(sip_encryption_class->hc_params,
            offsetof(sip_encryption_t, au_params));
 #endif
 #if SIP_HAVE_RESPONSE_KEY
-  TEST_SIZE(sip_response_key_class->hc_params, 
+  TEST_SIZE(sip_response_key_class->hc_params,
            offsetof(sip_response_key_t, au_params));
 #endif
-  TEST_SIZE(sip_proxy_authenticate_class->hc_params,  
+  TEST_SIZE(sip_proxy_authenticate_class->hc_params,
            offsetof(sip_proxy_authenticate_t, au_params));
-  TEST_SIZE(sip_proxy_authorization_class->hc_params,  
+  TEST_SIZE(sip_proxy_authorization_class->hc_params,
            offsetof(sip_proxy_authorization_t, au_params));
-  TEST_SIZE(sip_authorization_class->hc_params,  
+  TEST_SIZE(sip_authorization_class->hc_params,
            offsetof(sip_authorization_t, au_params));
-  TEST_SIZE(sip_www_authenticate_class->hc_params,  
+  TEST_SIZE(sip_www_authenticate_class->hc_params,
            offsetof(sip_www_authenticate_t, au_params));
 
-  TEST_SIZE(sip_error_info_class->hc_params, 
+  TEST_SIZE(sip_error_info_class->hc_params,
            offsetof(sip_error_info_t, ei_params));
-  TEST_SIZE(sip_alert_info_class->hc_params, 
+  TEST_SIZE(sip_alert_info_class->hc_params,
            offsetof(sip_alert_info_t, ai_params));
-  TEST_SIZE(sip_reply_to_class->hc_params, 
+  TEST_SIZE(sip_reply_to_class->hc_params,
            offsetof(sip_reply_to_t, rplyto_params));
   TEST_SIZE(sip_warning_class->hc_params, 0);
-                      
+
   TEST_SIZE(sip_mime_version_class->hc_params, 0);
-  TEST_SIZE(sip_content_type_class->hc_params, 
+  TEST_SIZE(sip_content_type_class->hc_params,
            offsetof(sip_content_type_t, c_params));
-  TEST_SIZE(sip_content_encoding_class->hc_params, 
+  TEST_SIZE(sip_content_encoding_class->hc_params,
            offsetof(sip_content_encoding_t, k_items));
-  TEST_SIZE(sip_content_disposition_class->hc_params, 
+  TEST_SIZE(sip_content_disposition_class->hc_params,
            offsetof(sip_content_disposition_t, cd_params));
   TEST_SIZE(sip_content_length_class->hc_params, 0);
 
@@ -1796,10 +1796,10 @@ static int count(sip_common_t *h)
 {
   sip_header_t *sh = (sip_header_t *)h;
   unsigned n;
-  
+
   for (n = 0; sh; sh = sh->sh_next)
     n++;
-  
+
   return n;
 }
 
@@ -1830,7 +1830,7 @@ static int sip_header_test(void)
 
   home = su_home_new(sizeof *home);
 
-  TEST_1(msg = read_message(MSG_DO_EXTRACT_COPY, 
+  TEST_1(msg = read_message(MSG_DO_EXTRACT_COPY,
     "MESSAGE sip:John_Smith@tct.hut.fi SIP/2.0\r\n"
     "To: John Smith <sip:John_Smith@tct.hut.fi:5066;user=ip;maddr=131.228.16.2>\r\n"
     "  ; tag = deadbeef\r\n"
@@ -1928,9 +1928,9 @@ static int sip_header_test(void)
       TEST_1(v->v_branch == v0->v_branch);
   }
   TEST_1(v == NULL && v0 == NULL);
-  
+
   v0 = sip->sip_via;
-  
+
   TEST_1(v = sip_via_dup(home, v0));
   TEST(len(v->v_common), len(v0->v_common));
   for (; v && v0; v = v->v_next, v0 = v0->v_next) {
@@ -1951,7 +1951,7 @@ static int sip_header_test(void)
 
   msg_header_remove(msg, (msg_pub_t *)sip, (msg_header_t *)sip->sip_payload);
 
-  TEST(sip_add_tl(msg, sip, 
+  TEST(sip_add_tl(msg, sip,
                  SIPTAG_FROM(SIP_NONE),
                  SIPTAG_VIA(SIP_NONE),
                  SIPTAG_VIA_STR("SIP/2.0/SCTP foo.bar.com:5060;branch=foo"),
@@ -1997,7 +1997,7 @@ static int sip_header_test(void)
   TEST_P(x, sip->sip_path->r_next);
 
   TEST_1(x = sip->sip_service_route);
-  TEST_1(sip_add_make(msg, sip, sip_service_route_class, 
+  TEST_1(sip_add_make(msg, sip, sip_service_route_class,
                      "<sip:135.180.130.133>") == 0);
   TEST_P(x, sip->sip_service_route);
   TEST_1(sip->sip_service_route->r_next);
@@ -2005,7 +2005,7 @@ static int sip_header_test(void)
   /* Detect parsing errors */
   TEST_1(!sip_cseq_make(home, "21874624876976 INVITE"));
   TEST_1(!sip_cseq_make(home, "218746INVITE"));
-  
+
   msg_destroy(msg), msg = NULL;
 
   su_home_unref(home), home = NULL;
@@ -2023,7 +2023,7 @@ static int test_bad_packet(void)
 
   home = su_home_new(sizeof *home);
 
-  TEST_1(msg = read_message(MSG_DO_EXTRACT_COPY, 
+  TEST_1(msg = read_message(MSG_DO_EXTRACT_COPY,
     "MESSAGE <sip:John_Smith@tct.hut.fi> SIP/2.0\r\n"
     "To: John Smith <sip:John_Smith@tct.hut.fi:5066;user=ip;maddr=131.228.16.2>\r\n"
     "  ; tag = deadbeef\r\n"
@@ -2066,7 +2066,7 @@ static int test_sip_list_header(void)
 
   home = su_home_new(sizeof *home);
 
-  TEST_1(msg = read_message(0, 
+  TEST_1(msg = read_message(0,
     "MESSAGE sip:John_Smith@tct.hut.fi SIP/2.0\r\n"
     "To: John Smith <sip:John_Smith@tct.hut.fi:5066;user=ip;maddr=131.228.16.2>\r\n"
     "From: <sip:joe@doe.org>;tag=foobar\r\n"
@@ -2141,7 +2141,7 @@ static int test_prack(void)
   su_home_t *home;
   sip_rack_t *rack, *rack0;
   sip_rseq_t *rseq, *rseq0;
-  
+
   BEGIN();
 
   TEST_1(home = su_home_create());
@@ -2156,7 +2156,7 @@ static int test_prack(void)
   TEST_1(rack0 = sip_rack_dup(home, rack));
   TEST_P(rack0->ra_method_name, rack->ra_method_name);
   TEST_1(rseq0 = sip_rseq_dup(home, rseq));
-  
+
   TEST_1(rack = sip_rack_make(home, "4\r\n\t5\r\n\tEXTRA"));
   TEST(rack->ra_response, 4);
   TEST(rack->ra_cseq, 5);
@@ -2164,13 +2164,13 @@ static int test_prack(void)
   TEST_S(rack->ra_method_name, "EXTRA");
   TEST_1(rseq = sip_rseq_make(home, "  6  "));
   TEST(rseq->rs_response, 6);
-  
+
   TEST_1(rack0 = sip_rack_dup(home, rack));
   TEST_1(rack0->ra_method_name != rack->ra_method_name);
   TEST_1(rseq0 = sip_rseq_dup(home, rseq));
 
   su_home_unref(home);
-  
+
   END();
 }
 
@@ -2204,7 +2204,7 @@ static int test_accept(void)
   TEST_1(aa = sip_accept_encoding_make(home, "gzip;q=1.0,deflate;q=1.0"));
   TEST_S(aa->aa_value, "gzip"); TEST_S(aa->aa_q, "1.0");
   TEST_1(aa->aa_next);
-  TEST_S(aa->aa_next->aa_value, "deflate"); 
+  TEST_S(aa->aa_next->aa_value, "deflate");
   TEST_1(aa = sip_accept_encoding_make(home, ","));
   TEST_S(aa->aa_value, ""); TEST_1(!aa->aa_next);
   TEST_1(aa = sip_accept_encoding_make(home, ""));
@@ -2214,7 +2214,7 @@ static int test_accept(void)
   TEST_1(aa = sip_accept_language_make(home, "fi;q=1.0,sv;q=1.0"));
   TEST_S(aa->aa_value, "fi"); TEST_S(aa->aa_q, "1.0");
   TEST_1(aa->aa_next);
-  TEST_S(aa->aa_next->aa_value, "sv"); 
+  TEST_S(aa->aa_next->aa_value, "sv");
   TEST_1(aa = sip_accept_language_make(home, ","));
   TEST_S(aa->aa_value, ""); TEST_1(!aa->aa_next);
   TEST_1(aa = sip_accept_language_make(home, ""));
@@ -2293,8 +2293,8 @@ static int test_www_authenticate(void)
          "opaque=\"423767123y723742376423762376423784623782a794e58\",\n"
          "stale=FALSE,algorithm=MD5"));
   TEST_S(www->au_scheme, "Digest");
-  TEST_1(www->au_params && www->au_params[0] && www->au_params[1] && www->au_params[2] && 
-        www->au_params[3] && www->au_params[4] && www->au_params[5] && 
+  TEST_1(www->au_params && www->au_params[0] && www->au_params[1] && www->au_params[2] &&
+        www->au_params[3] && www->au_params[4] && www->au_params[5] &&
         !www->au_params[6]);
   TEST_1(s = sip_header_as_string(home, (sip_header_t *)www));
   TEST_1(strlen(s) >= 128);
@@ -2387,7 +2387,7 @@ int test_min_se(void)
 
   END();
 }
-   
+
 int test_refer(void)
 {
   sip_refer_to_t *r, *r0;
@@ -2399,7 +2399,7 @@ int test_refer(void)
 
   BEGIN();
 
-  char const m[] = 
+  char const m[] =
     "REFER sip:10.3.3.104 SIP/2.0\r\n"
     "Via: SIP/2.0/UDP 10.3.3.8;branch=z9hG4bKb8389b4c1BA8899\r\n"
     "From: \"Anthony Minessale\" <sip:polycom500@10.3.3.104>;tag=5AA04E0-66CFC37F\r\n"
@@ -2425,9 +2425,9 @@ int test_refer(void)
   TEST_1(home = su_home_create());
 
   /* Check that Refer-Sub has now been added to our parser */
-  TEST_1(msg_mclass_insert_with_mask(test_mclass, sip_refer_sub_class, 
+  TEST_1(msg_mclass_insert_with_mask(test_mclass, sip_refer_sub_class,
                                     0, 0) == -1);
-  
+
   msg = read_message(0, m); TEST_1(msg); TEST_1(sip = sip_object(msg));
   TEST_1(sip->sip_refer_to);
   TEST_S(sip->sip_refer_to->r_url->url_headers,
@@ -2441,10 +2441,10 @@ int test_refer(void)
   TEST_1(veclen = msg_iovec(msg, NULL, ISIZE_MAX));
   TEST_1(iovec = su_zalloc(msg_home(home), veclen * (sizeof iovec[0])));
   TEST_SIZE(msg_iovec(msg, iovec, veclen), veclen);
-  
+
   for (i = 0, size = 0; i < veclen; i++)
     size += iovec[i].mv_len;
-  
+
   TEST_1(back = su_zalloc(msg_home(msg), size + 1));
 
   for (i = 0, size = 0; i < veclen; i++) {
@@ -2452,7 +2452,7 @@ int test_refer(void)
     size += iovec[i].mv_len;
   }
   back[size] = '\0';
-  
+
   TEST_S(back, m);
 
   TEST_1(r = r0 = sip_refer_to_make(home, "http://example.com;foo=bar"));
@@ -2474,7 +2474,7 @@ int test_refer(void)
   TEST_P(r->r_params, NULL);
   TEST_S(sip_header_as_string(home, (sip_header_t*)r), s0);
 
-  TEST_1(r = r0 = sip_refer_to_make(home, 
+  TEST_1(r = r0 = sip_refer_to_make(home,
                                    "Web Site <http://example.com>;foo=bar"));
   TEST_S(r->r_display, "Web Site");
   TEST(r->r_url->url_type, url_http);
@@ -2497,7 +2497,7 @@ int test_refer(void)
     TEST_1(r = r0 = sip_refer_to_make(home, s));
     msg_fragment_clear(r->r_common);
     TEST_1(str = sip_header_as_string(home, (void *)r));
-    TEST_S(str, 
+    TEST_S(str,
           "<"
           "sip:2000@10.3.3.104?Replaces=7d84c014-321368da-efa90f41%4010.3.3.8"
           "%3Bto-tag%3DpaNKgBB9vQe3D%3Bfrom-tag%3D93AC8D50-7CF6DAAF"
@@ -2505,15 +2505,15 @@ int test_refer(void)
   }
 
   su_home_unref(home);
-    
+
   TEST_1(home = su_home_create());
-  TEST_1(b = b0 = sip_referred_by_make(home, 
+  TEST_1(b = b0 = sip_referred_by_make(home,
                                      "sip:joe@example.edu;param=value"));
   TEST_P(b->b_display, NULL);
   TEST_1(b->b_params);
   TEST_P(b->b_cid, NULL);
 
-  TEST_1(b = sip_referred_by_make(home, 
+  TEST_1(b = sip_referred_by_make(home,
                                  "John Doe <sip:joe@example.edu>"
                                  ";cid=\"foo@bar\""));
   TEST_S(b->b_display, "John Doe");
@@ -2533,7 +2533,7 @@ int test_refer(void)
   TEST_S(b->b_cid, "cid:8u432658725");
   TEST(msg_header_remove_param(b->b_common, "cid"), 1);
   TEST_P(b->b_cid, NULL);
-  
+
   /* XXX */
 #define WORD ALPHA DIGIT "-.!%*_+`'~()<>:\\\"/[]?{}"
   rp = sip_replaces_make(home, WORD "@" WORD ";to-tag=foo;from-tag=bar"
@@ -2586,10 +2586,10 @@ static int test_features(void)
   TEST_1(s->k_items); TEST_S(s->k_items[0], "foo");
 
   TEST_1(u = sip_has_unsupported(home, s, pr));
-  TEST_1(u->k_items); 
-  TEST_S(u->k_items[0], "bar");  
-  TEST_S(u->k_items[1], "dig");  
-  TEST_P(u->k_items[2], NULL);  
+  TEST_1(u->k_items);
+  TEST_S(u->k_items[0], "bar");
+  TEST_S(u->k_items[1], "dig");
+  TEST_P(u->k_items[2], NULL);
 
   TEST_1(u1 = sip_has_unsupported(home, s, r));
   TEST_1(u1->k_items); TEST_S(u1->k_items[0], "dig"); TEST_1(!u1->k_items[1]);
@@ -2622,7 +2622,7 @@ static int sip_time_test(void)
                                 sip_time_t def,
                                 sip_time_t now);
 
-  
+
   END();
 }
 #endif
@@ -2670,7 +2670,7 @@ static int test_events(void)
   TEST(sip_allow_events_add(home, ae, "event8"), 0);
   TEST_S(ae->k_items[8], "event8");
 
-  TEST_1((ss = 
+  TEST_1((ss =
         sip_subscription_state_make(home, "terminated ; reason=timeout")));
   TEST_S(ss->ss_substate, "terminated");
   TEST_S(ss->ss_reason, "timeout");
@@ -2686,12 +2686,12 @@ static int test_events(void)
   TEST_S(ss->ss_expires, "200");
   TEST_S(ss->ss_retry_after, "10");
 
-  TEST_1((ss = 
+  TEST_1((ss =
         sip_subscription_state_make(home, "active;expires=2")));
   TEST_S(ss->ss_substate, "active");
   TEST_S(ss->ss_expires, "2");
 
-  TEST_1((ss = 
+  TEST_1((ss =
          sip_subscription_state_make(home, "terminated;retry-after=3600")));
   TEST_S(ss->ss_substate, "terminated");
   TEST_P(ss->ss_expires, NULL);
@@ -2702,7 +2702,7 @@ static int test_events(void)
   TEST_P(ss->ss_expires, NULL);
   TEST_S(ss->ss_retry_after, "3600");
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "SIP/2.0 202 Accepted\r\n"
     "To: <sip:foo@bar>;tag=deadbeef\r\n"
     "From: <sip:bar@foo>;\r\n"
@@ -2772,11 +2772,11 @@ static int test_route(void)
   TEST_1(p = sip_path_make(home, "<sip:foo@[baa::1]:5060>;lr"));
   TEST_1(p0 = sip_path_dup(home, p));
 
-  su_free(home, p); 
+  su_free(home, p);
   su_free(home, p0);
 
   TEST_1(!sip_service_route_make(home, "<sip:foo@[bar:50>;lr"));
-  TEST_1(!sip_service_route_make(home, 
+  TEST_1(!sip_service_route_make(home,
                                 "<sip:foo@[baa::1]>;lr bar, sip:foo"));
 
   TEST_1(sr = sip_service_route_make(home, "<sip:foo@[baa::1]:5060>;lr"));
@@ -2784,7 +2784,7 @@ static int test_route(void)
   su_free(home, sr);
 
   TEST_1(sr = sip_service_route_make(home, "sip:foo@[baa::1]:5060;lr"));
-  
+
   su_free(home, sr);
   su_free(home, sr0);
 
@@ -2856,9 +2856,9 @@ int test_caller_prefs(void)
   TEST_1(!sip_is_callerpref(NULL));
   TEST_1(sip_is_callerpref("+"));
   TEST_1(sip_is_callerpref("+foo"));
-  
+
   /* Booleans (treated as literals) */
-  s = "TRUE"; 
+  s = "TRUE";
   negate = 2; memset(sp, 0, sizeof sp);
   TEST_1(sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_literal);
@@ -2866,8 +2866,8 @@ int test_caller_prefs(void)
   TEST_1(sip_prefs_match(sp, sp));
   TEST_1(!sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_init);
-  
-  s = "FALSE"; 
+
+  s = "FALSE";
   negate = 2; memset(sp, 0, sizeof sp);
   TEST_1(sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_literal);
@@ -2875,11 +2875,11 @@ int test_caller_prefs(void)
   TEST_1(sip_prefs_match(sp, sp));
   TEST_1(!sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_init);
-  
+
   s = "\"!TRUE,!FALSE\""; negate = 0;
   TEST_1(sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_literal); TEST_1(negate);
-  
+
   /* Literal */
   s = "\" !oukki , doukki  \""; negate = 0; memset(sp, 0, sizeof sp);
 
@@ -2887,7 +2887,7 @@ int test_caller_prefs(void)
   TEST(sp->sp_type, sp_literal);
   TEST_SIZE(sp->sp_literal.spl_length, 5);
   TEST_M(sp->sp_literal.spl_value, "oukki", 5); TEST_1(negate);
-  
+
   TEST_1(sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_literal);
   TEST_SIZE(sp->sp_literal.spl_length, 6);
@@ -2897,19 +2897,19 @@ int test_caller_prefs(void)
   TEST(sp->sp_type, sp_init);
 
   /* Strings */
-  s = "\" !<oukki> , <douK\\\"ki  >\""; 
+  s = "\" !<oukki> , <douK\\\"ki  >\"";
   negate = 0; memset(sp, 0, sizeof sp);
 
   TEST_1(sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_string);
   TEST_SIZE(sp->sp_string.sps_length, 5);
   TEST_M(sp->sp_string.sps_value, "oukki", 5); TEST_1(negate);
-  
+
   TEST_1(sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_string);
   TEST_SIZE(sp->sp_string.sps_length, 10);
   TEST_M(sp->sp_string.sps_value, "douK\\\"ki  ", 10); TEST_1(!negate);
-  
+
   TEST_1(!sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_init);
 
@@ -2925,7 +2925,7 @@ int test_caller_prefs(void)
   TEST_1(negate);
 
   *a = *sp;
-    
+
   TEST_1(sip_prefs_parse(sp, &s, &negate));
   TEST(sp->sp_type, sp_range);
   TEST_D(sp->sp_range.spr_lower, -DBL_MAX);
@@ -3007,15 +3007,15 @@ int test_caller_prefs(void)
 
   error = 12;
 
-  TEST_1(sip_prefs_matching("\"INVITE,MESSAGE,SUBSCRIBE\"", 
-                           "\"INVITE\"", &error)); 
-  TEST_1(!sip_prefs_matching("\"INVITE,MESSAGE,SUBSCRIBE\"", 
-                            "\"BYE\"", &error)); 
+  TEST_1(sip_prefs_matching("\"INVITE,MESSAGE,SUBSCRIBE\"",
+                           "\"INVITE\"", &error));
+  TEST_1(!sip_prefs_matching("\"INVITE,MESSAGE,SUBSCRIBE\"",
+                            "\"BYE\"", &error));
   TEST(error, 12);
-  TEST_1(sip_prefs_matching("\"INVITE,MESSAGE,SUBSCRIBE\"", 
-                            "\"invite\"", &error)); 
-  TEST_1(sip_prefs_matching("\"!INVITE,MESSAGE,SUBSCRIBE\"", 
-                            "\"foo\"", &error)); 
+  TEST_1(sip_prefs_matching("\"INVITE,MESSAGE,SUBSCRIBE\"",
+                            "\"invite\"", &error));
+  TEST_1(sip_prefs_matching("\"!INVITE,MESSAGE,SUBSCRIBE\"",
+                            "\"foo\"", &error));
   TEST_1(sip_prefs_matching("TRUE", "", &error));
   TEST_1(sip_prefs_matching("", "", &error));
   TEST_1(!sip_prefs_matching("FALSE", "", &error));
@@ -3031,32 +3031,32 @@ int test_caller_prefs(void)
   TEST_1(sip_prefs_matching("\"!<INVITE>\"", "\"<invite>\"", &error));
   TEST_1(!sip_prefs_matching("\"INVITE\"", "\"!INVITE\"", &error));
   TEST_1(sip_prefs_matching("\"!INVITE\"", "\"INVITE,MESSAGE\"", &error));
-  TEST_1(sip_prefs_matching("\"!INVITE,!MESSAGE\"", 
+  TEST_1(sip_prefs_matching("\"!INVITE,!MESSAGE\"",
                             "\"INVITE,MESSAGE\"", &error));
   TEST_1(sip_prefs_matching("\"!MESSAGE\"", "\"INVITE,MESSAGE\"", &error));
-  TEST_1(!sip_prefs_matching("\"<foo>,<bar>\"", 
-                            "\"<FOO>,<BAR>\"", &error)); 
-  TEST_1(!sip_prefs_matching("\"<FOO>,<BAR>\"", "\"foo,bar\"", &error)); 
-  TEST_1(sip_prefs_matching("\"#=1\"", "\"#<=2\"", &error)); 
-  TEST_1(sip_prefs_matching("\"#1:2\"", "\"#<=2\"", &error)); 
-  TEST_1(!sip_prefs_matching("\"#1:2\"", "\"!#>=1,!#<=2\"", &error)); 
-  TEST_1(!sip_prefs_matching("\"#=0,#=1\"", "\"<FOO>,<BAR>\"", &error)); 
+  TEST_1(!sip_prefs_matching("\"<foo>,<bar>\"",
+                            "\"<FOO>,<BAR>\"", &error));
+  TEST_1(!sip_prefs_matching("\"<FOO>,<BAR>\"", "\"foo,bar\"", &error));
+  TEST_1(sip_prefs_matching("\"#=1\"", "\"#<=2\"", &error));
+  TEST_1(sip_prefs_matching("\"#1:2\"", "\"#<=2\"", &error));
+  TEST_1(!sip_prefs_matching("\"#1:2\"", "\"!#>=1,!#<=2\"", &error));
+  TEST_1(!sip_prefs_matching("\"#=0,#=1\"", "\"<FOO>,<BAR>\"", &error));
   TEST(error, 12);
 
   error = 12;
-  TEST_1(!sip_prefs_matching("\"<foo>,#=1\"", "\"<FOO>,<BAR>\"", &error)); 
+  TEST_1(!sip_prefs_matching("\"<foo>,#=1\"", "\"<FOO>,<BAR>\"", &error));
   TEST(error, -1);
 
   error = 12;
-  TEST_1(!sip_prefs_matching("\"<FOO>,<BAR>\"", "\"<foo>,#=1\"", &error)); 
+  TEST_1(!sip_prefs_matching("\"<FOO>,<BAR>\"", "\"<foo>,#=1\"", &error));
   TEST(error, -1);
 
   error = 12;
-  TEST_1(!sip_prefs_matching("\"<foo>,bar\"", "\"<FOO>,<BAR>\"", &error)); 
+  TEST_1(!sip_prefs_matching("\"<foo>,bar\"", "\"<FOO>,<BAR>\"", &error));
   TEST(error, -1);
 
   error = 12;
-  TEST_1(!sip_prefs_matching("\"<FOO>,<BAR>\"", "\"<foo>,#12:12\"", &error)); 
+  TEST_1(!sip_prefs_matching("\"<FOO>,<BAR>\"", "\"<foo>,#12:12\"", &error));
   TEST(error, -1);
 
   {
@@ -3083,7 +3083,7 @@ int test_caller_prefs(void)
     TEST_1(!sip_is_callerpref("+methods=\"foo\""));
   }
 
-  TEST_1(m = sip_contact_make(home, 
+  TEST_1(m = sip_contact_make(home,
                              "<sip:1@domain>;video;audio;type=\"<video/H263>\","
                              "<sip:2@domain>;video=FALSE;audio;text,"
                              "<sip:3@domain>;text;audio=FALSE"));
@@ -3106,37 +3106,37 @@ int test_caller_prefs(void)
 
   TEST_1(sip_contact_accept(m0, ac, &S, &N, &error)); TEST(S, 2); TEST(N, 2);
   TEST_1(!sip_contact_accept(m1, ac, &S, &N, &error));
-  TEST_1(!sip_contact_accept(m2, ac, &S, &N, &error)); 
+  TEST_1(!sip_contact_accept(m2, ac, &S, &N, &error));
 
-  TEST_1(ac = sip_accept_contact_make(home, 
+  TEST_1(ac = sip_accept_contact_make(home,
                                      "Joe the Luser "
                                      "<sip:127.0.0.1:5060>;video;audio"));
   TEST_S(ac->cp_params[0], "video");
   TEST_S(ac->cp_params[1], "audio");
   TEST_P(ac->cp_params[2], NULL);
 
-  TEST_1(ac = sip_accept_contact_make(home, 
+  TEST_1(ac = sip_accept_contact_make(home,
                                      "video;audio;explicit"));
   TEST_S(ac->cp_params[0], "video");
   TEST_S(ac->cp_params[1], "audio");
   TEST_S(ac->cp_params[2], "explicit");
   TEST_P(ac->cp_params[3], NULL);
 
-  TEST_1(ac = sip_accept_contact_make(home, 
+  TEST_1(ac = sip_accept_contact_make(home,
                                      "video = foo ;audio;explicit"));
   TEST_S(ac->cp_params[0], "video=foo");
   TEST_S(ac->cp_params[1], "audio");
   TEST_S(ac->cp_params[2], "explicit");
   TEST_P(ac->cp_params[3], NULL);
 
-  TEST_1(ac = sip_accept_contact_make(home, 
+  TEST_1(ac = sip_accept_contact_make(home,
                                      "video = \"bar\" ;audio;explicit"));
   TEST_S(ac->cp_params[0], "video=\"bar\"");
   TEST_S(ac->cp_params[1], "audio");
   TEST_S(ac->cp_params[2], "explicit");
   TEST_P(ac->cp_params[3], NULL);
-  
-  TEST_1(cp = sip_accept_contact_make(home, 
+
+  TEST_1(cp = sip_accept_contact_make(home,
                                     "*;audio;video;require;explicit;q=1.0,"
                                     "*;audio;require;q=0.8"
                                     ));
@@ -3156,8 +3156,8 @@ int test_caller_prefs(void)
 
   TEST_1(sip_contact_accept(m0, ac, &S, &N, &error)); TEST(S, 2); TEST(N, 2);
   /* Explicit has short-circuit evaluation */
-  TEST_1(!sip_contact_accept(m1, ac, &S, &N, &error)); 
-  TEST_1(!sip_contact_accept(m2, ac, &S, &N, &error)); 
+  TEST_1(!sip_contact_accept(m1, ac, &S, &N, &error));
+  TEST_1(!sip_contact_accept(m2, ac, &S, &N, &error));
 
   TEST_1(ac = ac->cp_next);
 
@@ -3174,7 +3174,7 @@ int test_caller_prefs(void)
 
   TEST_P(ac->cp_next, NULL);
 
-  TEST_1(rejc = sip_reject_contact_make(home, 
+  TEST_1(rejc = sip_reject_contact_make(home,
                                        "*;type=\"<video/H263>\";video=TRUE"));
   TEST_S(rejc->cp_params[0], "type=\"<video/H263>\"");
   TEST_S(rejc->cp_params[1], "video=TRUE");
@@ -3184,7 +3184,7 @@ int test_caller_prefs(void)
   TEST_1(!sip_contact_reject(m2, rejc));
 
   TEST_1(!sip_contact_immune(m0));
-  m0 = sip_contact_immunize(home, m0); TEST_1(m0); 
+  m0 = sip_contact_immunize(home, m0); TEST_1(m0);
   TEST_1(sip_contact_immune(m0));
 
   TEST_1(!sip_contact_immune(m1));
@@ -3237,7 +3237,7 @@ static int test_callerpref_scoring(void)
   int S;
   sip_contact_t *m, *m1, *m2, *m3, *m4, *m5;
 
-  char const contact[] = 
+  char const contact[] =
     "sip:u1@h.example.com;audio;video;methods=\"INVITE,BYE\";q=0.2,"
     "sip:u2@h.example.com;audio=\"FALSE\";"
     "methods=\"INVITE\";actor=\"msg-taker\";q=0.2,"
@@ -3246,10 +3246,10 @@ static int test_callerpref_scoring(void)
     "sip:u4@h.example.com;audio;methods=\"INVITE,OPTIONS\";q=0.2,"
     "sip:u5@h.example.com;q=0.5";
 
-  char const reject[] = 
+  char const reject[] =
     "*;actor=\"msg-taker\";video";
 
-  char const accept[] = 
+  char const accept[] =
     "*;audio;require,"
     "*;video;explicit,"
     "*;methods=\"BYE\";class=\"business\";q=1.0";
@@ -3291,7 +3291,7 @@ static int test_reason(void)
   TEST_S(re->re_cause, "200");
   TEST_S(re->re_text, "\"Ok\"");
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "BYE sip:foo@bar SIP/2.0\r\n"
     "To: <sip:foo@bar>;tag=deadbeef\r\n"
     "From: <sip:bar@foo>;\r\n"
@@ -3307,7 +3307,7 @@ static int test_reason(void)
 
   sip = sip_object(msg);
 
-  TEST_1(msg); 
+  TEST_1(msg);
   TEST_1(sip);
   TEST_1(re = sip->sip_reason);
   TEST_S(re->re_protocol, "SIP");
@@ -3341,7 +3341,7 @@ static int test_reason(void)
 
   /* Not a token */
   TEST_1(!sip_reason_make(home, "\"nSIP\";cause=200;text=\"Ok\""));
-  /* Empty list */ 
+  /* Empty list */
   TEST_1(!sip_reason_make(home, ","));
   /* no protocol token */
   TEST_1(!sip_reason_make(home, "cause=16;text=\"call cleared\""));
@@ -3368,7 +3368,7 @@ static int test_warning(void)
 
   TEST_1(home = su_home_create());
 
-  TEST_1((w = sip_warning_make(home, 
+  TEST_1((w = sip_warning_make(home,
                               "399 host:5060 \"Ok\", "
                               "399 [::1]:39999 \"foo\\\" bar\"")));
   TEST(w->w_code, 399);
@@ -3383,7 +3383,7 @@ static int test_warning(void)
   TEST_S(w->w_text, "foo\" bar");
   TEST_1(w->w_next == NULL);
 
-  TEST_S(sip_header_as_string(home, (sip_header_t *)w), 
+  TEST_S(sip_header_as_string(home, (sip_header_t *)w),
         "399 [::1]:39999 \"foo\\\" bar\"");
 
   su_home_unref(home);
@@ -3406,7 +3406,7 @@ static int test_sec_ext(void)
 
   BEGIN();
 
-  msg = read_message(MSG_DO_EXTRACT_COPY, 
+  msg = read_message(MSG_DO_EXTRACT_COPY,
     "BYE sip:foo@bar SIP/2.0\r\n"
     "To: <sip:foo@bar>;tag=deadbeef\r\n"
     "From: <sip:bar@foo>;\r\n"
@@ -3419,7 +3419,7 @@ static int test_sec_ext(void)
   sip = sip_object(msg);
 
   TEST_1(home = msg_home(msg));
-  
+
   TEST_1(sac = sip_security_client_make(home, "digest;q=0.5,ipsec-3gpp"));
   TEST_S(sac->sa_mec, "digest");
   TEST_S(sac->sa_q, "0.5");
@@ -3458,7 +3458,7 @@ static int test_sec_ext(void)
 
   END();
 }
+
 
 static int test_utils(void)
 {
@@ -3492,23 +3492,23 @@ static int test_utils(void)
   TEST_S(f->a_url->url_params, "test=1");
 
   TEST_1(secs = sip_security_server_make(home, "Digest"));
-  TEST_1(secv = 
-        sip_security_verify_make(home, 
+  TEST_1(secv =
+        sip_security_verify_make(home,
                                  "Digest;"
                                  "d-ver=\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\""));
-  
+
   TEST_1(sip_security_verify_compare(secs, secv, &d_ver) == 0);
   TEST_S(d_ver, "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"");
 
-  TEST_1(secs = 
-        sip_security_server_make(home, 
+  TEST_1(secs =
+        sip_security_server_make(home,
                                  "TLS;q=1,"
                                  "Digest;q=0.1;"
                                  "d-alg=MD5;d-qop=\"auth,auth-int\","
                                  "Digest;d-alg=AKA-MD5;q=0.9"
                                  ));
-  TEST_1(secv = 
-        sip_security_verify_make(home, 
+  TEST_1(secv =
+        sip_security_verify_make(home,
                                  "TLS;q=1,"
                                  "Digest ; q = 0.1;"
                                  "d-ver=\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\";"
@@ -3521,12 +3521,12 @@ static int test_utils(void)
   TEST_1(sip_security_verify_compare(secs->sa_next, secv, &d_ver) != 0);
   TEST_1(sip_security_verify_compare(secs, secv->sa_next, &d_ver) != 0);
   d_ver = "kuik";
-  TEST_1(sip_security_verify_compare(secs->sa_next, secv->sa_next, &d_ver) 
+  TEST_1(sip_security_verify_compare(secs->sa_next, secv->sa_next, &d_ver)
         == 0);
   TEST_S(d_ver, "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"");
   d_ver = "kuik";
-  TEST_1(sip_security_verify_compare(secs->sa_next->sa_next, 
-                                    secv->sa_next->sa_next, &d_ver) 
+  TEST_1(sip_security_verify_compare(secs->sa_next->sa_next,
+                                    secv->sa_next->sa_next, &d_ver)
         == 0);
   TEST_1(d_ver == NULL);
 
@@ -3535,15 +3535,15 @@ static int test_utils(void)
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
-         "usage: %s [-v] [-a]\n", 
+  fprintf(stderr,
+         "usage: %s [-v] [-a]\n",
          name);
   exit(exitcode);
 }
 
 char *lastpart(char *path)
 {
-  if (strchr(path, '/')) 
+  if (strchr(path, '/'))
     return strrchr(path, '/') + 1;
   else
     return path;
index ae13413fa6477f0d7f8d6f713d6d7c97d02ba117..397a9bec035ee36363eea4eaa18eb1691918347c 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@internal @IFILE validator.c  
+/**@internal @IFILE validator.c
  *
  * SIP parser tester. This uses output from tport dump where messages are
  * separated with Control-K ('\v') from each other.
@@ -74,7 +74,7 @@ typedef struct {
   unsigned o_very_verbose : 1; /**< Be very verbose */
   unsigned o_requests : 1;     /**< Only requests */
   unsigned o_responses : 1;    /**< Only responses */
-  unsigned o_decode : 1;       /**< Only try to decode, 
+  unsigned o_decode : 1;       /**< Only try to decode,
                                   print error if unknown headers */
   unsigned o_print : 1;                /**< Print whole message */
   unsigned o_times : 1;                /**< Generate timing information */
@@ -107,7 +107,7 @@ double *histogram_update(histogram_t *h, uint32_t n)
 {
   if (h->bsize > 1)
     n /= h->bsize;
-    
+
   if (n < h->N)
     return &h->buckets[n];
   else
@@ -119,7 +119,7 @@ histogram_div(histogram_t *h, histogram_t const *n)
 {
   size_t i;
   assert(h->N == n->N); assert(h->bsize == n->bsize);
-  
+
   for (i = 0; i <= h->N; i++) {
     if (n->buckets[i]) {
       h->buckets[i] /= n->buckets[i];
@@ -165,8 +165,8 @@ typedef struct {
 
 void usage(void)
 {
-  fprintf(stderr, 
-         "usage: %s [-vdp]\n", 
+  fprintf(stderr,
+         "usage: %s [-vdp]\n",
          name);
   exit(2);
 }
@@ -175,7 +175,7 @@ char *lastpart(char *path)
 {
   char *p = strrchr(path, '/');
 
-  if (p) 
+  if (p)
     return p + 1;
   else
     return path;
@@ -204,23 +204,23 @@ int main(int argc, char *argv[])
     else if (argv[1][1] == 0) {
       argv++; break;
     }
-    else if (strcmp(argv[1], "-v") == 0) 
+    else if (strcmp(argv[1], "-v") == 0)
       o->o_very_verbose = o->o_verbose, o->o_verbose = 1;
-    else if (strcmp(argv[1], "-d") == 0) 
+    else if (strcmp(argv[1], "-d") == 0)
       o->o_decode = 1;         /* Decode only */
-    else if (strcmp(argv[1], "-p") == 0) 
+    else if (strcmp(argv[1], "-p") == 0)
       o->o_print = 1;
-    else if (strcmp(argv[1], "-q") == 0) 
+    else if (strcmp(argv[1], "-q") == 0)
       o->o_requests = 1;
-    else if (strcmp(argv[1], "-Q") == 0) 
+    else if (strcmp(argv[1], "-Q") == 0)
       o->o_responses = 1;
-    else if (strcmp(argv[1], "-t") == 0) 
+    else if (strcmp(argv[1], "-t") == 0)
       o->o_times = 1;
-    else if (strcmp(argv[1], "-m") == 0) 
+    else if (strcmp(argv[1], "-m") == 0)
       o->o_memstats = 1;
-    else if (strcmp(argv[1], "-s") == 0) 
+    else if (strcmp(argv[1], "-s") == 0)
       o->o_vsipstats = o->o_sipstats, o->o_sipstats = 1;
-    else if (strcmp(argv[1], "-h") == 0) 
+    else if (strcmp(argv[1], "-h") == 0)
       o->o_histogram = 1;
     else
       usage();
@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
     validate_file(0, "", ctx);
 
   report(ctx);
-  
+
   exit(0);
 }
 
@@ -289,11 +289,11 @@ int validate_file(int fd, char const *name, context_t *ctx)
   errno = EINVAL;
   perror("mmap not implemented");
   return -1;
-#endif    
+#endif
 
 }
 
-su_inline 
+su_inline
 void nul_terminate(char *b, off_t size)
 {
   char *end;
@@ -320,9 +320,9 @@ int search_msg(char **bb, char const *protocol)
       return 1;                        /* status */
 
     linelen = strcspn(b, "\r\n");
-    
-    if (linelen > plen + 1 && 
-       b[linelen - plen - 1] == ' ' && 
+
+    if (linelen > plen + 1 &&
+       b[linelen - plen - 1] == ' ' &&
        strncmp(b + linelen - plen, protocol, plen) == 0)
       return 1;                        /* request */
 
@@ -334,7 +334,7 @@ int search_msg(char **bb, char const *protocol)
 int validate_dump(char *b, off_t size, context_t *ctx)
 {
   size_t n = 0, N = 0;
-  struct message { 
+  struct message {
     char *b;
     int   size;
   } *msgs = NULL;
@@ -352,7 +352,7 @@ int validate_dump(char *b, off_t size, context_t *ctx)
     if (o->o_responses &&
        memcmp(b, SIP_VERSION_CURRENT, strlen(SIP_VERSION_CURRENT)) != 0)
       ;
-    else if (o->o_requests && 
+    else if (o->o_requests &&
        memcmp(b, SIP_VERSION_CURRENT, strlen(SIP_VERSION_CURRENT)) == 0)
       ;
     else {
@@ -361,7 +361,7 @@ int validate_dump(char *b, off_t size, context_t *ctx)
 
       if (n == N) {
        N *= 2; if (n == N) N = 16;
-      
+
        msgs = realloc(msgs, sizeof(*msgs) * N);
        if (msgs == NULL) {
          perror("realloc");
@@ -370,13 +370,13 @@ int validate_dump(char *b, off_t size, context_t *ctx)
       }
       msgs[n].b = b; msgs[n].size = msize;
       n++;
-      
+
       ctx->bytes += msize;
-      
+
       if (msize > maxsize)
        maxsize = msize;
     }
-    
+
     b += msize; if (*b) *b++ = '\0';
   }
 
@@ -408,16 +408,16 @@ int validate_dump(char *b, off_t size, context_t *ctx)
 
     if (o->o_memstats)
       su_home_init_stats(msg_home(msg));
-    
+
     msg_buf_set(msg, msgs[n].b, msgs[n].size + 1);
     msg_buf_commit(msg, msgs[n].size, 1);
-    
+
     su_home_preload(msg_home(msg), 1, msgs[n].size + 384);
 
     m = msg_extract(msg);
 
     if (m < 0) {
-      fprintf(stderr, "%s%sparsing error in message "MOD_ZU"\n", 
+      fprintf(stderr, "%s%sparsing error in message "MOD_ZU"\n",
              ctx->name, ctx->sep, n);
       ctx->errors++;
     }
@@ -434,7 +434,7 @@ int validate_dump(char *b, off_t size, context_t *ctx)
 
     msg_destroy(msg);
   }
-  
+
   time1 = su_nanocounter();
 
   if (o->o_times) {
@@ -470,7 +470,7 @@ void report_memstats(char const *title, su_home_stat_t const hs[1])
           (ull)hs->hs_frees.hsf_number, (ull)hs->hs_frees.hsf_bytes,
           (ull)hs->hs_frees.hsf_rbytes);
   if (hs->hs_rehash || hs->hs_clones)
-    printf("\t"LLU" rehashes, "LLU" clones\n", 
+    printf("\t"LLU" rehashes, "LLU" clones\n",
           (ull)hs->hs_rehash, (ull)hs->hs_clones);
 }
 
@@ -506,11 +506,11 @@ void memstats(msg_t *msg, uint32_t msize, context_t *ctx)
 void report_sipstat(char const *what, sipstat_t const *sss)
 {
   printf("%s: "LLU" with %.1f headers (total "LLU")\n",
-        what, (ull)sss->number, (double)sss->headers / sss->number, 
+        what, (ull)sss->number, (double)sss->headers / sss->number,
         (ull)sss->headers);
   if (sss->payloads)
     printf("\t"LLU" with body of %.1f bytes (total "LLU")\n",
-          (ull)sss->payloads, (double)sss->pl_bytes / sss->payloads, 
+          (ull)sss->payloads, (double)sss->pl_bytes / sss->payloads,
           (ull)sss->payloads);
 }
 
@@ -541,7 +541,7 @@ void sipstats(msg_t *msg, uint32_t msize, sipstats_t *ss, context_t *ctx)
   sss->number++;
 
   /* Count headers */
-  for (n = 0, h = h->sh_succ; h && !sip_is_separator((sip_header_t *)h); h = h->sh_succ) 
+  for (n = 0, h = h->sh_succ; h && !sip_is_separator((sip_header_t *)h); h = h->sh_succ)
     n++;
 
   sss->headers += n;
@@ -574,7 +574,7 @@ void report_histogram(char const *title, histogram_t const *h)
   for (i = h->N - 1; i >= 0 && h->buckets[i] == 0.0; i--)
     ;
   max_i = i;
-  
+
   if (min_i >= max_i)
     return;
 
@@ -600,7 +600,7 @@ int report(context_t const *ctx)
   if (ctx->hist_msgsize)
     report_histogram("Message size", ctx->hist_msgsize);
 
-  if (o->o_times && ctx->files > 1) 
+  if (o->o_times && ctx->files > 1)
     printf("total "LLU" messages in %g seconds (%g msg/sec)\n",
           (ull)n, ctx->time, (double)n / ctx->time);
 
@@ -620,7 +620,7 @@ int report(context_t const *ctx)
 
     *hs = *ctx->hs;
     report_memstats("total", hs);
-    
+
     /* Calculate mean */
     hs->hs_clones /= n; hs->hs_rehash /= n;
     hs->hs_allocs.hsa_number /= n; hs->hs_allocs.hsa_bytes /= n;
@@ -632,7 +632,7 @@ int report(context_t const *ctx)
 
     report_memstats("mean", hs);
 
-    printf("\testimator fails %.1f%% times (mean slack %.0f bytes)\n", 
+    printf("\testimator fails %.1f%% times (mean slack %.0f bytes)\n",
           100 * (double)ctx->est_fail / (ctx->est_fail + ctx->est_succ),
           (double)ctx->est_slack / ctx->est_succ);
 
index d48356d3e7c6e3395cac76b353f159d9f15b075e..f6ea1333056d8e63ff1c8efbc5df98e0f60a7d87 100644 (file)
@@ -17,7 +17,7 @@
 2005-10-15  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
   * Updated API of soa_get_local_sdp() and friends.
-  
+
   Added parameter for returning SDP C structure to soa_get_capability_sdp(),
   soa_get_remote_sdp(), soa_get_user_sdp(), and soa_get_local_sdp().
 
     M ./libsofia-sip-ua/soa/test_soa.c -2 +2
 
 2005-10-12  Pekka Pessi  <Pekka.Pessi@nokia.com>
-       
+
   * Updated SOA_VALID_ACTIONS().
 
     M ./libsofia-sip-ua/soa/soa.c -1 +13
-             
+
   * Added soa_name.
 
     M ./libsofia-sip-ua/soa/soa.c +1
index 158b7d9683326e6c3166f4f65200d60be2898750..b641d77b1b3193381b1a524c4c426679667bf303 100644 (file)
@@ -1,7 +1,7 @@
 PROJECT_NAME         = "soa"
 OUTPUT_DIRECTORY     = ../docs/html/soa
 
-INPUT               = @srcdir@/soa.docs @srcdir@/sofia-sip/soa.h 
+INPUT               = @srcdir@/soa.docs @srcdir@/sofia-sip/soa.h
 INPUT               += @srcdir@/sofia-sip/soa_add.h @srcdir@/soa.c
 INPUT              += @srcdir@/sofia-sip/soa_tag.h @srcdir@/soa_tag.c
 
index 2bcdaf0238aa577fba89e1c3faea5cc42b073407..ddd11b5b9db455b9cace4c2c61a60346ae1d19b5 100644 (file)
@@ -35,7 +35,7 @@ nobase_include_sofia_HEADERS = \
                        sofia-sip/soa_add.h sofia-sip/soa_tag.h
 
 libsoa_la_SOURCES =    soa.c soa_static.c \
-                       soa_tag.c soa_tag_ref.c 
+                       soa_tag.c soa_tag_ref.c
 
 COVERAGE_INPUT =       $(libsoa_la_SOURCES) $(include_sofia_HEADERS)
 
index 8e62cf4b61a07f011ee278a791ca7f13c6e7b866..10622baf17c17eeaa2033f612656fc44a2c64bc5 100644 (file)
@@ -72,13 +72,13 @@ static char const __func__[] = "soa";
 /* Internal prototypes */
 su_inline int soa_media_is_ready(soa_session_t const *ss);
 
-enum soa_sdp_kind { 
+enum soa_sdp_kind {
   soa_capability_sdp_kind,
   soa_user_sdp_kind,
   soa_remote_sdp_kind
 };
 
-static int soa_set_sdp(soa_session_t *ss, 
+static int soa_set_sdp(soa_session_t *ss,
                       enum soa_sdp_kind what,
                       sdp_session_t const *sdp0,
                       char const *sdp_str, issize_t str_len);
@@ -247,7 +247,7 @@ soa_session_t *soa_create(char const *name,
     return (void)su_seterrno(EFAULT), NULL;
 
   namelen = strlen(name) + 1;
-  
+
   ss = su_home_new(actions->sizeof_soa_session + namelen);
   if (ss) {
     ss->ss_root = root;
@@ -520,7 +520,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
     }
   }
 
-  if (af < SOA_AF_ANY || af > SOA_AF_IP6_IP4) 
+  if (af < SOA_AF_ANY || af > SOA_AF_IP6_IP4)
     af = ss->ss_af;
 
   if (rtp_select < SOA_RTP_SELECT_SINGLE || rtp_select > SOA_RTP_SELECT_ALL)
@@ -533,7 +533,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
   srtp_confidentiality = srtp_confidentiality != 0;
   srtp_integrity = srtp_integrity != 0;
 
-  change_session 
+  change_session
     =  af != (int)ss->ss_af
     || rtp_select != (int)ss->ss_rtp_select
     || rtp_sort != (int)ss->ss_rtp_sort
@@ -705,8 +705,8 @@ tagi_t *soa_get_paramlist(soa_session_t const *ss,
 
 
 /** Base bethod for getting list of parameters. */
-tagi_t *soa_base_get_paramlist(soa_session_t const *ss, 
-                              tag_type_t tag, tag_value_t value, 
+tagi_t *soa_base_get_paramlist(soa_session_t const *ss,
+                              tag_type_t tag, tag_value_t value,
                               ...)
 {
   ta_list ta;
@@ -714,7 +714,7 @@ tagi_t *soa_base_get_paramlist(soa_session_t const *ss,
 
   if (ss == NULL)
     return NULL;
-  
+
   ta_start(ta, tag, value);
 
   params = tl_llist(
@@ -739,7 +739,7 @@ tagi_t *soa_base_get_paramlist(soa_session_t const *ss,
                          SOATAG_REMOTE_SDP_STR(ss->ss_remote->ssd_unparsed)),
 
                   SOATAG_AF(ss->ss_af),
-                  TAG_IF(ss->ss_address, 
+                  TAG_IF(ss->ss_address,
                          SOATAG_ADDRESS(ss->ss_address)),
 
                   SOATAG_SRTP_ENABLE(ss->ss_srtp_enable),
@@ -755,7 +755,7 @@ tagi_t *soa_base_get_paramlist(soa_session_t const *ss,
 
 #include <sofia-sip/sip_status.h>
 
-/** Convert @soa error to a SIP response code and phrase. */ 
+/** Convert @soa error to a SIP response code and phrase. */
 int soa_error_as_sip_response(soa_session_t *ss,
                              char const **return_phrase)
 {
@@ -773,7 +773,7 @@ int soa_error_as_sip_response(soa_session_t *ss,
   return ss->ss_status;
 }
 
-/** Convert @soa error to a SIP @Reason header. */ 
+/** Convert @soa error to a SIP @Reason header. */
 char const *soa_error_as_sip_reason(soa_session_t *ss)
 {
   char const *phrase;
@@ -789,7 +789,7 @@ char const *soa_error_as_sip_reason(soa_session_t *ss)
   status = soa_error_as_sip_response(ss, &phrase);
 
   reason = su_sprintf(ss->ss_home, "SIP;cause=%u;text=\"%s\"", status, phrase);
-  
+
   if (ss->ss_reason)
     su_free(ss->ss_home, reason);
 
@@ -815,7 +815,7 @@ int soa_get_warning(soa_session_t *ss, char const **return_text)
 /** Return SDP description of capabilities.
  *
  * @param ss  pointer to @soa session
- * @param return_sdp      return value for capability SDP structure 
+ * @param return_sdp      return value for capability SDP structure
  * @param return_sdp_str  return value for capability SDP string
  * @param return_len  return value for length of capability SDP string
  *
@@ -823,8 +823,8 @@ int soa_get_warning(soa_session_t *ss, char const **return_text)
  * @retval 1 if description is returned
  * @retval -1 upon an error
  *
- * @sa @RFC3261 section 11, soa_set_capability_sdp(), 
- * SOATAG_CAPS_SDP(), SOATAG_CAPS_SDP_STR(), 
+ * @sa @RFC3261 section 11, soa_set_capability_sdp(),
+ * SOATAG_CAPS_SDP(), SOATAG_CAPS_SDP_STR(),
  * nua_options(), #nua_i_options
  */
 int soa_get_capability_sdp(soa_session_t const *ss,
@@ -858,10 +858,10 @@ int soa_get_capability_sdp(soa_session_t const *ss,
 }
 
 
-/** Set capability SDP. 
+/** Set capability SDP.
  *
  * Capability SDP is used instead of user SDP when generating OPTIONS
- * responses describing media capabilities. 
+ * responses describing media capabilities.
  *
  * @param ss  pointer to @soa session
  * @param sdp pointer to SDP session structure
@@ -874,10 +874,10 @@ int soa_get_capability_sdp(soa_session_t const *ss,
  * @retval -1 upon an error
  *
  * @sa @RFC3261 section 11, soa_get_capability_sdp(),
- * SOATAG_CAPS_SDP(), SOATAG_CAPS_SDP_STR(), 
+ * SOATAG_CAPS_SDP(), SOATAG_CAPS_SDP_STR(),
  * nua_options(), #nua_i_options
  */
-int soa_set_capability_sdp(soa_session_t *ss, 
+int soa_set_capability_sdp(soa_session_t *ss,
                           struct sdp_session_s const *sdp,
                           char const *str, issize_t len)
 {
@@ -888,7 +888,7 @@ int soa_set_capability_sdp(soa_session_t *ss,
 }
 
 /** Set capabilities */
-int 
+int
 soa_base_set_capability_sdp(soa_session_t *ss,
                            sdp_session_t *_sdp,
                            char const *str0, isize_t len0)
@@ -947,12 +947,12 @@ soa_base_set_capability_sdp(soa_session_t *ss,
  *
  * @param ss  pointer to @soa session
  * @param return_sdp SDP  session structure return value
- * @param return_sdp_str  return value for pointer to string 
+ * @param return_sdp_str  return value for pointer to string
  *                        containing the user SDP session description
  * @param return_len  return value for user SDP session description string
- *                    length 
+ *                    length
  *
- * Any of the parameters @a return_sdp, @a return_sdp_str, or @a return_len 
+ * Any of the parameters @a return_sdp, @a return_sdp_str, or @a return_len
  * may be NULL.
  *
  * @retval 0 if there is no description to return
@@ -1008,9 +1008,9 @@ int soa_get_user_version(soa_session_t const *ss)
 {
   assert(ss != NULL);
   return ss ? (int)ss->ss_user_version : -1;
-} 
+}
 
-/**Store user SDP to soa session. 
+/**Store user SDP to soa session.
  *
  * User SDP is used as basis for SDP Offer/Answer negotiation. It can be
  * very minimal, consisting just m= line containing media name, transport
@@ -1039,7 +1039,7 @@ int soa_get_user_version(soa_session_t const *ss)
  * soa_generate_answer(), soa_get_local_sdp(), soa_set_capability_sdp(),
  * soa_set_remote_sdp()
  */
-int soa_set_user_sdp(soa_session_t *ss, 
+int soa_set_user_sdp(soa_session_t *ss,
                     struct sdp_session_s const *sdp,
                     char const *str, issize_t len)
 {
@@ -1050,7 +1050,7 @@ int soa_set_user_sdp(soa_session_t *ss,
 }
 
 /** Set user SDP (base version). */
-int soa_base_set_user_sdp(soa_session_t *ss, 
+int soa_base_set_user_sdp(soa_session_t *ss,
                          sdp_session_t *sdp, char const *str0, isize_t len0)
 {
   ++ss->ss_user_version;
@@ -1064,12 +1064,12 @@ int soa_base_set_user_sdp(soa_session_t *ss,
  *
  * @param ss  pointer to @soa session
  * @param return_sdp SDP  session structure return value
- * @param return_sdp_str  return value for pointer to string 
+ * @param return_sdp_str  return value for pointer to string
  *                        containing the user SDP session description
  * @param return_len  return value for user SDP session descrioption string
- *                    length 
+ *                    length
  *
- * Any of the parameters @a return_sdp, @a return_sdp_str, or @a return_len 
+ * Any of the parameters @a return_sdp, @a return_sdp_str, or @a return_len
  * may be NULL.
  *
  * @retval 0 if there is no description to return
@@ -1125,11 +1125,11 @@ int soa_get_remote_version(soa_session_t const *ss)
 {
   assert(ss != NULL);
   return ss->ss_remote_version;
-} 
+}
 
 /** Set remote SDP (offer or answer).
  *
- * <i>Remote SDP</i> is an SDP offer or answer received from the remote end. 
+ * <i>Remote SDP</i> is an SDP offer or answer received from the remote end.
  * It is used together with <i>User SDP</i> as basis for SDP Offer/Answer
  * negotiation in soa_generate_answer() or soa_process_answer(). Remote SDP
  * can be set using soa_set_params() and SOATAG_REMOTE_SDP() or
@@ -1158,7 +1158,7 @@ int soa_get_remote_version(soa_session_t const *ss)
  * soa_clear_remote_sdp(), soa_init_offer_answer(), soa_get_local_sdp(),
  * soa_set_user_sdp(), soa_set_capability_sdp().
  */
-int soa_set_remote_sdp(soa_session_t *ss, 
+int soa_set_remote_sdp(soa_session_t *ss,
                       struct sdp_session_s const *sdp,
                       char const *str, issize_t len)
 {
@@ -1178,11 +1178,11 @@ int soa_base_set_remote_sdp(soa_session_t *ss,
 
   if (!new_version)
     return 0;
-    
+
   soa_set_activity(ss, sdp->sdp_media, soa_activity_remote);
 
   ss->ss_remote_version++;
-  
+
   return soa_description_set(ss, ss->ss_remote, sdp, str0, len0);
 }
 
@@ -1236,12 +1236,12 @@ int soa_has_received_sdp(soa_session_t const *ss)
  *
  * @param ss  pointer to @soa session
  * @param return_sdp SDP  session structure return value
- * @param return_sdp_str  return value for pointer to string 
+ * @param return_sdp_str  return value for pointer to string
  *                        containing the user SDP session description
  * @param return_len  return value for user SDP session descrioption string
- *                    length 
+ *                    length
  *
- * Any of the parameters @a return_sdp, @a return_sdp_str, or @a return_len 
+ * Any of the parameters @a return_sdp, @a return_sdp_str, or @a return_len
  * may be NULL.
  *
  * @retval 0 if there is no description to return
@@ -1398,7 +1398,7 @@ int soa_base_remote_sip_features(soa_session_t *ss,
  * SOATAG_LOCAL_SDP() or SOATAG_LOCAL_SDP_STR().
  *
  * The user SDP has been stored to the soa session with soa_set_user_sdp()
- * or with soa_set_params() tags SOATAG_USER_SDP() or SOATAG_USER_SDP_STR(). 
+ * or with soa_set_params() tags SOATAG_USER_SDP() or SOATAG_USER_SDP_STR().
  * There are various other parameters directing the generation of offer, set
  * by soa_set_params().
  *
@@ -1566,7 +1566,7 @@ int soa_base_generate_answer(soa_session_t *ss,
   return 0;
 }
 
-/** Complete offer-answer after receiving answer. 
+/** Complete offer-answer after receiving answer.
  *
  * The SDP offer/answer negotiation is completed after receiving answer from
  * remote end. The answer is combined with the offer, and the application
@@ -1597,7 +1597,7 @@ int soa_process_answer(soa_session_t *ss,
   if (ss->ss_in_progress)
     return su_seterrno(EALREADY), -1;
 
-  /** @ERROR EPROTO We have not sent an offer 
+  /** @ERROR EPROTO We have not sent an offer
       or already have received answer. */
   if (!ss->ss_offer_sent || ss->ss_answer_recv)
     return su_seterrno(EPROTO), -1;
@@ -1647,7 +1647,7 @@ int soa_base_process_answer(soa_session_t *ss,
   return 0;
 }
 
-/** Process rejection of offer. 
+/** Process rejection of offer.
  *
  * If the SDP offer was rejected (e.g., an offer in re-INVITE asked remote
  * end to add video to the session but the request was rejected), the
@@ -1678,7 +1678,7 @@ int soa_process_reject(soa_session_t *ss,
   if (ss->ss_in_progress)
     return su_seterrno(EALREADY), -1;
 
-  /** @ERROR EPROTO We have not sent an offer 
+  /** @ERROR EPROTO We have not sent an offer
       or already have received answer. */
   if (!ss->ss_offer_sent || ss->ss_answer_recv)
     return su_seterrno(EPROTO), -1;
@@ -1713,7 +1713,7 @@ int soa_base_process_reject(soa_session_t *ss,
   return 0;
 }
 
-/** Activate session. 
+/** Activate session.
  *
  * Mark soa session as active.
  *
@@ -1982,7 +1982,7 @@ void soa_set_activity(soa_session_t *ss,
 
 /**
  * Parses and stores session description
- * 
+ *
  * @param ss instance pointer
  * @param what caps, local or remote
  * @param sdp0 new sdp (parsed)
@@ -1990,7 +1990,7 @@ void soa_set_activity(soa_session_t *ss,
  * @param str_len length on unparsed data
  **/
 static
-int soa_set_sdp(soa_session_t *ss, 
+int soa_set_sdp(soa_session_t *ss,
                enum soa_sdp_kind what,
                sdp_session_t const *sdp0,
                char const *sdp_str, issize_t str_len)
@@ -2037,17 +2037,17 @@ int soa_set_sdp(soa_session_t *ss,
     if (what == soa_remote_sdp_kind) {
       *sdp = *ssd->ssd_sdp;
       /* Calls soa_static_set_remote_sdp() by default */
-      return ss->ss_actions->soa_set_remote_sdp(ss, new_version, 
+      return ss->ss_actions->soa_set_remote_sdp(ss, new_version,
                                                sdp, sdp_str, str_len);
       /* XXX - should check changes by soa_set_remote_sdp */
     }
     return 0;
-  } 
+  }
 
   if (sdp0) {
     /* note: case 1 - src in parsed form */
     *sdp = *sdp0;
-  } 
+  }
   else /* if (sdp_str) */ {
     /* note: case 2 - src in unparsed form */
     parser = sdp_parse(ss->ss_home, sdp_str, str_len, flags | sdp_f_anynet);
@@ -2059,7 +2059,7 @@ int soa_set_sdp(soa_session_t *ss,
 
     *sdp = *sdp_session(parser);
   }
+
   switch (what) {
   case soa_capability_sdp_kind:
     /* Calls soa_static_set_capability_sdp() by default */
@@ -2110,7 +2110,7 @@ int soa_description_set(soa_session_t *ss,
     sdp_str0_new = su_strndup(ss->ss_home, sdp_str, str_len);
   else
     sdp_str0_new = sdp_str_new;
-  
+
   if (sdp_new && printer && sdp_str_new && sdp_str0_new) {
     tbf1 = ssd->ssd_sdp, tbf2 = ssd->ssd_printer;
     tbf3 = (void *)ssd->ssd_str, tbf4 = (void *)ssd->ssd_unparsed;
@@ -2118,14 +2118,14 @@ int soa_description_set(soa_session_t *ss,
     ssd->ssd_sdp = sdp_new;
     ssd->ssd_printer = printer;
     ssd->ssd_str = sdp_str_new;
-    ssd->ssd_unparsed = sdp_str0_new;      
+    ssd->ssd_unparsed = sdp_str0_new;
 
     retval = 1;
   }
   else {
     tbf1 = sdp_new, tbf2 = printer, tbf3 = sdp_str_new, tbf4 = sdp_str0_new;
   }
-  
+
   su_free(ss->ss_home, tbf1);
   sdp_printer_free(tbf2);
   if (tbf3 != tbf4)
@@ -2136,7 +2136,7 @@ int soa_description_set(soa_session_t *ss,
 
 
 /** Duplicate a session descriptions. */
-int soa_description_dup(su_home_t *home, 
+int soa_description_dup(su_home_t *home,
                        struct soa_description *ssd,
                        struct soa_description const *ssd0)
 {
@@ -2154,7 +2154,7 @@ int soa_description_dup(su_home_t *home,
 }
 
 /** Free session descriptions. */
-void soa_description_free(soa_session_t *ss, 
+void soa_description_free(soa_session_t *ss,
                          struct soa_description *ssd)
 {
   void *tbf1, *tbf2, *tbf3, *tbf4;
@@ -2257,12 +2257,12 @@ soa_init_sdp_connection(soa_session_t *ss,
     /* Use the application-specified address -
      * do not check that it is found from the local address list */
     c->c_nettype = sdp_net_in;
-    
+
     if (host_is_ip4_address(address))
       c->c_addrtype = sdp_addr_ip4;
     else
       c->c_addrtype = sdp_addr_ip6;
-    
+
     if (!host_is_ip6_reference(address)) {
       c->c_address = strcpy(buffer, address);
     }
@@ -2270,7 +2270,7 @@ soa_init_sdp_connection(soa_session_t *ss,
       /* Remove brackets [] around the reference */
       size_t len = strlen(address + 1);
       c->c_address = memcpy(buffer, address + 1, len - 1);
-      buffer[len - 1] = '\0'; 
+      buffer[len - 1] = '\0';
     }
     return 0;
   }
@@ -2299,7 +2299,7 @@ soa_init_sdp_connection(soa_session_t *ss,
   }
 
   for (res = NULL; res == NULL;) {
-    if ((error = su_getlocalinfo(hints, &res)) < 0 
+    if ((error = su_getlocalinfo(hints, &res)) < 0
        && error != ELI_NOADDRESS) {
       SU_DEBUG_1(("%s: su_localinfo: %s\n", __func__,
                  su_gli_strerror(error)));
index a53ef420736eabefb15e7576a21a007d5443489d..88e131b66c49f5e6a93b8610c916f1a8fb7e476c 100644 (file)
@@ -15,7 +15,7 @@ library. The interface to library is defined in <sofia-sip/soa.h>.
 
 SIP uses SDP and a negotiation procedure known as "SDP
 Offer-Answer Model" to establish the multimedia sessions. The
-SDP Offer-Answer negotiation is specified in 
+SDP Offer-Answer negotiation is specified in
 <a href="http://ietf.org/rfc/rfc3264.txt">RFC 3264</a>.
 
 The soa engine is implemented in object-oriented manner. The default soa
@@ -32,17 +32,17 @@ The basic capabilities provided by Offer/Answer mechanism include
 -# modifying session (section 8)
 -# indicating capabilities (section 9)
 
-The offerer indicates its capabilities in the offer: 
+The offerer indicates its capabilities in the offer:
 - the media streams it wants to establish
-- transport addresses it uses to receive by media streams 
-  (IP addresses, port numbers, transport protocols) 
+- transport addresses it uses to receive by media streams
+  (IP addresses, port numbers, transport protocols)
 - the codecs used by particular streams
 - codec parameters (for instance, codec profile used by H.263)
 
 The answerer indicates which parts of the offer are acceptable to
 it in the answer:
 - the media streams it agrees to establish
-- transport addresses answerer uses to receive by media streams 
+- transport addresses answerer uses to receive by media streams
 - the codecs and codec parameters used by particular streams
 
 Note that the capabilites indicate what the party generating the
@@ -57,24 +57,24 @@ involving two or more offer-answer rounds. For instance, an extension known
 as session <i>preconditions</i> is defined
 <a href="http://ietf.org/rfc/rfc3312.txt">RFC 3312</a>.
 Another example of two-phase negotiation is presented in RFC
-3264 section 10.2, showing how a single codec can be selected. 
+3264 section 10.2, showing how a single codec can be selected.
 
-@section soa_motivation SOA Design 
+@section soa_motivation SOA Design
 
 Why to have simple interface? Is it not simple enough to include SDP offer
 with your INVITE, and act on SDP answer in 200 OK?
 
 Our design goal is to allow application to follow the simple call
 model, regardless of the underlying complications - early
-sessions, preconditions, session timers, 3rd party call control. 
+sessions, preconditions, session timers, 3rd party call control.
 In other words, we would like a have a simple "cooked" interface
 toward naive applications even if the underlying call follows the
 byzantine call model chosen by 3GPP.
 
 @section soa_with_sip Using SDP Offer/Answer with SIP
 
-Using SDP Offer/Answer with SIP is specified in 
-<a href="http://ietf.org/rfc/rfc3261.txt">RFC 3261</a>, 
+Using SDP Offer/Answer with SIP is specified in
+<a href="http://ietf.org/rfc/rfc3261.txt">RFC 3261</a>,
 <a href="http://ietf.org/rfc/rfc3262.txt">RFC 3262 (100rel and PRACK)</a>, and
 <a href="http://ietf.org/rfc/rfc3211.txt">RFC 3311 (UPDATE)</a>.
 
@@ -90,7 +90,7 @@ The rules for sending offers:
 
 PRACK may only be sent when an unacknowledged 100rel (reliable 1XX
 series response) is received. UPDATE may be sent during early or
-established dialog. 
+established dialog.
 
 Only one INVITE request may be pending within a dialog. Only one
 non-INVITE request may be pending within a dialog (in one
@@ -120,13 +120,13 @@ The rules for receiving answer:
 - if offer was sent in INVITE, first session description in any
   non-error response to INVITE is treated as the answer
 - if offer was sent in 2XX response, session description in
-  ACK is answer 
+  ACK is answer
 - if offer was sent in 100rel response, session description in
-  PRACK is answer 
-- if offer was sent in PRACK or UPDATE, session description in 
+  PRACK is answer
+- if offer was sent in PRACK or UPDATE, session description in
   2XX response is answer
 
-Rules for situations when endpoint MUST ignore the SDP: 
+Rules for situations when endpoint MUST ignore the SDP:
 - If offer was sent in INVITE, only the first session description in
   any non-error (1XX or 2XX) response to INVITE is processed, rest
   are ignored
@@ -146,7 +146,7 @@ permission (for adding video).
 
 Rules for resolving glare (both endpoints trying to send offer at the same
 time):
-- if a offer is received while UAS has generated an offer, 
+- if a offer is received while UAS has generated an offer,
   it must be rejected (with SIP 491 response).
 
 @section soa_use_cases SOA and SDP Offer/Answer Scenarios
@@ -154,11 +154,11 @@ time):
 Note that due to limitations in space
 - soa_set_params() is referred as @c set_params
 - soa_set_remote_sdp() is referred as @c set_remote
-- soa_generate_offer() followed by soa_get_session_sdp() 
-  is referred as @c gen_offer  
-- soa_generate_answer() followed by soa_get_session_sdp() 
-  is referred as @c gen_answer 
-- soa_process_answer() is referred as @c proc_answer 
+- soa_generate_offer() followed by soa_get_session_sdp()
+  is referred as @c gen_offer
+- soa_generate_answer() followed by soa_get_session_sdp()
+  is referred as @c gen_answer
+- soa_process_answer() is referred as @c proc_answer
 
 @subsection soa_uc_basic_out Basic Call Out
 
@@ -228,7 +228,7 @@ This is the "basic" inbound call model.
        |               |               |                       |
 </pre>
 
-@subsection soa_uc_basic_3p 3rd Party Call In 
+@subsection soa_uc_basic_3p 3rd Party Call In
 
 The 3rd-party call model just reverses the O/A roles of callee and caller.
 
@@ -442,10 +442,10 @@ media session has been successfully established.
 @page soa_sdp_oa_use_cases Use Cases for SIP and SDP Offer/Answer
 
 This page contains a list of use cases or call scenarios for SIP and SDP
-Offer/Answer. 
+Offer/Answer.
 
 There are a few call scenarios that we expect to see when dealing with more
-telephone-like side of SIP: 
+telephone-like side of SIP:
 - calling to existing PSTN networks (early session)
 - doing resource reservations
 - calling to 3G IMS
@@ -531,9 +531,9 @@ is used when the session should be established before call alerts.
 
 @section soa_use_case_4 Case #4: UPDATE with Offer
 
-This is a call model with two rounds of offer/answer and 100rel. 
+This is a call model with two rounds of offer/answer and 100rel.
 It can be used, for instance, when the endpoints have to make sure
-that there are enough network capacity for the call to succeed. 
+that there are enough network capacity for the call to succeed.
 They can establish a new radio bearer, for instance, before
 progressing with the call. The initial offer would contain SDP
 attribute "inactive", the second "sendrev":
@@ -542,9 +542,9 @@ attribute "inactive", the second "sendrev":
        A                       B
        |                       |
        |----INVITE (offer)---->|
-       |                       | 
-       |                       | 
-       |<----183 (answer)------| 
+       |                       |
+       |                       |
+       |<----183 (answer)------|
        |--------PRACK--------->|
        |<-----200/PRACK--------|
        |                       |
@@ -594,7 +594,7 @@ the second "sendrev":
 </pre>
 
 
-@section soa_use_case_6 Case #6: Callee Making 2nd Offer 
+@section soa_use_case_6 Case #6: Callee Making 2nd Offer
 
 Alternative 2 to above: two rounds of offer/answer and 100rel, but
 now it is B who wants to do two rounds and initiates second
@@ -636,9 +636,9 @@ codecs and transport addresses used during the call:
                A                       B
                |                       |
                |----INVITE (offer)---->|
-               |                       | 
-               |                       | 
-               |<----183 (answer)------| 
+               |                       |
+               |                       |
+               |<----183 (answer)------|
                |-----PRACK(offer2)---->|
                |<--200/PRACK(answer2)--|
                |                       |
@@ -718,7 +718,7 @@ establishes the call:
 
 @section soa_use_case_10 Case #10: Upgrade Session with Re-INVITE
 
-The session is upgraded: a new media is added to the session. 
+The session is upgraded: a new media is added to the session.
 
 <pre>
        A                       B
@@ -775,7 +775,7 @@ The session upgraded is rejected.
 
 /** @typedef struct soa_session soa_session_t;
 
-@brief "soa" session object. 
+@brief "soa" session object.
 
 The @soa session object is responsible for
 @ref soa_with_sip "SDP offer/answer negotiation"
@@ -796,7 +796,7 @@ void soa_destroy(soa_session_t *);
 @code
 int soa_set_params(soa_session_t *ss,
                    tag_type_t tag, tag_value_t value, ...);
-int soa_get_params(soa_session_t const *ss, 
+int soa_get_params(soa_session_t const *ss,
                    tag_type_t tag, tag_value_t value, ...);
 
 tagi_t *soa_get_paramlist(soa_session_t const *ss,
@@ -805,7 +805,7 @@ tagi_t *soa_get_paramlist(soa_session_t const *ss,
 
 @par Functions used to obtain status information from "soa" session objects:
 @code
-int soa_error_as_sip_response(soa_session_t *soa, 
+int soa_error_as_sip_response(soa_session_t *soa,
                               char const **return_phrase);
 
 char const *soa_error_as_sip_reason(soa_session_t *soa);
@@ -814,9 +814,9 @@ int soa_get_warning(soa_session_t *ss, char const **return_phrase);
 @endcode
 
 
-@par Functions used to store and retrieve SDP descriptions: 
+@par Functions used to store and retrieve SDP descriptions:
 @code
-int soa_set_capability_sdp(soa_session_t *ss, 
+int soa_set_capability_sdp(soa_session_t *ss,
                            struct sdp_session_s const *sdp,
                            char const *str, issize_t len);
 
@@ -825,7 +825,7 @@ int soa_get_capability_sdp(soa_session_t const *ss,
                            char const **return_sdp_str,
                            isize_t *return_len);
 
-int soa_set_remote_sdp(soa_session_t *ss, 
+int soa_set_remote_sdp(soa_session_t *ss,
                        struct sdp_session_s const *sdp,
                        char const *str, issize_t len);
 
@@ -838,7 +838,7 @@ int soa_clear_remote_sdp(soa_session_t *ss);
 
 int soa_get_remote_version(soa_session_t const *ss);
 
-int soa_set_user_sdp(soa_session_t *ss, 
+int soa_set_user_sdp(soa_session_t *ss,
                      struct sdp_session_s const *sdp,
                      char const *str, issize_t len);
 
index 5fd5b60506e5e014dc99581105831d9b7b8bab8a..ec2afadb2a896370d41492f42a1624bbfb9eab74 100644 (file)
  *    a) generating offer (upgrade with user-SDP)
  *    b) generating answer (upgrade with remote-SDP, rejects with user-SDP)
  *  2. session exists
- *    a) generating offer: 
+ *    a) generating offer:
  *       upgrades with user-SDP
- *    b) generating answer: 
+ *    b) generating answer:
  *       upgrades with remote-SDP, rejects with user-SDP
- *    c) processing answer: 
+ *    c) processing answer:
  *       rejects with user-SDP, no upgrades
  *
  * Upgrading session with user SDP:
@@ -101,16 +101,16 @@ static void soa_static_deinit(soa_session_t *);
 static int soa_static_set_params(soa_session_t *ss, tagi_t const *tags);
 static int soa_static_get_params(soa_session_t const *ss, tagi_t *tags);
 static tagi_t *soa_static_get_paramlist(soa_session_t const *ss,
-                                       tag_type_t tag, tag_value_t value, 
+                                       tag_type_t tag, tag_value_t value,
                                        ...);
-static int soa_static_set_capability_sdp(soa_session_t *ss, 
+static int soa_static_set_capability_sdp(soa_session_t *ss,
                                       sdp_session_t *sdp,
                                       char const *, isize_t);
-static int soa_static_set_remote_sdp(soa_session_t *ss, 
+static int soa_static_set_remote_sdp(soa_session_t *ss,
                                   int new_version,
                                   sdp_session_t *sdp,
                                   char const *, isize_t);
-static int soa_static_set_user_sdp(soa_session_t *ss, 
+static int soa_static_set_user_sdp(soa_session_t *ss,
                                   sdp_session_t *sdp,
                                   char const *, isize_t);
 static int soa_static_generate_offer(soa_session_t *ss, soa_callback_f *);
@@ -122,7 +122,7 @@ static int soa_static_activate(soa_session_t *ss, char const *option);
 static int soa_static_deactivate(soa_session_t *ss, char const *option);
 static void soa_static_terminate(soa_session_t *ss, char const *option);
 
-struct soa_session_actions const soa_default_actions = 
+struct soa_session_actions const soa_default_actions =
   {
     (sizeof soa_default_actions),
     sizeof (struct soa_static_session),
@@ -213,7 +213,7 @@ static int soa_static_get_params(soa_session_t const *ss, tagi_t *tags)
 }
 
 static tagi_t *soa_static_get_paramlist(soa_session_t const *ss,
-                                       tag_type_t tag, tag_value_t value, 
+                                       tag_type_t tag, tag_value_t value,
                                        ...)
 {
   soa_static_session_t *sss = (soa_static_session_t *)ss;
@@ -237,28 +237,28 @@ static tagi_t *soa_static_get_paramlist(soa_session_t const *ss,
   return tl;
 }
 
-static int soa_static_set_capability_sdp(soa_session_t *ss, 
+static int soa_static_set_capability_sdp(soa_session_t *ss,
                                         sdp_session_t *sdp,
-                                        char const *sdp_str, 
+                                        char const *sdp_str,
                                         isize_t sdp_len)
 {
   return soa_base_set_capability_sdp(ss, sdp, sdp_str, sdp_len);
 }
 
 
-static int soa_static_set_remote_sdp(soa_session_t *ss, 
+static int soa_static_set_remote_sdp(soa_session_t *ss,
                                     int new_version,
                                     sdp_session_t *sdp,
-                                    char const *sdp_str, 
+                                    char const *sdp_str,
                                     isize_t sdp_len)
 {
   return soa_base_set_remote_sdp(ss, new_version, sdp, sdp_str, sdp_len);
 }
 
 
-static int soa_static_set_user_sdp(soa_session_t *ss, 
+static int soa_static_set_user_sdp(soa_session_t *ss,
                                   sdp_session_t *sdp,
-                                  char const *sdp_str, 
+                                  char const *sdp_str,
                                   isize_t sdp_len)
 {
   return soa_base_set_user_sdp(ss, sdp, sdp_str, sdp_len);
@@ -266,7 +266,7 @@ static int soa_static_set_user_sdp(soa_session_t *ss,
 
 /** Generate a rejected m= line */
 static
-sdp_media_t *soa_sdp_make_rejected_media(su_home_t *home, 
+sdp_media_t *soa_sdp_make_rejected_media(su_home_t *home,
                                         sdp_media_t const *m,
                                         sdp_session_t *sdp,
                                         int include_all_codecs)
@@ -317,7 +317,7 @@ sdp_session_t *soa_sdp_expand_media(su_home_t *home,
   return expanded;
 }
 
-/** Check if @a session should be upgraded with @a remote */ 
+/** Check if @a session should be upgraded with @a remote */
 int soa_sdp_upgrade_is_needed(sdp_session_t const *session,
                              sdp_session_t const *remote)
 {
@@ -328,7 +328,7 @@ int soa_sdp_upgrade_is_needed(sdp_session_t const *session,
   if (!session)
     return 1;
 
-  for (rm = remote->sdp_media, lm = session->sdp_media; 
+  for (rm = remote->sdp_media, lm = session->sdp_media;
        rm && lm ; rm = rm->m_next, lm = lm->m_next) {
     if (rm->m_rejected)
       continue;
@@ -394,12 +394,12 @@ sdp_rtpmap_t *soa_sdp_media_matching_rtpmap(sdp_rtpmap_t const *from,
 
 /** Find first matching media in table @a mm.
  *
- * - if allow_rtp_mismatch == 0, search for a matching codec 
+ * - if allow_rtp_mismatch == 0, search for a matching codec
  * - if allow_rtp_mismatch == 1, prefer m=line with matching codec
  * - if allow_rtp_mismatch > 1, ignore codecs
  */
 static
-int soa_sdp_matching_mindex(soa_session_t *ss, 
+int soa_sdp_matching_mindex(soa_session_t *ss,
                            sdp_media_t *mm[],
                            sdp_media_t const *with,
                            int *return_codec_mismatch)
@@ -425,11 +425,11 @@ int soa_sdp_matching_mindex(soa_session_t *ss,
 
     if (!sdp_media_match_with(mm[i], with))
       continue;
-    
+
     if (!rtp)
       break;
 
-    if (soa_sdp_media_matching_rtpmap(with->m_rtpmaps, 
+    if (soa_sdp_media_matching_rtpmap(with->m_rtpmaps,
                                      mm[i]->m_rtpmaps,
                                      auxiliary))
       break;
@@ -445,11 +445,11 @@ int soa_sdp_matching_mindex(soa_session_t *ss,
 }
 
 /** Set payload types in @a l_m according to the values in @a r_m.
- * 
+ *
  * @retval number of common codecs
  */
 static
-int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m, 
+int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m,
                          sdp_media_t const *r_m)
 {
   sdp_rtpmap_t *lrm, **next_lrm;
@@ -489,7 +489,7 @@ int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m,
       lrm->rm_any = 1;
     }
   }
-  
+
   if (local_codecs == common_codecs)
     return common_codecs;
 
@@ -511,7 +511,7 @@ int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m,
       next_lrm = &lrm->rm_next;
       continue;
     }
-    
+
     lrm->rm_any = 0;
 
     pt = lrm->rm_pt;
@@ -520,7 +520,7 @@ int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m,
       for (pt = 96; pt < 128; pt++)
         if (!dynamic_pt[pt])
           break;
-      
+
       if (pt == 128) {
         for (pt = 0; pt < 128; pt++)
           if (!sdp_rtpmap_well_known[pt] && !dynamic_pt[pt])
@@ -544,7 +544,7 @@ int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m,
     }
 
     dynamic_pt[pt] = 1;
-  
+
     next_lrm = &lrm->rm_next;
   }
 
@@ -557,7 +557,7 @@ int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m,
  * @return Number of common codecs
  */
 static
-int soa_sdp_sort_rtpmap(sdp_rtpmap_t **inout_list, 
+int soa_sdp_sort_rtpmap(sdp_rtpmap_t **inout_list,
                        sdp_rtpmap_t const *rrm,
                        char const *auxiliary)
 {
@@ -611,7 +611,7 @@ int soa_sdp_sort_rtpmap(sdp_rtpmap_t **inout_list,
  * @return Number of common codecs
  */
 static
-int soa_sdp_select_rtpmap(sdp_rtpmap_t **inout_list, 
+int soa_sdp_select_rtpmap(sdp_rtpmap_t **inout_list,
                          sdp_rtpmap_t const *rrm,
                          char const *auxiliary,
                          int select_single)
@@ -628,7 +628,7 @@ int soa_sdp_select_rtpmap(sdp_rtpmap_t **inout_list,
   for (left = inout_list; *left; ) {
     if (auxiliary && soa_sdp_is_auxiliary_codec(*left, auxiliary))
       /* Insert into list of auxiliary codecs */
-      *next_aux = *left, *left = (*left)->rm_next, 
+      *next_aux = *left, *left = (*left)->rm_next,
        next_aux = &(*next_aux)->rm_next;
     else if (!(select_single && common_codecs > 0)
             && sdp_rtpmap_find_matching(rrm, (*left)))
@@ -645,7 +645,7 @@ int soa_sdp_select_rtpmap(sdp_rtpmap_t **inout_list,
 }
 
 
-/** Sort and select rtpmaps  */ 
+/** Sort and select rtpmaps  */
 static
 int soa_sdp_media_upgrade_rtpmaps(soa_session_t *ss,
                                  sdp_media_t *sm,
@@ -660,7 +660,7 @@ int soa_sdp_media_upgrade_rtpmaps(soa_session_t *ss,
   if (rm->m_type == sdp_media_audio)
     auxiliary = sss->sss_audio_aux;
 
-  if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE || 
+  if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE ||
       (ss->ss_rtp_sort == SOA_RTP_SORT_DEFAULT &&
        rm->m_mode == sdp_recvonly)) {
     soa_sdp_sort_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary);
@@ -679,7 +679,7 @@ int soa_sdp_media_upgrade_rtpmaps(soa_session_t *ss,
 }
 
 
-/** Sort and select rtpmaps within session */ 
+/** Sort and select rtpmaps within session */
 static
 int soa_sdp_session_upgrade_rtpmaps(soa_session_t *ss,
                                    sdp_session_t *session,
@@ -688,8 +688,8 @@ int soa_sdp_session_upgrade_rtpmaps(soa_session_t *ss,
   sdp_media_t *sm;
   sdp_media_t const *rm;
 
-  for (sm = session->sdp_media, rm = remote->sdp_media; 
-       sm && rm; 
+  for (sm = session->sdp_media, rm = remote->sdp_media;
+       sm && rm;
        sm = sm->m_next, rm = rm->m_next) {
     if (!sm->m_rejected && sdp_media_uses_rtp(sm))
       soa_sdp_media_upgrade_rtpmaps(ss, sm, rm);
@@ -698,7 +698,7 @@ int soa_sdp_session_upgrade_rtpmaps(soa_session_t *ss,
   return 0;
 }
 
-/** Upgrade m= lines within session */ 
+/** Upgrade m= lines within session */
 static
 int soa_sdp_upgrade(soa_session_t *ss,
                    su_home_t *home,
@@ -737,7 +737,7 @@ int soa_sdp_upgrade(soa_session_t *ss,
   if (!s_media || !o_media || !u_media || !r_media)
     return -1;
 
-  um = sdp_media_dup_all(home, user->sdp_media, session); 
+  um = sdp_media_dup_all(home, user->sdp_media, session);
   if (!um && user->sdp_media)
     return -1;
 
@@ -819,7 +819,7 @@ int soa_sdp_upgrade(soa_session_t *ss,
        for (i = 0; i < Ns; i++) {
          if (s_media[i])
            continue;
-         s_media[i] = 
+         s_media[i] =
            soa_sdp_make_rejected_media(home, o_media[i], session, 0);
        }
       }
@@ -905,7 +905,7 @@ int *u2s_alloc(su_home_t *home, int const *u2s)
   return NULL;
 }
 
-/** Check if @a session contains media that are rejected by @a remote. */ 
+/** Check if @a session contains media that are rejected by @a remote. */
 static
 int soa_sdp_reject_is_needed(sdp_session_t const *session,
                             sdp_session_t const *remote)
@@ -917,7 +917,7 @@ int soa_sdp_reject_is_needed(sdp_session_t const *session,
   if (!session)
     return 0;
 
-  for (sm = session->sdp_media, rm = remote->sdp_media; 
+  for (sm = session->sdp_media, rm = remote->sdp_media;
        sm && rm; sm = sm->m_next, rm = rm->m_next) {
     if (rm->m_rejected) {
       if (!sm->m_rejected)
@@ -937,7 +937,7 @@ int soa_sdp_reject_is_needed(sdp_session_t const *session,
   return 0;
 }
 
-/** If m= line is rejected by remote mark m= line rejected within session */ 
+/** If m= line is rejected by remote mark m= line rejected within session */
 static
 int soa_sdp_reject(su_home_t *home,
                   sdp_session_t *session,
@@ -983,7 +983,7 @@ int soa_sdp_reject(su_home_t *home,
  * @sa soatag_hold
  *
  * @retval 1 if session was changed (or to be changed, if @a dryrun is nonzero)
- */ 
+ */
 static
 int soa_sdp_mode_set(sdp_session_t const *user,
                     int const *s2u,
@@ -1129,7 +1129,7 @@ static int offer_answer_step(soa_session_t *ss,
   if (local && remote) switch (action) {
   case generate_answer:
   case process_answer:
-    if (sdp_media_count(remote, sdp_media_any, "*", 0, 0) < 
+    if (sdp_media_count(remote, sdp_media_any, "*", 0, 0) <
        sdp_media_count(local, sdp_media_any, "*", 0, 0)) {
       SU_DEBUG_5(("%s: remote %s is truncated: expanding\n",
                  by, action == generate_answer ? "offer" : "answer"));
@@ -1140,7 +1140,7 @@ static int offer_answer_step(soa_session_t *ss,
   default:
     break;
   }
-  
+
   /* Step A: Create local SDP session (based on user-supplied SDP) */
   if (local == NULL) switch (action) {
   case generate_offer:
@@ -1156,7 +1156,7 @@ static int offer_answer_step(soa_session_t *ss,
       /* o->o_address = local->sdp_origin->o_address; */
     }
     if (!o->o_address)
-      o->o_address = c0; 
+      o->o_address = c0;
     local->sdp_origin = o;
 
     if (soa_init_sdp_origin(ss, o, c_address) < 0) {
@@ -1179,7 +1179,7 @@ static int offer_answer_step(soa_session_t *ss,
       break;
     if (local != local0)
       *local0 = *local, local = local0;
-    SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by, 
+    SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
                "upgrade with local description"));
     if (soa_sdp_upgrade(ss, tmphome, local, user, NULL, &u2s, &s2u) < 0)
       goto internal_error;
@@ -1226,7 +1226,7 @@ static int offer_answer_step(soa_session_t *ss,
        } while (0)
        DUP_LOCAL(local);
       }
-      SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by, 
+      SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
                  "marking rejected media"));
       soa_sdp_reject(tmphome, local, remote);
     }
@@ -1269,7 +1269,7 @@ static int offer_answer_step(soa_session_t *ss,
       SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
                  "upgrade codecs with remote description"));
       if (local != local0) {
-       *local0 = *local, local = local0; 
+       *local0 = *local, local = local0;
        DUP_LOCAL(local);
       }
       soa_sdp_session_upgrade_rtpmaps(ss, local, remote);
@@ -1281,7 +1281,7 @@ static int offer_answer_step(soa_session_t *ss,
     break;
   }
 
-  /* Step F: Update c= line */ 
+  /* Step F: Update c= line */
   switch (action) {
   case generate_offer:
   case generate_answer:
@@ -1290,12 +1290,12 @@ static int offer_answer_step(soa_session_t *ss,
        local->sdp_connection)
       break;
 
-    if (local->sdp_connection == NULL || 
-       (user->sdp_connection != NULL && 
+    if (local->sdp_connection == NULL ||
+       (user->sdp_connection != NULL &&
         sdp_connection_cmp(local->sdp_connection, user->sdp_connection))) {
       sdp_media_t *m;
 
-      /* Every m= line (even rejected one) must have a c= line 
+      /* Every m= line (even rejected one) must have a c= line
        * or there must be a c= line at session level
        */
       if (user->sdp_connection)
@@ -1309,7 +1309,7 @@ static int offer_answer_step(soa_session_t *ss,
 
       if (m) {
        if (local != local0) {
-         *local0 = *local, local = local0; 
+         *local0 = *local, local = local0;
          DUP_LOCAL(local);
        }
        local->sdp_connection = c;
@@ -1324,7 +1324,7 @@ static int offer_answer_step(soa_session_t *ss,
   soa_description_free(ss, ss->ss_previous);
 
   if (u2s) {
-    u2s = u2s_alloc(ss->ss_home, u2s); 
+    u2s = u2s_alloc(ss->ss_home, u2s);
     s2u = u2s_alloc(ss->ss_home, s2u);
     if (!u2s || !s2u)
       goto internal_error;
@@ -1379,7 +1379,7 @@ static int offer_answer_step(soa_session_t *ss,
        ss->ss_previous_user_version = 0;
        ss->ss_previous_remote_version = 0;
       }
-      
+
       su_free(ss->ss_home, u2s), su_free(ss->ss_home, s2u);
 
       goto internal_error;
@@ -1444,7 +1444,7 @@ static int soa_static_generate_answer(soa_session_t *ss,
 {
   /* NOTE:
    * - local SDP might have changed
-   * - remote SDP might have been updated 
+   * - remote SDP might have been updated
    */
 
   if (offer_answer_step(ss, generate_answer, "soa_generate_answer") < 0)
@@ -1459,7 +1459,7 @@ static int soa_static_process_answer(soa_session_t *ss,
   /* NOTE:
    * - both local and remote information is available
    * - local SDP might have changed
-   * - remote SDP might have been updated 
+   * - remote SDP might have been updated
    */
   if (offer_answer_step(ss, process_answer, "soa_process_answer") < 0)
     return -1;
index f3e000fb3f67c285741edc36f23cc7e6b0d415d4..b251035cabbfc95e83f9cd1e7a0359e45a017caa 100644 (file)
@@ -58,7 +58,7 @@ int soa_tag_filter(tagi_t const *f, tagi_t const *t)
   if (!t || !t->t_tag)
     return 0;
 
-  ns = t->t_tag->tt_ns; 
+  ns = t->t_tag->tt_ns;
   if (!ns)
     return 0;
 
@@ -66,7 +66,7 @@ int soa_tag_filter(tagi_t const *f, tagi_t const *t)
 }
 
 /**@def SOATAG_ANY()
- * 
+ *
  * Filter tag matching any SOATAG_*() item.
  */
 tag_typedef_t soatag_any = NSTAG_TYPEDEF(*);
@@ -218,7 +218,7 @@ tag_typedef_t soatag_user_sdp = SDPTAG_TYPEDEF(user_sdp);
  *
  * User SDP is used as basis for SDP Offer/Answer negotiation. It can be
  * very minimal, listing just m= lines with the port numbers and RTP payload
- * numbers of supported codecs, like 
+ * numbers of supported codecs, like
  * @code
  *   SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8")
  * @endcode
@@ -256,7 +256,7 @@ tag_typedef_t soatag_user_sdp_str = STRTAG_TYPEDEF(user_sdp_str);
  *      #SOA_AF_ANY,
  *      #SOA_AF_IP4_ONLY, #SOA_AF_IP6_ONLY,
  *      #SOA_AF_IP4_IP6,  #SOA_AF_IP6_IP4
- *    } 
+ *    }
  *
  * @par Values
  *    - #SOA_AF_ANY       (0) any address family (default)
@@ -303,7 +303,7 @@ tag_typedef_t soatag_address = STRTAG_TYPEDEF(address);
  *    soa_set_params(), soa_get_params(), soa_get_paramlist() \n
  *
  * @par Parameter type
- *    enum { 
+ *    enum {
  *      #SOA_RTP_SELECT_SINGLE, #SOA_RTP_SELECT_COMMON, #SOA_RTP_SELECT_ALL
  *    } \n
  *    (int in range 0..2)
@@ -330,7 +330,7 @@ tag_typedef_t soatag_rtp_select = INTTAG_TYPEDEF(rtp_select);
  * The named audio codecs are considered auxiliary, that is, they are
  * considered as common codec only when they are the only codec listed on
  * the media line.
- * 
+ *
  * When generating answer or second offer soa includes auxiliary audio
  * codecs in the list of codecs even if it is selecting only one codec or
  * common codecs.
@@ -358,10 +358,10 @@ tag_typedef_t soatag_audio_aux = STRTAG_TYPEDEF(audio_aux);
 /**@def SOATAG_RTP_SORT(x)
  *
  * When selecting the common codecs, soa can either select first local codec
- * supported by remote end, or first remote codec supported by local codecs. 
+ * supported by remote end, or first remote codec supported by local codecs.
  * The preference is indicated with ordering: the preferred codec is
  * first and so on.
- * 
+ *
  * The auxiliary audio codecs (specified with SOATAG_AUDIO_AUX()) are listed
  * after other codecs.
  *
@@ -415,14 +415,14 @@ tag_typedef_t soatag_rtp_mismatch = BOOLTAG_TYPEDEF(rtp_mismatch);
 
 
 /**@def SOATAG_ACTIVE_AUDIO(x)
- * 
+ *
  * Audio session status.
  *
  * @par Used with
  *
  * @par Parameter type
- *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED, 
- *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY, 
+ *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED,
+ *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY,
  *           #SOA_ACTIVE_RECVONLY, #SOA_ACTIVE_SENDRECV }
  *
  * @par Values
@@ -438,14 +438,14 @@ tag_typedef_t soatag_rtp_mismatch = BOOLTAG_TYPEDEF(rtp_mismatch);
 tag_typedef_t soatag_active_audio = INTTAG_TYPEDEF(active_audio);
 
 /**@def SOATAG_ACTIVE_VIDEO(x)
- * 
+ *
  * Video session status
  *
  * @par Used with
  *
  * @par Parameter type
- *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED, 
- *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY, 
+ *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED,
+ *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY,
  *           #SOA_ACTIVE_RECVONLY, #SOA_ACTIVE_SENDRECV }
  *
  * @par Values
@@ -460,7 +460,7 @@ tag_typedef_t soatag_active_audio = INTTAG_TYPEDEF(active_audio);
 tag_typedef_t soatag_active_video = INTTAG_TYPEDEF(active_video);
 
 /**@def SOATAG_ACTIVE_IMAGE(x)
- * 
+ *
  * Active image session status
  *
  * @par Used with
@@ -468,8 +468,8 @@ tag_typedef_t soatag_active_video = INTTAG_TYPEDEF(active_video);
  *    #nua_i_state \n
  *
  * @par Parameter type
- *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED, 
- *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY, 
+ *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED,
+ *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY,
  *           #SOA_ACTIVE_RECVONLY, #SOA_ACTIVE_SENDRECV }
  *
  * @par Values
@@ -480,8 +480,8 @@ tag_typedef_t soatag_active_video = INTTAG_TYPEDEF(active_video);
  *    - #SOA_ACTIVE_SENDRECV  (3)
  *
  * @par Parameter type
- *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED, 
- *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY, 
+ *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED,
+ *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY,
  *           #SOA_ACTIVE_RECVONLY, #SOA_ACTIVE_SENDRECV }
  *
  * @par Values
@@ -496,7 +496,7 @@ tag_typedef_t soatag_active_video = INTTAG_TYPEDEF(active_video);
 tag_typedef_t soatag_active_image = INTTAG_TYPEDEF(active_image);
 
 /**@def SOATAG_ACTIVE_CHAT(x)
- * 
+ *
  * Active chat session status.
  *
  * @par Used with
@@ -504,8 +504,8 @@ tag_typedef_t soatag_active_image = INTTAG_TYPEDEF(active_image);
  *    #nua_i_state \n
  *
  * @par Parameter type
- *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED, 
- *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY, 
+ *    enum { #SOA_ACTIVE_DISABLED, #SOA_ACTIVE_REJECTED,
+ *           #SOA_ACTIVE_INACTIVE, #SOA_ACTIVE_SENDONLY,
  *           #SOA_ACTIVE_RECVONLY, #SOA_ACTIVE_SENDRECV }
  *
  * @par Values
@@ -520,7 +520,7 @@ tag_typedef_t soatag_active_image = INTTAG_TYPEDEF(active_image);
 tag_typedef_t soatag_active_chat = INTTAG_TYPEDEF(active_chat);
 
 /**@def SOATAG_SRTP_ENABLE(x)
- *  
+ *
  * Enable SRTP
  *
  * @par Used with
@@ -533,7 +533,7 @@ tag_typedef_t soatag_active_chat = INTTAG_TYPEDEF(active_chat);
  *    @c !=0 enable \n
  *    @c 0 disable
  *
- * Corresponding tag taking reference parameter is 
+ * Corresponding tag taking reference parameter is
  * SOATAG_SRTP_ENABLE_REF()
  *
  * @todo SRTP functionality is not implemented.
@@ -541,7 +541,7 @@ tag_typedef_t soatag_active_chat = INTTAG_TYPEDEF(active_chat);
 tag_typedef_t soatag_srtp_enable = BOOLTAG_TYPEDEF(srtp_enable);
 
 /**@def SOATAG_SRTP_CONFIDENTIALITY(x)
- *  
+ *
  * Enable SRTP confidentiality negotiation.
  *
  * @par Used with
@@ -554,16 +554,16 @@ tag_typedef_t soatag_srtp_enable = BOOLTAG_TYPEDEF(srtp_enable);
  *    @c != 0 enable SRTP confidentiality \n
  *    @c 0 disable SRTP conidentiality
  *
- * Corresponding tag taking reference parameter is 
+ * Corresponding tag taking reference parameter is
  * SOATAG_SRTP_CONFIDENTIALITY_REF()
  *
  * @todo SRTP functionality is not implemented.
  */
-tag_typedef_t soatag_srtp_confidentiality = 
+tag_typedef_t soatag_srtp_confidentiality =
   BOOLTAG_TYPEDEF(srtp_confidentiality);
 
 /**@def SOATAG_SRTP_INTEGRITY(x)
- *  
+ *
  * Enable SRTP integrity protection
  *
  * @par Used with
@@ -576,7 +576,7 @@ tag_typedef_t soatag_srtp_confidentiality =
  *    @c !=0 enable \n
  *    @c 0 disable
  *
- * Corresponding tag taking reference parameter is 
+ * Corresponding tag taking reference parameter is
  * SOATAG_SRTP_INTEGRITY_REF()
  *
  * @todo SRTP functionality is not implemented.
@@ -585,12 +585,12 @@ tag_typedef_t soatag_srtp_integrity = BOOLTAG_TYPEDEF(srtp_integrity);
 
 /**@def SOATAG_HOLD(x)
  *
- * Hold media stream or streams. 
+ * Hold media stream or streams.
  *
  * The hold media stream will have the attribute a=sendonly (meaning that
  * some hold announcements or pause music is sent to the held party but that
  * the held party should not generate any media) or a=inactive (meaning that
- * no media is sent). 
+ * no media is sent).
  *
  * When putting a SIP session on hold with sendonly, the application can
  * include, e.g., SOATAG_HOLD("audio") or SOATAG_HOLD("video") or
@@ -636,7 +636,7 @@ tag_typedef_t soatag_hold = STRTAG_TYPEDEF(hold);
  *   - true (1) - update session with m= line in user SDP based on their order
  *
  * The default value is false and session are updated based on media types.
- * 
+ *
  *
  * Corresponding tag taking a reference parameter is SOATAG_RTP_SELECT_REF().
  *
index e543dac49b484af79c24eb79dacedaa011341d41..9330005ff78cb0657cf91b756e0ba595432cabf2 100644 (file)
@@ -62,20 +62,20 @@ SOFIAPUBFUN void soa_destroy(soa_session_t *);
 
 SOFIAPUBFUN int soa_set_params(soa_session_t *ss,
                               tag_type_t tag, tag_value_t value, ...);
-SOFIAPUBFUN int soa_get_params(soa_session_t const *ss, 
+SOFIAPUBFUN int soa_get_params(soa_session_t const *ss,
                               tag_type_t tag, tag_value_t value, ...);
 
 SOFIAPUBFUN tagi_t *soa_get_paramlist(soa_session_t const *ss,
                                      tag_type_t tag, tag_value_t value, ...);
 
-SOFIAPUBFUN int soa_error_as_sip_response(soa_session_t *soa, 
+SOFIAPUBFUN int soa_error_as_sip_response(soa_session_t *soa,
                                          char const **return_phrase);
 
 SOFIAPUBFUN char const *soa_error_as_sip_reason(soa_session_t *soa);
 
 SOFIAPUBFUN int soa_get_warning(soa_session_t *ss, char const **return_phrase);
 
-SOFIAPUBFUN int soa_set_capability_sdp(soa_session_t *ss, 
+SOFIAPUBFUN int soa_set_capability_sdp(soa_session_t *ss,
                                       struct sdp_session_s const *sdp,
                                       char const *str, issize_t len);
 
@@ -84,7 +84,7 @@ SOFIAPUBFUN int soa_get_capability_sdp(soa_session_t const *ss,
                                       char const **return_sdp_str,
                                       isize_t *return_len);
 
-SOFIAPUBFUN int soa_set_remote_sdp(soa_session_t *ss, 
+SOFIAPUBFUN int soa_set_remote_sdp(soa_session_t *ss,
                                   struct sdp_session_s const *sdp,
                                   char const *str, issize_t len);
 
@@ -97,7 +97,7 @@ SOFIAPUBFUN int soa_clear_remote_sdp(soa_session_t *ss);
 
 SOFIAPUBFUN int soa_get_remote_version(soa_session_t const *ss);
 
-SOFIAPUBFUN int soa_set_user_sdp(soa_session_t *ss, 
+SOFIAPUBFUN int soa_set_user_sdp(soa_session_t *ss,
                                 struct sdp_session_s const *sdp,
                                 char const *str, issize_t len);
 
index f61bd7401335cd5e75342682dd06203c9aee9581..0aa2830cb1166ad3b57a95f9cab9be7faf535009 100644 (file)
@@ -57,7 +57,7 @@ struct soa_session_actions
   void (*soa_deinit)(soa_session_t *ss);
   int (*soa_set_params)(soa_session_t *ss, tagi_t const *tags);
   int (*soa_get_params)(soa_session_t const *ss, tagi_t *tags);
-  tagi_t *(*soa_get_paramlist)(soa_session_t const *ss, 
+  tagi_t *(*soa_get_paramlist)(soa_session_t const *ss,
                               tag_type_t, tag_value_t, ...);
   char **(*soa_media_features)(soa_session_t *, int live, su_home_t *);
   char const * const *(*soa_sip_require)(soa_session_t const *ss);
@@ -98,10 +98,10 @@ SOFIAPUBFUN char const * const *soa_base_sip_supported(soa_session_t const *ss);
 SOFIAPUBFUN int soa_base_remote_sip_features(soa_session_t *ss,
                                             char const * const *support,
                                             char const * const *required);
-SOFIAPUBFUN int soa_base_set_capability_sdp(soa_session_t *ss, 
+SOFIAPUBFUN int soa_base_set_capability_sdp(soa_session_t *ss,
                                            sdp_session_t *sdp,
                                            char const *, isize_t);
-SOFIAPUBFUN int soa_base_set_remote_sdp(soa_session_t *ss, 
+SOFIAPUBFUN int soa_base_set_remote_sdp(soa_session_t *ss,
                                        int new_version,
                                        sdp_session_t *sdp, char const *, isize_t);
 SOFIAPUBFUN int soa_base_set_user_sdp(soa_session_t *ss,
@@ -120,7 +120,7 @@ SOFIAPUBFUN int soa_base_activate(soa_session_t *ss, char const *option);
 SOFIAPUBFUN int soa_base_deactivate(soa_session_t *ss, char const *option);
 SOFIAPUBFUN void soa_base_terminate(soa_session_t *ss, char const *option);
 
-struct soa_description 
+struct soa_description
 {
   sdp_session_t  *ssd_sdp;     /**< Session description  */
   char const     *ssd_unparsed;        /**< Original session description as string */
@@ -205,7 +205,7 @@ struct soa_session
   int             ss_status;   /**< Status from last media operation */
   char const     *ss_phrase;   /**< Phrase from last media operation */
   char           *ss_reason;   /**< Reason generated by media operation */
-  
+
 
   /* Media parameters */
   char const     *ss_address;
@@ -240,26 +240,26 @@ SOFIAPUBFUN int soa_set_status(soa_session_t *ss,
 
 enum soa_activity { soa_activity_local, soa_activity_remote, soa_activity_session };
 
-SOFIAPUBFUN void soa_set_activity(soa_session_t *ss, 
-                                 sdp_media_t const *m, 
+SOFIAPUBFUN void soa_set_activity(soa_session_t *ss,
+                                 sdp_media_t const *m,
                                  enum soa_activity activity);
 
-SOFIAPUBFUN int soa_description_set(soa_session_t *ss, 
+SOFIAPUBFUN int soa_description_set(soa_session_t *ss,
                                    struct soa_description *ssd,
                                    sdp_session_t *sdp,
                                    char const *sdp_str,
                                    isize_t sdp_len);
 
-SOFIAPUBFUN void soa_description_free(soa_session_t *, 
+SOFIAPUBFUN void soa_description_free(soa_session_t *,
                                      struct soa_description *ssd);
 
-SOFIAPUBFUN int soa_description_dup(su_home_t *, 
+SOFIAPUBFUN int soa_description_dup(su_home_t *,
                                    struct soa_description *ssd,
                                    struct soa_description const *ssd0);
 
 SOFIAPUBFUN int soa_init_sdp_origin(soa_session_t *ss,
                                    sdp_origin_t *o, char buf[64]);
-SOFIAPUBFUN int soa_init_sdp_connection(soa_session_t *, 
+SOFIAPUBFUN int soa_init_sdp_connection(soa_session_t *,
                                        sdp_connection_t *, char buf[64]);
 
 /* ====================================================================== */
index 3f9dcc7b2140682abd2b39cb7b4e5cd59fd11432..7c31ac0ab47ba5a515fa291c31825112f7eb174f 100644 (file)
@@ -48,7 +48,7 @@ SOFIAPUBVAR tagi_t soa_tag_list[];
 SOFIAPUBVAR tag_typedef_t soatag_any;
 
 /**
- * Media states 
+ * Media states
  */
 enum {
   SOA_ACTIVE_REJECTED = -8, /**< Media rejected in negotiation */
@@ -164,7 +164,7 @@ SOFIAPUBVAR tag_typedef_t soatag_rtp_select;
 SOFIAPUBVAR tag_typedef_t soatag_rtp_select_ref;
 
 /** Parameter type for SOATAG_RTP_SELECT() */
-enum { 
+enum {
   SOA_RTP_SELECT_SINGLE,       /**< Select the best common codec */
   SOA_RTP_SELECT_COMMON,       /**< Select all common codecs */
   SOA_RTP_SELECT_ALL           /**< Select all local codecs */
@@ -183,7 +183,7 @@ SOFIAPUBVAR tag_typedef_t soatag_rtp_sort_ref;
 /** Parameter type for SOATAG_RTP_SORT() */
 enum {
   SOA_RTP_SORT_DEFAULT,                /**< Select codecs by local preference
-                                *  when media is recvonly, 
+                                *  when media is recvonly,
                                 * remote preference othewise.
                                 */
   SOA_RTP_SORT_LOCAL,          /**< Select codecs by local preference. */
index 8e2fd12d6f92b5e156c841e3c9ade8e5390aeea4..20af22f78c61dba0a7c6d4c9662d0c432f9ac4fe 100644 (file)
@@ -72,7 +72,7 @@ int tstflags = 0;
 
 #define NONE ((void*)-1)
 
-struct context 
+struct context
 {
   su_home_t home[1];
   su_root_t *root;
@@ -130,11 +130,11 @@ int test_api_errors(struct context *ctx)
   TEST_1(soa_get_user_sdp(NULL, NULL, NULL, NULL) < 0);
   TEST_1(soa_get_local_sdp(NULL, NULL, NULL, NULL) < 0);
 
-  TEST_1(-1 == soa_generate_offer(NULL, 0, test_api_completed)); 
+  TEST_1(-1 == soa_generate_offer(NULL, 0, test_api_completed));
 
-  TEST_1(-1 == soa_generate_answer(NULL, test_api_completed)); 
+  TEST_1(-1 == soa_generate_answer(NULL, test_api_completed));
 
-  TEST_1(-1 == soa_process_answer(NULL, test_api_completed)); 
+  TEST_1(-1 == soa_process_answer(NULL, test_api_completed));
 
   TEST_1(-1 == soa_process_reject(NULL, test_api_completed));
 
@@ -162,7 +162,7 @@ int test_api_errors(struct context *ctx)
 int test_soa_tags(struct context *ctx)
 {
   BEGIN();
-  
+
   su_home_t home[1] = { SU_HOME_INIT(home) };
   tagi_t *t;
 
@@ -194,7 +194,7 @@ int test_init(struct context *ctx, char *argv[])
 
   ctx->root = su_root_create(ctx); TEST_1(ctx->root);
 
-  ctx->asynch.a = soa_create("asynch", ctx->root, ctx); 
+  ctx->asynch.a = soa_create("asynch", ctx->root, ctx);
   TEST_1(!ctx->asynch.a);
 
 #if 0
@@ -205,7 +205,7 @@ int test_init(struct context *ctx, char *argv[])
 
   TEST_1(soa_find("asynch"));
 
-  ctx->asynch.a = soa_create("asynch", ctx->root, ctx); 
+  ctx->asynch.a = soa_create("asynch", ctx->root, ctx);
   TEST_1(ctx->asynch.a);
 
   ctx->asynch.b = soa_create("asynch", ctx->root, ctx);
@@ -214,7 +214,7 @@ int test_init(struct context *ctx, char *argv[])
 
   /* Create asynchronous endpoints */
 
-  ctx->a = soa_create("static", ctx->root, ctx); 
+  ctx->a = soa_create("static", ctx->root, ctx);
   TEST_1(!ctx->a);
 
   TEST_1(!soa_find("static"));
@@ -349,7 +349,7 @@ int test_static_offer_answer(struct context *ctx)
 {
   BEGIN();
   int n;
-  
+
   soa_session_t *a, *b;
 
   char const *caps = NONE, *offer = NONE, *answer = NONE;
@@ -359,19 +359,19 @@ int test_static_offer_answer(struct context *ctx)
 
   su_home_t home[1] = { SU_HOME_INIT(home) };
 
-  char const a_caps[] = 
+  char const a_caps[] =
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
     "m=audio 0 RTP/AVP 0 8\r\n";
 
-  char const b_caps[] = 
+  char const b_caps[] =
     "m=audio 5004 RTP/AVP 96 8\n"
     "m=rtpmap:96 GSM/8000\n";
 
-  TEST(soa_set_capability_sdp(ctx->a, 0, "m=audio 0 RTP/AVP 0 8", -1), 
+  TEST(soa_set_capability_sdp(ctx->a, 0, "m=audio 0 RTP/AVP 0 8", -1),
        1);
-  TEST(soa_set_capability_sdp(ctx->a, 0, a_caps, strlen(a_caps)), 
+  TEST(soa_set_capability_sdp(ctx->a, 0, a_caps, strlen(a_caps)),
        1);
   TEST(soa_get_capability_sdp(ctx->a, NULL, &caps, &capslen), 1);
 
@@ -402,7 +402,7 @@ int test_static_offer_answer(struct context *ctx)
                     SOATAG_AF(SOA_AF_IP4_ONLY),
                     SOATAG_ADDRESS("1.2.3.4"),
                     TAG_END());
-  
+
   n = soa_generate_answer(b, test_completed); TEST(n, 0);
 
   TEST_1(soa_is_complete(b));
@@ -498,7 +498,7 @@ int test_static_offer_answer(struct context *ctx)
   TEST(soa_is_audio_active(b), SOA_ACTIVE_INACTIVE);
   TEST(soa_is_remote_audio_active(b), SOA_ACTIVE_INACTIVE);
 
-  /* 'A' will release hold. */ 
+  /* 'A' will release hold. */
   TEST(soa_set_params(a, SOATAG_HOLD(NULL), TAG_END()), 1);
 
   TEST(soa_generate_offer(a, 1, test_completed), 0);
@@ -540,7 +540,7 @@ int test_static_offer_answer(struct context *ctx)
       c = sdp->sdp_connection;
     TEST_1(c);
     c->c_address = "0.0.0.0";
-    
+
     TEST_1(p = sdp_print(home, sdp, NULL, 0, sdp_f_realloc));
     TEST_1(sdp_message(p));
     offer = sdp_message(p); offerlen = strlen(offer);
@@ -562,10 +562,10 @@ int test_static_offer_answer(struct context *ctx)
   TEST(soa_is_audio_active(b), SOA_ACTIVE_RECVONLY);
   TEST(soa_is_remote_audio_active(b), SOA_ACTIVE_RECVONLY);
 
-  /* 'A' will propose adding video. */ 
-  /* 'B' will reject. */ 
+  /* 'A' will propose adding video. */
+  /* 'B' will reject. */
   TEST(soa_set_params(a,
-                     SOATAG_HOLD(NULL),  /* 'A' will release hold. */ 
+                     SOATAG_HOLD(NULL),  /* 'A' will release hold. */
                      SOATAG_USER_SDP_STR("m=audio 5008 RTP/AVP 0 8\r\ni=x\r\n"
                                          "m=video 5006 RTP/AVP 34\r\n"),
                      TAG_END()), 2);
@@ -596,7 +596,7 @@ int test_static_offer_answer(struct context *ctx)
     sdp_session_t const *l = NULL, *u = NULL, *r = NULL;
     sdp_media_t const *m;
 
-    TEST(soa_get_params(b, 
+    TEST(soa_get_params(b,
                        SOATAG_LOCAL_SDP_REF(l),
                        SOATAG_USER_SDP_REF(u),
                        SOATAG_REMOTE_SDP_REF(r),
@@ -611,7 +611,7 @@ int test_static_offer_answer(struct context *ctx)
 
   /* 'B' will now propose adding video. */
   /* 'A' will accept. */
-  TEST(soa_set_params(b, 
+  TEST(soa_set_params(b,
                      SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8\r\n"
                                          "m=video 5006 RTP/AVP 34\r\n"),
                      TAG_END()), 1);
@@ -636,14 +636,14 @@ int test_static_offer_answer(struct context *ctx)
   TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
   TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
   TEST(soa_is_video_active(a), SOA_ACTIVE_SENDRECV);
-  
+
   TEST_VOID(soa_terminate(a, NULL));
 
   TEST(soa_is_audio_active(a), SOA_ACTIVE_DISABLED);
   TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_DISABLED);
 
   TEST_VOID(soa_terminate(b, NULL));
-  
+
   TEST_VOID(soa_destroy(a));
   TEST_VOID(soa_destroy(b));
 
@@ -656,7 +656,7 @@ int test_codec_selection(struct context *ctx)
 {
   BEGIN();
   int n;
-  
+
   soa_session_t *a, *b;
 
   char const *offer = NONE, *answer = NONE;
@@ -666,7 +666,7 @@ int test_codec_selection(struct context *ctx)
   sdp_media_t const *m;
   sdp_rtpmap_t const *rm;
 
-  char const a_caps[] = 
+  char const a_caps[] =
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
@@ -674,7 +674,7 @@ int test_codec_selection(struct context *ctx)
     "a=rtpmap:97 GSM/8000\n"
     ;
 
-  char const b_caps[] = 
+  char const b_caps[] =
     "m=audio 5004 RTP/AVP 96 97\n"
     "a=rtpmap:96 G7231/8000\n"
     "a=rtpmap:97 G729/8000\n";
@@ -791,7 +791,7 @@ int test_codec_selection(struct context *ctx)
   /* Re-O/A: add a common codec */
 
   /* Accept media without common codecs */
-  TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0), 
+  TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
                        SOATAG_USER_SDP_STR(
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
@@ -799,11 +799,11 @@ int test_codec_selection(struct context *ctx)
     "m=audio 5008 RTP/AVP 0 8 96 3 127\r\n"
     "a=rtpmap:96 G729/8000\n"
     "a=rtpmap:127 CN/8000\n"
-    ),                 
+    ),
                        SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE),
                        SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL),
                        TAG_END()));
-  TEST_1(soa_set_params(b, SOATAG_RTP_MISMATCH(0), 
+  TEST_1(soa_set_params(b, SOATAG_RTP_MISMATCH(0),
                        SOATAG_USER_SDP_STR(
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
@@ -813,7 +813,7 @@ int test_codec_selection(struct context *ctx)
     "a=rtpmap:97 G729/8000\n"
     "a=rtpmap:111 telephone-event/8000\n"
     "a=fmtp:111 0-15\n"
-    ),                 
+    ),
                        SOATAG_AUDIO_AUX("cn telephone-event"),
                        SOATAG_RTP_SORT(SOA_RTP_SORT_LOCAL),
                        SOATAG_RTP_SELECT(SOA_RTP_SELECT_COMMON),
@@ -865,7 +865,7 @@ int test_codec_selection(struct context *ctx)
   /* ---------------------------------------------------------------------- */
   /* Re-O/A: prune down to single codec. */
 
-  TEST_1(soa_set_params(a, 
+  TEST_1(soa_set_params(a,
                        SOATAG_USER_SDP_STR(
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
@@ -874,7 +874,7 @@ int test_codec_selection(struct context *ctx)
     "a=rtpmap:96 G729/8000\n"
     "a=rtpmap:97 GSM/8000\n"
     "a=rtpmap:127 CN/8000\n"
-    ),                 
+    ),
                        SOATAG_RTP_MISMATCH(0),
                        SOATAG_RTP_SELECT(SOA_RTP_SELECT_COMMON),
                        TAG_END()));
@@ -911,8 +911,8 @@ int test_codec_selection(struct context *ctx)
   TEST_S(rm->rm_encoding, "CN");
   TEST_1(!rm->rm_next);
 
-  /* Answering end matches payload types 
-     then sorts by local preference, 
+  /* Answering end matches payload types
+     then sorts by local preference,
      then select best codec => GSM with pt 97 */
   TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
   TEST_1(rm = m->m_rtpmaps); TEST(rm->rm_pt, 97);
@@ -1181,7 +1181,7 @@ int test_codec_selection(struct context *ctx)
 
   TEST_VOID(soa_terminate(a, NULL));
   TEST_VOID(soa_terminate(b, NULL));
-  
+
   TEST_VOID(soa_destroy(a));
   TEST_VOID(soa_destroy(b));
 
@@ -1295,7 +1295,7 @@ int test_media_replace(struct context *ctx)
 {
   BEGIN();
   int n;
-  
+
   soa_session_t *a, *b;
 
   char const *offer = NONE, *answer = NONE;
@@ -1304,14 +1304,14 @@ int test_media_replace(struct context *ctx)
   sdp_session_t const *a_sdp, *b_sdp;
   sdp_media_t const *m;
 
-  char const a_caps[] = 
+  char const a_caps[] =
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
     "m=audio 5008 RTP/AVP 0 8\r\n"
     ;
 
-  char const b_caps[] = 
+  char const b_caps[] =
     "m=audio 5004 RTP/AVP 0 8\n"
     "a=rtpmap:96 G7231/8000\n"
     "a=rtpmap:97 G729/8000\n"
@@ -1369,7 +1369,7 @@ int test_media_replace(struct context *ctx)
     "a=T38FaxTranscodingJBIG:0\r\n"
     "a=T38FaxRateManagement:transferredTCF\r\n"
     "a=T38FaxMaxDatagram:400\r\n"
-    ),                 
+    ),
                        TAG_END()));
 
   n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
@@ -1392,21 +1392,21 @@ int test_media_replace(struct context *ctx)
   TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
   TEST(m->m_type, sdp_media_image);
   TEST(m->m_proto, sdp_proto_udptl);
-  TEST_1(m->m_format); 
-  TEST_S(m->m_format->l_text, "t38"); 
+  TEST_1(m->m_format);
+  TEST_S(m->m_format->l_text, "t38");
 
   TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
   TEST(m->m_type, sdp_media_image);
   TEST(m->m_proto, sdp_proto_udptl);
-  TEST_1(m->m_format); 
-  TEST_S(m->m_format->l_text, "t38"); 
+  TEST_1(m->m_format);
+  TEST_S(m->m_format->l_text, "t38");
 
   TEST(soa_is_audio_active(a), SOA_ACTIVE_DISABLED);
   TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_DISABLED);
 
   TEST_VOID(soa_terminate(a, NULL));
   TEST_VOID(soa_terminate(b, NULL));
-  
+
   TEST_VOID(soa_destroy(a));
   TEST_VOID(soa_destroy(b));
 
@@ -1571,7 +1571,7 @@ int test_media_reject(struct context *ctx)
 {
   BEGIN();
   int n;
-  
+
   soa_session_t *a, *b;
 
   char const *offer = NONE, *answer = NONE;
@@ -1579,7 +1579,7 @@ int test_media_reject(struct context *ctx)
 
   sdp_session_t const *b_sdp;
 
-  char const a_caps[] = 
+  char const a_caps[] =
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
@@ -1587,7 +1587,7 @@ int test_media_reject(struct context *ctx)
     "a=rtpmap:97 GSM/8000\n"
     ;
 
-  char const b_caps[] = 
+  char const b_caps[] =
     "m=audio 0 RTP/AVP 96 97\n"
     "a=rtpmap:96 G7231/8000\n"
     "a=rtpmap:97 G729/8000\n";
@@ -1620,7 +1620,7 @@ int test_media_reject(struct context *ctx)
 
   TEST_VOID(soa_terminate(a, NULL));
   TEST_VOID(soa_terminate(b, NULL));
-  
+
   TEST_VOID(soa_destroy(a));
   TEST_VOID(soa_destroy(b));
 
@@ -1632,7 +1632,7 @@ int test_media_replace2(struct context *ctx)
 {
   BEGIN();
   int n;
-  
+
   soa_session_t *a, *b;
 
   char const *offer = NONE, *answer = NONE;
@@ -1641,7 +1641,7 @@ int test_media_replace2(struct context *ctx)
   sdp_session_t const *a_sdp, *b_sdp;
   sdp_media_t const *m;
 
-  char const a_caps[] = 
+  char const a_caps[] =
     "v=0\r\n"
     "o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
@@ -1657,7 +1657,7 @@ int test_media_replace2(struct context *ctx)
     "a=rtpmap:96 G7231/8000\n"
     "a=rtpmap:97 G729/8000\n";
 
-  char const a_caps2[] = 
+  char const a_caps2[] =
     "v=0\r\n"
     "o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
@@ -1671,14 +1671,14 @@ int test_media_replace2(struct context *ctx)
     "a=T38FaxRateManagement:transferredTCF\r\n"
     "a=T38FaxMaxDatagram:400\r\n";
 
-  char const b_caps[] = 
+  char const b_caps[] =
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
     "m=audio 5008 RTP/AVP 0 8\r\n"
     ;
 
-  char const b_caps2[] = 
+  char const b_caps2[] =
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
@@ -1759,22 +1759,22 @@ int test_media_replace2(struct context *ctx)
   TEST_1(m = m->m_next);
   TEST(m->m_type, sdp_media_image);
   TEST(m->m_proto, sdp_proto_udptl);
-  TEST_1(m->m_format); 
-  TEST_S(m->m_format->l_text, "t38"); 
+  TEST_1(m->m_format);
+  TEST_S(m->m_format->l_text, "t38");
 
   TEST_1(m = b_sdp->sdp_media); TEST_1(m->m_rejected);
   TEST_1(m = m->m_next);
   TEST(m->m_type, sdp_media_image);
   TEST(m->m_proto, sdp_proto_udptl);
-  TEST_1(m->m_format); 
-  TEST_S(m->m_format->l_text, "t38"); 
+  TEST_1(m->m_format);
+  TEST_S(m->m_format->l_text, "t38");
 
   TEST(soa_is_audio_active(a), SOA_ACTIVE_DISABLED);
   TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_DISABLED);
 
   TEST_VOID(soa_terminate(a, NULL));
   TEST_VOID(soa_terminate(b, NULL));
-  
+
   TEST_VOID(soa_destroy(a));
   TEST_VOID(soa_destroy(b));
 
@@ -1788,25 +1788,25 @@ int test_asynch_offer_answer(struct context *ctx)
 
 #if 0                          /* This has never been implemented */
   int n;
-  
+
   char const *caps = NONE, *offer = NONE, *answer = NONE;
   isize_t capslen = -1, offerlen = -1, answerlen = -1;
 
-  char const a[] = 
+  char const a[] =
     "v=0\r\n"
     "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
     "m=audio 5004 RTP/AVP 0 8\r\n";
 
-  char const b[] = 
+  char const b[] =
     "v=0\n"
     "o=right 93298573265 321974 IN IP4 127.0.0.3\n"
     "c=IN IP4 127.0.0.3\n"
     "m=audio 5006 RTP/AVP 96\n"
     "m=rtpmap:96 GSM/8000\n";
 
-  n = soa_set_capability_sdp(ctx->asynch.a, 0, 
-                            "m=audio 5004 RTP/AVP 0 8", -1); 
+  n = soa_set_capability_sdp(ctx->asynch.a, 0,
+                            "m=audio 5004 RTP/AVP 0 8", -1);
   TEST(n, 1);
 
   n = soa_set_capability_sdp(ctx->asynch.a, 0, a, strlen(a)); TEST(n, 1);
@@ -1819,7 +1819,7 @@ int test_asynch_offer_answer(struct context *ctx)
 
   n = soa_generate_offer(ctx->asynch.a, 1, test_completed); TEST(n, 1);
 
-  su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.a); 
+  su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.a);
   ctx->completed = NULL;
 
   n = soa_get_local_sdp(ctx->asynch.a, 0, &offer, &offerlen); TEST(n, 1);
@@ -1828,7 +1828,7 @@ int test_asynch_offer_answer(struct context *ctx)
 
   n = soa_generate_answer(ctx->asynch.b, test_completed); TEST(n, 1);
 
-  su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.b); 
+  su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.b);
   ctx->completed = NULL;
 
   TEST_1(soa_is_complete(ctx->asynch.b));
@@ -1840,7 +1840,7 @@ int test_asynch_offer_answer(struct context *ctx)
 
   n = soa_process_answer(ctx->asynch.a, test_completed); TEST(n, 1);
 
-  su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.a); 
+  su_root_run(ctx->root); TEST(ctx->completed, ctx->asynch.a);
   ctx->completed = NULL;
 
   TEST_1(soa_is_complete(ctx->asynch.a));
@@ -1867,7 +1867,7 @@ int test_asynch_offer_answer(struct context *ctx)
   TEST_VOID(soa_terminate(ctx->asynch.b, NULL));
 
 #endif
-  
+
   END();
 }
 
@@ -1878,7 +1878,7 @@ int test_deinit(struct context *ctx)
   su_root_destroy(ctx->root), ctx->root = NULL;
   soa_destroy(ctx->a);
   soa_destroy(ctx->b);
-  
+
   END();
 }
 
@@ -1892,8 +1892,8 @@ static RETSIGTYPE sig_alarm(int s)
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
-         "usage: %s [-v|-q] [-a] [-l level] [-p outbound-proxy-uri]\n", 
+  fprintf(stderr,
+         "usage: %s [-v|-q] [-a] [-l level] [-p outbound-proxy-uri]\n",
          name);
   exit(exitcode);
 }
@@ -1927,7 +1927,7 @@ int main(int argc, char *argv[])
 
       if (rest == NULL || *rest)
        usage(1);
-      
+
       su_log_set_level(soa_log, level);
     }
     else if (strcmp(argv[i], "--attach") == 0) {
index 24bdb98be8a2cb0dbd556ff551e7fed602e29fd5..2dd92e46cab4a6678addc476eb9817d2f2c0a8fe 100644 (file)
@@ -3,7 +3,7 @@ $TTL 86400
                        1 ; serial
                        28800 ; refresh
                        7200 ; retry
-                       604800 ; expire 
+                       604800 ; expire
                        86400 ; ttk
                        )
 
index 9765d641d02391fc84e5908bf89e40fd6526d0e2..46e5f4098c39907ef056ba141465e30a5e0ef11e 100644 (file)
@@ -7,7 +7,7 @@ $TTL     60
             36000000   ; EXPIRE
             120        ; MINIMUM
             )
-               
+
            NS   ns.example.com.
 
 133        PTR  sip00.example.com.
index c7c8e997cc673de88893e3aa08287ddaefd9f2f0..c923d57608b184c4f2cef7e0310982d3a34547af 100644 (file)
@@ -7,7 +7,7 @@ $TTL     60
             36000000   ; EXPIRE
             120        ; MINIMUM
             )
-               
+
            NS   ns.example.com.
 
 c.a.7.e.d.7.e.f.f.f.0.2.8.0.a.0 PTR  sip01.example.com.
index 915ad74c193dd81cb97d4e1fd29ec679171571d3..e48ecffe6fbdc15206cc6ae938400b78b4fdf823 100644 (file)
@@ -7,7 +7,7 @@ $TTL     60
             36000000   ; EXPIRE
             120        ; MINIMUM
             )
-               
+
            NS   ns.example.com.
 
 c.a.7.e.d.7.e.f.f.f.0.2.8.0.a.0 PTR  sip01.example.com.
index aaea3137e21d58055f64bdaf11b95f55b801b479..afb3be0cec69a40c10aee03506275f08075e7186 100644 (file)
@@ -17,9 +17,9 @@ INCLUDES =            -I$(srcdir)/../url -I../url \
 
 noinst_LTLIBRARIES =   libsresolv.la
 
-check_PROGRAMS =       torture_sresolv test_sresolv 
+check_PROGRAMS =       torture_sresolv test_sresolv
 
-TESTS =                torture_sresolv run_test_sresolv 
+TESTS =                torture_sresolv run_test_sresolv
 
 CLEANFILES =           resolv.conf error.conf named.conf.tmp \
                        .test_sresolv.api.conf.?????? \
index 460cbc47ab86c5cc94bcdd34f7ed930d8b91b811..2103afca2774f04348388437d7b809d04eccf9dd 100644 (file)
@@ -53,7 +53,7 @@ alias6  A6      128 a6
 full   A6      0 3ff0:12:3012:c006:0a08:20ff:fe7d:e7ac
 
 sip00  A       194.2.188.133
-       AAAA    3ff0:0010:3012:c000:02c0:95ff:fee2:4b78 
+       AAAA    3ff0:0010:3012:c000:02c0:95ff:fee2:4b78
 
 sip01  A       194.2.188.134
        AAAA    3ff0:0012:3012:c006:0a08:20ff:fe7d:e7ac
index 5120fb45f39ddc008a4519a6fd4d9bed21635b89..3d9e6329e8be882d5ae632c8efdbe916a3de9895 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@file resolve_sip.c Use sresolv library to resolve a SIP or SIPS domain.
  *
- * This is an example program for @b sresolv library. 
+ * This is an example program for @b sresolv library.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
@@ -94,9 +94,9 @@ static int query_srv(struct context *sr, char const *domain);
 static int query_a(struct context *sr, char const *domain);
 
 /* Process NAPTR records */
-static 
-void answer_to_naptr_query(sres_context_t *sr, 
-                          sres_query_t *q, 
+static
+void answer_to_naptr_query(sres_context_t *sr,
+                          sres_query_t *q,
                           sres_record_t *answers[])
 {
   int i;
@@ -104,7 +104,7 @@ void answer_to_naptr_query(sres_context_t *sr,
   sr->sr_query = NULL;
 
   /* Sort NAPTR records by the order. */
-  sres_sort_answers(sr->sres, answers);  
+  sres_sort_answers(sr->sres, answers);
 
   for (i = 0; answers && answers[i]; i++) {
     sres_naptr_record_t const *na = answers[i]->sr_naptr;
@@ -114,8 +114,8 @@ void answer_to_naptr_query(sres_context_t *sr,
       continue;
 
     printf("naptr: %s\n\t%d IN NAPTR %u %u \"%s\" \"%s\" \"%s\" %s\n",
-          na->na_record->r_name, na->na_record->r_ttl, 
-          na->na_order, na->na_prefer, 
+          na->na_record->r_name, na->na_record->r_ttl,
+          na->na_order, na->na_prefer,
           na->na_flags, na->na_services,
           na->na_regexp, na->na_replace);
 
@@ -162,8 +162,8 @@ int query_naptr(struct context *sr, char const *domain)
 }
 
 /* Process SRV records */
-static 
-void answer_to_srv_query(sres_context_t *sr, sres_query_t *q, 
+static
+void answer_to_srv_query(sres_context_t *sr, sres_query_t *q,
                         sres_record_t *answers[])
 {
   int i;
@@ -206,8 +206,8 @@ int query_srv(struct context *sr, char const *domain)
 }
 
 /* Process A records */
-static 
-void answer_to_a_query(sres_context_t *sr, sres_query_t *q, 
+static
+void answer_to_a_query(sres_context_t *sr, sres_query_t *q,
                       sres_record_t *answers[])
 {
   int i;
@@ -260,11 +260,11 @@ int prepare_run(struct context *sr)
   sr->sr_n_sockets = 1;
   sr->sr_sockets = calloc(1, sizeof(*sr->sr_sockets));
   sr->sr_pollfds = calloc(1, sizeof(*sr->sr_pollfds));
-  
+
   if (!sr->sr_sockets || !sr->sr_pollfds ||
       (sres_resolver_sockets(sr->sres, sr->sr_sockets, 1) == -1))
     return 0;
-  
+
   sr->sr_pollfds[0].fd = sr->sr_sockets[0];
   sr->sr_pollfds[0].events = POLLIN | POLLERR;
 
@@ -280,14 +280,14 @@ void run(struct context *sr)
   while (!sr->sr_ready) {
     events = poll(sr->sr_pollfds, n, 500);
 
-    if (events) 
+    if (events)
       for (i = 0; i < n; i++) {
        if (sr->sr_pollfds[i].revents)
          sres_resolver_receive(sr->sres, sr->sr_pollfds[i].fd);
       }
 
     /* No harm is done (except wasted CPU) if timer is called more often */
-    sres_resolver_timer(sr->sres, sr->sr_sockets[0]); 
+    sres_resolver_timer(sr->sres, sr->sr_sockets[0]);
   }
 }
 
@@ -310,8 +310,8 @@ int main(int argc, char *argv[])
 
   sr->sres = sres_resolver_new(getenv("SRESOLV_CONF"));
 
-  if (sr->sres) 
-    if (prepare_run(sr)) 
+  if (sr->sres)
+    if (prepare_run(sr))
       if (query_naptr(sr, sr->sr_canon = argv[1]) == 0)
        run(sr);
 
index 7b7aeada478deec4d3faf5b46ebde05922efb9ce..c54b78022b6623b06deaa87b83bfbdfc9188876b 100644 (file)
@@ -10,5 +10,3 @@
 ns.example.com A       127.0.0.2
                AAAA    ::2
                A6      0 ::2
-
-       
\ No newline at end of file
index d8ef4d7054f4e74bb9e498b6ed142f2506f02b86..b93b285b3fd1ab95ca2d7b93dd2f62726c20711d 100644 (file)
@@ -61,14 +61,14 @@ fi
 } || {
 echo test_sresolv: there is no BIND 9 named in you path, skipping
 exit 77
-} 
+}
 
 if eval $ipv6
 then
     # Figure out nice IPv6 address for us
     ns=`ip addr ls | awk '
     /^[0-9]:/ { up = ($3 ~ /UP/) && ($3 !~ /LOOPBACK/); }
-    /inet6 fe80::/ { next; } # no link-local 
+    /inet6 fe80::/ { next; } # no link-local
     up && $1 ~ /inet6/ { sub(/\/.*$/, "", $2); print $2; exit 0; }'`
 
     # Nothing found, use localnode ::1
@@ -161,13 +161,13 @@ named -f -d 999 -c $t/named.conf &
 echo $0: started named pid $!
 for i in 1 2 3 4 5; do
     test -r $t/named.pid && break
-    sleep 1; 
+    sleep 1;
 done
 
-test -r $t/named.pid || { 
-    echo $0: cannot start named >&2 ; 
+test -r $t/named.pid || {
+    echo $0: cannot start named >&2 ;
     if fgrep -i -e SELINUX=enforcing /etc/selinux/config >/dev/null 2>&1 ; then
-       echo $0: perhaps you have to disable SELinux protection for named 
+       echo $0: perhaps you have to disable SELinux protection for named
     fi
     exit 77
 }
index b8d33b59bddeb7d624e961c73018bad277e4cce3..f929555b96e7309f1c5c6a161b8f68ba464cfff8 100644 (file)
@@ -94,7 +94,7 @@ typedef struct sres_cache sres_cache_t;
 /** Opaque type of DNS resolver object. */
 typedef struct sres_resolver_s sres_resolver_t;
 
-#ifndef SRES_CONTEXT_T 
+#ifndef SRES_CONTEXT_T
 #define SRES_CONTEXT_T struct sres_context_s
 #endif
 /** Application-defined type for sres_query_t context. */
@@ -119,7 +119,7 @@ sres_resolver_new_with_cache(char const *conf_file_path,
                             char const *options, ...);
 
 /** New resolver object. */
-SRESPUBFUN 
+SRESPUBFUN
 sres_resolver_t *
 sres_resolver_new_with_cache_va(char const *conf_file_path,
                                sres_cache_t *cache,
@@ -148,12 +148,12 @@ void *sres_resolver_get_userdata(sres_resolver_t const *res);
  * function is responsible for freeing the list of answers and it must
  * (eventually) call sres_free_answers().
  */
-typedef void sres_answer_f(sres_context_t *context, 
+typedef void sres_answer_f(sres_context_t *context,
                           sres_query_t *query,
                           sres_record_t **answers);
 
 /** Make a DNS query. */
-SRESPUBFUN 
+SRESPUBFUN
 sres_query_t *sres_query(sres_resolver_t *res,
                          sres_answer_f *callback,
                          sres_context_t *context,
@@ -161,7 +161,7 @@ sres_query_t *sres_query(sres_resolver_t *res,
                          char const *domain);
 
 /** Search DNS. */
-SRESPUBFUN 
+SRESPUBFUN
 sres_query_t *sres_search(sres_resolver_t *res,
                          sres_answer_f *callback,
                          sres_context_t *context,
@@ -169,7 +169,7 @@ sres_query_t *sres_search(sres_resolver_t *res,
                          char const *name);
 
 /** Make a reverse DNS query. */
-SRESPUBFUN 
+SRESPUBFUN
 sres_query_t *sres_query_sockaddr(sres_resolver_t *res,
                                   sres_answer_f *callback,
                                   sres_context_t *context,
@@ -177,7 +177,7 @@ sres_query_t *sres_query_sockaddr(sres_resolver_t *res,
                                  struct sockaddr const *addr);
 
 /** Make a DNS query with socket. @deprecated */
-SRESPUBFUN 
+SRESPUBFUN
 sres_query_t *sres_query_make(sres_resolver_t *res,
                              sres_answer_f *callback,
                              sres_context_t *context,
@@ -186,7 +186,7 @@ sres_query_t *sres_query_make(sres_resolver_t *res,
                              char const *domain);
 
 /** Make a reverse DNS query with socket. @deprecated */
-SRESPUBFUN 
+SRESPUBFUN
 sres_query_t *sres_query_make_sockaddr(sres_resolver_t *res,
                                       sres_answer_f *callback,
                                       sres_context_t *context,
@@ -195,25 +195,25 @@ sres_query_t *sres_query_make_sockaddr(sres_resolver_t *res,
                                       struct sockaddr const *addr);
 
 /** Rebind a DNS query. */
-SRESPUBFUN 
+SRESPUBFUN
 void sres_query_bind(sres_query_t *q,
                      sres_answer_f *callback,
                      sres_context_t *context);
 
 /**Get a list of matching (type/domain) records from cache. */
-SRESPUBFUN 
+SRESPUBFUN
 sres_record_t **sres_cached_answers(sres_resolver_t *res,
                                    uint16_t type,
                                    char const *domain);
 
 /**Search for a list of matching (type/name) records from cache. */
-SRESPUBFUN 
+SRESPUBFUN
 sres_record_t **sres_search_cached_answers(sres_resolver_t *res,
                                           uint16_t type,
                                           char const *name);
 
 /**Get a list of matching (type/domain) records from cache. */
-SRESPUBFUN 
+SRESPUBFUN
 sres_record_t **sres_cached_answers_sockaddr(sres_resolver_t *res,
                                              uint16_t type,
                                             struct sockaddr const *addr);
@@ -229,7 +229,7 @@ int sres_set_cached_srv_priority(sres_resolver_t *res,
 
 
 /** Send a query, wait for answer, return results. */
-SRESPUBFUN 
+SRESPUBFUN
 int sres_blocking_query(sres_resolver_t *res,
                        uint16_t type,
                        char const *domain,
@@ -237,7 +237,7 @@ int sres_blocking_query(sres_resolver_t *res,
                        sres_record_t ***return_records);
 
 /** Search DNS, return results. */
-SRESPUBFUN 
+SRESPUBFUN
 int sres_blocking_search(sres_resolver_t *res,
                         uint16_t type,
                         char const *name,
@@ -245,7 +245,7 @@ int sres_blocking_search(sres_resolver_t *res,
                         sres_record_t ***return_records);
 
 /** Send a a reverse DNS query, wait for answer, return results. */
-SRESPUBFUN 
+SRESPUBFUN
 int sres_blocking_query_sockaddr(sres_resolver_t *res,
                                 uint16_t type,
                                 struct sockaddr const *addr,
@@ -260,8 +260,8 @@ SRESPUBFUN int sres_sort_answers(sres_resolver_t *, sres_record_t **answers);
 
 /** Filter and sort the list of records */
 SRESPUBFUN
-int sres_filter_answers(sres_resolver_t *res, 
-                       sres_record_t **answers, 
+int sres_filter_answers(sres_resolver_t *res,
+                       sres_record_t **answers,
                        uint16_t type);
 
 /** Free the list records. */
index 462bcc54902330f2db006bffb5faaf7b9c05abf6..cdc39c15524596bb0a67d227aaca7636c9f042c7 100644 (file)
@@ -27,7 +27,7 @@
 #define SOFIA_RESOLV_SRES_ASYNC_H
 
 /**
- * @file sofia-resolv/sres_async.h 
+ * @file sofia-resolv/sres_async.h
  *
  * Asynchronous interface for Sofia DNS Resolver.
  *
@@ -50,7 +50,7 @@
 extern "C" {
 #endif
 
-#ifndef SRES_ASYNC_T 
+#ifndef SRES_ASYNC_T
 #define SRES_ASYNC_T struct sres_async_s
 #endif
 /** Application-defined type for context used by asynchronous operation. */
@@ -59,7 +59,7 @@ typedef SRES_ASYNC_T sres_async_t;
 /** Prototype for update function.
  *
  * This kind of function is called when the nameserver configuration has
- * been updated. 
+ * been updated.
  *
  * If the old_socket is not -1, it indicates that old_socket will be closed
  * and it should be removed from poll() or select() set.
@@ -75,7 +75,7 @@ typedef int sres_update_f(sres_async_t *async,
 
 /** Set asynchronous operation data. */
 SRESPUBFUN
-sres_async_t *sres_resolver_set_async(sres_resolver_t *res, 
+sres_async_t *sres_resolver_set_async(sres_resolver_t *res,
                                      sres_update_f *update,
                                      sres_async_t *async,
                                      int update_all);
@@ -86,7 +86,7 @@ sres_async_t *sres_resolver_get_async(sres_resolver_t const *res,
                                      sres_update_f *update);
 
 /** Create sockets for resolver. */
-SRESPUBFUN int sres_resolver_sockets(sres_resolver_t *, 
+SRESPUBFUN int sres_resolver_sockets(sres_resolver_t *,
                                     sres_socket_t *sockets,
                                     int n);
 
index 2639ce0c372a3dfa124426ab0dc09e0ddc31833a..b34260d51d54eea2ccbe3d828382501f078abb35 100644 (file)
@@ -81,7 +81,7 @@ SRESPUBFUN int sres_cache_get(sres_cache_t *cache,
 
 /** Free answers not matching with type */
 SRESPUBFUN int sres_cache_filter(sres_cache_t *cache,
-                                sres_record_t **answers, 
+                                sres_record_t **answers,
                                 uint16_t type);
 
 /** Free the list records. */
@@ -103,7 +103,7 @@ SRESPUBFUN void sres_cache_free_record(sres_cache_t *cache, void *rr);
 SRESPUBFUN void sres_cache_store(sres_cache_t *, sres_record_t *, time_t now);
 
 /** Modify the priority in the specified SRV record */
-SRESPUBFUN int sres_cache_set_srv_priority(sres_cache_t *, 
+SRESPUBFUN int sres_cache_set_srv_priority(sres_cache_t *,
                                           char const *domain,
                                           char const *target,
                                           uint16_t port,
index f5a12eb18fea5cc839b3f0a7deb82c037ef03f4f..0317b3f67d25c6174b37dd15dc7ed89e5ecb10b8 100644 (file)
@@ -27,7 +27,7 @@
 #define SOFIA_RESOLV_SRES_CONFIG_H
 
 /**
- * @file sofia-resolv/sres_config.h 
+ * @file sofia-resolv/sres_config.h
  *
  * Configuration for Sofia DNS Resolver.
  *
index eb4aa6d450d819ac69f33d36e8b5d35f6fe3911f..0edba479adb9085d238336b9f474e6b70fb33718 100644 (file)
@@ -45,7 +45,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-  
+
 /** Common part of all DNS records. */
 typedef struct sres_common
 {
@@ -101,7 +101,7 @@ typedef struct sres_a_record
   struct in_addr a_addr;       /**< IP4 address */
 } sres_a_record_t;
 
-/** IPv6 address used by sresolv library. 
+/** IPv6 address used by sresolv library.
  *
  * @sa #sres_aaaa_record, #sres_a6_record
  */
@@ -225,10 +225,10 @@ enum sres_qtypes {
   sres_type_nxt = 30,      /**< Next domain. */
   sres_type_eid = 31,      /**< Endpoint identifier. */
   sres_type_nimloc = 32,    /**< Nimrod Locator. */
-  sres_type_srv = 33,      /**< Server Selection (@RFC2782, 
+  sres_type_srv = 33,      /**< Server Selection (@RFC2782,
                                 #sres_srv_record). */
   sres_type_atma = 34,     /**< ATM Address */
-  sres_type_naptr = 35,            /**< Naming Authority PoinTeR (@RFC2915, 
+  sres_type_naptr = 35,            /**< Naming Authority PoinTeR (@RFC2915,
                                  #sres_naptr_record) */
   sres_type_kx = 36,       /**< Key Exchange */
   sres_type_cert = 37,     /**< Certification record */
index c75efe5d991b2a95dde80528094c2756aa6b3cd1..c705fa6ec48f721ac4200cb835f4337f8296298e 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-#ifndef SRESOLV_H 
+#ifndef SRESOLV_H
 /** Defined when <sofia-sip/sresolv.h> has been included. */
 #define SRESOLV_H
 
@@ -64,7 +64,7 @@ SOFIAPUBVAR tag_typedef_t srestag_cache_ref;
 #define SRESTAG_CACHE_REF(x) srestag_cache_ref, tag_ptr_vr(&(x), (x))
 
 /** Create a resolver object using @a root reactor. */
-SOFIAPUBFUN sres_resolver_t *sres_resolver_create(su_root_t *root, 
+SOFIAPUBFUN sres_resolver_t *sres_resolver_create(su_root_t *root,
                                                  char const *resolv_conf,
                                                  tag_type_t, tag_value_t,
                                                  ...);
index fd5ea81d5cb9578f543c70fbfbd265efcd9b919a..274f512c7170c9a14bb64c87be87881aae0f707c 100644 (file)
 
 /**@CFILE sres.c
  * @brief Sofia DNS Resolver implementation.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Teemu Jalava <Teemu.Jalava@nokia.com>
  * @author Mikko Haataja
- * @author Kai Vehmanen <kai.vehmanen@nokia.com> 
- *         (work on the win32 nameserver discovery) 
- * @author Dimitri E. Prado 
+ * @author Kai Vehmanen <kai.vehmanen@nokia.com>
+ *         (work on the win32 nameserver discovery)
+ * @author Dimitri E. Prado
  *         (initial version of win32 nameserver discovery)
  *
  * @todo The resolver should allow handling arbitrary records, too.
@@ -105,7 +105,7 @@ typedef int socklen_t;
 
 #if HAVE_WINSOCK2_H
 /* Posix send() */
-su_inline 
+su_inline
 ssize_t sres_send(sres_socket_t s, void *b, size_t length, int flags)
 {
   if (length > INT_MAX)
@@ -114,7 +114,7 @@ ssize_t sres_send(sres_socket_t s, void *b, size_t length, int flags)
 }
 
 /* Posix recvfrom() */
-su_inline 
+su_inline
 ssize_t sres_recvfrom(sres_socket_t s, void *buffer, size_t length, int flags,
                      struct sockaddr *from, socklen_t *fromlen)
 {
@@ -126,7 +126,7 @@ ssize_t sres_recvfrom(sres_socket_t s, void *buffer, size_t length, int flags,
   if (length > INT_MAX)
     length = INT_MAX;
 
-  retval = recvfrom(s, buffer, (int)length, flags, 
+  retval = recvfrom(s, buffer, (int)length, flags,
                    (void *)from, fromlen ? &ilen : NULL);
 
   if (fromlen)
@@ -202,7 +202,7 @@ typedef struct sres_nameserver sres_nameserver_t;
 static char const sres_conf_file_path[] = "/etc/resolv.conf";
 
 /** EDNS0 support. @internal */
-enum edns { 
+enum edns {
   edns_not_tried = -1,
   edns_not_supported = 0,
   edns0_configured = 1,
@@ -220,7 +220,7 @@ struct sres_server {
 
   /** ICMP/temporary error received, zero when successful. */
   time_t                  dns_icmp;
-  /** Persistent error, zero when successful or timeout. 
+  /** Persistent error, zero when successful or timeout.
    *
    * Never selected if dns_error is SRES_TIME_MAX.
    */
@@ -251,7 +251,7 @@ struct sres_resolver_s {
   short               res_update_all;
 
   uint16_t            res_id;
-  short               res_i_server;  /**< Current server to try 
+  short               res_i_server;  /**< Current server to try
                                        (when doing round-robin) */
   short               res_n_servers; /**< Number of servers */
   sres_server_t     **res_servers;
@@ -338,7 +338,7 @@ struct sres_message {
 #define m_qdcount m_packet.mp_header.mh_qdcount
 #define m_ancount m_packet.mp_header.mh_ancount
 #define m_nscount m_packet.mp_header.mh_nscount
-#define m_arcount m_packet.mp_header.mh_arcount 
+#define m_arcount m_packet.mp_header.mh_arcount
 #define m_data    m_packet.mp_data
 };
 
@@ -385,7 +385,7 @@ HTABLE_PROTOS_WITH(sres_qtable, qt, sres_query_t, unsigned, size_t);
    (void *)&((struct sockaddr *)ss)->sa_data)
 #endif
 
-static int sres_config_changed_servers(sres_config_t const *new_c, 
+static int sres_config_changed_servers(sres_config_t const *new_c,
                                       sres_config_t const *old_c);
 static sres_server_t **sres_servers_new(sres_resolver_t *res,
                                        sres_config_t const *c);
@@ -398,8 +398,8 @@ sres_new_id(sres_resolver_t *res)
 }
 
 /** Return true if we have a search list or a local domain name. */
-static int 
-sres_has_search_domain(sres_resolver_t *res) 
+static int
+sres_has_search_domain(sres_resolver_t *res)
 {
   return res->res_config->c_search[0] != NULL;
 }
@@ -409,7 +409,7 @@ static void sres_resolver_destructor(void *);
 sres_resolver_t *
 sres_resolver_new_with_cache_va(char const *conf_file_path,
                                sres_cache_t *cache,
-                               char const *options, 
+                               char const *options,
                                va_list va);
 static
 sres_resolver_t *
@@ -434,25 +434,25 @@ static sres_query_t * sres_query_alloc(sres_resolver_t *res,
 
 static void sres_free_query(sres_resolver_t *res, sres_query_t *q);
 
-static 
-int sres_sockaddr2string(sres_resolver_t *, 
-                        char name[], size_t namelen, 
+static
+int sres_sockaddr2string(sres_resolver_t *,
+                        char name[], size_t namelen,
                         struct sockaddr const *);
 
-static 
+static
 sres_config_t *sres_parse_resolv_conf(sres_resolver_t *res,
                                      char const **options);
 
 static
-sres_server_t *sres_next_server(sres_resolver_t *res, 
+sres_server_t *sres_next_server(sres_resolver_t *res,
                                uint8_t *in_out_i,
                                int always);
 
 static
 int sres_send_dns_query(sres_resolver_t *res, sres_query_t *q);
 
-static 
-void sres_answer_subquery(sres_context_t *context, 
+static
+void sres_answer_subquery(sres_context_t *context,
                          sres_query_t *query,
                          sres_record_t **answers);
 
@@ -468,26 +468,26 @@ void sres_query_report_error(sres_query_t *q,
 static void
 sres_resend_dns_query(sres_resolver_t *res, sres_query_t *q, int timeout);
 
-static 
+static
 sres_server_t *sres_server_by_socket(sres_resolver_t const *ts,
                                     sres_socket_t socket);
 
 static
-int sres_resolver_report_error(sres_resolver_t *res, 
+int sres_resolver_report_error(sres_resolver_t *res,
                               sres_socket_t socket,
                               int errcode,
                               struct sockaddr_storage *remote,
-                              socklen_t remotelen, 
+                              socklen_t remotelen,
                               char const *info);
 
 static
-void sres_log_response(sres_resolver_t const *res, 
+void sres_log_response(sres_resolver_t const *res,
                       sres_message_t const *m,
                       struct sockaddr_storage const *from,
                       sres_query_t const *query,
                       sres_record_t * const *reply);
 
-static int sres_decode_msg(sres_resolver_t *res, 
+static int sres_decode_msg(sres_resolver_t *res,
                           sres_message_t *m,
                           sres_query_t **,
                           sres_record_t ***aanswers);
@@ -531,9 +531,9 @@ static sres_record_t *sres_create_error_rr(sres_cache_t *cache,
 static void m_put_uint16(sres_message_t *m, uint16_t h);
 static void m_put_uint32(sres_message_t *m, uint32_t w);
 
-static uint16_t m_put_domain(sres_message_t *m, 
-                             char const *domain, 
-                             uint16_t top, 
+static uint16_t m_put_domain(sres_message_t *m,
+                             char const *domain,
+                             uint16_t top,
                              char const *topdomain);
 
 static uint32_t m_get_uint32(sres_message_t *m);
@@ -560,7 +560,7 @@ static int m_get_domain(char *d, int n, sres_message_t *m, uint16_t offset);
  *
  * The SRESOLV_DEBUG environment variable is used to determine the debug
  * logging level for @b sresolv module. The default level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, sresolv_log, SOFIA_DEBUG
  */
 #ifdef DOXYGEN
@@ -571,8 +571,8 @@ extern char const SRESOLV_DEBUG[]; /* dummy declaration for Doxygen */
 #define SU_DEBUG 3
 #endif
 
-/**Debug log for @b sresolv module. 
- * 
+/**Debug log for @b sresolv module.
+ *
  * The sresolv_log is the log object used by @b sresolv module. The level of
  * #sresolv_log is set using #SRESOLV_DEBUG environment variable.
  */
@@ -593,7 +593,7 @@ enum {
  * file can be overriden by giving the name of the configuration file as @a
  * conf_file_path.
  *
- * @param conf_file_path name of the resolv.conf configuration file 
+ * @param conf_file_path name of the resolv.conf configuration file
  *
  * @return A pointer to a newly created sres resolver object, or NULL upon
  * an error.
@@ -638,9 +638,9 @@ sres_resolver_t *sres_resolver_copy(sres_resolver_t *res)
  * It is also possible to override the values in the resolv.conf and
  * RES_OPTIONS by giving the directives in the NULL-terminated list.
  *
- * @param conf_file_path name of the resolv.conf configuration file 
+ * @param conf_file_path name of the resolv.conf configuration file
  * @param cache          optional pointer to a resolver cache (may be NULL)
- * @param option, ...    list of resolv.conf options directives 
+ * @param option, ...    list of resolv.conf options directives
  *                       (overriding options in conf_file)
  *
  * @par Environment Variables
@@ -667,7 +667,7 @@ sres_resolver_new_with_cache(char const *conf_file_path,
 
 /**Create a resolver.
  *
- * Allocate and initialize a new sres resolver object. 
+ * Allocate and initialize a new sres resolver object.
  *
  * This is a stdarg version of sres_resolver_new_with_cache().
  */
@@ -683,7 +683,7 @@ sres_resolver_new_with_cache_va(char const *conf_file_path,
   sres_resolver_t *res;
 
   va_copy(va0, va);
-  
+
   for (i = 0, o = option; o; o = va_arg(va0, char const *)) {
     if (i < 16)
       olist[i] = o;
@@ -716,7 +716,7 @@ sres_resolver_new_internal(sres_cache_t *cache,
   sres_resolver_t *res;
   size_t i, n, len;
   char **array, *o, *end;
+
   for (n = 0, len = 0; options && options[n]; n++)
     len += strlen(options[n]) + 1;
 
@@ -785,7 +785,7 @@ sres_resolver_ref(sres_resolver_t *res)
 {
   return su_home_ref(res->res_home);
 }
-                    
+
 /** Decrease the reference count on a resolver object.  */
 void
 sres_resolver_unref(sres_resolver_t *res)
@@ -796,12 +796,12 @@ sres_resolver_unref(sres_resolver_t *res)
 /** Set userdata pointer.
  *
  * @return New userdata pointer.
- * 
+ *
  * @ERRORS
  * @ERROR EFAULT @a res points outside the address space
  */
 void *
-sres_resolver_set_userdata(sres_resolver_t *res, 
+sres_resolver_set_userdata(sres_resolver_t *res,
                           void *userdata)
 {
   void *old;
@@ -817,7 +817,7 @@ sres_resolver_set_userdata(sres_resolver_t *res,
 /**Get userdata pointer.
  *
  * @return Userdata pointer.
- * 
+ *
  * @ERRORS
  * @ERROR EFAULT @a res points outside the address space
  */
@@ -833,7 +833,7 @@ sres_resolver_get_userdata(sres_resolver_t const *res)
 /** Set async object.
  *
  * @return Set async object.
- * 
+ *
  * @ERRORS
  * @ERROR EFAULT @a res points outside the address space
  * @ERROR EALREADY different async callback already set
@@ -841,7 +841,7 @@ sres_resolver_get_userdata(sres_resolver_t const *res)
 sres_async_t *
 sres_resolver_set_async(sres_resolver_t *res,
                        sres_update_f *callback,
-                       sres_async_t *async, 
+                       sres_async_t *async,
                        int update_all)
 {
   if (!res)
@@ -849,7 +849,7 @@ sres_resolver_set_async(sres_resolver_t *res,
 
   if (res->res_updcb && res->res_updcb != callback)
     return su_seterrno(EALREADY), (void *)NULL;
-    
+
   res->res_async = async;
   res->res_updcb = callback;
   res->res_update_all = callback && update_all != 0;
@@ -906,12 +906,12 @@ int sres_resolver_set_timer_cb(sres_resolver_t *res,
  * Query types also indicate the record type of the result.
  * Any record can be queried with #sres_qtype_any.
  * Well-known query types understood and decoded by @b sres include
- * #sres_type_a, 
+ * #sres_type_a,
  * #sres_type_aaaa,
  * #sres_type_cname,
- * #sres_type_ptr 
- * #sres_type_soa, 
- * #sres_type_aaaa, 
+ * #sres_type_ptr
+ * #sres_type_soa,
+ * #sres_type_aaaa,
  * #sres_type_srv, and
  * #sres_type_naptr.
  *
@@ -939,7 +939,7 @@ sres_query(sres_resolver_t *res,
 {
   sres_query_t *query = NULL;
   size_t dlen;
-  
+
   char b[8];
   SU_DEBUG_9(("sres_query(%p, %p, %s, \"%s\") called\n",
                          (void *)res, (void *)context, sres_record_type(type, b), domain));
@@ -970,12 +970,12 @@ sres_query(sres_resolver_t *res,
 
 /**Search DNS.
  *
- * Sends DNS queries with specified @a type and @a name to the DNS server. 
+ * Sends DNS queries with specified @a type and @a name to the DNS server.
  * If the @a name does not contain enought dots, the search domains are
  * appended to the name and resulting domain name are also queried. When
  * answer to all the search domains is received, the @a callback function
  * is called with @a context and combined records from answers as arguments.
- * 
+ *
  * The sres resolver takes care of retransmitting the queries if a root
  * object is associate with the resolver or if sres_resolver_timer() is
  * called in regular intervals. It generates an error record with nonzero
@@ -1031,7 +1031,7 @@ sres_search(sres_resolver_t *res,
     dots = res->res_config->c_opt.ndots;
   else if (sres_has_search_domain(res))
     for (dots = 0, dot = strchr(domain, '.');
-        dots < res->res_config->c_opt.ndots && dot; 
+        dots < res->res_config->c_opt.ndots && dot;
         dots++, dot = strchr(dot + 1, '.'))
       ;
   else
@@ -1057,7 +1057,7 @@ sres_search(sres_resolver_t *res,
       for (i = 0, subs = 0; i <= SRES_MAX_SEARCH; i++) {
        if (domains[i]) {
          len = strlen(domains[i]);
-         
+
          if (dlen + len + 1 > SRES_MAXDNAME)
            continue;
 
@@ -1106,7 +1106,7 @@ sres_search(sres_resolver_t *res,
  * @param context pointer given as an extra argument to @a callback function
  * @param type record type to query (or sres_qtype_any for any record)
  * @param addr socket address structure
- * 
+ *
  * The @a type should be #sres_type_ptr. The @a addr should contain either
  * IPv4 (AF_INET) or IPv6 (AF_INET6) address.
  *
@@ -1132,7 +1132,7 @@ sres_query_sockaddr(sres_resolver_t *res,
                    uint16_t type,
                    struct sockaddr const *addr)
 {
-  char name[80]; 
+  char name[80];
 
   if (!res || !addr)
     return su_seterrno(EFAULT), (void *)NULL;
@@ -1171,7 +1171,7 @@ sres_query_make_sockaddr(sres_resolver_t *res,
                         uint16_t type,
                         struct sockaddr const *addr)
 {
-  char name[80]; 
+  char name[80];
 
   if (!res || !addr)
     return su_seterrno(EFAULT), (void *)NULL;
@@ -1226,7 +1226,7 @@ sres_cached_answers(sres_resolver_t *res,
 
   if (!domain)
     return NULL;
-  
+
   if (!sres_cache_get(res->res_cache, type, domain, &result))
     return su_seterrno(ENOENT), (void *)NULL;
 
@@ -1267,7 +1267,7 @@ sres_search_cached_answers(sres_resolver_t *res,
 
   if (sres_has_search_domain(res))
     for (dots = 0, dot = strchr(domain, '.');
-        dots < res->res_config->c_opt.ndots && dot; 
+        dots < res->res_config->c_opt.ndots && dot;
         dots++, dot = strchr(dot + 1, '.'))
       ;
   else
@@ -1315,7 +1315,7 @@ sres_search_cached_answers(sres_resolver_t *res,
  * @param res pointer to resolver
  * @param type record type to query (or sres_qtype_any for any record)
  * @param addr socket address structure
- * 
+ *
  * The @a type should be #sres_type_ptr. The @a addr should contain either
  * IPv4 (AF_INET) or IPv6 (AF_INET6) address.
  *
@@ -1324,7 +1324,7 @@ sres_search_cached_answers(sres_resolver_t *res,
  * "ip6-dotint", the IPv6 addresses are resolved using suffix ".ip6.int"
  * instead of default ".ip6.arpa".
  *
- * @retval 
+ * @retval
  * pointer to an array of pointers to cached records, or
  * NULL if no entry was found.
  *
@@ -1363,13 +1363,13 @@ sres_cached_answers_sockaddr(sres_resolver_t *res,
  * @param res      pointer to resolver
  * @param domain   domain name of the SRV record(s) to modify
  * @param target   SRV target of the SRV record(s) to modify
- * @param port     port number of SRV record(s) to modify 
- *                 (in host byte order) 
+ * @param port     port number of SRV record(s) to modify
+ *                 (in host byte order)
  * @param ttl      new ttl for SRV records of the domain
  * @param priority new priority value (0=highest, 65535=lowest)
  *
  * @sa sres_cache_set_srv_priority()
- * 
+ *
  * @NEW_1_12_8
  */
 int sres_set_cached_srv_priority(sres_resolver_t *res,
@@ -1389,8 +1389,8 @@ int sres_set_cached_srv_priority(sres_resolver_t *res,
   if (!domain)
     return -1;
 
-  return sres_cache_set_srv_priority(res->res_cache, 
-                                    domain, target, port, 
+  return sres_cache_set_srv_priority(res->res_cache,
+                                    domain, target, port,
                                     ttl, priority);
 }
 
@@ -1409,7 +1409,7 @@ sres_sort_answers(sres_resolver_t *res, sres_record_t **answers)
 
   /* Simple insertion sorting */
   /*
-   * We do not use qsort because we want later extend this to sort 
+   * We do not use qsort because we want later extend this to sort
    * local A records first etc.
    */
   for (i = 1; answers[i]; i++) {
@@ -1431,10 +1431,10 @@ sres_sort_answers(sres_resolver_t *res, sres_record_t **answers)
 
 /** Sort and filter query results */
 int
-sres_filter_answers(sres_resolver_t *res, 
-                   sres_record_t **answers, 
+sres_filter_answers(sres_resolver_t *res,
+                   sres_record_t **answers,
                    uint16_t type)
-{                  
+{
   int i, n;
 
   if (res == NULL || answers == NULL)
@@ -1465,11 +1465,11 @@ void sres_free_answer(sres_resolver_t *res, sres_record_t *answer)
 }
 
 /** Free and zero an array of records.
- * 
- * The array of records can be returned by sres_cached_answers() or 
+ *
+ * The array of records can be returned by sres_cached_answers() or
  * given by callback function.
  */
-void 
+void
 sres_free_answers(sres_resolver_t *res,
                  sres_record_t **answers)
 {
@@ -1528,7 +1528,7 @@ char const *sres_record_type(int type, char buffer[8])
   case sres_qtype_mailb: return "MAILB";
   case sres_qtype_maila: return "MAILA";
   case sres_qtype_any: return "ANY";
-    
+
   default:
     sprintf(buffer, "%u?", type & 65535);
     return buffer;
@@ -1553,7 +1553,7 @@ char const *sres_record_class(int rclass, char buffer[8])
 }
 
 /** Compare two records. */
-int 
+int
 sres_record_compare(sres_record_t const *aa, sres_record_t const *bb)
 {
   int D;
@@ -1565,9 +1565,9 @@ sres_record_compare(sres_record_t const *aa, sres_record_t const *bb)
 
   if (a->r_status)
     return 0;
-  
+
   switch (a->r_type) {
-  case sres_type_soa: 
+  case sres_type_soa:
     {
       sres_soa_record_t const *A = aa->sr_soa, *B = bb->sr_soa;
       D = A->soa_serial - B->soa_serial; if (D) return D;
@@ -1588,7 +1588,7 @@ sres_record_compare(sres_record_t const *aa, sres_record_t const *bb)
     {
       sres_a6_record_t const *A = aa->sr_a6, *B = bb->sr_a6;
       D = A->a6_prelen - B->a6_prelen; if (D) return D;
-      D = !A->a6_prename - !B->a6_prename; 
+      D = !A->a6_prename - !B->a6_prename;
       if (D == 0 && A->a6_prename && B->a6_prename)
        D = strcasecmp(A->a6_prename, B->a6_prename); if (D) return D;
       return memcmp(&A->a6_suffix, &B->a6_suffix, sizeof A->a6_suffix);
@@ -1596,7 +1596,7 @@ sres_record_compare(sres_record_t const *aa, sres_record_t const *bb)
   case sres_type_aaaa:
     {
       sres_aaaa_record_t const *A = aa->sr_aaaa, *B = bb->sr_aaaa;
-      return memcmp(&A->aaaa_addr, &B->aaaa_addr, sizeof A->aaaa_addr);      
+      return memcmp(&A->aaaa_addr, &B->aaaa_addr, sizeof A->aaaa_addr);
     }
   case sres_type_cname:
     {
@@ -1625,7 +1625,7 @@ sres_record_compare(sres_record_t const *aa, sres_record_t const *bb)
       D = strcmp(A->na_flags, B->na_flags); if (D) return D;
       D = strcmp(A->na_services, B->na_services); if (D) return D;
       D = strcmp(A->na_regexp, B->na_regexp); if (D) return D;
-      return strcmp(A->na_replace, B->na_replace); 
+      return strcmp(A->na_replace, B->na_replace);
     }
   default:
     return 0;
@@ -1636,14 +1636,14 @@ sres_record_compare(sres_record_t const *aa, sres_record_t const *bb)
 /* Private functions */
 
 /** Destruct */
-static 
-void 
+static
+void
 sres_resolver_destructor(void *arg)
 {
   sres_resolver_t *res = arg;
 
   assert(res);
-  sres_cache_unref(res->res_cache); 
+  sres_cache_unref(res->res_cache);
   res->res_cache = NULL;
 
   sres_servers_close(res, res->res_servers);
@@ -1656,7 +1656,7 @@ sres_resolver_destructor(void *arg)
 }
 
 /*
- * 3571 is a prime => 
+ * 3571 is a prime =>
  * we hash successive id values to different parts of hash tables
  */
 #define Q_PRIME 3571
@@ -1697,18 +1697,18 @@ sres_query_alloc(sres_resolver_t *res,
     query->q_i_server = res->res_i_server;
     query->q_n_servers = res->res_n_servers;
     query->q_hash = query->q_id * Q_PRIME /* + query->q_i_server */;
-    
+
     sres_qtable_append(res->res_queries, query);
 
     if (res->res_schedulecb && res->res_queries->qt_used == 1)
-      res->res_schedulecb(res->res_async, 2 * SRES_RETRANSMIT_INTERVAL); 
+      res->res_schedulecb(res->res_async, 2 * SRES_RETRANSMIT_INTERVAL);
   }
 
   return query;
 }
 
 su_inline
-void 
+void
 sres_remove_query(sres_resolver_t *res, sres_query_t *q, int all)
 {
   int i;
@@ -1749,7 +1749,7 @@ void sres_free_query(sres_resolver_t *res, sres_query_t *q)
       sres_cache_free_answers(res->res_cache, q->q_subanswers[i]);
     q->q_subanswers[i] = NULL;
   }
+
   su_free(res->res_home, q);
 }
 
@@ -1767,7 +1767,7 @@ sres_combine_results(sres_resolver_t *res,
       for (j = 0; search_results[i][j]; j++)
        found++;
 
-  combined_result = su_alloc((su_home_t *)res->res_cache, 
+  combined_result = su_alloc((su_home_t *)res->res_cache,
                             (found + 1) * (sizeof combined_result[0]));
   if (combined_result) {
     for (i = 0, found = 0; i <= SRES_MAX_SEARCH; i++)
@@ -1832,7 +1832,7 @@ sres_sockaddr2string(sres_resolver_t *res,
       name[4 * i + 2] = hex > 9 ? hex + 'a' - 10 : hex + '0';
       name[4 * i + 3] = '.';
     }
-    
+
     strcpy(name + 4 * i, postfix);
 
     return (int)required;
@@ -1840,7 +1840,7 @@ sres_sockaddr2string(sres_resolver_t *res,
 #endif /* HAVE_SIN6 */
   else {
     su_seterrno(EAFNOSUPPORT);
-    SU_DEBUG_3(("%s: %s\n", "sres_sockaddr2string", 
+    SU_DEBUG_3(("%s: %s\n", "sres_sockaddr2string",
                 su_strerror(EAFNOSUPPORT)));
     return 0;
   }
@@ -1848,8 +1848,8 @@ sres_sockaddr2string(sres_resolver_t *res,
 
 /** Make a domain name a top level domain name.
  *
- * The function sres_toplevel() returns a copies string @a domain and 
- * terminates it with a dot if it is not already terminated. 
+ * The function sres_toplevel() returns a copies string @a domain and
+ * terminates it with a dot if it is not already terminated.
  */
 static
 char const *
@@ -1926,7 +1926,7 @@ int sres_resolver_update(sres_resolver_t *res, int always)
  * @retval 0 when otherwise successful
  * @retval -1 upon an error
  */
-static 
+static
 int sres_update_config(sres_resolver_t *res, int always, time_t now)
 {
   sres_config_t *c = NULL;
@@ -1938,9 +1938,9 @@ int sres_update_config(sres_resolver_t *res, int always, time_t now)
   if (!always && previous && now < res->res_checked)
     return 0;
   /* Try avoid checking for changes too often. */
-  res->res_checked = now + SRES_UPDATE_INTERVAL_SECS; 
-  
-  if (!always && previous && 
+  res->res_checked = now + SRES_UPDATE_INTERVAL_SECS;
+
+  if (!always && previous &&
       sres_config_timestamp(previous) == previous->c_modified)
     return 0;
 
@@ -1999,7 +1999,7 @@ static int sres_parse_win32_ip(sres_config_t *c)
  * name server IP addresses.
  *
  * @return number of server addresses added
- */ 
+ */
 static int sres_parse_win32_reg_parse_dnsserver(sres_config_t *c, HKEY key, LPCTSTR lpValueName)
 {
   su_home_t *home = c->c_home;
@@ -2009,10 +2009,10 @@ static int sres_parse_win32_reg_parse_dnsserver(sres_config_t *c, HKEY key, LPCT
   int ret, servers_added = 0;
 
   /* get name servers and ... */
-  while((ret = RegQueryValueEx(key, 
-                              lpValueName, 
-                              NULL, NULL, 
-                              name_servers, 
+  while((ret = RegQueryValueEx(key,
+                              lpValueName,
+                              NULL, NULL,
+                              name_servers,
                               &name_servers_length)) == ERROR_MORE_DATA) {
     name_servers_length += QUERY_DATALEN;
 
@@ -2033,14 +2033,14 @@ static int sres_parse_win32_reg_parse_dnsserver(sres_config_t *c, HKEY key, LPCT
 
       /* add to list */
       reg_dns_list = su_strlst_split(home, (char *)name_servers, " ");
-           
+
       for(i = 0 ; i < su_strlst_len(reg_dns_list); i++) {
        const char *item = su_strlst_item(reg_dns_list, i);
        SU_DEBUG_3(("Adding nameserver: %s (key=%s)\n", item, (char*)lpValueName));
        sres_parse_nameserver(c, item);
        ++servers_added;
       }
-           
+
       su_strlst_destroy(reg_dns_list);
 
     }
@@ -2069,9 +2069,9 @@ static int sres_parse_win32_reg(sres_config_t *c)
 #define MAX_VALUE_NAME_LEN    16383
 
   su_home_t *home = c->c_home;
-  HKEY key_handle;  
+  HKEY key_handle;
 #if 0
-  HKEY interface_key_handle;  
+  HKEY interface_key_handle;
   FILETIME ftime;
   int index, i;
 #endif
@@ -2085,13 +2085,13 @@ static int sres_parse_win32_reg(sres_config_t *c)
   int guid_size = MAX_VALUE_NAME_LEN;
 #endif
 
-  /* step: find interface specific nameservers 
+  /* step: find interface specific nameservers
    * - this is currently disabled 2006/Jun (the current check might insert
-   *   multiple unnecessary nameservers to the search list) 
+   *   multiple unnecessary nameservers to the search list)
    */
   /* open the 'Interfaces' registry Key */
-  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, 
-                  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces", 
+  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces",
                   0, KEY_READ, &key_handle)) {
     SU_DEBUG_2(("RegOpenKeyEx failed\n"));
   } else {
@@ -2101,12 +2101,12 @@ static int sres_parse_win32_reg(sres_config_t *c)
                        interface_guid, &guid_size,
                        NULL,NULL,0,&ftime) == ERROR_SUCCESS){
       if (RegOpenKeyEx(key_handle, interface_guid,
-                      0, KEY_READ, 
+                      0, KEY_READ,
                       &interface_key_handle) == ERROR_SUCCESS) {
 
        /* note: 'NameServer' is preferred over 'DhcpNameServer' */
        found += sres_parse_win32_reg_parse_dnsserver(c, interface_key_handle, "NameServer");
-       if (found == 0) 
+       if (found == 0)
          found += sres_parse_win32_reg_parse_dnsserver(c, interface_key_handle, "DhcpNameServer");
 
        RegCloseKey(interface_key_handle);
@@ -2120,16 +2120,16 @@ static int sres_parse_win32_reg(sres_config_t *c)
   }
 #endif /* #if 0: interface-specific nameservers */
 
-  /* step: if no interface-specific nameservers are found, 
+  /* step: if no interface-specific nameservers are found,
    *       check for system-wide nameservers */
   if (found == 0) {
-    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, 
-                    "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 
+    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                    "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
                     0, KEY_READ, &key_handle)) {
       SU_DEBUG_2(("RegOpenKeyEx failed (2)\n"));
     } else {
       found += sres_parse_win32_reg_parse_dnsserver(c, key_handle, "NameServer");
-      if (found == 0) 
+      if (found == 0)
        found += sres_parse_win32_reg_parse_dnsserver(c, key_handle, "DhcpNameServer");
       RegCloseKey(key_handle);
     }
@@ -2149,13 +2149,13 @@ static int sres_parse_win32_reg(sres_config_t *c)
 
 /** Parse /etc/resolv.conf file.
  *
- * @retval #sres_config_t structure when successful 
+ * @retval #sres_config_t structure when successful
  * @retval NULL upon an error
  *
- * @todo The resolv.conf directives @b sortlist and most of the options 
+ * @todo The resolv.conf directives @b sortlist and most of the options
  *       are currently ignored.
  */
-static 
+static
 sres_config_t *sres_parse_resolv_conf(sres_resolver_t *res,
                                      char const **options)
 {
@@ -2164,7 +2164,7 @@ sres_config_t *sres_parse_resolv_conf(sres_resolver_t *res,
   if (c) {
     FILE *f;
     int i;
-    
+
     f = fopen(c->c_filename = res->res_cnffile, "r");
 
     sres_parse_config(c, f);
@@ -2172,7 +2172,7 @@ sres_config_t *sres_parse_resolv_conf(sres_resolver_t *res,
     if (f)
       fclose(f);
 
-#if HAVE_WIN32    
+#if HAVE_WIN32
     /* note: no 127.0.0.1 on win32 systems */
     /* on win32, query the registry for nameservers */
     if (sres_parse_win32_ip(c) == 0 || sres_parse_win32_reg(c) == 0)
@@ -2184,14 +2184,14 @@ sres_config_t *sres_parse_resolv_conf(sres_resolver_t *res,
     if (c->c_nameservers[0] == NULL)
       sres_parse_nameserver(c, "127.0.0.1");
 #endif
-      
+
     for (i = 0; c->c_nameservers[i] && i < SRES_MAX_NAMESERVERS; i++) {
       struct sockaddr_in *sin = (void *)c->c_nameservers[i]->ns_addr;
       sin->sin_port = htons(c->c_port);
     }
 
     sres_parse_options(c, getenv("RES_OPTIONS"));
-    
+
     if (options)
       for (i = 0; options[i]; i++)
        sres_parse_options(c, options[i]);
@@ -2206,7 +2206,7 @@ sres_config_t *sres_parse_resolv_conf(sres_resolver_t *res,
 
 uint16_t _sres_default_port = 53;
 
-/** Parse config file. 
+/** Parse config file.
  *
  * @return Number of search domains, if successful.
  * @retval -1 upon an error (never happens).
@@ -2230,7 +2230,7 @@ int sres_parse_config(sres_config_t *c, FILE *f)
   c->c_opt.attempts = SRES_MAX_RETRY_COUNT;
   c->c_port = _sres_default_port;
 
-  if (f != NULL) {  
+  if (f != NULL) {
     for (line = 1; fgets(buf, sizeof(buf), f); line++) {
       size_t len;
       char *value, *b;
@@ -2320,7 +2320,7 @@ int sres_parse_config(sres_config_t *c, FILE *f)
  * - @b attempts:<i>n</i> fail after <i>n</i> retries
  * - @b rotate          use round robin selection of nameservers
  * - @b no-check-names  do not check names for invalid characters
- * - @b inet6           (no effect) 
+ * - @b inet6           (no effect)
  * - @b ip6-dotint      IPv6 addresses are resolved using suffix ".ip6.int"
  *                      instead of the standard ".ip6.arpa" suffix
  * - @b ip6-bytestring  (no effect)
@@ -2358,7 +2358,7 @@ extern LOCALDOMAIN;
 #endif
 
 /* Parse options line or #SRES_OPTIONS or #RES_OPTIONS environment variable. */
-static int 
+static int
 sres_parse_options(sres_config_t *c, char const *value)
 {
   if (!value)
@@ -2440,8 +2440,8 @@ int sres_parse_nameserver(sres_config_t *c, char const *server)
     struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
     memset(sa, 0, ns->ns_addrlen = sizeof *sin6);
     err = su_inet_pton(sa->sa_family = AF_INET6, server, &sin6->sin6_addr);
-  } 
-  else 
+  }
+  else
 #endif
     {
       struct sockaddr_in *sin = (struct sockaddr_in *)sa;
@@ -2486,8 +2486,8 @@ time_t sres_config_timestamp(sres_config_t const *c)
 /* ---------------------------------------------------------------------- */
 
 /** Check if the new configuration has different servers than the old */
-static 
-int sres_config_changed_servers(sres_config_t const *new_c, 
+static
+int sres_config_changed_servers(sres_config_t const *new_c,
                                sres_config_t const *old_c)
 {
   int i;
@@ -2534,7 +2534,7 @@ sres_server_t **sres_servers_new(sres_resolver_t *res,
     dns->dns_socket = INVALID_SOCKET;
     ns = c->c_nameservers[i];
     memcpy(dns->dns_addr, ns->ns_addr, dns->dns_addrlen = ns->ns_addrlen);
-    su_inet_ntop(dns->dns_addr->ss_family, SS_ADDR(dns->dns_addr), 
+    su_inet_ntop(dns->dns_addr->ss_family, SS_ADDR(dns->dns_addr),
              dns->dns_name, sizeof dns->dns_name);
     dns->dns_edns = c->c_opt.edns;
     servers[i] = dns++;
@@ -2575,7 +2575,7 @@ int sres_servers_count(sres_server_t *const *servers)
   for (i = 0; i < SRES_MAX_NAMESERVERS; i++) {
     if (!servers[i])
       break;
-  }  
+  }
 
   return i;
 }
@@ -2637,7 +2637,7 @@ sres_socket_t sres_server_socket(sres_resolver_t *res, sres_server_t *dns)
     sres_close(s);
     return INVALID_SOCKET;
   }
-  
+
   if (res->res_updcb) {
     if (res->res_updcb(res->res_async, s, INVALID_SOCKET) < 0) {
       SU_DEBUG_1(("%s: %s: %s\n", "sres_server_socket", "update callback",
@@ -2648,18 +2648,18 @@ sres_socket_t sres_server_socket(sres_resolver_t *res, sres_server_t *dns)
   }
 
   dns->dns_socket = s;
-  
+
   return s;
 }
 
 /* ---------------------------------------------------------------------- */
 
 /** Send a query packet */
-static 
-int 
-sres_send_dns_query(sres_resolver_t *res, 
+static
+int
+sres_send_dns_query(sres_resolver_t *res,
                    sres_query_t *q)
-{                        
+{
   sres_message_t m[1];
   uint8_t i, i0, N = res->res_n_servers;
   sres_socket_t s;
@@ -2680,7 +2680,7 @@ sres_send_dns_query(sres_resolver_t *res,
     return -1;
   if (servers == NULL)
     return -1;
-  if (N == 0) 
+  if (N == 0)
     return -1;
 
   memset(m, 0, offsetof(sres_message_t, m_data[sizeof m->m_packet.mp_header]));
@@ -2689,16 +2689,16 @@ sres_send_dns_query(sres_resolver_t *res,
   size = sizeof(m->m_packet.mp_header);
   m->m_size = (uint16_t)sizeof(m->m_data);
   m->m_offset = (uint16_t)size;
-  
+
   m->m_id = id;
   m->m_flags = htons(SRES_HDR_QUERY | SRES_HDR_RD);
-  
+
   /* Query record */
   m->m_qdcount = htons(1);
   m_put_domain(m, domain, 0, NULL);
   m_put_uint16(m, type);
   m_put_uint16(m, sres_class_in);
-  
+
   no_edns_size = m->m_offset;
 
   /* EDNS0 record (optional) */
@@ -2707,7 +2707,7 @@ sres_send_dns_query(sres_resolver_t *res,
   m_put_uint16(m, sizeof(m->m_packet)); /* Class: our UDP payload size */
   m_put_uint32(m, 0);          /* TTL: extended RCODE & flags */
   m_put_uint16(m, 0);
-  
+
   edns_size = m->m_offset;
 
   if (m->m_error) {
@@ -2727,9 +2727,9 @@ sres_send_dns_query(sres_resolver_t *res,
     /* If server supports EDNS, include EDNS0 record */
     q->q_edns = dns->dns_edns;
     /* 0 (no EDNS) or 1 (EDNS supported) additional data records */
-    m->m_arcount = htons(q->q_edns != 0); 
+    m->m_arcount = htons(q->q_edns != 0);
     /* Size with or without EDNS record */
-    size = q->q_edns ? edns_size : no_edns_size; 
+    size = q->q_edns ? edns_size : no_edns_size;
 
     s = sres_server_socket(res, dns);
 
@@ -2757,10 +2757,10 @@ sres_send_dns_query(sres_resolver_t *res,
 
   q->q_i_server = i;
 
-  SU_DEBUG_5(("%s(%p, %p) id=%u %s %s (to [%s]:%u)\n", 
+  SU_DEBUG_5(("%s(%p, %p) id=%u %s %s (to [%s]:%u)\n",
              "sres_send_dns_query",
-             (void *)res, (void *)q, id, sres_record_type(type, b), domain, 
-             dns->dns_name, 
+             (void *)res, (void *)q, id, sres_record_type(type, b), domain,
+             dns->dns_name,
              htons(((struct sockaddr_in *)dns->dns_addr)->sin_port)));
 
   return 0;
@@ -2779,7 +2779,7 @@ sres_send_dns_query(sres_resolver_t *res,
  * @param always return always a server
  */
 static
-sres_server_t *sres_next_server(sres_resolver_t *res, 
+sres_server_t *sres_next_server(sres_resolver_t *res,
                                uint8_t *in_out_i,
                                int always)
 {
@@ -2801,7 +2801,7 @@ sres_server_t *sres_next_server(sres_resolver_t *res,
        dns->dns_error != SRES_TIME_MAX)
       dns->dns_error = 0;
   }
-  
+
   /* Retry using another server? */
   for (j = (i + 1) % N; (j != i); j = (j + 1) % N) {
     dns = servers[j]; if (!dns) continue;
@@ -2820,7 +2820,7 @@ sres_server_t *sres_next_server(sres_resolver_t *res,
   if (!always)
     return NULL;
 
-  dns = servers[i]; 
+  dns = servers[i];
   if (dns && dns->dns_error < now && dns->dns_error != SRES_TIME_MAX)
     return dns;
 
@@ -2829,7 +2829,7 @@ sres_server_t *sres_next_server(sres_resolver_t *res,
     if (dns->dns_error < now && dns->dns_error != SRES_TIME_MAX)
       return *in_out_i = j, dns;
   }
-  
+
   return NULL;
 }
 
@@ -2837,7 +2837,7 @@ sres_server_t *sres_next_server(sres_resolver_t *res,
  * Callback function for subqueries
  */
 static
-void sres_answer_subquery(sres_context_t *context, 
+void sres_answer_subquery(sres_context_t *context,
                          sres_query_t *query,
                          sres_record_t **answers)
 {
@@ -2908,7 +2908,7 @@ sres_query_report_error(sres_query_t *q,
 
     SU_DEBUG_5(("sres(q=%p): reporting errors for %u %s\n",
                (void *)q, q->q_type, q->q_name));
+
     sres_remove_query(q->q_res, q, 1);
     (q->q_callback)(q->q_context, q, answers);
   }
@@ -2922,7 +2922,7 @@ sres_query_report_error(sres_query_t *q,
  * recommend calling it in 500 ms intervals.
  *
  * @param res pointer to resolver object
- * @param dummy argument for compatibility 
+ * @param dummy argument for compatibility
  */
 void sres_resolver_timer(sres_resolver_t *res, int dummy)
 {
@@ -2943,16 +2943,16 @@ void sres_resolver_timer(sres_resolver_t *res, int dummy)
      */
     for (i = 0; i < res->res_queries->qt_size; i++) {
       q = res->res_queries->qt_table[i];
-      
+
       if (!q)
        continue;
-      
+
       /* Exponential backoff */
       retry_time = q->q_timestamp + ((time_t)1 << q->q_retry_count);
-      
+
       if (now < retry_time)
        continue;
-      
+
       sres_resend_dns_query(res, q, 1);
 
       if (q != res->res_queries->qt_table[i])
@@ -2960,14 +2960,14 @@ void sres_resolver_timer(sres_resolver_t *res, int dummy)
     }
 
     if (res->res_schedulecb && res->res_queries->qt_used)
-      res->res_schedulecb(res->res_async, SRES_RETRANSMIT_INTERVAL); 
+      res->res_schedulecb(res->res_async, SRES_RETRANSMIT_INTERVAL);
   }
 
   sres_cache_clean(res->res_cache, res->res_now);
 }
 
 /** Resend DNS query, report error if cannot resend any more.
- * 
+ *
  * @param res  resolver object
  * @param q    query object
  * @param timeout  true if resent because of timeout
@@ -2978,10 +2978,10 @@ sres_resend_dns_query(sres_resolver_t *res, sres_query_t *q, int timeout)
 {
   uint8_t i, N;
   sres_server_t *dns;
-  
+
   SU_DEBUG_9(("sres_resend_dns_query(%p, %p, %s) called\n",
              (void *)res, (void *)q, timeout ? "timeout" : "error"));
-  
+
   N = res->res_n_servers;
 
   if (N > 0 && q->q_retry_count < SRES_MAX_RETRY_COUNT) {
@@ -2994,12 +2994,12 @@ sres_resend_dns_query(sres_resolver_t *res, sres_query_t *q, int timeout)
       if (q->q_retry_count > res->res_n_servers + 1 &&
          dns->dns_edns == edns_not_tried)
        q->q_edns = edns_not_supported;
-      
+
       sres_send_dns_query(res, q);
 
       if (timeout)
        q->q_retry_count++;
-      
+
       return;
     }
   }
@@ -3015,7 +3015,7 @@ sres_resend_dns_query(sres_resolver_t *res, sres_query_t *q, int timeout)
 
 
 /** Get a server by socket */
-static 
+static
 sres_server_t *
 sres_server_by_socket(sres_resolver_t const *res, sres_socket_t socket)
 {
@@ -3045,7 +3045,7 @@ sres_canonize_sockaddr(struct sockaddr_storage *from, socklen_t *fromlen)
 
   if (from->ss_family == AF_INET6) {
     struct in6_addr const *ip6 = &sin6->sin6_addr;
-  
+
     if (IN6_IS_ADDR_V4MAPPED(ip6) || IN6_IS_ADDR_V4COMPAT(ip6)) {
       /* Convert to a IPv4 address */
       struct sockaddr_in *sin = (struct sockaddr_in *)from;
@@ -3086,7 +3086,7 @@ int sres_no_update(sres_async_t *async,
 /** Create connected sockets for resolver.
  */
 int sres_resolver_sockets(sres_resolver_t *res,
-                         sres_socket_t *return_sockets, 
+                         sres_socket_t *return_sockets,
                          int n)
 {
   sres_socket_t s = INVALID_SOCKET;
@@ -3108,7 +3108,7 @@ int sres_resolver_sockets(sres_resolver_t *res,
 
     if (s == INVALID_SOCKET) { /* Mark as a bad destination */
       dns->dns_icmp = SRES_TIME_MAX;
-      dns->dns_error = SRES_TIME_MAX;  
+      dns->dns_error = SRES_TIME_MAX;
     }
 
     return_sockets[i++] = s;
@@ -3121,18 +3121,18 @@ int sres_resolver_sockets(sres_resolver_t *res,
 /** Get a server by socket address */
 static
 sres_server_t *
-sres_server_by_sockaddr(sres_resolver_t const *res, 
+sres_server_by_sockaddr(sres_resolver_t const *res,
                        void const *from, socklen_t fromlen)
 {
   int i;
 
   for (i = 0; i < res->res_n_servers; i++) {
     sres_server_t *dns = res->res_servers[i];
-    if (dns->dns_addrlen == fromlen && 
+    if (dns->dns_addrlen == fromlen &&
        memcmp(dns->dns_addr, from, fromlen) == 0)
       return dns;
   }
-  
+
   return NULL;
 }
 #endif
@@ -3206,11 +3206,11 @@ int sres_resolver_error(sres_resolver_t *res, int socket)
        strcpy(info, origin = "local");
        break;
       case SO_EE_ORIGIN_ICMP:
-       snprintf(info, sizeof(info), "%s type=%u code=%u", 
+       snprintf(info, sizeof(info), "%s type=%u code=%u",
                 origin = "icmp", ee->ee_type, ee->ee_code);
        break;
       case SO_EE_ORIGIN_ICMP6:
-       snprintf(info, sizeof(info), "%s type=%u code=%u", 
+       snprintf(info, sizeof(info), "%s type=%u code=%u",
                 origin = "icmp6", ee->ee_type, ee->ee_code);
        break;
       case SO_EE_ORIGIN_NONE:
@@ -3222,7 +3222,7 @@ int sres_resolver_error(sres_resolver_t *res, int socket)
       }
 
       if (ee->ee_info)
-       snprintf(info + strlen(info), sizeof(info) - strlen(info), 
+       snprintf(info + strlen(info), sizeof(info) - strlen(info),
                 " info=%08x", ee->ee_info);
       errcode = ee->ee_errno;
 
@@ -3231,9 +3231,9 @@ int sres_resolver_error(sres_resolver_t *res, int socket)
 
        sres_canonize_sockaddr(from, &fromlen);
 
-       snprintf(info + strlen(info), sizeof(info) - strlen(info), 
+       snprintf(info + strlen(info), sizeof(info) - strlen(info),
                 " reported by ");
-       su_inet_ntop(from->ss_family, SS_ADDR(from), 
+       su_inet_ntop(from->ss_family, SS_ADDR(from),
                  info + strlen(info), sizeof(info) - strlen(info));
       }
 
@@ -3246,8 +3246,8 @@ int sres_resolver_error(sres_resolver_t *res, int socket)
        /* Get error, if any */
        getsockopt(socket, SOL_SOCKET, SO_ERROR, (void *)&error, &errorlen);
       }
-      
-      if (sres_resolver_report_error(res, socket, errcode, 
+
+      if (sres_resolver_report_error(res, socket, errcode,
                                     msg->msg_name, msg->msg_namelen,
                                     info))
        return errcode;
@@ -3279,12 +3279,12 @@ int sres_resolver_error(sres_resolver_t *res, int socket)
 
 /** Report error */
 static
-int 
+int
 sres_resolver_report_error(sres_resolver_t *res,
                           sres_socket_t socket,
                           int errcode,
                           struct sockaddr_storage *remote,
-                          socklen_t remotelen, 
+                          socklen_t remotelen,
                           char const *info)
 {
   char buf[80];
@@ -3298,7 +3298,7 @@ sres_resolver_report_error(sres_resolver_t *res,
       struct sockaddr_in const *sin = (struct sockaddr_in *)remote;
       uint8_t const *in_addr = (uint8_t*)&sin->sin_addr;
       su_inet_ntop(AF_INET, in_addr, buf, sizeof(buf));
-    } 
+    }
 #if HAVE_SIN6
     else if (remote->ss_family == AF_INET6) {
       struct sockaddr_in6 const *sin6 = (struct sockaddr_in6 *)remote;
@@ -3308,9 +3308,9 @@ sres_resolver_report_error(sres_resolver_t *res,
 #endif
   }
 
-  SU_DEBUG_5(("sres: network error %u (%s)%s%s%s%s\n", 
+  SU_DEBUG_5(("sres: network error %u (%s)%s%s%s%s\n",
              errcode, su_strerror(errcode),
-             buf[0] ? " from " : "", buf, 
+             buf[0] ? " from " : "", buf,
              info ? " by " : "",
              info ? info : ""));
 
@@ -3328,7 +3328,7 @@ sres_resolver_report_error(sres_resolver_t *res,
 
       for (i = 0; i < res->res_queries->qt_size; i++) {
        q = res->res_queries->qt_table[i];
-      
+
        if (!q || dns != res->res_servers[q->q_i_server])
          continue;
 
@@ -3340,13 +3340,13 @@ sres_resolver_report_error(sres_resolver_t *res,
       }
     }
   }
-  
+
   return 1;
 }
 
 
 /** Receive a response packet from socket. */
-int 
+int
 sres_resolver_receive(sres_resolver_t *res, int socket)
 {
   ssize_t num_bytes;
@@ -3363,8 +3363,8 @@ sres_resolver_receive(sres_resolver_t *res, int socket)
   SU_DEBUG_9(("%s(%p, %u) called\n", "sres_resolver_receive",
              (void *)res, socket));
 
-  memset(m, 0, offsetof(sres_message_t, m_data)); 
-  
+  memset(m, 0, offsetof(sres_message_t, m_data));
+
   num_bytes = sres_recvfrom(socket, m->m_data, sizeof (m->m_data), 0,
                            (void *)from, &fromlen);
 
@@ -3398,12 +3398,12 @@ sres_resolver_receive(sres_resolver_t *res, int socket)
     sres_qtable_append(res->res_queries, query);
     sres_send_dns_query(res, query);
     query->q_retry_count++;
-  } 
+  }
   else if (!error && reply) {
     /* Remove the query from the pending list and notify the listener */
     sres_remove_query(res, query, 1);
     if (query->q_callback != NULL)
-      (query->q_callback)(query->q_context, query, reply); 
+      (query->q_callback)(query->q_context, query, reply);
     sres_free_query(res, query);
   }
   else {
@@ -3414,7 +3414,7 @@ sres_resolver_receive(sres_resolver_t *res, int socket)
 }
 
 static
-void sres_log_response(sres_resolver_t const *res, 
+void sres_log_response(sres_resolver_t const *res,
                       sres_message_t const *m,
                       struct sockaddr_storage const *from,
                       sres_query_t const *query,
@@ -3433,7 +3433,7 @@ void sres_log_response(sres_resolver_t const *res,
       struct sockaddr_in const *sin = (void *)from;
       su_inet_ntop(AF_INET, &sin->sin_addr, host, sizeof host);
       port = sin->sin_port;
-    } 
+    }
 #if HAVE_SIN6
     else if (from->ss_family == AF_INET6) {
       struct sockaddr_in6 const *sin6 = (void *)from;
@@ -3442,8 +3442,8 @@ void sres_log_response(sres_resolver_t const *res,
     }
 #endif
 
-    SU_DEBUG_5(("sres_resolver_receive(%p, %p) id=%u (from [%s]:%u)\n", 
-               (void *)res, (void *)query, m->m_id, 
+    SU_DEBUG_5(("sres_resolver_receive(%p, %p) id=%u (from [%s]:%u)\n",
+               (void *)res, (void *)query, m->m_id,
                host, ntohs(port)));
   }
 }
@@ -3457,7 +3457,7 @@ void sres_log_response(sres_resolver_t const *res,
  */
 static
 int
-sres_decode_msg(sres_resolver_t *res, 
+sres_decode_msg(sres_resolver_t *res,
                sres_message_t *m,
                sres_query_t **qq,
                sres_record_t ***return_answers)
@@ -3486,9 +3486,9 @@ sres_decode_msg(sres_resolver_t *res,
 
   m->m_flags   = ntohs(m->m_flags);
   m->m_qdcount = ntohs(m->m_qdcount);
-  m->m_ancount = ntohs(m->m_ancount); 
-  m->m_nscount = ntohs(m->m_nscount); 
-  m->m_arcount = ntohs(m->m_arcount); 
+  m->m_ancount = ntohs(m->m_ancount);
+  m->m_nscount = ntohs(m->m_nscount);
+  m->m_arcount = ntohs(m->m_arcount);
 
   hash = Q_PRIME * m->m_id;
 
@@ -3530,8 +3530,8 @@ sres_decode_msg(sres_resolver_t *res,
   if (m->m_ancount == 0 && err == 0)
     err = SRES_RECORD_ERR;
 
-  if (err == SRES_RECORD_ERR || 
-      err == SRES_NAME_ERR || 
+  if (err == SRES_RECORD_ERR ||
+      err == SRES_NAME_ERR ||
       err == SRES_UNIMPL_ERR)
     errorcount = 1;
 
@@ -3547,7 +3547,7 @@ sres_decode_msg(sres_resolver_t *res,
       rr = error = sres_create_error_rr(res->res_cache, query, err);
     else
       rr = sres_create_record(res, m);
+
     if (!rr) {
       SU_DEBUG_5(("sres_create_record: %s\n", m->m_error));
       break;
@@ -3577,7 +3577,7 @@ sres_decode_msg(sres_resolver_t *res,
       rr->sr_refcount++;
     else
       /* Do not pass extra records to user */
-      answers[i] = NULL;       
+      answers[i] = NULL;
 
     sres_cache_store(res->res_cache, rr, res->res_now);
   }
@@ -3585,7 +3585,7 @@ sres_decode_msg(sres_resolver_t *res,
   *return_answers = answers;
 
   return err;
-}  
+}
 
 static
 sres_record_t *
@@ -3600,13 +3600,13 @@ sres_create_record(sres_resolver_t *res, sres_message_t *m)
   char btype[8], bclass[8];
 
   sr = memset(sr0, 0, sizeof sr0);
-  
+
   len = m_get_domain(sr->sr_name = name, sizeof(name) - 1, m, 0); /* Name */
   sr->sr_type = m_get_uint16(m);  /* Type */
   sr->sr_class = m_get_uint16(m); /* Class */
   sr->sr_ttl = m_get_uint32(m);   /* TTL */
   sr->sr_rdlen = m_get_uint16(m); /* rdlength */
-  sr->sr_parsed = 1;           
+  sr->sr_parsed = 1;
   if (m->m_error)
     goto error;
 
@@ -3672,7 +3672,7 @@ sres_create_record(sres_resolver_t *res, sres_message_t *m)
 
   return sr;
 
- error:  
+ error:
   if (sr && sr != sr0)
     sres_cache_free_record(cache, sr);
   SU_DEBUG_5(("%s: %s\n", "sres_create_record", m->m_error));
@@ -3697,7 +3697,7 @@ static sres_record_t *sres_init_rr_soa(sres_cache_t *cache,
   soa->soa_retry = m_get_uint32(m);
   soa->soa_expire = m_get_uint32(m);
   soa->soa_minimum = m_get_uint32(m);
-  
+
   if (m->m_error)
     return NULL;
 
@@ -3849,7 +3849,7 @@ static sres_record_t *sres_init_rr_srv(sres_cache_t *cache,
   offset = m->m_offset, dlen = m_get_domain(NULL, 0, m, 0) + 1;
   if (m->m_error)
     return NULL;
-  
+
   srv = (void *)sres_cache_alloc_record(cache, (void *)srv, dlen);
   if (srv)
     m_get_domain(srv->srv_target = (char *)(srv + 1), dlen, m, offset);
@@ -3942,7 +3942,7 @@ sres_record_t *sres_create_error_rr(sres_cache_t *cache,
 
 static
 void
-m_put_uint16(sres_message_t *m, 
+m_put_uint16(sres_message_t *m,
             uint16_t h)
 {
   uint8_t *p;
@@ -3962,8 +3962,8 @@ m_put_uint16(sres_message_t *m,
 }
 
 static
-void 
-m_put_uint32(sres_message_t *m, 
+void
+m_put_uint32(sres_message_t *m,
             uint32_t w)
 {
   uint8_t *p;
@@ -3988,7 +3988,7 @@ m_put_uint32(sres_message_t *m,
 static
 uint16_t
 m_put_domain(sres_message_t *m,
-            char const *domain, 
+            char const *domain,
             uint16_t top,
             char const *topdomain)
 {
@@ -4065,7 +4065,7 @@ m_get_uint32(sres_message_t *m)
 }
 
 static
-uint16_t 
+uint16_t
 m_get_uint16(sres_message_t *m)
 {
   uint8_t const *p = m->m_data + m->m_offset;
@@ -4084,7 +4084,7 @@ m_get_uint16(sres_message_t *m)
 }
 
 static
-uint8_t 
+uint8_t
 m_get_uint8(sres_message_t *m)
 {
   uint8_t const *p = m->m_data + m->m_offset;
@@ -4105,7 +4105,7 @@ m_get_uint8(sres_message_t *m)
 /**
  * Get a string.
  */
-static int m_get_string(char *d, 
+static int m_get_string(char *d,
                        int n,
                        sres_message_t *m,
                        uint16_t offset)
@@ -4123,7 +4123,7 @@ static int m_get_string(char *d,
     save_offset = 0;
 
   size = p[offset++];
-  
+
   if (size + offset >= m->m_size) {
     m->m_error = "truncated message";
     return size;
@@ -4150,7 +4150,7 @@ static int m_get_string(char *d,
  *
  * @param offset start uncompression from this point in message
  */
-static int m_get_domain(char *d, 
+static int m_get_domain(char *d,
                        int n,
                        sres_message_t *m,
                        uint16_t offset)
@@ -4164,7 +4164,7 @@ static int m_get_domain(char *d,
   if (m->m_error)
     return 0;
 
-  if (d == NULL) 
+  if (d == NULL)
     n = 0;
 
   if (offset == 0)
@@ -4191,7 +4191,7 @@ static int m_get_domain(char *d,
 
       offset = new_offset;
       save_offset = 0;
-    } 
+    }
     else {
       if (offset + cnt >= m->m_size) {
         m->m_error = "truncated message";
@@ -4204,13 +4204,13 @@ static int m_get_domain(char *d,
 
       i += cnt + 1;
       offset += cnt;
-    }  
+    }
   }
 
-  if (i == 0) { 
-    if (i < n) 
+  if (i == 0) {
+    if (i < n)
       d[i] = '.';
-    i++; 
+    i++;
   }
 
   if (i < n)
index 12151214548150cd43de0a5787d7a52cfb092a27..545ff476b401b9b118ee8c9ccb71491dc1b86a8a 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@CFILE sres_blocking.c
  * @brief Blocking interface for Sofia DNS Resolver implementation.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @date Created: Fri Mar 24 15:23:08 EET 2006 ppessi
  */
@@ -94,7 +94,7 @@ struct _pollfd {
   short revents;    /* returned events */
 } fds[SRES_MAX_NAMESERVERS];
 #endif
-  sres_record_t ***return_records;  
+  sres_record_t ***return_records;
 };
 
 struct sres_blocking_context_s
@@ -103,7 +103,7 @@ struct sres_blocking_context_s
   sres_resolver_t *resolver;
   sres_blocking_t *block;
   sres_query_t *query;
-  sres_record_t ***return_records;  
+  sres_record_t ***return_records;
 };
 
 static
@@ -143,7 +143,7 @@ int sres_blocking_update(sres_blocking_t *b,
 
     b->n_sockets = N;
   }
-  
+
   if (new_socket != INVALID_SOCKET) {
     if (N == SRES_MAX_NAMESERVERS)
       return -1;
@@ -194,7 +194,7 @@ int sres_blocking_complete(sres_blocking_context_t *c)
     }
 
     n = select(n, readfds, NULL, errorfds, timeval);
-  
+
     if (n <= 0)
       sres_resolver_timer(c->resolver, -1);
     else for (i = 0; n > 0 && i < c->block->n_sockets; i++) {
@@ -213,7 +213,7 @@ int sres_blocking_complete(sres_blocking_context_t *c)
 }
 
 static
-void sres_blocking_callback(sres_blocking_context_t *c, 
+void sres_blocking_callback(sres_blocking_context_t *c,
                            sres_query_t *query,
                            sres_record_t **answers)
 {
@@ -221,13 +221,13 @@ void sres_blocking_callback(sres_blocking_context_t *c,
   *c->return_records = answers;
 }
 
-static 
+static
 sres_blocking_t *sres_set_blocking(sres_resolver_t *res)
 {
   sres_blocking_t *b;
   int i;
 
-  b = sres_resolver_get_async(res, sres_blocking_update); 
+  b = sres_resolver_get_async(res, sres_blocking_update);
   if (b)
     return b;
 
@@ -241,7 +241,7 @@ sres_blocking_t *sres_set_blocking(sres_resolver_t *res)
   if (b) {
     for (i = 0; i < SRES_MAX_NAMESERVERS; i++)
       b->fds[i].fd = INVALID_SOCKET;
-  
+
     if (!sres_resolver_set_async(res, sres_blocking_update, b, 0)) {
       free(b), b = NULL;
     }
@@ -261,7 +261,7 @@ int sres_is_blocking(sres_resolver_t *res)
 /**Send a DNS query, wait for response, return results.
  *
  * Sends a DNS query with specified @a type and @a domain to the DNS server,
- * if @a ignore_cache is not given or no records are found from cache. 
+ * if @a ignore_cache is not given or no records are found from cache.
  * Function returns an error record with nonzero status if no response is
  * received from DNS server.
  *
@@ -280,7 +280,7 @@ int sres_is_blocking(sres_resolver_t *res)
  * @ERROR ENAMETOOLONG @a domain is longer than SRES_MAXDNAME
  * @ERROR ENETDOWN no DNS servers configured
  * @ERROR ENOMEM memory exhausted
- * @ERROR EOPNOTSUPP  resolver @a res is in asynchronous mode 
+ * @ERROR EOPNOTSUPP  resolver @a res is in asynchronous mode
  *
  * @sa sres_query(), sres_blocking_search()
  *
@@ -305,7 +305,7 @@ int sres_blocking_query(sres_resolver_t *res,
 
   c->block = sres_set_blocking(res);
   if (c->block == NULL)
-    return su_seterrno(EOPNOTSUPP); /* Resolver in asynchronous mode */ 
+    return su_seterrno(EOPNOTSUPP); /* Resolver in asynchronous mode */
 
   if (!ignore_cache) {
     cached = sres_cached_answers(res, type, domain);
@@ -325,7 +325,7 @@ int sres_blocking_query(sres_resolver_t *res,
 
 /** Search DNS, return results.
  *
- * Search for @a name with specified @a type and @a name from the DNS server. 
+ * Search for @a name with specified @a type and @a name from the DNS server.
  * If the @a name does not contain enought dots, the search domains are
  * appended to the name and resulting domain name are also queried.
  *
@@ -344,7 +344,7 @@ int sres_blocking_query(sres_resolver_t *res,
  * @ERROR ENAMETOOLONG @a domain is longer than SRES_MAXDNAME
  * @ERROR ENETDOWN no DNS servers configured
  * @ERROR ENOMEM memory exhausted
- * @ERROR EOPNOTSUPP  resolver @a res is in asynchronous mode 
+ * @ERROR EOPNOTSUPP  resolver @a res is in asynchronous mode
  *
  * @sa sres_blocking_query(), sres_search()
  *
@@ -369,7 +369,7 @@ int sres_blocking_search(sres_resolver_t *res,
 
   c->block = sres_set_blocking(res);
   if (c->block == NULL)
-    return su_seterrno(EOPNOTSUPP); /* Resolver in asynchronous mode */ 
+    return su_seterrno(EOPNOTSUPP); /* Resolver in asynchronous mode */
 
   if (!ignore_cache) {
     cached = sres_search_cached_answers(res, type, name);
@@ -402,7 +402,7 @@ int sres_blocking_search(sres_resolver_t *res,
  * @ERROR EFAULT @a res or @a addr point outside the address space
  * @ERROR ENOMEM memory exhausted
  * @ERROR ENETDOWN no DNS servers configured
- * @ERROR EOPNOTSUPP  resolver @a res is in asynchronous mode 
+ * @ERROR EOPNOTSUPP  resolver @a res is in asynchronous mode
  *
  * @sa sres_blocking_query(), sres_query_sockaddr(), sres_cached_answers_sockaddr()
  *
@@ -427,7 +427,7 @@ int sres_blocking_query_sockaddr(sres_resolver_t *res,
 
   c->block = sres_set_blocking(res);
   if (c->block == NULL)
-    return su_seterrno(EOPNOTSUPP); /* Resolver in asynchronous mode */ 
+    return su_seterrno(EOPNOTSUPP); /* Resolver in asynchronous mode */
 
   if (!ignore_cache) {
     cached = sres_cached_answers_sockaddr(res, type, addr);
index 5c2d6d2602b0b8b22042d9ef509e6b7ce819c9e8..40cc294a0c7d412507c88f2a81d05c69d4730ee8 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@CFILE sres_cache.c
  * @brief Cache for Sofia DNS Resolver.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Teemu Jalava <Teemu.Jalava@nokia.com>
  * @author Mikko Haataja
@@ -38,7 +38,7 @@
 #include <stdint.h>
 #elif HAVE_INTTYPES_H
 #include <inttypes.h>
-#else 
+#else
 #if defined(_WIN32)
 typedef unsigned _int8 uint8_t;
 typedef unsigned _int16 uint16_t;
@@ -200,8 +200,8 @@ int sres_cache_get(sres_cache_t *cache,
   rr_iter2 = sres_htable_hash(cache->cache_hash, hash);
 
   /* Find the domain records from the hash table */
-  for (rr_iter = rr_iter2; 
-       rr_iter && *rr_iter; 
+  for (rr_iter = rr_iter2;
+       rr_iter && *rr_iter;
        rr_iter = sres_htable_next(cache->cache_hash, rr_iter)) {
     rr = (*rr_iter)->rr;
 
@@ -209,7 +209,7 @@ int sres_cache_get(sres_cache_t *cache,
        now <= (*rr_iter)->rr_expires &&
         (type == sres_qtype_any || rr->sr_type == type) &&
         rr->sr_name != NULL &&
-        strcasecmp(rr->sr_name, domain) == 0) 
+        strcasecmp(rr->sr_name, domain) == 0)
       rr_count++;
   }
 
@@ -227,8 +227,8 @@ int sres_cache_get(sres_cache_t *cache,
 
   /* Second pass: add the rr pointers to the allocated array */
 
-  for (rr_iter = rr_iter2, rr_count = 0; 
-       rr_iter && *rr_iter; 
+  for (rr_iter = rr_iter2, rr_count = 0;
+       rr_iter && *rr_iter;
        rr_iter = sres_htable_next(cache->cache_hash, rr_iter)) {
     rr = (*rr_iter)->rr;
 
@@ -237,7 +237,7 @@ int sres_cache_get(sres_cache_t *cache,
         (type == sres_qtype_any || rr->sr_type == type) &&
         rr->sr_name != NULL &&
         strcasecmp(rr->sr_name, domain) == 0) {
-      SU_DEBUG_9(("rr found in cache: %s %02d\n", 
+      SU_DEBUG_9(("rr found in cache: %s %02d\n",
                  rr->sr_name, rr->sr_type));
 
       result[rr_count++] = rr;
@@ -249,7 +249,7 @@ int sres_cache_get(sres_cache_t *cache,
 
   UNLOCK(cache);
 
-  SU_DEBUG_9(("%s(%p, %s, \"%s\") returned %d entries\n", "sres_cache_get", 
+  SU_DEBUG_9(("%s(%p, %s, \"%s\") returned %d entries\n", "sres_cache_get",
              (void *)cache, sres_record_type(type, b), domain, rr_count));
 
   *return_cached = result;
@@ -282,7 +282,7 @@ sres_cache_alloc_record(sres_cache_t *cache,
     memcpy(&sr->sr_status, &template->sr_status,
           size - offsetof(sres_common_t, r_status));
   }
-    
+
   return sr;
 }
 
@@ -298,7 +298,7 @@ void sres_cache_free_record(sres_cache_t *cache, void *_sr)
 }
 
 /** Store record to cache */
-void 
+void
 sres_cache_store(sres_cache_t *cache, sres_record_t *rr, time_t now)
 {
   sres_rr_hash_entry_t **rr_iter, *rr_hash_entry;
@@ -322,7 +322,7 @@ sres_cache_store(sres_cache_t *cache, sres_record_t *rr, time_t now)
     }
 
   for (rr_iter = sres_htable_hash(cache->cache_hash, hash);
-       (rr_hash_entry = *rr_iter); 
+       (rr_hash_entry = *rr_iter);
        rr_iter = sres_htable_next(cache->cache_hash, rr_iter)) {
     sres_record_t *or = rr_hash_entry->rr;
 
@@ -334,13 +334,13 @@ sres_cache_store(sres_cache_t *cache, sres_record_t *rr, time_t now)
       continue;
     if (!!or->sr_name != !!rr->sr_name)
       continue;
-    if (or->sr_name != rr->sr_name && 
+    if (or->sr_name != rr->sr_name &&
        strcasecmp(or->sr_name, rr->sr_name) != 0)
       continue;
     if (rr->sr_type != sres_type_soa /* There can be only one */
        && sres_record_compare(or, rr))
       continue;
-    
+
     /* There was an old entry in the cache.. Zap it, replace this with it */
     sres_heap_remove(cache->cache_heap, rr_hash_entry->rr_heap_index);
     rr_hash_entry->rr_expires = now + rr->sr_ttl;
@@ -354,7 +354,7 @@ sres_cache_store(sres_cache_t *cache, sres_record_t *rr, time_t now)
 
     return;
   }
-  
+
   rr_hash_entry = su_zalloc(cache->cache_home, sizeof(*rr_hash_entry));
 
   if (rr_hash_entry) {
@@ -402,7 +402,7 @@ void _sres_cache_free_answers(sres_cache_t *cache, sres_record_t **answers)
   for (i = 0; answers[i] != NULL; i++) {
     if (answers[i]->sr_refcount <= 1)
       su_free(cache->cache_home, answers[i]);
-    else 
+    else
       answers[i]->sr_refcount--;
     answers[i] = NULL;
   }
@@ -416,7 +416,7 @@ void _sres_cache_free_one(sres_cache_t *cache, sres_record_t *answer)
   if (answer) {
     if (answer->sr_refcount <= 1)
       su_free(cache->cache_home, answer);
-    else 
+    else
       answer->sr_refcount--;
   }
 }
@@ -427,7 +427,7 @@ unsigned
 sres_hash_key(const char *string)
 {
   unsigned int result = 0;
-  
+
   while (string && *string)
     result = result * 797 + (unsigned char) * (string++);
 
@@ -460,7 +460,7 @@ void sres_cache_clean(sres_cache_t *cache, time_t now)
        UNLOCK(cache);
        return;
       }
-      
+
       sres_heap_remove(cache->cache_heap, 1);
       sres_htable_remove(cache->cache_hash, e);
       _sres_cache_free_one(cache, e->rr);
@@ -478,16 +478,16 @@ void sres_cache_clean(sres_cache_t *cache, time_t now)
  * greylisting of SIP servers.
  *
  * @param cache    pointer to DNS cache object
- * @param domain   domain name of the SRV record(s) to modify 
+ * @param domain   domain name of the SRV record(s) to modify
  *                 (including final dot)
  * @param target   SRV target of the SRV record(s) to modify
- * @param port     port number of SRV record(s) to modify 
- *                 (in host byte order) 
+ * @param port     port number of SRV record(s) to modify
+ *                 (in host byte order)
  * @param ttl      new ttl
  * @param priority new priority value (0=highest, 65535=lowest)
  *
  * @sa sres_set_cached_srv_priority()
- * 
+ *
  * @NEW_1_12_8
  */
 int sres_cache_set_srv_priority(sres_cache_t *cache,
@@ -501,7 +501,7 @@ int sres_cache_set_srv_priority(sres_cache_t *cache,
   unsigned hash;
   sres_rr_hash_entry_t **iter;
   time_t expires;
-  
+
   if (cache == NULL || domain == NULL || target == NULL)
     return -1;
 
@@ -517,13 +517,13 @@ int sres_cache_set_srv_priority(sres_cache_t *cache,
        iter && *iter;
        iter = sres_htable_next(cache->cache_hash, iter)) {
     sres_record_t *rr = (*iter)->rr;
-    
+
     if (rr && rr->sr_name &&
        sres_type_srv == rr->sr_type &&
        strcasecmp(rr->sr_name, domain) == 0) {
 
       (*iter)->rr_expires = expires;
-      
+
       if ((port == 0 || rr->sr_srv->srv_port == port) &&
          rr->sr_srv->srv_target &&
          strcasecmp(rr->sr_srv->srv_target, target) == 0) {
@@ -552,12 +552,12 @@ int sres_heap_earlier_entry(sres_rr_hash_entry_t const *a,
 
 static inline
 void sres_heap_set_entry(sres_rr_hash_entry_t **heap,
-                        size_t index, 
+                        size_t index,
                         sres_rr_hash_entry_t *entry)
 {
   entry->rr_heap_index = index;
   heap[index] = entry;
-}  
+}
 
 HEAP_BODIES(static inline,
            sres_heap_t,
index d1385bd3a05e9b5462c2514caa359adad1a78b9f..fba22de731aeed72aad96bd009e9038a500f2f67 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@CFILE sresolv.c
  * @brief Sofia DNS Resolver interface using su_root_t.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Teemu Jalava <Teemu.Jalava@nokia.com>
  * @author Mikko Haataja
@@ -78,17 +78,17 @@ struct sres_sofia_s {
   sres_sofia_register_t srs_reg[SRES_MAX_NAMESERVERS];
 };
 
-static int sres_sofia_update(sres_sofia_t *, 
+static int sres_sofia_update(sres_sofia_t *,
                             su_socket_t new_socket,
                             su_socket_t old_socket);
 
-static void sres_sofia_timer(su_root_magic_t *magic, 
+static void sres_sofia_timer(su_root_magic_t *magic,
                             su_timer_t *t,
                             sres_sofia_t *arg);
 
 static int sres_sofia_set_timer(sres_sofia_t *srs, unsigned long interval);
 
-static int sres_sofia_poll(su_root_magic_t *, su_wait_t *, 
+static int sres_sofia_poll(su_root_magic_t *, su_wait_t *,
                           sres_sofia_register_t *);
 
 /**Create a resolver.
@@ -97,7 +97,7 @@ static int sres_sofia_poll(su_root_magic_t *, su_wait_t *,
  * the resolver object using the Sofia asynchronous reactor #su_root_t.
  */
 sres_resolver_t *
-sres_resolver_create(su_root_t *root, 
+sres_resolver_create(su_root_t *root,
                     char const *conf_file_path,
                     tag_type_t tag, tag_value_t value, ...)
 {
@@ -127,7 +127,7 @@ sres_resolver_create(su_root_t *root,
     srs->srs_socket = INVALID_SOCKET;
 
     sres_resolver_set_async(res, sres_sofia_update, srs, 0);
-    
+
     t = su_timer_create(su_root_task(root), SRES_RETRANSMIT_INTERVAL);
     srs->srs_timer = t;
 
@@ -150,7 +150,7 @@ sres_resolver_create(su_root_t *root,
 }
 
 /** Destroy a resolver object. */
-int 
+int
 sres_resolver_destroy(sres_resolver_t *res)
 {
   sres_sofia_t *srs;
@@ -163,9 +163,9 @@ sres_resolver_destroy(sres_resolver_t *res)
     return su_seterrno(EINVAL);
 
   /* Remove sockets from too, zap timers. */
-  sres_sofia_update(srs, INVALID_SOCKET, INVALID_SOCKET); 
+  sres_sofia_update(srs, INVALID_SOCKET, INVALID_SOCKET);
 
-  sres_resolver_unref(res); 
+  sres_resolver_unref(res);
 
   return 0;
 }
@@ -229,7 +229,7 @@ static int sres_sofia_update(sres_sofia_t *srs,
 
       reg = srs->srs_reg + i;
     }
-    else 
+    else
       reg = old_reg;
   }
 
@@ -271,7 +271,7 @@ static int sres_sofia_update(sres_sofia_t *srs,
 
   SU_DEBUG_3(("sres: %s: %s\n", what, su_strerror(error)));
 
-  return su_seterrno(error);                   
+  return su_seterrno(error);
 }
 
 
@@ -317,20 +317,20 @@ su_socket_t sres_resolver_root_socket(sres_resolver_t *res)
       return INVALID_SOCKET;
   }
 
-  return srs->srs_socket; 
+  return srs->srs_socket;
 }
 
 
 /** Sofia timer wrapper. */
-static 
-void 
+static
+void
 sres_sofia_timer(su_root_magic_t *magic, su_timer_t *t, sres_sofia_t *srs)
 {
   sres_resolver_timer(srs->srs_resolver, -1);
 }
 
 /** Sofia timer set wrapper. */
-static 
+static
 int
 sres_sofia_set_timer(sres_sofia_t *srs, unsigned long interval)
 {
@@ -342,10 +342,10 @@ sres_sofia_set_timer(sres_sofia_t *srs, unsigned long interval)
 
 
 /** Sofia poll/select wrapper, called by su_root_t object */
-static 
-int 
-sres_sofia_poll(su_root_magic_t *magic, 
-               su_wait_t *w, 
+static
+int
+sres_sofia_poll(su_root_magic_t *magic,
+               su_wait_t *w,
                sres_sofia_register_t *reg)
 {
   sres_sofia_t *srs = reg->reg_ptr;
index 9e8bd93a3fed034fc6087a6daf68f5802d0fe9e4..d76a4d3848c239c0043891ad83c7c29b032fbb23 100644 (file)
@@ -32,7 +32,7 @@ or AAAA records, these DNS libraries are inadequate for a SIP application.
 Sofia resolver uses the usual configuration for DNS. In Unix-based systems,
 the DNS configuration is stored in the file /etc/resolv.conf, on Windows, it
 is available through the registry. Sofia resolvers reloads the configuration
-when it detect that it has been changed. 
+when it detect that it has been changed.
 
 In addition to the configuration files, the environment variables
 #SRES_OPTIONS and #RES_OPTIONS can be used to change the behaviour of the
@@ -68,7 +68,7 @@ of calling the sres_query() and sres_query_sockaddr() callback functions.
 @code
 #include <sofia-sip/sresolv.h>
 
-sres_resolver_t *sres_resolver_create(su_root_t *root, 
+sres_resolver_t *sres_resolver_create(su_root_t *root,
                                      char const *resolv_conf,
                                      tag_type_t, tag_value_t, ...);
 
@@ -80,7 +80,7 @@ int sres_resolver_destroy(sres_resolver_t *res);
 
 The second part of interface is used when sending DNS queries:
 
-@code 
+@code
 sres_query_t *sres_query(sres_resolver_t *res,
                         sres_answer_f *callback,
                         sres_context_t *context,
@@ -116,7 +116,7 @@ sres_record_t **sres_cached_answers_sockaddr(sres_resolver_t *res,
 
 int sres_sort_answers(sres_resolver_t *res, sres_record_t **answers);
 
-int sres_filter_answers(sres_resolver_t *sres, sres_record_t **answers, 
+int sres_filter_answers(sres_resolver_t *sres, sres_record_t **answers,
                        uint16_t type);
 
 void sres_free_answers(sres_resolver_t *res, sres_record_t **answers);
@@ -127,7 +127,7 @@ void sres_free_answer(sres_resolver_t *res, sres_record_t *answer);
 
 @section sofia_resolv_sres_h Interface in <sofia-resolv/sres.h>
 
-The generic interface to Sofia resolver is defined in <sofia-resolv/sres.h>. 
+The generic interface to Sofia resolver is defined in <sofia-resolv/sres.h>.
 The first part of interface consists of functions for handling resolver
 objects:
 
@@ -182,7 +182,7 @@ int sres_blocking_query_sockaddr(sres_resolver_t *res,
 
 @subsection sresolv_async Asynchronous Interface in <sofia-resolv/sres_async.h>
 
-It is also possible to use resolver asynchronously without #su_root_t object. 
+It is also possible to use resolver asynchronously without #su_root_t object.
 
 @code
 #include <sys/types.h>
@@ -191,7 +191,7 @@ It is also possible to use resolver asynchronously without #su_root_t object.
 
 #include <sofia-resolv/sres_async.h>
 
-sres_async_t *sres_resolver_set_async(sres_resolver_t *res, 
+sres_async_t *sres_resolver_set_async(sres_resolver_t *res,
                                      sres_update_f *update,
                                      sres_async_t *async,
                                      int update_all);
@@ -239,7 +239,7 @@ struct context
     process_natpr(context, NULL, results);
   }
   else {
-    context->query = sres_query(context->sres, 
+    context->query = sres_query(context->sres,
                                 process_natpr, context,
                                sres_type_naptr, domain);
     if (!context->query)
@@ -253,9 +253,9 @@ void process_natpr(sres_context_t *context,
                   sres_record_t *answers[])
 {
   sres_sort_answers(context->sres, answers);
+
   ...
+
   sres_free_answers(context->sres, answers);
 }
 @endcode
index bac2b82b373d395e898d92a8172d47f699608a72..868c88fcd9f0c5f50852be2261adbd353a337d2c 100644 (file)
@@ -25,7 +25,7 @@
 /**@internal
  *
  * @CFILE test_sresolv.c Test module for sresolv
- * 
+ *
  * @author Mikko Haataja
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  *
@@ -103,7 +103,7 @@ struct sres_context_s
   sres_socket_t    sink;
   int              sinkidx;
   char const      *sinkconf;
-  
+
   int              ready;
   int              n_sockets;
   sres_socket_t    sockets[SRES_MAX_NAMESERVERS];
@@ -122,7 +122,7 @@ static int tstflags = 0;
 #if HAVE_WINSOCK2_H
 
 /* Posix send() */
-su_inline 
+su_inline
 ssize_t sres_send(sres_socket_t s, void *b, size_t length, int flags)
 {
   if (length > INT_MAX)
@@ -130,7 +130,7 @@ ssize_t sres_send(sres_socket_t s, void *b, size_t length, int flags)
   return (ssize_t)send(s, b, (int)length, flags);
 }
 
-su_inline 
+su_inline
 ssize_t sres_sendto(sres_socket_t s, void *b, size_t length, int flags,
                    struct sockaddr const *sa, socklen_t salen)
 {
@@ -140,7 +140,7 @@ ssize_t sres_sendto(sres_socket_t s, void *b, size_t length, int flags,
 }
 
 /* Posix recvfrom() */
-su_inline 
+su_inline
 ssize_t sres_recvfrom(sres_socket_t s, void *buffer, size_t length, int flags,
                      struct sockaddr *from, socklen_t *fromlen)
 {
@@ -152,7 +152,7 @@ ssize_t sres_recvfrom(sres_socket_t s, void *buffer, size_t length, int flags,
   if (length > INT_MAX)
     length = INT_MAX;
 
-  retval = recvfrom(s, buffer, (int)length, flags, 
+  retval = recvfrom(s, buffer, (int)length, flags,
                    (void *)from, fromlen ? &ilen : NULL);
 
   if (fromlen)
@@ -218,7 +218,7 @@ int setblocking(sres_socket_t s, int blocking)
   if (mode < 0)
      return -1;
 
-  if (blocking) 
+  if (blocking)
     mode &= ~(O_NDELAY | O_NONBLOCK);
   else
     mode |= O_NDELAY | O_NONBLOCK;
@@ -255,7 +255,7 @@ int test_socket(sres_context_t *ctx)
     TEST_1(setblocking(s2, 0) == 0);
     TEST_1(setblocking(s3, 0) == 0);
     TEST_1(setblocking(s4, 0) == 0);
-    
+
     memset(a, 0, sizeof a);
     memset(a1, 0, sizeof a1);
     memset(a2, 0, sizeof a2);
@@ -280,10 +280,10 @@ int test_socket(sres_context_t *ctx)
 
     TEST(bind(s3, (struct sockaddr *)a3, a3len), 0);
     TEST(bind(s4, (struct sockaddr *)a4, a4len), 0);
-    
+
     alen = sizeof a;
     TEST(getsockname(s3, (struct sockaddr *)a, &alen), 0);
-    sin3->sin_port = sin->sin_port; 
+    sin3->sin_port = sin->sin_port;
     memset(sin->sin_zero, 0, sizeof sin->sin_zero);
     TEST(alen, a3len); TEST_M(a, a3, a3len);
 
@@ -329,7 +329,7 @@ int poll_sockets(sres_context_t *ctx)
   n = ctx->n_sockets;
 
   events = poll(ctx->fds, ctx->n_sockets, ctx->timeout ? 50 : 500);
-      
+
   if (!events)
     return events;
 
@@ -339,7 +339,7 @@ int poll_sockets(sres_context_t *ctx)
     if (ctx->fds[i].revents & POLLIN)
       sres_resolver_receive(ctx->resolver, ctx->fds[i].fd);
   }
-  
+
   return events;
 }
 
@@ -353,9 +353,9 @@ static void run(sres_context_t *ctx)
       ctx->timeout <<= 1;
       offset += ctx->timeout;
     }
-    
+
     /* No harm is done (except wasted CPU) if timer is called more often */
-    sres_resolver_timer(ctx->resolver, -1); 
+    sres_resolver_timer(ctx->resolver, -1);
   }
 }
 
@@ -376,7 +376,7 @@ int test_soa(sres_context_t *ctx)
   TEST_RUN(ctx);
 
   TEST_1(result = sres_cached_answers(res, sres_type_soa, domain));
-  
+
   TEST_1(result != NULL);
   TEST_1(result[0] != NULL);
 
@@ -415,7 +415,7 @@ int test_naptr(sres_context_t *ctx)
 
   for (i = 0; result[i] != NULL; i++) {
     rr = (sres_naptr_record_t *) result[i]->sr_naptr;
-                                        
+
     switch(rr->na_order) {
     case 20:
       TEST(rr->na_record->r_type, sres_type_naptr);
@@ -475,7 +475,7 @@ int test_naptr(sres_context_t *ctx)
   END();
 }
 
-char const longname[1026] = 
+char const longname[1026] =
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -484,7 +484,7 @@ char const longname[1026] =
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
-  
+
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -493,7 +493,7 @@ char const longname[1026] =
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
-  
+
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -502,7 +502,7 @@ char const longname[1026] =
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
-  
+
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -512,7 +512,7 @@ char const longname[1026] =
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.";
 
-char name2048[2049] = 
+char name2048[2049] =
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
   "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
@@ -556,7 +556,7 @@ int test_a(sres_context_t *ctx)
   sres_record_t **result;
   const sres_a_record_t *rr_a;
   char const *domain = "sip00.example.com";
-  char name1025[1026] = 
+  char name1025[1026] =
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -565,7 +565,7 @@ int test_a(sres_context_t *ctx)
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-                 
+
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -583,7 +583,7 @@ int test_a(sres_context_t *ctx)
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-                 
+
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -592,7 +592,7 @@ int test_a(sres_context_t *ctx)
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-                 
+
                  ".";
 
   BEGIN();
@@ -612,7 +612,7 @@ int test_a(sres_context_t *ctx)
   query = sres_query(res, test_answer, ctx, sres_type_a, longname);
   TEST_1(query);
   sres_query_bind(query, NULL, NULL);
-  
+
   TEST_1(sres_query(res, test_answer, ctx, sres_type_a, domain));
 
   TEST_RUN(ctx);
@@ -660,7 +660,7 @@ int test_a(sres_context_t *ctx)
   sres_free_answers(res, ctx->result), ctx->result = NULL;
 
   /* Try missing domain */
-  TEST_1(sres_query(res, test_answer, ctx, sres_type_a, 
+  TEST_1(sres_query(res, test_answer, ctx, sres_type_a,
                         "no-sip.example.com"));
 
   TEST_RUN(ctx);
@@ -675,9 +675,9 @@ int test_a(sres_context_t *ctx)
 
   sres_free_answers(res, ctx->result), ctx->result = NULL;
 
-  /* Try domain without A record => 
+  /* Try domain without A record =>
      we should get a record with SRES_RECORD_ERR */
-  TEST_1(sres_query(res, test_answer, ctx, sres_type_a, 
+  TEST_1(sres_query(res, test_answer, ctx, sres_type_a,
                         "aaaa.example.com"));
 
   TEST_RUN(ctx);
@@ -736,7 +736,7 @@ int test_a6(sres_context_t *ctx)
 
   TEST_1(result = ctx->result);
   TEST_1(result[0]);
-  
+
   rr_a6 = result[0]->sr_a6;
   TEST(rr_a6->a6_record->r_type, sres_type_a6);
   TEST(rr_a6->a6_record->r_class, sres_class_in);
@@ -807,7 +807,7 @@ int test_a6_prefix(sres_context_t *ctx)
   TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
         "3ff0:12:3012:c006:a08:20ff:fe7d:e7ac");
   TEST_P(rr_a6->a6_prename, NULL);
+
   sres_free_answers(res, ctx->result), ctx->result = NULL;
 
   /* Check parsing of special case: no suffix */
@@ -822,7 +822,7 @@ int test_a6_prefix(sres_context_t *ctx)
   TEST(rr_a6->a6_prelen, 128);
   TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "::");
   TEST_S(rr_a6->a6_prename, "a6.example.com.");
+
   sres_free_answers(res, ctx->result), ctx->result = NULL;
 
   TEST_1(result = sres_cached_answers(res, sres_type_a6, domain));
@@ -868,7 +868,7 @@ int test_aaaa(sres_context_t *ctx)
   sres_free_answers(res, ctx->result), ctx->result = NULL;
 
   TEST_1(result = sres_cached_answers(res, sres_type_aaaa, domain));
-  
+
   TEST_1(rr_aaaa = result[0]->sr_aaaa);
   TEST(rr_aaaa->aaaa_record->r_type, sres_type_aaaa);
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
@@ -900,7 +900,7 @@ int test_srv(sres_context_t *ctx)
 
   for (i = 0; result[i] != NULL; i++) {
     TEST_1(rr = (sres_srv_record_t *) result[i]->sr_srv);
-    
+
     switch(rr->srv_priority) {
     case 3:
       TEST(rr->srv_record->r_type, sres_type_srv);
@@ -940,7 +940,7 @@ int test_srv(sres_context_t *ctx)
 
   for (i = 0; result[i] != NULL; i++) {
     TEST_1(rr = (sres_srv_record_t *) result[i]->sr_srv);
-    
+
     switch(rr->srv_priority) {
     case 3:
       TEST(rr->srv_record->r_type, sres_type_srv);
@@ -1035,7 +1035,7 @@ int test_ptr_ipv4_sockaddr(sres_context_t *ctx)
   sres_query_t *query;
   const sres_ptr_record_t *rr;
   struct sockaddr_in sin = {0};
-  
+
   su_inet_pton(AF_INET, "127.0.0.1", &sin.sin_addr);
   sin.sin_family = AF_INET;
 
@@ -1048,7 +1048,7 @@ int test_ptr_ipv4_sockaddr(sres_context_t *ctx)
   TEST_RUN(ctx);
 
   result = ctx->result;
-  
+
   TEST_1(result != NULL);
   TEST_1(result[0] != NULL);
 
@@ -1067,7 +1067,7 @@ int test_ptr_ipv6(sres_context_t *ctx)
   sres_resolver_t *res = ctx->resolver;
   sres_record_t **result;
   const sres_ptr_record_t *rr;
-  char const *domain = 
+  char const *domain =
     "c.a.7.e.d.7.e.f.f.f.0.2.8.0.a.0.0.0.0.c.2.1.0.3.0.0.2.1.e.f.f.3.ip6.int";
 
   BEGIN();
@@ -1076,7 +1076,7 @@ int test_ptr_ipv6(sres_context_t *ctx)
   TEST_RUN(ctx);
 
   result = ctx->result;
-  
+
   TEST_1(result != NULL);
   TEST_1(result[0] != NULL);
 
@@ -1098,12 +1098,12 @@ int test_ptr_ipv6_sockaddr(sres_context_t *ctx)
 
   BEGIN();
 
-  su_inet_pton(AF_INET6, "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac", 
+  su_inet_pton(AF_INET6, "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac",
               &sin6.sin6_addr);
 
   sin6.sin6_family = AF_INET6;
 
-  ctx->query = 
+  ctx->query =
     sres_query_sockaddr(res, test_answer, ctx,
                             sres_type_ptr, (struct sockaddr*)&sin6);
   TEST_1(ctx->query != NULL);
@@ -1111,7 +1111,7 @@ int test_ptr_ipv6_sockaddr(sres_context_t *ctx)
   TEST_RUN(ctx);
 
   result = ctx->result;
-  
+
   TEST_1(result != NULL);
   TEST_1(result[0] != NULL);
 
@@ -1153,7 +1153,7 @@ int test_cache(sres_context_t *ctx)
   sres_query(res, test_answer_multi, ctx,
                  sres_qtype_any, "_sips._tcp.example.com");
 
-  sres_query(res, test_answer_multi, ctx, 
+  sres_query(res, test_answer_multi, ctx,
                  sres_qtype_any, "sip.example.com");
 
   sres_query(res, test_answer_multi, ctx,
@@ -1179,11 +1179,11 @@ int test_cache(sres_context_t *ctx)
 
   /* For a chance, a fully qualified domain name with final "." */
   domain = "example.com.";
-  
-  result = sres_cached_answers(res, 
+
+  result = sres_cached_answers(res,
                               sres_qtype_any,
                               domain);
-  
+
   TEST_1(result != NULL);
 
   for (i = 0; result[i] != NULL; i++) {
@@ -1227,7 +1227,7 @@ int test_cache(sres_context_t *ctx)
         TEST_S(rr_naptr->na_flags, "u");
         TEST_S(rr_naptr->na_services, "TEST+D2U");
 
-        TEST_S(rr_naptr->na_regexp, 
+        TEST_S(rr_naptr->na_regexp,
               "/(tst:([^@]+@))?example.com$/\\1operator.com/i");
 
         TEST_S(rr_naptr->na_replace, ".");
@@ -1251,7 +1251,7 @@ int test_cache(sres_context_t *ctx)
       }
     }
   }
-  
+
   TEST(ok, 7);
 
   /* Reverse order before sorting */
@@ -1269,8 +1269,8 @@ int test_cache(sres_context_t *ctx)
     sort_array[0] = result[i], sort_array[1] = result[i], sort_array[2] = NULL;
     sres_sort_answers(res, sort_array);
   }
-  
-  /* Test free */ 
+
+  /* Test free */
   for (i = 0; result[i]; i++) {
     sres_free_answer(res, result[i]);
     result[i] = NULL;
@@ -1279,10 +1279,10 @@ int test_cache(sres_context_t *ctx)
   /* Test sres_free_answers() */
   sres_free_answers(res, result);
 
-  result = sres_cached_answers(res, 
+  result = sres_cached_answers(res,
                               sres_qtype_any,
                               "_sips._tcp.example.com");
-  
+
   TEST_1(result != NULL);
 
   ok = 0;
@@ -1340,7 +1340,7 @@ int test_cache(sres_context_t *ctx)
   sres_free_answers(res, result);
 
   domain = "sip.example.com";
-  result = sres_cached_answers(res, 
+  result = sres_cached_answers(res,
                               sres_qtype_any,
                               domain);
 
@@ -1357,7 +1357,7 @@ int test_cache(sres_context_t *ctx)
 
 #if HAVE_SIN6
   domain = "subnet.example.com";
-  result = sres_cached_answers(res, 
+  result = sres_cached_answers(res,
                               sres_qtype_any,
                               domain);
 
@@ -1386,10 +1386,10 @@ int test_cache(sres_context_t *ctx)
         "3ffe:1200:3012:c000:206:5bff:fe55:462f");
   sres_free_answers(res, result);
 
-  result = sres_cached_answers_sockaddr(res, 
+  result = sres_cached_answers_sockaddr(res,
                                         sres_type_ptr,
                                         (struct sockaddr *)&sin6);
-  
+
   TEST_1(result != NULL);
 
   rr_ptr = result[0]->sr_ptr;
@@ -1397,7 +1397,7 @@ int test_cache(sres_context_t *ctx)
 
   TEST(rr_ptr->ptr_record->r_type, sres_type_ptr);
   TEST(rr_ptr->ptr_record->r_class, sres_class_in);
-  TEST_S(rr_ptr->ptr_domain, "sip01.example.com.");    
+  TEST_S(rr_ptr->ptr_domain, "sip01.example.com.");
 
   sres_free_answers(res, result);
 #endif /* HAVE_SIN6 */
@@ -1412,7 +1412,7 @@ int test_query_one_type(sres_context_t *ctx)
   sres_record_t **result;
   const sres_aaaa_record_t *rr_aaaa;
   char buf[50] = {0};
-  
+
   BEGIN();
 
   TEST_1(sres_query(res, test_answer, ctx,
@@ -1447,7 +1447,7 @@ int sink_make(sres_context_t *ctx)
   struct sockaddr_in sin[1];
   socklen_t sinsize = sizeof sin;
   FILE *f;
-  
+
   BEGIN();
 
   sink = socket(AF_INET, SOCK_DGRAM, 0); TEST_1(sink != INVALID_SOCKET);
@@ -1458,21 +1458,21 @@ int sink_make(sres_context_t *ctx)
 
   ctx->sink = sink;
 
-  template = su_sprintf(ctx->home, "%s/test_sresolv.XXXXXX", 
+  template = su_sprintf(ctx->home, "%s/test_sresolv.XXXXXX",
                        tmpdir ? tmpdir : "/tmp");
   TEST_1(template);
 
-#ifndef _WIN32  
+#ifndef _WIN32
   fd = mkstemp(template); TEST_1(fd != -1);
 #else
   fd = open(template, O_WRONLY); TEST_1(fd != -1);
-#endif  
+#endif
 
   f = fdopen(fd, "w"); TEST_1(f);
-  fprintf(f, 
+  fprintf(f,
          "domain example.com\n"
          "search foo.bar.com\n"
-         "port %u\n", 
+         "port %u\n",
          ntohs(sin->sin_port));
   fclose(f);
 
@@ -1563,7 +1563,7 @@ static void test_answer(sres_context_t *ctx,
   ctx->query = q;
   if (ctx->result)
     sres_free_answers(ctx->resolver, ctx->result);
-  ctx->result = answer; 
+  ctx->result = answer;
   BREAK(ctx);
 }
 
@@ -1720,9 +1720,9 @@ int test_net(sres_context_t *ctx)
   TEST_1(ctx->sink != INVALID_SOCKET && ctx->sink != (sres_socket_t)0);
 
   /* Prepare for test_answer() callback */
-  sres_free_answers(ctx->resolver, ctx->result); 
+  sres_free_answers(ctx->resolver, ctx->result);
   ctx->result = NULL;
-  ctx->query = NULL; 
+  ctx->query = NULL;
 
   /* Get canned response */
   TEST_1(bin = hex2bin(__func__, hextest, NULL, &binlen));
@@ -1795,12 +1795,12 @@ int test_init(sres_context_t *ctx, char const *conf_file)
   ctx->n_sockets = n;
   TEST_1(n < SRES_MAX_NAMESERVERS);
   TEST(sres_resolver_sockets(res, ctx->sockets, n), n);
-  
+
   for (i = 0; i < n; i++) {
     ctx->fds[i].fd = ctx->sockets[i];
     ctx->fds[i].events = POLLIN | POLLERR;
   }
-  
+
   TEST_P(sres_resolver_ref(ctx->resolver), ctx->resolver);
   sres_resolver_unref(ctx->resolver);
 
@@ -1823,7 +1823,7 @@ int test_deinit(sres_context_t *ctx)
   offset = 0;
   memset(ctx, 0, sizeof ctx);
   ctx->home->suh_size = sizeof ctx;
-  
+
   return 0;
 }
 
@@ -1839,7 +1839,7 @@ int test_conf_errors(sres_context_t *ctx, char const *conf_file)
   TEST_1(res = sres_resolver_new(conf_file));
   n = sres_resolver_sockets(res, NULL, 0);
   TEST_1(n > 0);
-    
+
   TEST(sres_resolver_sockets(res, &socket, 1), n);
 
 #if !__linux
@@ -1852,12 +1852,12 @@ search example.com
 port $port
 -->8-->8-->8-->8-->8-->8-->8-->8-->8-->8-->8-->8--
   */
-  printf("%s:%u: %s test should be updated\n", 
+  printf("%s:%u: %s test should be updated\n",
         __FILE__, __LINE__, __func__);
 #else
   TEST_P(sres_query(res, test_answer, ctx, sres_type_a, "example.com"), NULL);
 #endif
-    
+
   sres_resolver_unref(res);
 
   END();
@@ -1882,7 +1882,7 @@ static RETSIGTYPE sig_alarm(int s)
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
+  fprintf(stderr,
          "usage: %s OPTIONS [-] [conf-file] [error-conf-file]\n"
          "\twhere OPTIONS are\n"
          "\t    -v be verbose\n"
@@ -1932,7 +1932,7 @@ int main(int argc, char **argv)
 
       if (rest == NULL || *rest)
        usage(1);
-      
+
       su_log_set_level(sresolv_log, level);
     } else
       usage(1);
@@ -1949,7 +1949,7 @@ int main(int argc, char **argv)
 #if HAVE_ALARM
   else if (o_alarm) {
     alarm(60);
-    signal(SIGALRM, sig_alarm); 
+    signal(SIGALRM, sig_alarm);
   }
 #endif
 
@@ -1975,7 +1975,7 @@ int main(int argc, char **argv)
     /* These tests are run with (local) nameserver,
      */
     int initerror = test_init(ctx, argv[i]);
-    if (!initerror) { 
+    if (!initerror) {
       error |= test_a(ctx);
       error |= test_soa(ctx);
       error |= test_naptr(ctx);
index 61762e88d18c7db8aa06596a4ad3f7ee57bc5780..d499d10392d0ed89b6f3e30d2b15d0eebb488e3b 100644 (file)
@@ -25,7 +25,7 @@
 /**@internal
  *
  * @CFILE torture_sresolv.c Torture tests for Sofia resolver.
- * 
+ *
  * @author Mikko Haataja
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  */
@@ -96,7 +96,7 @@ static void test_answer(sres_context_t *ctx,
 {
 }
 
-static char name2048[2049] = 
+static char name2048[2049] =
   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
   "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
@@ -151,7 +151,7 @@ int test_api_errors(void)
 
   template = su_sprintf(ctx->home, ".torture_sresolv_api.conf.XXXXXX");
   TEST_1(template);
-  
+
   TEST_1(res = sres_resolver_new(NULL));
   TEST(su_home_threadsafe((su_home_t *)res), 0);
   TEST_VOID(sres_resolver_unref(res));
@@ -160,7 +160,7 @@ int test_api_errors(void)
   fd = mkstemp(template); TEST_1(fd != -1);
 #else
   fd = open(template, O_WRONLY); TEST_1(fd != -1);
-#endif  
+#endif
 
   f = fdopen(fd, "w"); TEST_1(f);
   fprintf(f, "domain example.com\n");
@@ -173,9 +173,9 @@ int test_api_errors(void)
   TEST(su_home_threadsafe((su_home_t *)res), 0);
 
   unlink(template);
-  
+
   s = sockets[0];
-  
+
   TEST_P(sres_resolver_ref(NULL), NULL);
   TEST(errno, EFAULT);
   sres_resolver_unref(NULL);
@@ -188,7 +188,7 @@ int test_api_errors(void)
   TEST_P(sres_resolver_get_userdata(res), NULL);
   TEST_P(sres_resolver_set_userdata(res, sa), NULL);
   TEST_P(sres_resolver_get_userdata(res), sa);
-  TEST_P(sres_resolver_set_userdata(res, NULL), sa); 
+  TEST_P(sres_resolver_set_userdata(res, NULL), sa);
   TEST_P(sres_resolver_get_userdata(res), NULL);
 
   errno = 0;
@@ -218,7 +218,7 @@ int test_api_errors(void)
   sres_sort_answers(NULL, NULL);
 
   sres_resolver_unref(res);
-  
+
   END();
 }
 
@@ -232,7 +232,7 @@ static
 int test_cache(void)
 {
   BEGIN();
+
   sres_a_record_t *a, a0[1], **all;
   char host[128];
   sres_cache_t *cache;
@@ -285,7 +285,7 @@ int test_cache(void)
     t2.tv_sec = t1.tv_sec - t0.tv_sec, t2.tv_nsec = t1.tv_nsec - t0.tv_nsec;
     if (t1.tv_nsec < t0.tv_nsec)
       t2.tv_sec--, t2.tv_nsec += 1000000000;
-    printf("sres_cache: stored %u entries: %lu.%09lu sec\n", 
+    printf("sres_cache: stored %u entries: %lu.%09lu sec\n",
           (unsigned)N, (long unsigned)t2.tv_sec, t2.tv_nsec);
   }
 
@@ -302,7 +302,7 @@ int test_cache(void)
     t2.tv_sec = t1.tv_sec - t0.tv_sec, t2.tv_nsec = t1.tv_nsec - t0.tv_nsec;
     if (t1.tv_nsec < t0.tv_nsec)
       t2.tv_sec--, t2.tv_nsec += 1000000000;
-    printf("sres_cache: cleaned %u entries: %lu.%09lu sec\n", 
+    printf("sres_cache: cleaned %u entries: %lu.%09lu sec\n",
           (unsigned)N, (long unsigned)t2.tv_sec, t2.tv_nsec);
   }
 
@@ -324,7 +324,7 @@ int test_cache(void)
     t2.tv_sec = t1.tv_sec - t0.tv_sec, t2.tv_nsec = t1.tv_nsec - t0.tv_nsec;
     if (t1.tv_nsec < t0.tv_nsec)
       t2.tv_sec--, t2.tv_nsec += 1000000000;
-    printf("sres_cache: stored %u entries: %lu.%09lu sec\n", 
+    printf("sres_cache: stored %u entries: %lu.%09lu sec\n",
           (unsigned)N, (long unsigned)t2.tv_sec, t2.tv_nsec);
   }
 
@@ -337,12 +337,12 @@ int test_cache(void)
     sres_cache_clean(cache, now + 3600);
 
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t1);
-  
+
   if (o_timing) {
     t2.tv_sec = t1.tv_sec - t0.tv_sec, t2.tv_nsec = t1.tv_nsec - t0.tv_nsec;
     if (t1.tv_nsec < t0.tv_nsec)
       t2.tv_sec--, t2.tv_nsec += 1000000000;
-    printf("sres_cache: cleaned %u entries: %lu.%09lu sec\n", 
+    printf("sres_cache: cleaned %u entries: %lu.%09lu sec\n",
           (unsigned)N, (long unsigned)t2.tv_sec, t2.tv_nsec);
   }
 
@@ -369,7 +369,7 @@ static RETSIGTYPE sig_alarm(int s)
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
+  fprintf(stderr,
          "usage: %s OPTIONS [-]\n"
          "\twhere OPTIONS are\n"
          "\t    -v be verbose\n"
@@ -419,7 +419,7 @@ int main(int argc, char **argv)
 
       if (rest == NULL || *rest)
        usage(1);
-      
+
       su_log_set_level(sresolv_log, level);
     }
     else
@@ -429,7 +429,7 @@ int main(int argc, char **argv)
 #if HAVE_ALARM
   if (o_alarm) {
     alarm(60);
-    signal(SIGALRM, sig_alarm); 
+    signal(SIGALRM, sig_alarm);
   }
 #endif
 
index 7b9b392990b8cee64a5980052f7ac85b3797110b..f3373fa5b471e3b7b717cf8f50994c340aa99d84 100644 (file)
 2006-05-07  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * sofia-sip/stun.h: Added new NAT types stun_nattype_t. The
-       naming is now compliant with the terms used by IETF BEHAVE 
+       naming is now compliant with the terms used by IETF BEHAVE
        documents.
 
 2006-05-06  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
        * sofia-sip/stun.h (stun_nattype_str): Added a new function to the
        public API.
-       
+
        * sofia-sip/stun.h (stun_nattype): Modified the function signature.
 
        * sofia-sip/stun.h (stun_state_t): Moved all request-specific states
@@ -54,7 +54,7 @@
 
 2006-02-09  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-       * stun_tag.h: Added STUN_DOMAIN() and STUN_REQUIRE_INTEGRITY(). 
+       * stun_tag.h: Added STUN_DOMAIN() and STUN_REQUIRE_INTEGRITY().
        Deprecated STUN_INTEGRITY.
 
        * stun.c: Mark wait entries as deregistered after
@@ -95,7 +95,7 @@
        * stun_internal.h: included stun_common.h
 
        * torture_stun.c: updated get_localinfo() to get_address()
-       
+
 2006-01-13  Martti Mela  <martti.mela@nokia.com>
 
        * stun.c: actions are now very separate from each other. Bug fixes.
        glueing into TPORT.
 
        * stunc.c: Removed unnecessary su_root_break()s.
-       
+
 2006-01-10  Martti Mela  <martti.mela@nokia.com>
 
        * stun.c: First working version of get_lifetime functionality. All
        stun_handle functionality.
 
        * stunc.c, torture_stun.c: modified in accordance to stun.h.
-       
+
 2005-12-16  Martti Mela  <martti.mela@nokia.com>
 
        * stun.h: changed stun_engine_t to stun_handle_t.
        representation, too.
 
        * stunc.c, torture_stun.c: behave now in conformance to stun.h
-       
+
 2005-12-15  Martti Mela  <martti.mela@nokia.com>
 
        * STUN updated to work asynchronously.
 
 2005-11-19  Kai Vehmanen  <kaiv@.devtag.AUTHORS>
 
-       * stun.h (stun_set_uname_pwd): Changed from unsigned to signed 
+       * stun.h (stun_set_uname_pwd): Changed from unsigned to signed
        char pointers for passing username and password.
 
 2005-11-18  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
 2005-10-24  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-       * stun.c: Fixed stun_bind() behaviour when STUN 
+       * stun.c: Fixed stun_bind() behaviour when STUN
        discovery fails. Added enum for tracking client
        state.
 
index 68e8623c2274fb3fc0d8795af70c9b6390a41acc..eb6516c9292c9828a1cf91a7f044ec3d907ffba8 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**@internal
- * @file lookup_stun_server.c 
+ * @file lookup_stun_server.c
  * @brief Test app for STUN DNS-SRV lookups.
  *
  * @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
@@ -53,16 +53,16 @@ static void lookup_cb(stun_dns_lookup_t *self,
   uint16_t tcp_port = 0, udp_port = 0, stp_port = 0;
   int res = 0;
 
-  printf("STUN DNS-SRV lookup results:\n"); 
+  printf("STUN DNS-SRV lookup results:\n");
 
   res = stun_dns_lookup_udp_addr(self, &udp_target, &udp_port);
-  printf(" _stun._udp.%s:     %s:%u (%s).\n", g_domain, udp_target, udp_port, RESULT(res)); 
+  printf(" _stun._udp.%s:     %s:%u (%s).\n", g_domain, udp_target, udp_port, RESULT(res));
 
   res = stun_dns_lookup_tcp_addr(self, &tcp_target, &tcp_port);
-  printf(" _stun._tcp.%s:     %s:%u (%s).\n", g_domain, tcp_target, tcp_port, RESULT(res)); 
+  printf(" _stun._tcp.%s:     %s:%u (%s).\n", g_domain, tcp_target, tcp_port, RESULT(res));
 
   res = stun_dns_lookup_stp_addr(self, &stp_target, &stp_port);
-  printf(" _stun-tls._tcp.%s: %s:%u (%s).\n", g_domain, stp_target, stp_port, RESULT(res)); 
+  printf(" _stun-tls._tcp.%s: %s:%u (%s).\n", g_domain, stp_target, stp_port, RESULT(res));
 
   su_root_break(root);
 }
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
 {
   su_root_t *root;
   stun_dns_lookup_t *lookup;
-  
+
   if (argc < 2) {
     printf("usage: ./lookup_stun_server <domain>\n");
     return -1;
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
 
   /* step: initiate the DNS-SRV lookup */
   lookup = stun_dns_lookup(root, root, lookup_cb, g_domain);
+
   if (lookup) {
     /* step: enter the main loop (break fro lookup_cb()) */
     su_root_run(root);
index 30dcb20827cd120329322fa4e9f46dceb184bfa1..2ee2f0b32242857f7b29e2442145861985753e45 100644 (file)
@@ -56,13 +56,13 @@ typedef struct stun_dns_lookup_s stun_dns_lookup_t;
 
 typedef struct stun_mini_s     stun_mini_t;
 
-#ifndef STUN_MAGIC_T 
+#ifndef STUN_MAGIC_T
 #define STUN_MAGIC_T            struct stun_magic_t
 #endif
 /** STUN server context */
 typedef STUN_MAGIC_T stun_magic_t;
 
-#ifndef STUN_DISCOVERY_MAGIC_T 
+#ifndef STUN_DISCOVERY_MAGIC_T
 #define STUN_DISCOVERY_MAGIC_T            struct stun_discovery_magic_t
 #endif
 /** STUN discovery_ context */
@@ -90,44 +90,44 @@ typedef enum stun_action_s {
  * XXX: should be extended to distinguish between filtering and
  *      mapping allocation behaviour (see IETF BEHAVE documents)
  *
- * Note: the NAT type detection algorithm can fail in 
- *       case where the NAT behaves in a nondeterministic 
+ * Note: the NAT type detection algorithm can fail in
+ *       case where the NAT behaves in a nondeterministic
  *       fashion.
  **/
 typedef enum stun_nattype_e {
-  stun_nat_unknown = 0, 
-      
+  stun_nat_unknown = 0,
+
   /* no NAT between client and STUN server */
-  stun_open_internet,     
+  stun_open_internet,
 
   /* UDP communication blocked by FW */
-  stun_udp_blocked,       
+  stun_udp_blocked,
 
   /* No NAT, but a FW element is performing address and port
    * restricted filtering. */
-  stun_sym_udp_fw,        
+  stun_sym_udp_fw,
 
-  /* Endpoint independent filtering (endpoint independent mapping) 
+  /* Endpoint independent filtering (endpoint independent mapping)
    * RFC3489 full cone NAT. */
-  stun_nat_full_cone,     
+  stun_nat_full_cone,
 
   /* Address restricted filtering (endpoint independent mapping),
    * RFC3489 restricted cone NAT. */
-  stun_nat_res_cone,      
+  stun_nat_res_cone,
 
-  /* Address and port restricted filtering (endpoint 
+  /* Address and port restricted filtering (endpoint
    * independent mapping), RFC3489 port restricted cone */
-  stun_nat_port_res_cone, 
+  stun_nat_port_res_cone,
 
   /* Endpoint independent filtering, endpoint dependent mapping. */
-  stun_nat_ei_filt_ad_map, 
+  stun_nat_ei_filt_ad_map,
 
   /* Address dependent filtering, endpoint dependent mapping. */
-  stun_nat_ad_filt_ad_map, 
+  stun_nat_ad_filt_ad_map,
 
-  /* Address and port dependent filtering, endpoint dependent mapping 
+  /* Address and port dependent filtering, endpoint dependent mapping
    * RFC3489 symmetric NAT). */
-  stun_nat_adp_filt_ad_map, 
+  stun_nat_adp_filt_ad_map,
 
 } stun_nattype_t;
 
@@ -138,9 +138,9 @@ typedef enum stun_nattype_e {
  * @see stun_obtain_shared_secret()
  * @see stun_test_nattype()
  * @see stun_test_lifetime()
- */ 
+ */
 typedef enum stun_state_e {
-  
+
   stun_no_assigned_event,
 
   /* TLS events; see stun_obtain_shared_request() */
@@ -211,7 +211,7 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
                         int sid, su_sockaddr_t *from_addr,
                         socklen_t from_len);
 
-/* ------------------------------------------------------------------- 
+/* -------------------------------------------------------------------
  * Functions for 'Binding Discovery' usage (RFC3489/3489bis) */
 
 SOFIAPUBFUN
@@ -219,12 +219,12 @@ int stun_obtain_shared_secret(stun_handle_t *sh, stun_discovery_f,
                              stun_discovery_magic_t *magic,
                              tag_type_t tag, tag_value_t value, ...);
 
-SOFIAPUBFUN 
-int stun_bind(stun_handle_t *sh, 
+SOFIAPUBFUN
+int stun_bind(stun_handle_t *sh,
              stun_discovery_f, stun_discovery_magic_t *magic,
              tag_type_t tag, tag_value_t value, ...);
 
-SOFIAPUBFUN 
+SOFIAPUBFUN
 int stun_discovery_get_address(stun_discovery_t *sd,
                               void *addr,
                               socklen_t *return_addrlen);
@@ -244,13 +244,13 @@ int stun_test_lifetime(stun_handle_t *sh,
                       tag_type_t tag, tag_value_t value, ...);
 SOFIAPUBFUN int stun_lifetime(stun_discovery_t *sd);
 
-/* ------------------------------------------------------------------- 
+/* -------------------------------------------------------------------
  * Functions for 'Connectivity Check' and 'NAT Keepalives' usages (RFC3489bis) */
 
-SOFIAPUBFUN 
+SOFIAPUBFUN
 int stun_set_uname_pwd(stun_handle_t *sh,
                       const char *uname,
-                      isize_t len_uname, 
+                      isize_t len_uname,
                       const char *pwd,
                       isize_t len_pwd);
 
@@ -259,7 +259,7 @@ SOFIAPUBFUN int stun_message_length(void *data, isize_t len, int end_of_message)
 
 /* Create a keepalive dispatcher for bound SIP sockets */
 
-SOFIAPUBFUN 
+SOFIAPUBFUN
 int stun_keepalive(stun_handle_t *sh,
                   su_sockaddr_t *sa,
                   tag_type_t tag, tag_value_t value,
@@ -274,10 +274,10 @@ SOFIAPUBFUN int stun_keepalive_destroy(stun_handle_t *sh, su_socket_t s);
 /* -------------------------------------------------------------------
  * Functions for STUN server discovery using DNS (RFC3489/3489bis) */
 
-SOFIAPUBFUN 
-stun_dns_lookup_t *stun_dns_lookup(stun_magic_t *magic, 
+SOFIAPUBFUN
+stun_dns_lookup_t *stun_dns_lookup(stun_magic_t *magic,
                                   su_root_t *root,
-                                  stun_dns_lookup_f func, 
+                                  stun_dns_lookup_f func,
                                   const char *domain);
 SOFIAPUBFUN void stun_dns_lookup_destroy(stun_dns_lookup_t *self);
 
index b97003a9427e518a91cbea83373a9c7b063f315e..81f0ebd9edc7612f4e326edf06f8bcea97a70a28 100644 (file)
 
 /**
  * @file sofia-sip/stun_common.h
- * @brief 
- * 
+ * @brief
+ *
  * @author Tat Chan <Tat.Chan@nokia.com>
- * 
+ *
  * @date Created: Fri Oct  3 13:39:55 2003 ppessi
- * 
+ *
  */
 
 #include <sofia-sip/su_localinfo.h>
@@ -69,7 +69,7 @@ SOFIA_BEGIN_DECLS
 #define STUN_A_REFRESH_INTERVAL       0x8024
 
 /* Defines for mandatory and optional attributes */
-#define STUN_A_LAST_MANDATORY         0x0023 /**< largest attribute in the current 
+#define STUN_A_LAST_MANDATORY         0x0023 /**< largest attribute in the current
                                                spec (see above for exceptions
                                                for buggy servers) */
 #define STUN_A_OPTIONAL               0x7fff
@@ -209,7 +209,7 @@ int stun_encode_message_integrity(stun_attr_t *attr, unsigned char *buf, int len
 int stun_encode_type_len(stun_attr_t *attr, uint16_t len);
 int stun_encode_response_address(stun_attr_t *attr);
 
-int stun_validate_message_integrity(stun_msg_t *msg, stun_buffer_t *pwd); 
+int stun_validate_message_integrity(stun_msg_t *msg, stun_buffer_t *pwd);
 
 int stun_copy_buffer(stun_buffer_t *p, stun_buffer_t *p2);
 void stun_init_buffer(stun_buffer_t *p);
index 78776b62719680208f87e78a2471d2ae74583dd8..01764816554562fd005a8ef49e3edcdb9a00be6e 100644 (file)
  * @author Tat Chan <Tat.Chan@nokia.com>
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
- * 
+ *
  * @date Created: Thu Jul 24 17:21:00 2003 ppessi
  */
 
-#include "config.h" 
+#include "config.h"
 
 #include <assert.h>
 #include <string.h>
@@ -79,7 +79,7 @@ static char const __func__[] = "stun";
 #endif
 
 /** STUN log. */
-su_log_t stun_log[] = { SU_LOG_INIT("stun", "STUN_DEBUG", SU_DEBUG) }; 
+su_log_t stun_log[] = { SU_LOG_INIT("stun", "STUN_DEBUG", SU_DEBUG) };
 
 /**@var char const STUN_DEBUG[]
  *
@@ -87,7 +87,7 @@ su_log_t stun_log[] = { SU_LOG_INIT("stun", "STUN_DEBUG", SU_DEBUG) };
  *
  * The STUN_DEBUG environment variable is used to determine the debug logging
  * level for @b stun module. The default level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, stun_log, SOFIA_DEBUG
  */
 extern char const STUN_DEBUG[];
@@ -100,7 +100,7 @@ enum {
 /**
  * States of STUN requests. See stun_state_e for states
  * discovery processes.
- */ 
+ */
 typedef enum stun_req_state_e {
   stun_req_no_assigned_event,
   stun_req_dispose_me,            /**< request can be disposed */
@@ -214,7 +214,7 @@ struct stun_handle_s
   char           *sh_domain;        /**< domain address for DNS-SRV lookups */
 
   stun_dns_lookup_t  *sh_dns_lookup;
-  stun_action_t       sh_dns_pend_action; 
+  stun_action_t       sh_dns_pend_action;
   stun_discovery_f    sh_dns_pend_cb;
   stun_discovery_magic_t *sh_dns_pend_ctx;
   tagi_t             *sh_dns_pend_tags;
@@ -259,13 +259,13 @@ char const *stun_str_state(stun_state_t state)
   STUN_STATE_STR(stun_tls_ssl_connect_failed);
   STUN_STATE_STR(stun_discovery_timeout);
   /* STUN_STATE_STR(stun_req_timeout); */
-  
+
   case stun_error:
   default: return "stun_error";
   }
 }
 
-/** 
+/**
  * Returns the NAT type attached to STUN discovery handle.
  *
  * @see stun_nattype_str().
@@ -294,7 +294,7 @@ char const *stun_nattype_str(stun_discovery_t *sd)
 
 /**
  * Returns the detected NAT type.
- * 
+ *
  * @see stun_nattype_str().
  * @see stun_test_nattype().
  */
@@ -318,10 +318,10 @@ int stun_lifetime(stun_discovery_t *sd)
 
 
 #if HAVE_OPENSSL
-char const stun_version[] = 
+char const stun_version[] =
  "sofia-sip-stun using " OPENSSL_VERSION_TEXT;
 #else
-char const stun_version[] = 
+char const stun_version[] =
  "sofia-sip-stun";
 #endif
 
@@ -349,18 +349,18 @@ static int get_localinfo(int family, su_sockaddr_t *su, socklen_t *return_len);
 #endif
 
 /* timers */
-static void stun_sendto_timer_cb(su_root_magic_t *magic, 
+static void stun_sendto_timer_cb(su_root_magic_t *magic,
                                 su_timer_t *t,
                                 su_timer_arg_t *arg);
 #if HAVE_OPENSSL
-static void stun_tls_connect_timer_cb(su_root_magic_t *magic, 
+static void stun_tls_connect_timer_cb(su_root_magic_t *magic,
                                      su_timer_t *t,
                                      su_timer_arg_t *arg);
 #endif
-static void stun_test_lifetime_timer_cb(su_root_magic_t *magic, 
+static void stun_test_lifetime_timer_cb(su_root_magic_t *magic,
                                        su_timer_t *t,
                                        su_timer_arg_t *arg);
-static void stun_keepalive_timer_cb(su_root_magic_t *magic, 
+static void stun_keepalive_timer_cb(su_root_magic_t *magic,
                                    su_timer_t *t,
                                    su_timer_arg_t *arg);
 
@@ -387,8 +387,8 @@ su_root_t *stun_root(stun_handle_t *self)
 /**
  * Check if a STUN handle should be created.
  *
- * Return true if STUNTAG_SERVER() or STUNTAG_DOMAIN() tags have 
- * been specified, or otherwise if STUN_SERVER environment variable 
+ * Return true if STUNTAG_SERVER() or STUNTAG_DOMAIN() tags have
+ * been specified, or otherwise if STUN_SERVER environment variable
  * is set.
  *
  * @TAGS
@@ -408,7 +408,7 @@ int stun_is_requested(tag_type_t tag, tag_value_t value, ...)
   ta_start(ta, tag, value);
   t = tl_find(ta_args(ta), stuntag_server);
   t2 = tl_find(ta_args(ta), stuntag_domain);
-  if (t && t->t_value) 
+  if (t && t->t_value)
     stun_server = (char *)t->t_value;
   else if (t2 && t2->t_value)
     stun_server = (char *)t2->t_value;
@@ -420,14 +420,14 @@ int stun_is_requested(tag_type_t tag, tag_value_t value, ...)
 }
 
 
-/** 
+/**
  * Creates a STUN handle.
  *
- * The created handles can be used for STUN binding discovery, 
+ * The created handles can be used for STUN binding discovery,
  * keepalives, and other STUN usages.
  *
  * @param root eventloop to used by the stun state machine
- * @param tag,value,... tag-value list 
+ * @param tag,value,... tag-value list
  *
  * @TAGS
  * @TAG STUNTAG_DOMAIN() domain to use in DNS-SRV based STUN server
@@ -444,7 +444,7 @@ stun_handle_t *stun_handle_init(su_root_t *root,
   int req_msg_integrity = 1;
   int err;
   ta_list ta;
-  
+
   enter;
 
   ta_start(ta, tag, value);
@@ -470,7 +470,7 @@ stun_handle_t *stun_handle_init(su_root_t *root,
     SU_DEBUG_5(("%s: using STUN_SERVER=%s\n", __func__, server));
   }
 
-  SU_DEBUG_5(("%s(\"%s\"): called\n", 
+  SU_DEBUG_5(("%s(\"%s\"): called\n",
              __func__, server));
 
   /* fail, if no server or a domain for a DNS-SRV lookup is specified */
@@ -478,7 +478,7 @@ stun_handle_t *stun_handle_init(su_root_t *root,
     errno = ENOENT;
     return NULL;
   }
-  
+
   stun->sh_pri_info.ai_addrlen = 16;
   stun->sh_pri_info.ai_addr = &stun->sh_pri_addr->su_sa;
 
@@ -490,7 +490,7 @@ stun_handle_t *stun_handle_init(su_root_t *root,
 
   stun->sh_domain = su_strdup(stun->sh_home, domain);
   stun->sh_dns_lookup = NULL;
-  
+
   if (server) {
     err = stun_atoaddr(stun->sh_home, AF_INET, &stun->sh_pri_info, server);
     if (err < 0) {
@@ -512,16 +512,16 @@ stun_handle_t *stun_handle_init(su_root_t *root,
   /* initialize username and password */
   stun_init_buffer(&stun->sh_username);
   stun_init_buffer(&stun->sh_passwd);
-  
+
   stun->sh_nattype = stun_nat_unknown;
-  
+
   /* initialize random number generator */
   srand(time(NULL));
+
   return stun;
 }
 
-/** 
+/**
  * Performs shared secret request/response processing.
  * Result will be trigged in STUN handle callback (state
  * one of stun_tls_*).
@@ -549,13 +549,13 @@ int stun_obtain_shared_secret(stun_handle_t *sh,
 
   if (!sh->sh_pri_addr[0].su_port) {
     /* no STUN server address, perform a DNS-SRV lookup */
-   
+
     ta_list ta;
     ta_start(ta, tag, value);
     SU_DEBUG_5(("Delaying STUN shared-secret req. for DNS-SRV query.\n"));
     err = priv_dns_queue_action(sh, stun_action_tls_query, sdf, magic, ta_tags(ta));
     ta_end(ta);
-       
+
     return err;
   }
 
@@ -588,7 +588,7 @@ int stun_obtain_shared_secret(stun_handle_t *sh,
 
   /* Do an asynchronous connect(). Three error codes are ok,
    * others cause return -1. */
-  if (connect(s, (struct sockaddr *) &sh->sh_pri_addr, 
+  if (connect(s, (struct sockaddr *) &sh->sh_pri_addr,
              ai->ai_addrlen) == SOCKET_ERROR) {
     err = su_errno();
     if (err != EINPROGRESS && err != EAGAIN && err != EWOULDBLOCK) {
@@ -598,7 +598,7 @@ int stun_obtain_shared_secret(stun_handle_t *sh,
 
   SU_DEBUG_9(("%s: %s: %s\n", __func__, "connect",
              su_strerror(err)));
-  
+
   sd = stun_discovery_create(sh, stun_action_tls_query, sdf, magic);
   sd->sd_socket = s;
   /* req = stun_request_create(sd); */
@@ -650,16 +650,16 @@ static stun_request_t *stun_request_create(stun_discovery_t *sd)
 
   /* This is the default */
   req->sr_socket = sd->sd_socket;
-  
+
   req->sr_localinfo.li_addrlen = sizeof(su_sockaddr_t);
   req->sr_localinfo.li_addr = req->sr_local_addr;
-  
+
   /* default timeout for next sendto() */
   req->sr_timeout = STUN_SENDTO_TIMEOUT;
   req->sr_retry_count = 0;
   /* req->sr_action = action; */
   req->sr_request_mask = 0;
-  
+
   req->sr_msg = calloc(sizeof(stun_msg_t), 1);
 
   req->sr_state = stun_req_discovery_init;
@@ -706,9 +706,9 @@ void stun_request_destroy(stun_request_t *req)
 }
 
 
-/** Destroy a STUN client */ 
+/** Destroy a STUN client */
 void stun_handle_destroy(stun_handle_t *sh)
-{ 
+{
   stun_discovery_t *sd = NULL, *kill = NULL;
   stun_request_t *a, *b;
 
@@ -753,7 +753,7 @@ void stun_handle_destroy(stun_handle_t *sh)
 
 /** Create wait object and register it to the handle callback */
 static
-int assign_socket(stun_discovery_t *sd, su_socket_t s, int register_socket) 
+int assign_socket(stun_discovery_t *sd, su_socket_t s, int register_socket)
 {
   stun_handle_t *sh = sd->sd_handle;
   int events;
@@ -763,7 +763,7 @@ int assign_socket(stun_discovery_t *sd, su_socket_t s, int register_socket)
   socklen_t sulen;
   char addr[SU_ADDRSIZE];
   int err;
-  
+
   su_wait_t wait[1] = { SU_WAIT_INIT };
 
   enter;
@@ -806,7 +806,7 @@ int assign_socket(stun_discovery_t *sd, su_socket_t s, int register_socket)
 #endif
 
     if ((err = bind(s, &su->su_sa, sulen)) < 0) {
-      SU_DEBUG_3(("%s: bind(%s:%u): %s\n",  __func__, 
+      SU_DEBUG_3(("%s: bind(%s:%u): %s\n",  __func__,
                  su_inet_ntop(su->su_family, SU_ADDR(su), addr, sizeof(addr)),
                  (unsigned) ntohs(su->su_port),
                  su_strerror(su_errno())));
@@ -867,13 +867,13 @@ static int get_localinfo(int family, su_sockaddr_t *su, socklen_t *return_len)
 
       memcpy(su, li->li_addr, *return_len = li->li_addrlen);
 
-      SU_DEBUG_3(("%s: using local address %s\n", __func__, 
+      SU_DEBUG_3(("%s: using local address %s\n", __func__,
                  su_inet_ntop(family, SU_ADDR(su), addr, sizeof(addr))));
       break;
     }
 
     su_freelocalinfo(res);
-    
+
     if (!li) {                 /* Not found */
       return STUN_ERROR(error, su_getlocalinfo);
     }
@@ -898,13 +898,13 @@ static void priv_lookup_cb(stun_dns_lookup_t *self,
   if (res == 0 && udp_target) {
     /* XXX: assumption that same host and port used for UDP/TLS */
     stun_atoaddr(sh->sh_home, AF_INET, &sh->sh_pri_info, udp_target);
-    
-    if (udp_port) 
+
+    if (udp_port)
       sh->sh_pri_addr[0].su_port = htons(udp_port);
     else
       sh->sh_pri_addr[0].su_port = htons(STUN_DEFAULT_PORT);
 
-    /* step: now that server address is known, continue 
+    /* step: now that server address is known, continue
      *       the pending action */
 
     SU_DEBUG_5(("STUN server address found, running queue actions (%d).\n",
@@ -918,15 +918,15 @@ static void priv_lookup_cb(stun_dns_lookup_t *self,
     case stun_action_binding_request:
       stun_bind(sh, sh->sh_dns_pend_cb, sh->sh_dns_pend_ctx, TAG_NEXT(sh->sh_dns_pend_tags));
       break;
-      
+
     case stun_action_test_lifetime:
       stun_test_lifetime(sh, sh->sh_dns_pend_cb, sh->sh_dns_pend_ctx, TAG_NEXT(sh->sh_dns_pend_tags));
       break;
-      
+
     case stun_action_test_nattype:
       stun_test_nattype(sh, sh->sh_dns_pend_cb, sh->sh_dns_pend_ctx, TAG_NEXT(sh->sh_dns_pend_tags));
       break;
-      
+
     default:
       SU_DEBUG_5(("Warning: unknown pending STUN DNS-SRV action.\n"));
     }
@@ -963,7 +963,7 @@ static int priv_dns_queue_action(stun_handle_t *sh,
       sh->sh_dns_lookup = stun_dns_lookup((stun_magic_t*)sh, sh->sh_root, priv_lookup_cb, sh->sh_domain);
       ta_start(ta, tag, value);
       assert(sh->sh_dns_pend_tags == NULL);
-      sh->sh_dns_pend_tags = tl_tlist(sh->sh_home, 
+      sh->sh_dns_pend_tags = tl_tlist(sh->sh_home,
                                      ta_tags(ta));
       ta_end(ta);
       sh->sh_dns_pend_cb = sdf;
@@ -974,7 +974,7 @@ static int priv_dns_queue_action(stun_handle_t *sh,
 
     return 0;
   }
-  
+
   return -1;
 }
 
@@ -988,17 +988,17 @@ static int priv_stun_bind_send(stun_handle_t *sh, stun_request_t *req, stun_disc
   return res;
 }
 
-/** 
+/**
  * Performs a STUN Binding Discovery (see RFC3489/3489bis) process
  *
- * To integrity protect the discovery process, first call 
+ * To integrity protect the discovery process, first call
  * stun_request_shared_secret() on the handle 'sh'.
  *
  * If STUNTAG_REGISTER_SOCKET() is omitted, or set to false, the
  * client is responsible for socket i/o. Other stun module will
  * perform the whole discovery process and return the results
  * via callback 'sdf'.
- * 
+ *
  * @param sh       pointer to valid stun handle
  * @param sdf      callback to signal process progress
  * @param magic    context pointer attached to 'sdf'
@@ -1011,16 +1011,16 @@ static int priv_stun_bind_send(stun_handle_t *sh, stun_request_t *req, stun_disc
  * @return
  * On success, zero is returned.  Upon error, -1 is returned, and @e errno is
  * set appropriately.
- * 
+ *
  * @ERRORS
  * @ERROR EFAULT          An invalid address is given as argument
  * @ERROR EPROTONOSUPPORT Not a UDP socket.
  * @ERROR EINVAL          The socket is already bound to an address.
- * @ERROR EACCESS        The address is protected, and the user is not 
+ * @ERROR EACCESS        The address is protected, and the user is not
  *                       the super-user.
  * @ERROR ENOTSOCK       Argument is a descriptor for a file, not a socket.
- * @ERROR EAGAIN          Operation in progress. Application should call 
- *                        stun_bind() again when there is data available on 
+ * @ERROR EAGAIN          Operation in progress. Application should call
+ *                        stun_bind() again when there is data available on
  *                        the socket.
  */
 int stun_bind(stun_handle_t *sh,
@@ -1034,7 +1034,7 @@ int stun_bind(stun_handle_t *sh,
   stun_discovery_t *sd = NULL;
   ta_list ta;
   int s_reg = 0;
-  
+
   enter;
 
   if (sh == NULL)
@@ -1077,7 +1077,7 @@ int stun_bind(stun_handle_t *sh,
 }
 
 
-/** 
+/**
  * Returns the address of the public binding allocated by the NAT.
  *
  * In case of multiple on path NATs, the binding allocated by
@@ -1091,7 +1091,7 @@ int stun_discovery_get_address(stun_discovery_t *sd,
                               socklen_t *return_addrlen)
 {
   socklen_t siz;
-  
+
   enter;
 
   assert(sd && addr);
@@ -1105,7 +1105,7 @@ int stun_discovery_get_address(stun_discovery_t *sd,
     *return_addrlen = siz;
 
   memcpy(addr, sd->sd_addr_seen_outside, siz);
-  
+
   return 0;
 }
 
@@ -1149,7 +1149,7 @@ static int stun_discovery_destroy(stun_discovery_t *sd)
 
   sh = sd->sd_handle;
 
-  if (sd->sd_timer) 
+  if (sd->sd_timer)
     su_timer_destroy(sd->sd_timer), sd->sd_timer = NULL;
 
   /* if we are in the queue*/
@@ -1163,12 +1163,12 @@ static int stun_discovery_destroy(stun_discovery_t *sd)
 }
 
 /**
- * Initiates STUN discovery process to find out NAT 
- * characteristics. 
+ * Initiates STUN discovery process to find out NAT
+ * characteristics.
  *
- * Process partly follows the algorithm defined in RFC3489 section 
+ * Process partly follows the algorithm defined in RFC3489 section
  * 10.1. Due the known limitations of RFC3489, some of the tests
- * are done. 
+ * are done.
  *
  * Note: does not support STUNTAG_DOMAIN() even if specified to
  * stun_handle_init().
@@ -1198,13 +1198,13 @@ int stun_test_nattype(stun_handle_t *sh,
 
   if (!sh->sh_pri_addr[0].su_port) {
     /* no STUN server address, perform a DNS-SRV lookup */
-   
+
     ta_list ta;
     ta_start(ta, tag, value);
     SU_DEBUG_5(("Delaying STUN get-nat-type req. for DNS-SRV query.\n"));
     err = priv_dns_queue_action(sh, stun_action_test_nattype, sdf, magic, ta_tags(ta));
     ta_end(ta);
-       
+
     return err;
   }
 
@@ -1238,10 +1238,10 @@ int stun_test_nattype(stun_handle_t *sh,
   destination = (su_sockaddr_t *) sd->sd_pri_addr;
 
   req = stun_request_create(sd);
-  if (stun_make_binding_req(sh, req, req->sr_msg, 
-                           STUNTAG_CHANGE_IP(0), 
+  if (stun_make_binding_req(sh, req, req->sr_msg,
+                           STUNTAG_CHANGE_IP(0),
                            STUNTAG_CHANGE_PORT(0),
-                           TAG_END()) < 0) 
+                           TAG_END()) < 0)
     return -1;
 
   err = stun_send_binding_request(req, destination);
@@ -1253,10 +1253,10 @@ int stun_test_nattype(stun_handle_t *sh,
   /* Same Public IP and port, Test III, server ip 0 or 1 should be
      the same */
   req = stun_request_create(sd);
-  if (stun_make_binding_req(sh, req, req->sr_msg, 
-                           STUNTAG_CHANGE_IP(0), 
+  if (stun_make_binding_req(sh, req, req->sr_msg,
+                           STUNTAG_CHANGE_IP(0),
                            STUNTAG_CHANGE_PORT(1),
-                           TAG_END()) < 0) 
+                           TAG_END()) < 0)
     return -1;
 
   err = stun_send_binding_request(req, destination);
@@ -1267,12 +1267,12 @@ int stun_test_nattype(stun_handle_t *sh,
   req = NULL;
 
   req = stun_request_create(sd);
-  if (stun_make_binding_req(sh, req, req->sr_msg, 
-                           STUNTAG_CHANGE_IP(1), 
+  if (stun_make_binding_req(sh, req, req->sr_msg,
+                           STUNTAG_CHANGE_IP(1),
                            STUNTAG_CHANGE_PORT(1),
-                           TAG_END()) < 0) 
+                           TAG_END()) < 0)
     return -1;
-  
+
   err = stun_send_binding_request(req, destination);
   if (err < 0) {
     stun_free_message(req->sr_msg);
@@ -1286,7 +1286,7 @@ int stun_test_nattype(stun_handle_t *sh,
  *******************************************************************/
 
 #if HAVE_OPENSSL
-static 
+static
 int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
 {
   stun_discovery_t *sd = arg;
@@ -1349,7 +1349,7 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
       stun_free_buffer(&msg_req->enc_buf);
       return -1;
     }
-    
+
     /* openssl initiation */
     SSLeay_add_ssl_algorithms();
     SSL_load_error_strings();
@@ -1361,13 +1361,13 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
       stun_free_buffer(&msg_req->enc_buf);
       return -1;
     }
-    
+
     if (SSL_CTX_set_cipher_list(ctx, "AES128-SHA") == 0) {
       STUN_ERROR(errno, SSL_CTX_set_cipher_list);
       stun_free_buffer(&msg_req->enc_buf);
       return -1;
     }
-    
+
     /* Start TLS negotiation */
     ssl = SSL_new(ctx);
     self->sh_ssl = ssl;
@@ -1406,7 +1406,7 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
 
       return -1;
     }
-    
+
     /* Inform application about the progress  */
     sd->sd_state = stun_tls_writing;
     /* self->sh_callback(self->sh_context, self, self->sh_state); */
@@ -1424,16 +1424,16 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
                      sd->sd_socket, events);
 
     SU_DEBUG_3(("TLS connection using %s\n", SSL_get_cipher(ssl)));
-    
-    server_cert = SSL_get_peer_certificate(ssl); 
+
+    server_cert = SSL_get_peer_certificate(ssl);
     if(server_cert) {
       SU_DEBUG_3(("\t subject: %s\n", X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0)));
       SU_DEBUG_3(("\t issuer: %s\n", X509_NAME_oneline(X509_get_issuer_name(server_cert), 0, 0)));
     }
     X509_free(server_cert);
-    
+
     z = SSL_write(ssl, msg_req->enc_buf.data, msg_req->enc_buf.size);
-    
+
     if (z < 0) {
       err = SSL_get_error(ssl, z);
       if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE)
@@ -1484,7 +1484,7 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
     SSL_CTX_free(self->sh_ctx), ctx = NULL;
 
     stun_free_buffer(&msg_req->enc_buf);
-  
+
     /* process response */
     if (stun_parse_message(resp) < 0) {
       perror("stun_parse_message");
@@ -1505,17 +1505,17 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
 
     case SHARED_SECRET_ERROR_RESPONSE:
       if (stun_process_error_response(resp) < 0) {
-       SU_DEBUG_5(("Error in Shared Secret Error Response.\n")); 
+       SU_DEBUG_5(("Error in Shared Secret Error Response.\n"));
       }
       stun_free_buffer(&resp->enc_buf);
       return -1;
-    
+
       break;
 
     default:
       break;
     }
-    
+
     su_wait_destroy(w);
     su_root_deregister(self->sh_root, sd->sd_index);
     sd->sd_index = -1; /* mark index as deregistered */
@@ -1539,7 +1539,7 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
 
 
 #if HAVE_OPENSSL
-static void stun_tls_connect_timer_cb(su_root_magic_t *magic, 
+static void stun_tls_connect_timer_cb(su_root_magic_t *magic,
                                      su_timer_t *t,
                                      su_timer_arg_t *arg)
 {
@@ -1562,7 +1562,7 @@ static void stun_tls_connect_timer_cb(su_root_magic_t *magic,
 
   su_root_deregister(sh->sh_root, sd->sd_index);
   sd->sd_index = -1; /* mark index as deregistered */
-  
+
   sd->sd_state = stun_tls_connection_timeout;
   sd->sd_callback(sd->sd_magic, sh, sd, sd->sd_action, sd->sd_state);
 
@@ -1577,7 +1577,7 @@ static void stun_tls_connect_timer_cb(su_root_magic_t *magic,
 int stun_make_sharedsecret_req(stun_msg_t *msg)
 {
 
-  int i, len; 
+  int i, len;
   uint16_t tmp;
 
   /* compose header */
@@ -1586,17 +1586,17 @@ int stun_make_sharedsecret_req(stun_msg_t *msg)
                                stun_send_message */
   for (i = 0; i < STUN_TID_BYTES; i++) {
     msg->stun_hdr.tran_id[i] = (1 + rand() % RAND_MAX_16);
-  } 
-  
+  }
+
   /* no buffer assigned yet */
   stun_init_buffer(&msg->enc_buf);
-  
+
   msg->enc_buf.data = malloc(20);
   msg->enc_buf.size = 20;
 
   tmp = htons(msg->stun_hdr.msg_type);
   len = 0;
-  
+
   memcpy(msg->enc_buf.data, &tmp, sizeof(tmp));
   len+=sizeof(tmp);
 
@@ -1606,7 +1606,7 @@ int stun_make_sharedsecret_req(stun_msg_t *msg)
 
   memcpy(msg->enc_buf.data+len, msg->stun_hdr.tran_id, STUN_TID_BYTES);
   len+=STUN_TID_BYTES;
-    
+
   return 0;
 }
 
@@ -1695,12 +1695,12 @@ static int stun_bind_callback(stun_magic_t *m, su_wait_t *w, su_wakeup_arg_t *ar
   binding_response.enc_buf.size = dgram_len;
   memcpy(binding_response.enc_buf.data, dgram, dgram_len);
 
-  
+
   SU_DEBUG_5(("%s: response from server %s:%u\n", __func__,
              su_inet_ntop(recv.su_family, SU_ADDR(&recv), addr, sizeof(addr)),
              ntohs(recv.su_port)));
 
-  debug_print(&binding_response.enc_buf);      
+  debug_print(&binding_response.enc_buf);
 
   /* Parse here the incoming message. */
   if (stun_parse_message(&binding_response) < 0) {
@@ -1722,13 +1722,13 @@ static int stun_bind_callback(stun_magic_t *m, su_wait_t *w, su_wakeup_arg_t *ar
 
     msg = &binding_response;
     for (a = &msg->stun_attr; *a;) {
-      
+
       if ((*a)->pattr)
        free((*a)->pattr);
-      
+
       if ((*a)->enc_buf.data)
        free((*a)->enc_buf.data);
-      
+
       b = *a;
       b = b->next;
       free(*a);
@@ -1792,7 +1792,7 @@ static int do_action(stun_handle_t *sh, stun_msg_t *msg)
     req->sr_state = stun_req_dispose_me;
     break;
   }
-  
+
   return 0;
 }
 
@@ -1837,14 +1837,14 @@ static int process_binding_request(stun_request_t *req, stun_msg_t *binding_resp
     }
 
     break;
-    
+
   case BINDING_ERROR_RESPONSE:
   default:
     if (stun_process_error_response(binding_response) < 0) {
       SU_DEBUG_3(("%s: Error in Binding Error Response.\n", __func__));
     }
     req->sr_state = stun_req_error;
-      
+
     break;
   }
 
@@ -1852,7 +1852,7 @@ static int process_binding_request(stun_request_t *req, stun_msg_t *binding_resp
 
 }
 
-static void stun_test_lifetime_timer_cb(su_root_magic_t *magic, 
+static void stun_test_lifetime_timer_cb(su_root_magic_t *magic,
                                       su_timer_t *t,
                                       su_timer_arg_t *arg)
 {
@@ -1921,7 +1921,7 @@ static int process_test_lifetime(stun_request_t *req, stun_msg_t *binding_respon
 
     new = stun_request_create(sd);
     new->sr_from_y = 0;
-    if (stun_make_binding_req(sh, new, new->sr_msg, 0, 0) < 0) 
+    if (stun_make_binding_req(sh, new, new->sr_msg, 0, 0) < 0)
       return -1;
 
     destination = (su_sockaddr_t *) sd->sd_pri_addr;
@@ -1957,16 +1957,16 @@ static int process_test_lifetime(stun_request_t *req, stun_msg_t *binding_respon
   li = &req->sr_localinfo;
   sa = req->sr_local_addr;
   stun_free_message(binding_response);
-  
+
   /* Destroy me with the bad mofo timer */
   req->sr_state = stun_req_dispose_me, req = NULL;
-  
+
   new = stun_request_create(sd);
   /* Use sockfdy */
   new->sr_socket = sockfdy;
   new->sr_from_y = 1;
 
-  if (stun_make_binding_req(sh, new, new->sr_msg, 0, 0) < 0) 
+  if (stun_make_binding_req(sh, new, new->sr_msg, 0, 0) < 0)
     return -1;
 
   stun_add_response_address(new->sr_msg, (struct sockaddr_in *) sa);
@@ -1999,7 +1999,7 @@ static int action_bind(stun_request_t *req, stun_msg_t *binding_response)
 
   sd->sd_state = stun_discovery_done;
   req->sr_state = stun_req_dispose_me;
-  
+
   if (sd->sd_callback)
     sd->sd_callback(sd->sd_magic, sh, sd, action, sd->sd_state);
 
@@ -2016,7 +2016,7 @@ static int priv_find_matching_localadress(su_sockaddr_t *su)
   int af;
   char addr[SU_ADDRSIZE];
 
-  SU_DEBUG_5(("%s: checking if %s is a local address.\n", __func__, 
+  SU_DEBUG_5(("%s: checking if %s is a local address.\n", __func__,
              su_inet_ntop(AF_INET, SU_ADDR(su), addr, sizeof(addr))));
 
   hints->li_family = af = su->su_family;
@@ -2028,15 +2028,15 @@ static int priv_find_matching_localadress(su_sockaddr_t *su)
   for (li = res; li; li = li->li_next) {
     if (li->li_family != af)
       continue;
-      
+
     if (memcmp(SU_ADDR(su), SU_ADDR(li->li_addr), SU_ADDRLEN(su)) == 0) {
       SU_DEBUG_5(("%s: found matching local address\n", __func__));
       break;
     }
 
-    SU_DEBUG_9(("%s: skipping local address %s.\n", __func__, 
+    SU_DEBUG_9(("%s: skipping local address %s.\n", __func__,
                su_inet_ntop(af, SU_ADDR(li->li_addr), addr, sizeof(addr))));
-  }  
+  }
 
   su_freelocalinfo(res);
 
@@ -2046,9 +2046,9 @@ static int priv_find_matching_localadress(su_sockaddr_t *su)
 /**
  * Helper function for action_determine_nattype().
  */
-static void priv_mark_discovery_done(stun_discovery_t *sd, 
-                                    stun_handle_t *sh, 
-                                    stun_action_t action, 
+static void priv_mark_discovery_done(stun_discovery_t *sd,
+                                    stun_handle_t *sh,
+                                    stun_action_t action,
                                     stun_request_t *req)
 {
   sd->sd_state = stun_discovery_done;
@@ -2059,7 +2059,7 @@ static void priv_mark_discovery_done(stun_discovery_t *sd,
 
 /**
  * Handles responses related to the NAT type discovery process.
- * 
+ *
  * The requests for Tests I-III are sent in parallel, so the
  * callback has to keep track of which requests have been received
  * and postpone decisions until enough responses have been processed.
@@ -2095,7 +2095,7 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
   li = &req->sr_localinfo;
 
   /* check whether the response timed out or not */
-  if (req->sr_state == stun_req_timeout) 
+  if (req->sr_state == stun_req_timeout)
     reply_res = -1;
   else
     reply_res = 1;
@@ -2127,7 +2127,7 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
        inet_ntoa(li->li_addr->su_sin.sin_addr),
        li->li_addr->su_port)); */
 
-    /* note: check whether MAPPED-ADDRESS address has changed (when 
+    /* note: check whether MAPPED-ADDRESS address has changed (when
      *       sending to a different IP:port -> NAT mapping behaviour) */
     if (su_cmp_sockaddr(sd->sd_addr_seen_outside, li->li_addr) != 0) {
       sd->sd_mapped_addr_match = 0;
@@ -2146,21 +2146,21 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
     sd->sd_nattype = stun_udp_blocked;
     priv_mark_discovery_done(sd, sh, action, req);
   }
-  /* case 2: mapped address matches our local address 
+  /* case 2: mapped address matches our local address
    *         not behind a NAT, result of test two determinces
    *         whether we are behind a symmetric FW or not */
   else if (sd->sd_first > 0 &&
-          sd->sd_second && 
+          sd->sd_second &&
           priv_find_matching_localadress(sd->sd_addr_seen_outside)) {
-    if (sd->sd_second > 0) 
+    if (sd->sd_second > 0)
       sd->sd_nattype = stun_open_internet;
     else
       sd->sd_nattype = stun_sym_udp_fw;
     priv_mark_discovery_done(sd, sh, action, req);
   }
-  /* case 3: response ok to Test-II, and behind a NAT 
+  /* case 3: response ok to Test-II, and behind a NAT
    *         do not make conclusions until Test-IV has been scheduled */
-  else if (sd->sd_first > 0 && 
+  else if (sd->sd_first > 0 &&
           sd->sd_second > 0 &&
           sd->sd_fourth) {
     if (sd->sd_mapped_addr_match == 1)
@@ -2169,28 +2169,28 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
       sd->sd_nattype = stun_nat_ei_filt_ad_map;
     priv_mark_discovery_done(sd, sh, action, req);
   }
-  /* case 4: tests I-III done, perform IV 
+  /* case 4: tests I-III done, perform IV
    *         see notes below */
-  else if (sd->sd_first > 0 && 
+  else if (sd->sd_first > 0 &&
           sd->sd_second &&
           sd->sd_third &&
           sd->sd_fourth == 0) {
 
-    /* 
+    /*
      * No response received, so we now perform Test IV using the address
-     * learnt from response to Test-I. 
-     * 
+     * learnt from response to Test-I.
+     *
      * Unfortunately running  this test will potentially affect
      * results of a subsequent Test-II (depends on NAT binding timeout
-     * values). To get around this, the STUN server would ideally have 
+     * values). To get around this, the STUN server would ideally have
      * a dedicated IP:port for Test-IV. But within the currents specs,
-     * we need to reuse one of the IP:port addresses already used in 
+     * we need to reuse one of the IP:port addresses already used in
      * Test-II by the STUN server to send us packets.
      */
 
     SU_DEBUG_7(("Sending STUN NAT type Test-IV request to %s.\n",
               inet_ntoa(sd->sd_sec_addr[0].su_sin.sin_addr)));
-    
+
     sd->sd_fourth = 2; /* request, -1, 0, 1 reserved for results */
     req->sr_state = stun_req_dispose_me;
     req = stun_request_create(sd);
@@ -2212,13 +2212,13 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
       action_determine_nattype(req, binding_response);
       return -1;
     }
-    
+
     return 0; /* we don't want to dispose this req */
   }
   /* case 5: no response Test-II, and success with III
    *         the NAT is filtering packets from different IP
    *         do not make conclusions until Test-IV has been scheduled */
-  else if (sd->sd_first > 0 && 
+  else if (sd->sd_first > 0 &&
           sd->sd_second < 0 &&
           sd->sd_third > 0 &&
           sd->sd_fourth) {
@@ -2228,10 +2228,10 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
       sd->sd_nattype = stun_nat_ad_filt_ad_map;
     priv_mark_discovery_done(sd, sh, action, req);
   }
-  /* case 6: no response to Test-II nor III 
+  /* case 6: no response to Test-II nor III
    *         the NAT is filtering packets from different port
    *         do not make conclusions until Test-IV has been scheduled */
-  else if (sd->sd_first > 0 && 
+  else if (sd->sd_first > 0 &&
           sd->sd_second < 0 &&
           sd->sd_third < 0 &&
           sd->sd_fourth) {
@@ -2249,7 +2249,7 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
 }
 
 
-static void stun_sendto_timer_cb(su_root_magic_t *magic, 
+static void stun_sendto_timer_cb(su_root_magic_t *magic,
                                 su_timer_t *t,
                                 su_timer_arg_t *arg)
 {
@@ -2269,7 +2269,7 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
 
   ++req->sr_retry_count;
 
-  /* check if max retry count has been exceeded; or if 
+  /* check if max retry count has been exceeded; or if
    * action type is NAT type check (XXX: the request attributes
    * are not passed correctly to resend function) */
   if (req->sr_retry_count >= sh->sh_max_retries ||
@@ -2283,7 +2283,7 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
     /* Either the server was dead, address wrong or STUN_UDP_BLOCKED */
     /* sd->sd_nattype = stun_udp_blocked; */
     req->sr_state = stun_req_timeout;
-    
+
     /* If the action is binding request, we are done. If action was
        NAT type determination, process with the state machine. */
     switch (action) {
@@ -2300,11 +2300,11 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
     case stun_action_test_nattype:
       action_determine_nattype(req, NULL);
       break;
-      
+
     case stun_action_test_lifetime:
       process_test_lifetime(req, NULL);
       break;
-      
+
     case stun_action_keepalive:
       sd->sd_state = stun_discovery_timeout;
 
@@ -2313,7 +2313,7 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
        sd->sd_callback(sd->sd_magic, sh, sd, action, sd->sd_state);
 
       stun_keepalive_destroy(sh, sd->sd_socket);
-      
+
       break;
 
     default:
@@ -2338,10 +2338,10 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
     timeout = req->sr_timeout *= 2;
 
   }
-  
+
   su_timer_set_at(t, stun_sendto_timer_cb, (su_wakeup_arg_t *) req,
                  su_time_add(su_now(), timeout));
-  
+
   return;
 }
 
@@ -2355,20 +2355,20 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
  * @return
  * On success, zero is returned.  Upon error, -1 is returned, and @e errno is
  * set appropriately.
- * 
+ *
  * @ERRORS
  * @ERROR EBADF           @a sockfd is not a valid deseriptor.
  * @ERROR EPROTONOSUPPORT @a sockfd is not an UDP socket.
  * @ERROR EINVAL          The socket is already bound to an address.
- * @ERROR EACCESS        The address is protected, and the user is not 
+ * @ERROR EACCESS        The address is protected, and the user is not
  *                       the super-user.
  * @ERROR ENOTSOCK       Argument is a descriptor for a file, not a socket.
- * @ERROR EAGAIN          Operation in progress. Application should call 
- *                        stun_bind() again when there is data available on 
+ * @ERROR EAGAIN          Operation in progress. Application should call
+ *                        stun_bind() again when there is data available on
  *                        the socket.
  * @ERROR ETIMEDOUT       Request timed out.
- * 
- */   
+ *
+ */
 static int stun_send_binding_request(stun_request_t *req,
                                     su_sockaddr_t  *srvr_addr)
 {
@@ -2406,9 +2406,9 @@ int stun_make_binding_req(stun_handle_t *sh,
                          tag_type_t tag, tag_value_t value, ...)
 {
   int i;
-  stun_attr_t *tmp, **p; 
+  stun_attr_t *tmp, **p;
   int bits = 0;
-  int chg_ip = 0, chg_port = 0; 
+  int chg_ip = 0, chg_port = 0;
 
   ta_list ta;
 
@@ -2422,7 +2422,7 @@ int stun_make_binding_req(stun_handle_t *sh,
          TAG_END());
 
   ta_end(ta);
-  
+
   if (chg_ip)
     bits |= CHG_IP;
   if (chg_port)
@@ -2430,15 +2430,15 @@ int stun_make_binding_req(stun_handle_t *sh,
 
   if (req)
     req->sr_request_mask = bits;
-  
+
   /* compose header */
   msg->stun_hdr.msg_type = BINDING_REQUEST;
   msg->stun_hdr.msg_len = 0; /* actual len computed by
                                stun_send_message */
   for (i = 0; i < STUN_TID_BYTES; i++) {
     msg->stun_hdr.tran_id[i] = (1 + rand() % RAND_MAX_16);
-  } 
-  
+  }
+
   /* optional attributes:
    * - Response Address
    * - Change Request X
@@ -2463,7 +2463,7 @@ int stun_make_binding_req(stun_handle_t *sh,
 
   /* USERNAME */
   if (sh->sh_use_msgint &&
-      sh->sh_username.data && 
+      sh->sh_username.data &&
       sh->sh_passwd.data) {
     stun_buffer_t *a_pattr = (stun_buffer_t*)malloc(sizeof(stun_buffer_t));
     tmp = (stun_attr_t *) malloc(sizeof(stun_attr_t));
@@ -2507,7 +2507,7 @@ int stun_process_response(stun_msg_t *msg)
   /* check message digest if exists */
   switch (msg->stun_hdr.msg_type) {
   case BINDING_RESPONSE:
-    if (stun_process_binding_response(msg) < 0) 
+    if (stun_process_binding_response(msg) < 0)
       return -1;
     break;
   case BINDING_ERROR_RESPONSE:
@@ -2546,7 +2546,7 @@ int stun_process_error_response(stun_msg_t *msg)
   }
 
   ec = (stun_attr_errorcode_t *)attr->pattr;
-  
+
   SU_DEBUG_5(("%s: Received Binding Error Response:\n", __func__));
   SU_DEBUG_5(("%s: Error: %d %s\n", __func__, ec->code, ec->phrase));
 
@@ -2554,7 +2554,7 @@ int stun_process_error_response(stun_msg_t *msg)
 }
 
 /**
- * Sets values for USERNAME and PASSWORD stun fields 
+ * Sets values for USERNAME and PASSWORD stun fields
  * for the handle.
  */
 int stun_set_uname_pwd(stun_handle_t *sh,
@@ -2572,7 +2572,7 @@ int stun_set_uname_pwd(stun_handle_t *sh,
   }
   else
     return -1;
-  
+
   sh->sh_passwd.data = malloc(len_pwd);
   if (sh->sh_passwd.data) {
     memcpy(sh->sh_passwd.data, pwd, len_pwd);
@@ -2582,13 +2582,13 @@ int stun_set_uname_pwd(stun_handle_t *sh,
     return -1;
 
   sh->sh_use_msgint = 1; /* turn on message integrity ussage */
-  
+
   return 0;
 }
 
-  
+
 /**
- * Converts character address format to sockaddr_in 
+ * Converts character address format to sockaddr_in
  */
 int stun_atoaddr(su_home_t *home,
                 int ai_family,
@@ -2608,7 +2608,7 @@ int stun_atoaddr(su_home_t *home,
   dstaddr = (su_sockaddr_t *) info->ai_addr;
 
   /* note: works only for IPv4 */
-  if (ai_family != AF_INET) 
+  if (ai_family != AF_INET)
     return -1;
 
   hints->ai_family = ai_family;
@@ -2624,7 +2624,7 @@ int stun_atoaddr(su_home_t *home,
     host = tmp;
     ++port;
   }
-    
+
   err = su_getaddrinfo(host, NULL, hints, &res);
   if (err == 0) {
     for (ai = res; ai; ai = ai->ai_next) {
@@ -2637,12 +2637,12 @@ int stun_atoaddr(su_home_t *home,
       info->ai_protocol = ai->ai_protocol;
       info->ai_addrlen = ai->ai_addrlen;
       info->ai_canonname = su_strdup(home, host);
-      
+
       memcpy(&dstaddr->su_sa, res->ai_addr, sizeof(struct sockaddr));
       break;
     }
 
-    if (port) 
+    if (port)
       dstaddr->su_port = htons(atoi(port));
     else
       dstaddr->su_port = htons(STUN_DEFAULT_PORT);
@@ -2659,7 +2659,7 @@ int stun_atoaddr(su_home_t *home,
 }
 
 /**
- * Initiates STUN discovery process to find out NAT 
+ * Initiates STUN discovery process to find out NAT
  * binding life-time settings.
  *
  * @TAGS
@@ -2693,13 +2693,13 @@ int stun_test_lifetime(stun_handle_t *sh,
 
   if (!sh->sh_pri_addr[0].su_port) {
     /* no STUN server address, perform a DNS-SRV lookup */
-   
+
     ta_list ta;
     ta_start(ta, tag, value);
     SU_DEBUG_5(("Delaying STUN get-lifetime req. for DNS-SRV query.\n"));
     err = priv_dns_queue_action(sh, stun_action_test_lifetime, sdf, magic, ta_tags(ta));
     ta_end(ta);
-       
+
     return err;
   }
 
@@ -2768,7 +2768,7 @@ int stun_test_lifetime(stun_handle_t *sh,
 
   SU_DEBUG_1(("%s: determining binding life time, this may take a while.\n", __func__));
 
-  if (stun_make_binding_req(sh, req, req->sr_msg, 0, 0) < 0) 
+  if (stun_make_binding_req(sh, req, req->sr_msg, 0, 0) < 0)
     return -1;
 
   err = stun_send_binding_request(req, destination);
@@ -2794,7 +2794,7 @@ int stun_add_response_address(stun_msg_t *req, struct sockaddr_in *mapped_addr)
   addr = malloc(sizeof(stun_attr_sockaddr_t));
   memcpy(addr, mapped_addr, sizeof(stun_attr_sockaddr_t));
   tmp->pattr = addr;
-  
+
   if (req->stun_attr == NULL) {
     tmp->next = NULL;
   }
@@ -2808,7 +2808,7 @@ int stun_add_response_address(stun_msg_t *req, struct sockaddr_in *mapped_addr)
 
 
 /**
- * Determines if the message is STUN message (-1 if not stun). 
+ * Determines if the message is STUN message (-1 if not stun).
  */
 int stun_msg_is_keepalive(uint16_t data)
 {
@@ -2826,7 +2826,7 @@ int stun_msg_is_keepalive(uint16_t data)
 }
 
 /**
- * Determines length of STUN message (0 (-1?) if not stun). 
+ * Determines length of STUN message (0 (-1?) if not stun).
  */
 int stun_message_length(void *data, isize_t len, int end_of_message)
 {
@@ -2851,7 +2851,7 @@ int stun_message_length(void *data, isize_t len, int end_of_message)
 }
 
 /** Process incoming message */
-int stun_process_message(stun_handle_t *sh, su_socket_t s, 
+int stun_process_message(stun_handle_t *sh, su_socket_t s,
                         su_sockaddr_t *sa, socklen_t salen,
                         void *data, isize_t len)
 {
@@ -2866,8 +2866,8 @@ int stun_process_message(stun_handle_t *sh, su_socket_t s,
   /* Message received. */
   msg.enc_buf.data = data;
   msg.enc_buf.size = (unsigned)len;
-  debug_print(&msg.enc_buf);      
+
+  debug_print(&msg.enc_buf);
 
   /* Parse here the incoming message. */
   if (stun_parse_message(&msg) < 0) {
@@ -2904,8 +2904,8 @@ int stun_discovery_release_socket(stun_discovery_t *sd)
 }
 
 
-/** 
- * Creates a keepalive dispatcher for bound SIP sockets 
+/**
+ * Creates a keepalive dispatcher for bound SIP sockets
  */
 int stun_keepalive(stun_handle_t *sh,
                   su_sockaddr_t *sa,
@@ -2937,7 +2937,7 @@ int stun_keepalive(stun_handle_t *sh,
   /* If there already is keepalive associated with the given socket,
    * destroy it. */
   stun_keepalive_destroy(sh, s);
-  
+
   sd = stun_discovery_create(sh, action, NULL, NULL); /* XXX --
                                                         specify last
                                                         params if
@@ -2948,17 +2948,17 @@ int stun_keepalive(stun_handle_t *sh,
 
   req = stun_request_create(sd);
 
-  SU_DEBUG_3(("%s: Starting to send STUN keepalives to %s:%u\n", __func__, 
+  SU_DEBUG_3(("%s: Starting to send STUN keepalives to %s:%u\n", __func__,
              su_inet_ntop(sa->su_family, SU_ADDR(sa), addr, sizeof(addr)),
              (unsigned) ntohs(sa->su_port)));
-  
+
   if (stun_make_binding_req(sh, req, req->sr_msg, 0, 0) < 0 ||
       stun_send_binding_request(req, sa) < 0) {
     stun_request_destroy(req);
     stun_discovery_destroy(sd);
     return -1;
   }
-  
+
   sd->sd_timer = su_timer_create(su_root_task(sh->sh_root), timeout);
   su_timer_set(sd->sd_timer, stun_keepalive_timer_cb, (su_wakeup_arg_t *) sd);
 
@@ -2966,7 +2966,7 @@ int stun_keepalive(stun_handle_t *sh,
 }
 
 /** Send SIP keepalives */
-static void stun_keepalive_timer_cb(su_root_magic_t *magic, 
+static void stun_keepalive_timer_cb(su_root_magic_t *magic,
                                    su_timer_t *t,
                                    su_timer_arg_t *arg)
 {
@@ -2984,14 +2984,14 @@ static void stun_keepalive_timer_cb(su_root_magic_t *magic,
     return;
 
   req = stun_request_create(sd);
-  
+
   if (stun_make_binding_req(sh, req, req->sr_msg, 0, 0) < 0 ||
       stun_send_binding_request(req, destination) < 0) {
     stun_request_destroy(req);
     stun_discovery_destroy(sd);
     return;
   }
-  
+
   sd->sd_timer = su_timer_create(su_root_task(sh->sh_root), timeout);
   su_timer_set(sd->sd_timer, stun_keepalive_timer_cb, (su_wakeup_arg_t *) sd);
 
@@ -3088,9 +3088,9 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
       break;
 
     default:
-      return -1;    
+      return -1;
     }
-  }   
+  }
 
   tmp = s_attr;
   tmp->attr_type = SOURCE_ADDRESS;
@@ -3115,10 +3115,10 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
 
   stun_send_message(s, &to_addr, &resp, NULL);
   return 0;
-} 
+}
 
 /**
- * Returns socket attached to the discovery object 
+ * Returns socket attached to the discovery object
  */
 su_socket_t stun_discovery_get_socket(stun_discovery_t *sd)
 {
index d11716304dcc09c1283caa14496efe1c76fc2b6e..33b1a424586380dd6a3f73b3e244b3799abcaee7 100644 (file)
 
 /**@internal
  * @file stun_common.c
- * @brief 
- * 
+ * @brief
+ *
  * @author Tat Chan <Tat.Chan@nokia.com>
  * @author Kai Vehmanen <kai.vehmanen@nokia.com>
- *  
+ *
  * @date Created: Fri Oct  3 13:40:41 2003 ppessi
- * 
+ *
  */
 
 #include "config.h"
@@ -88,7 +88,7 @@ int stun_parse_message(stun_msg_t *msg)
   /* parse header first */
   p = msg->enc_buf.data;
   msg->stun_hdr.msg_type = get16(p, 0);
-  msg->stun_hdr.msg_len = get16(p, 2); 
+  msg->stun_hdr.msg_len = get16(p, 2);
   memcpy(msg->stun_hdr.tran_id, p + 4, STUN_TID_BYTES);
 
   SU_DEBUG_5(("%s: Parse STUN message: Length = %d\n", __func__,
@@ -120,7 +120,7 @@ int stun_parse_attribute(stun_msg_t *msg, unsigned char *p)
   attr_type = get16(p, 0);
   len = get16(p, 2);
 
-  SU_DEBUG_5(("%s: received attribute: Type %02X, Length %d - %s\n", 
+  SU_DEBUG_5(("%s: received attribute: Type %02X, Length %d - %s\n",
              __func__, attr_type, len, stun_attr_phrase(attr_type)));
 
   if (attr_type > STUN_A_LAST_MANDATORY && attr_type < STUN_A_OPTIONAL) {
@@ -197,8 +197,8 @@ int stun_parse_attribute(stun_msg_t *msg, unsigned char *p)
   return len+4;
 }
 
-int stun_parse_attr_address(stun_attr_t *attr, 
-                           const unsigned char *p, 
+int stun_parse_attr_address(stun_attr_t *attr,
+                           const unsigned char *p,
                            unsigned len)
 {
   su_sockaddr_t *addr;
@@ -398,7 +398,7 @@ int stun_encode_error_code(stun_attr_t *attr) {
   /* note: align the phrase len (see RFC3489:11.2.9) */
   padded = phrase_len + (phrase_len % 4 == 0 ? 0 : 4 - (phrase_len % 4));
 
-  /* note: error-code has four octets of headers plus the 
+  /* note: error-code has four octets of headers plus the
    *       reason field -> len+4 octets */
   if (stun_encode_type_len(attr, (uint16_t)(padded + 4)) < 0) {
     return -1;
@@ -409,7 +409,7 @@ int stun_encode_error_code(stun_attr_t *attr) {
     attr->enc_buf.data[6] = class;
     attr->enc_buf.data[7] = num;
     /* note: 4 octets of TLV header and 4 octets of error-code header */
-    memcpy(attr->enc_buf.data+8, error->phrase, 
+    memcpy(attr->enc_buf.data+8, error->phrase,
           phrase_len);
     memset(attr->enc_buf.data + 8 + phrase_len, 0, padded - phrase_len);
   }
@@ -491,8 +491,8 @@ int stun_encode_type_len(stun_attr_t *attr, uint16_t len) {
   return 0;
 }
 
-/** 
- * Validate the message integrity based on given 
+/**
+ * Validate the message integrity based on given
  * STUN password 'pwd'. The received content should be
  * in msg->enc_buf.
  */
@@ -506,7 +506,7 @@ int stun_validate_message_integrity(stun_msg_t *msg, stun_buffer_t *pwd)
   unsigned char *padded_text;
 #endif
 
-  /* password NULL so shared-secret not established and 
+  /* password NULL so shared-secret not established and
      messege integrity checks can be skipped */
   if (pwd->data == NULL)
     return 0;
@@ -610,7 +610,7 @@ int stun_free_message(stun_msg_t *msg) {
 
 
 int stun_send_message(su_socket_t s, su_sockaddr_t *to_addr,
-                     stun_msg_t *msg, stun_buffer_t *pwd) 
+                     stun_msg_t *msg, stun_buffer_t *pwd)
 {
   int err;
   char ipaddr[SU_ADDRSIZE + 2];
@@ -618,7 +618,7 @@ int stun_send_message(su_socket_t s, su_sockaddr_t *to_addr,
 
   stun_encode_message(msg, pwd);
 
-  err = su_sendto(s, msg->enc_buf.data, msg->enc_buf.size, 0, 
+  err = su_sendto(s, msg->enc_buf.data, msg->enc_buf.size, 0,
                  to_addr, SU_SOCKADDR_SIZE(to_addr));
 
   free(msg->enc_buf.data), msg->enc_buf.data = NULL;
@@ -648,9 +648,9 @@ int stun_send_message(su_socket_t s, su_sockaddr_t *to_addr,
   }
   else
     STUN_ERROR(errno, sendto);
-  
+
   return err;
-}  
+}
 
 
 /** Send a STUN message.
@@ -673,7 +673,7 @@ int stun_encode_message(stun_msg_t *msg, stun_buffer_t *pwd) {
       case MAPPED_ADDRESS:
       case SOURCE_ADDRESS:
       case CHANGED_ADDRESS:
-      case REFLECTED_FROM:     
+      case REFLECTED_FROM:
 #ifdef USE_TURN
       case TURN_ALTERNATE_SERVER:
       case TURN_DESTINATION_ADDRESS:
@@ -717,7 +717,7 @@ int stun_encode_message(stun_msg_t *msg, stun_buffer_t *pwd) {
     msg->stun_hdr.msg_len = len;
     buf_len = 20 + msg->stun_hdr.msg_len;
     buf = (unsigned char *) malloc(buf_len);
-    
+
     /* convert to binary format for transmission */
     set16(buf, 0, msg->stun_hdr.msg_type);
     set16(buf, 2, msg->stun_hdr.msg_len);
@@ -730,7 +730,7 @@ int stun_encode_message(stun_msg_t *msg, stun_buffer_t *pwd) {
     while(attr) {
       /* attach only if enc_buf is not null */
       if(attr->enc_buf.data && attr->attr_type != MESSAGE_INTEGRITY) {
-       memcpy(buf+len, (void *)attr->enc_buf.data, attr->enc_buf.size); 
+       memcpy(buf+len, (void *)attr->enc_buf.data, attr->enc_buf.size);
        len += attr->enc_buf.size;
       }
       attr = attr->next;
@@ -742,10 +742,10 @@ int stun_encode_message(stun_msg_t *msg, stun_buffer_t *pwd) {
        free(buf);
        return -1;
       }
-      memcpy(buf+len, (void *)msg_int->enc_buf.data, 
+      memcpy(buf+len, (void *)msg_int->enc_buf.data,
             msg_int->enc_buf.size);
     }
-    
+
     /* save binary buffer for future reference */
     if (msg->enc_buf.data)
       free(msg->enc_buf.data);
@@ -782,10 +782,10 @@ char *stun_determine_ip_address(int family)
   sa = &temp->su_sin;
 
   address_size = strlen(inet_ntoa(sa->sin_addr));
-  
+
   local_ip_address = malloc(address_size + 1);
   strcpy(local_ip_address, (char *) inet_ntoa(sa->sin_addr)); /* otherwise? */
-    
+
   su_freelocalinfo(li);
 
   return local_ip_address;
@@ -807,7 +807,7 @@ const char *stun_attr_phrase(uint16_t type)
   case UNKNOWN_ATTRIBUTES: return "UNKNOWN-ATTRIBUTES";
   case REFLECTED_FROM: return "REFLECTED-FROM";
   case STUN_A_ALTERNATE_SERVER:
-  case STUN_A_ALTERNATE_SERVER_DEP: 
+  case STUN_A_ALTERNATE_SERVER_DEP:
     return "ALTERNATE-SERVER";
   case STUN_A_REALM: return "REALM";
   case STUN_A_NONCE: return "NONCE";
index 6c3bb1485f7c1d18870c66685d9ba37ae0b67f90..bfbfe77e412ca3cf38edafbbdfbb763b0bfbb799 100644 (file)
  */
 
 /**@internal
- * @file stun_dns.c 
+ * @file stun_dns.c
  * @brief Functins to discover STUN server address using DNS-SRV.
  *
- * Refs: 
+ * Refs:
  *   - RFC3489/3489bis
  *   - RFC2782
- * 
+ *
  * @author Kai Vehmanen <kai.vehmanen@nokia.com>
  */
 
@@ -100,16 +100,16 @@ static void priv_sres_cb(stun_dns_lookup_t *self,
        self->stun_tcp_target = su_strdup(self->stun_home, rr->srv_target);
        self->stun_tcp_port = rr->srv_port;
        self->stun_state |= stun_dns_tls;
-       SU_DEBUG_5(("%s: stun (tcp) for domain %s is at %s:%u.\n", 
-                   __func__, rr->srv_record->r_name, self->stun_tcp_target, self->stun_tcp_port)); 
+       SU_DEBUG_5(("%s: stun (tcp) for domain %s is at %s:%u.\n",
+                   __func__, rr->srv_record->r_name, self->stun_tcp_target, self->stun_tcp_port));
       }
       else if ((self->stun_state & stun_dns_udp) == 0 &&
               strncmp(rr->srv_record->r_name, udp_name, strlen(udp_name)) == 0) {
        self->stun_udp_target = su_strdup(self->stun_home, rr->srv_target);
        self->stun_udp_port = rr->srv_port;
        self->stun_state |= stun_dns_udp;
-       SU_DEBUG_5(("%s: stun (udp) for domain %s is at %s:%u.\n", 
-                   __func__, rr->srv_record->r_name, self->stun_udp_target, self->stun_udp_port)); 
+       SU_DEBUG_5(("%s: stun (udp) for domain %s is at %s:%u.\n",
+                   __func__, rr->srv_record->r_name, self->stun_udp_target, self->stun_udp_port));
       }
     }
   }
@@ -130,18 +130,18 @@ static void priv_sres_cb(stun_dns_lookup_t *self,
  * The result will be delivered asynchronously in the
  * 'func' callback. 'root' will be used as the event loop.
  */
-stun_dns_lookup_t *stun_dns_lookup(stun_magic_t *magic, 
+stun_dns_lookup_t *stun_dns_lookup(stun_magic_t *magic,
                                   su_root_t *root,
-                                  stun_dns_lookup_f func, 
+                                  stun_dns_lookup_f func,
                                   const char *domain)
 {
   stun_dns_lookup_t *self;
   sres_query_t *query;
 
-  if (!domain || 
+  if (!domain ||
       strlen(domain) + strlen(STUN_SRV_SERVICE_UDP ".") + 1>= SRES_MAXDNAME)
     return NULL;
-  
+
   self = su_home_new(sizeof(stun_dns_lookup_t));
 
   /* see nta.c:outgoing_answer_srv() */
@@ -167,7 +167,7 @@ stun_dns_lookup_t *stun_dns_lookup(stun_magic_t *magic,
   else {
     su_free(NULL, self), self = NULL;
   }
-  
+
   return self;
 }
 
@@ -192,7 +192,7 @@ void stun_dns_lookup_destroy(stun_dns_lookup_t *self)
  * @param port location where to store port number
  *
  * @return 0 on success, non-zero otherwise
- */ 
+ */
 int stun_dns_lookup_udp_addr(stun_dns_lookup_t *self, const char **target, uint16_t *port)
 {
   int result = -1;
@@ -215,7 +215,7 @@ int stun_dns_lookup_udp_addr(stun_dns_lookup_t *self, const char **target, uint1
  * @param port location where to store port number
  *
  * @return 0 on success, non-zero otherwise
- */ 
+ */
 int stun_dns_lookup_tcp_addr(stun_dns_lookup_t *self, const char **target, uint16_t *port)
 {
   int result = -1;
@@ -238,7 +238,7 @@ int stun_dns_lookup_tcp_addr(stun_dns_lookup_t *self, const char **target, uint1
  * @param port location where to store port number
  *
  * @return 0 on success, non-zero otherwise
- */ 
+ */
 int stun_dns_lookup_stp_addr(stun_dns_lookup_t *self, const char **target, uint16_t *port)
 {
   /* XXX: not implemented */
index e9b7e9c779e9d748693d96261a7b3ec9d4d1afa0..00ef89b571178896563a0c1f4ebaa7ab743985cf 100644 (file)
@@ -99,7 +99,7 @@ int stun_send_message(su_socket_t s, su_sockaddr_t *srvr,
                      stun_msg_t *msg, stun_buffer_t *pwd);
 
 int stun_make_binding_req(stun_handle_t *se, stun_request_t *req,
-                         stun_msg_t *msg, 
+                         stun_msg_t *msg,
                          tag_type_t, tag_value_t, ...);
 int stun_process_response(stun_msg_t *msg);
 
index de9cdbf2b6acb7b7077000a56caa36c6f456c552..b5ec01ec2349fbb95cc212bb52e297e71262904d 100644 (file)
 
 /**@internal
  * @file stun_mini.c
- * @brief Minimal stun server 
- * 
+ * @brief Minimal stun server
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Tat Chan <Tat.Chan@nokia.com>
  * @author Kai Vehmanen <kai.vehmanen@nokia.com>
- *  
+ *
  * @date Created: Fri Oct  3 13:40:41 2003 ppessi
- * 
+ *
  */
 
 #include "config.h"
@@ -62,11 +62,11 @@ struct stun_mini_s
   stun_bound_t *sockets;
 };
 
-static int process_3489_request(stun_mini_t *mini, 
+static int process_3489_request(stun_mini_t *mini,
                                stun_msg_t *request, stun_msg_t *response,
                                su_socket_t socket, void *, socklen_t);
 
-static int process_bis_request(stun_mini_t *mini, 
+static int process_bis_request(stun_mini_t *mini,
                               stun_msg_t *request, stun_msg_t *response,
                               su_socket_t socket, void *, socklen_t);
 
@@ -118,12 +118,12 @@ int stun_mini_add_socket(stun_mini_t *mini, su_socket_t socket)
     return su_seterrno(EAFNOSUPPORT);
 
   ss = calloc(1, offsetof(stun_bound_t, ss_addr.array[addrlen]));
-  
+
   ss->ss_socket = socket;
   ss->ss_scope = su_sockaddr_scope((void *)addr, addrlen);
 
   memcpy(ss->ss_addr.array, addr, ss->ss_addrlen = addrlen);
-  
+
   *next = ss;
 
   return 0;
@@ -168,7 +168,7 @@ void stun_mini_request(stun_mini_t *mini,
 
   if (mini == NULL || msg == NULL || from == NULL)
     return;
-    
+
   if (msglen < 20)
     verdict = "runt";
   else if (data[0] == 1)
@@ -218,7 +218,7 @@ int process_3489_request(stun_mini_t *mini,
                         stun_msg_t *request,
                         stun_msg_t *response,
                         su_socket_t socket,
-                        void *from, 
+                        void *from,
                         socklen_t fromlen)
 {
   stun_bound_t *ss, *changed = NULL, ss0[1];
@@ -239,12 +239,12 @@ int process_3489_request(stun_mini_t *mini,
   a = stun_get_attr(request->stun_attr, RESPONSE_ADDRESS);
   if (a)
     return STUN_600_GLOBAL_FAILURE;
+
   /* compose header */
   response->stun_hdr.msg_type = BINDING_RESPONSE;
-  memcpy(response->stun_hdr.tran_id, request->stun_hdr.tran_id, 
+  memcpy(response->stun_hdr.tran_id, request->stun_hdr.tran_id,
         sizeof response->stun_hdr.tran_id);
-  
+
   next = &response->stun_attr;
 
   /* MAPPED-ADDRESS */
@@ -265,7 +265,7 @@ int process_3489_request(stun_mini_t *mini,
     struct sockaddr_in const *sin, *sin2;
     int scope = su_sockaddr_scope(from, fromlen);
     stun_bound_t *changed_ip = NULL, *same_scope = NULL;
-    
+
     sin = from;
 
     for (changed = mini->sockets; changed; changed = changed->ss_next) {
@@ -296,7 +296,7 @@ int process_3489_request(stun_mini_t *mini,
       /* We don't have socekt with both changed port and ip */
       changed = changed_ip;
 
-    if (changed == NULL) 
+    if (changed == NULL)
       changed = same_scope;
   }
 
@@ -337,11 +337,11 @@ int process_3489_request(stun_mini_t *mini,
   stun_send_message(socket, (void *)from, response, NULL);
 
   return 0;
-} 
+}
 
-static int process_bis_request(stun_mini_t *mini, 
+static int process_bis_request(stun_mini_t *mini,
                               stun_msg_t *request, stun_msg_t *response,
-                              su_socket_t socket, 
+                              su_socket_t socket,
                               void *from, socklen_t fromlen)
 {
   return process_3489_request(mini, request, response, socket, from, fromlen);
@@ -365,7 +365,7 @@ int send_stun_error(stun_msg_t *response,
 
   response->stun_hdr.msg_type = BINDING_ERROR_RESPONSE;
   response->stun_hdr.msg_len = 0; /* actual len computed later */
-  
+
   memcpy(response->stun_hdr.tran_id, transaction_id, 16);
 
   /* ERROR-CODE */
index d69707d9a9692ba85361c0f9e23331c041bbfb0f..bb5a3922615a571a5b0ae25c52c6ed55d6ff7ad2 100644 (file)
 #include <sofia-sip/stun_tag.h>
 
 /**@def STUNTAG_ANY()
- * 
+ *
  * Filter tag matching any STUNTAG_*().
  */
 tag_typedef_t stuntag_any = NSTAG_TYPEDEF(*);
 
 /**@def STUNTAG_DOMAIN(x)
- * 
+ *
  * The domain to use in DNS-SRV based STUN server discovery.
  * Note: this is commonly the domain part of a public SIP
  * address (AOR). See sect 9.1 of RFC3489.
@@ -64,9 +64,9 @@ tag_typedef_t stuntag_domain = STRTAG_TYPEDEF(domain);
 
 /**@def STUNTAG_SERVER(x)
  *
- * Fully qualified host name, or dotted IP address of the STUN server 
+ * Fully qualified host name, or dotted IP address of the STUN server
  * address. If defined, the DNS-SRV based discovery (@see STUNTAG_DOMAIN())
- * will be skipped. 
+ * will be skipped.
  *
  * @par Used with
  *    nua_set_params() \n
@@ -86,9 +86,9 @@ tag_typedef_t stuntag_domain = STRTAG_TYPEDEF(domain);
 tag_typedef_t stuntag_server = STRTAG_TYPEDEF(server);
 
 /**@def STUNTAG_REQUIRE_INTEGRITY(x)
- *  
+ *
  * Whether to require support for shared-secret based packet
- * authentication and integrity checks (see sect 9.2 of RFC3489). 
+ * authentication and integrity checks (see sect 9.2 of RFC3489).
  * If false, integrity checks are performed only when server supports it.
  *
  * @par Used with
@@ -113,7 +113,7 @@ tag_typedef_t stuntag_require_integrity = BOOLTAG_TYPEDEF(require_integrity);
 tag_typedef_t stuntag_integrity = BOOLTAG_TYPEDEF(integrity);
 
 /**@def STUNTAG_SOCKET(x)
- *  
+ *
  * Bind socket for STUN.
  *
  * @par Used with
@@ -130,7 +130,7 @@ tag_typedef_t stuntag_integrity = BOOLTAG_TYPEDEF(integrity);
 tag_typedef_t stuntag_socket = SOCKETTAG_TYPEDEF(socket);
 
 /**@def STUNTAG_REGISTER_EVENTS(x)
- *  
+ *
  * Register socket events for eventloop owned by STUN.
  *
  * @par Used with
@@ -150,7 +150,7 @@ tag_typedef_t stuntag_socket = SOCKETTAG_TYPEDEF(socket);
 tag_typedef_t stuntag_register_events = BOOLTAG_TYPEDEF(register_events);
 
 /**@def STUNTAG_ACTION(x)
- *  
+ *
  * Command action for STUN request.
  *
  * @par Used with
@@ -169,7 +169,7 @@ tag_typedef_t stuntag_action = INTTAG_TYPEDEF(action);
 /* ---------------------------------------------------------------------- */
 
 /**@def STUNTAG_CHANGE_IP(x)
- *  
+ *
  * Add CHANGE-REQUEST attribute with "change IP" flag to the request.
  *
  * @par Used with
@@ -183,7 +183,7 @@ tag_typedef_t stuntag_action = INTTAG_TYPEDEF(action);
 tag_typedef_t stuntag_change_ip = BOOLTAG_TYPEDEF(change_ip);
 
 /**@def STUNTAG_CHANGE_PORT(x)
- *  
+ *
  * Add CHANGE-REQUEST attribute with "change port" flag to the request.
  *
  * @par Used with
@@ -199,7 +199,7 @@ tag_typedef_t stuntag_change_port = BOOLTAG_TYPEDEF(change_port);
 /* ---------------------------------------------------------------------- */
 
 /**@def STUNTAG_TIMEOUT(x)
- *  
+ *
  * Timeout controls the launching of the STUN keepalive timer.
  *
  * @par Used with
index 4c965f0415f7bdfef95c199c64b8120f2bdbe2b1..cf27d57f5fb3e721769fd34480fa8c148f023cfc 100644 (file)
 
 /**
  * STUN test client
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Martti Mela <Martti.Mela@nokia.com>
  * @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
- * 
+ *
  * @date Created: Thu Jul 24 17:21:00 2003 ppessi
  */
 
 /**@page stunc STUN test client.
- * 
+ *
  * @section stunc_synopsis Synopsis
  * <tt>stunc [OPTIONS] \<stun-server-address\></tt>
  *
  * @section stunc_description Description
  * The @em stunc utility can be used to gather information about possible
- * NAT devices that are located between the client and STUN server. 
+ * NAT devices that are located between the client and STUN server.
  *
  * @em stunc can provide the following information: the IP address and
  * port as seen by the STUN server, detecting presence of NATs, and
@@ -78,7 +78,7 @@
  *
  * <dt>-s</dt>
  * <dd>Request a shared-secret over TLS. Tests whether the STUN server
- * supports the shared-secret mechanism (needed to protect message 
+ * supports the shared-secret mechanism (needed to protect message
  * integrity). Can be combined with @em -b, @em -l and @em -n.
  * </dd>
  *
@@ -99,7 +99,7 @@
  *
  * @section stunc_environment Environment
  * #STUN_DEBUG
- * 
+ *
  * @section stunc_bugs Reporting Bugs
  * Report bugs to <sofia-sip-devel@lists.sourceforge.net>.
  *
  * PARTICULAR PURPOSE.
  */
 
-#include "config.h" 
+#include "config.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -156,7 +156,7 @@ static char const __func__[] = "stunc";
 
 void usage(char *name)
 {
-  fprintf(stderr, 
+  fprintf(stderr,
          "stunc (%s)\n"
          "usage: %s <server> [-b] [-n] [-l] [-r] [-s]\n"
          "  -b\tmake a binding request\n"
@@ -216,14 +216,14 @@ void stunc_ss_cb(stunc_t *stunc,
                      STUNTAG_SOCKET(stunc->sc_socket),
                      STUNTAG_REGISTER_EVENTS(1),
                      TAG_NULL());
-    
+
       if (err < 0) {
        SU_DEBUG_0(("%s: %s  failed\n", __func__, "stun_handle_bind()"));
        su_root_break(stun_root(sh));
       }
     }
     break;
-    
+
   case stun_tls_connection_failed:
     SU_DEBUG_0(("%s: Obtaining shared secret failed.\n",
                __func__));
@@ -269,7 +269,7 @@ void stunc_bind_cb(stunc_t *stunc,
   case stun_discovery_done:
     addrlen = sizeof(*sa);
     memset(sa, 0, addrlen);
-    
+
     if (stun_discovery_get_address(sd, sa, &addrlen) < 0) {
       SU_DEBUG_0(("%s: stun_discovery_get_address() failed", __func__));
       return;
@@ -313,7 +313,7 @@ void stunc_nattype_cb(stunc_t *stunc,
     break;
 
   case stun_discovery_done:
-    SU_DEBUG_3(("%s: NAT type determined to be '%s' (%d).\n", 
+    SU_DEBUG_3(("%s: NAT type determined to be '%s' (%d).\n",
                __func__, stun_nattype_str(sd), (int)stun_nattype(sd)));
     break;
 
@@ -361,12 +361,12 @@ void stunc_lifetime_cb(stunc_t *stunc,
 int main(int argc, char *argv[])
 {
   int err = 0, i, sflags = 0;
-  stunc_t stunc[1]; 
+  stunc_t stunc[1];
   su_root_t *root;
   stun_handle_t *sh;
   su_socket_t s;
 
-  if (su_init() != 0) 
+  if (su_init() != 0)
     return -1;
 
   root = su_root_create(stunc);
@@ -393,16 +393,16 @@ int main(int argc, char *argv[])
 
   /* Running this test requires a local STUN server on default port */
   sh = stun_handle_init(root,
-                       STUNTAG_SERVER(argv[1]), 
+                       STUNTAG_SERVER(argv[1]),
                        STUNTAG_REQUIRE_INTEGRITY(sflags & do_secret),
-                       TAG_NULL()); 
+                       TAG_NULL());
 
   if (!sh) {
     SU_DEBUG_0(("%s: %s failed\n", __func__, "stun_handle_init()"));
     return -1;
   }
 
-  s = su_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); 
+  s = su_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
   if (s == -1) {
     SU_DEBUG_0(("%s: %s  failed: %s\n", __func__,
                "su_socket()", su_gli_strerror(errno)));
@@ -424,7 +424,7 @@ int main(int argc, char *argv[])
     sockaddr.su_family = AF_INET;
 
     SU_DEBUG_3(("stunc: Binding to local port %u.\n", ntohs(sockaddr.su_port)));
-  
+
     err = bind(s, (struct sockaddr *)&sockaddr, socklen);
     if (err < 0) {
       SU_DEBUG_1(("%s: Error %d binding to %s:%u\n", __func__, err,
@@ -452,7 +452,7 @@ int main(int argc, char *argv[])
                    STUNTAG_SOCKET(s),
                    STUNTAG_REGISTER_EVENTS(1),
                    TAG_NULL());
-    
+
     if (err < 0) {
       SU_DEBUG_0(("%s: %s  failed\n", __func__, "stun_bind()"));
       return -1;
@@ -464,7 +464,7 @@ int main(int argc, char *argv[])
                            STUNTAG_REGISTER_EVENTS(1),
                            STUNTAG_SOCKET(stunc->sc_socket),
                            TAG_NULL());
-    
+
     if (err < 0) {
       SU_DEBUG_0(("%s: %s  failed\n", __func__, "stun_test_nattype()"));
       su_root_break(stun_root(sh));
@@ -476,13 +476,13 @@ int main(int argc, char *argv[])
                             STUNTAG_REGISTER_EVENTS(1),
                             STUNTAG_SOCKET(stunc->sc_socket),
                             TAG_NULL());
-    
+
     if (err < 0) {
       SU_DEBUG_0(("%s: %s  failed\n", __func__, "stun_test_lifetime()"));
       su_root_break(stun_root(sh));
     }
   }
+
   if (err == 0)
     su_root_run(root);
 
index a9cde33b5254620d97cca379bcf5af6a6c587577..4d4cdbc940caaa33384944c5a2eec5f85ab5b781 100644 (file)
@@ -93,7 +93,7 @@
 
 2005-08-17  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
-       * Added su_strlst_dup() and su_strlst_copy(). 
+       * Added su_strlst_dup() and su_strlst_copy().
 
        * Added { to BEGIN() and } to END() in <tstdef.h>
 
index fbbf63bd62d6f68011f3fe75df6f1dae25ec2b9e..2eb90fd79fce51d6615112d516d24ed7ae14984c 100644 (file)
@@ -14,7 +14,7 @@
 
 noinst_LTLIBRARIES =   libsu.la
 
-bin_PROGRAMS =                 addrinfo localinfo 
+bin_PROGRAMS =                 addrinfo localinfo
 
 check_PROGRAMS =       torture_su torture_su_port \
                        torture_su_alloc torture_su_time torture_su_tag \
index 87b4ed55877b8f64867de1e6f6882922a8d4bb7b..daae610ba55ee5177eb97ac3c86da602806422dd 100644 (file)
  */
 
 /**@page addrinfo Resolve network services
- * 
+ *
  * @section synopsis Synopsis
  *
  * <tt>addrinfo [-pcn46] service-name host</tt>
  *
  * @section description Description
- * 
+ *
  * The @em addrinfo utility will use su_getaddrinfo() to resolve the network
  * services and print resolved names. See sect 6.1 of RFC3493 and the getaddrinfo(3)
  * manual page of POSIX 1003.1g, for more information.
index 047fd7ad12be6f1700b0391c43d288206cad785c..ba46ee83ac61611e5f89165ed30cc8f515f59ed2 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@file smoothsort.c
  * @brief Smoothsort implementation
- * 
+ *
  * Smoothsort is a in-place sorting algorithm with performance of O(NlogN)
  * in worst case and O(n) in best case.
  *
@@ -60,7 +60,7 @@ static inline size_t stretch_up(stretch s[1])
   size_t next;
 
   s->p >>= 1;
-  
+
   next = s->b + s->c + 1, s->c = s->b, s->b = next;
 
   return next;
@@ -87,8 +87,8 @@ static char const *binary(unsigned long long p)
     return "0";
 
   binary[64] = 0;
-  
-  for (i = 64; p; p >>= 1) 
+
+  for (i = 64; p; p >>= 1)
     binary[--i] = "01"[p & 1];
 
   return binary + i;
@@ -107,7 +107,7 @@ static char const *binary(unsigned long long p)
  * @param s       description of current stretch
  */
 static void sift(array const *array, size_t r, stretch s)
-{ 
+{
   while (s.b >= 3) {
     size_t r2 = r - s.b + s.c;
 
@@ -115,7 +115,7 @@ static void sift(array const *array, size_t r, stretch s)
       r2 = r - 1;
       stretch_down(&s, 0);
     }
+
     if (array->less(array->m, r2, r))
       break;
 
@@ -125,8 +125,8 @@ static void sift(array const *array, size_t r, stretch s)
 
     stretch_down(&s, 0);
   }
-} 
+}
+
 /** Trinkle the roots of the given stretches
  *
  * @param array   description of array to sort
@@ -160,12 +160,12 @@ static void trinkle(array const *array, size_t r, stretch s)
     }
 
     r2 = r - s.b + s.c;
+
     if (array->less(array->m, r2, r - 1)) {
       r2 = r - 1;
       stretch_down(&s, 0);
     }
+
     if (array->less(array->m, r2, r3)) {
       DEBUG(("swap(%p [%zu]=[%zu])\n", array, r, r3));
       array->swap(array->m, r, r3); r = r3;
@@ -175,9 +175,9 @@ static void trinkle(array const *array, size_t r, stretch s)
     DEBUG(("\tswap(%p @%zu <=> @%zu b=%u)\n", array, r, r2, s.b));
     array->swap(array->m, r, r2); r = r2;
     stretch_down(&s, 0);
-    break; 
+    break;
   }
+
   sift(array, r, s);
 }
 
@@ -198,7 +198,7 @@ static void semitrinkle(array const *array, size_t r, stretch s)
     array->swap(array->m, r, r1);
     trinkle(array, r1, s);
   }
-} 
+}
 
 /** Sort array using smoothsort.
  *
@@ -251,10 +251,10 @@ void su_smoothsort(void *base, size_t r, size_t N,
     DEBUG(("loop1 q=%zu: b=%u p=%s\n", q, s.b, binary(s.p)));
 
     if (s.b <= 1) {
-      while ((s.p & 1) == 0) 
+      while ((s.p & 1) == 0)
        stretch_up(&s);
       --r;
-    } 
+    }
     else /* if b >= 3 */ {
       if (s.p) semitrinkle(array, r - (s.b - s.c), s);
       stretch_down(&s, 1);
index 2fa9318defd4077c9ec6a7272a7e8ab8f724929a..a19bd4b78b019f475331ee7543d268a2a97500f7 100644 (file)
-/***************************************************************************** 
- * 
- *  MODULE NAME : GETOPT.C 
- * 
- *  COPYRIGHTS: 
- *             This module contains code made available by IBM 
- *             Corporation on an AS IS basis.  Any one receiving the 
- *             module is considered to be licensed under IBM copyrights 
- *             to use the IBM-provided source code in any way he or she 
- *             deems fit, including copying it, compiling it, modifying 
- *             it, and redistributing it, with or without 
- *             modifications.  No license under any IBM patents or 
- *             patent applications is to be implied from this copyright 
- *             license. 
- * 
- *             A user of the module should understand that IBM cannot 
- *             provide technical support for the module and will not be 
- *             responsible for any consequences of use of the program. 
- * 
- *             Any notices, including this one, are not to be removed 
- *             from the module without the prior written consent of 
- *             IBM. 
- * 
- *  AUTHOR:   Original author: 
- *                 G. R. Blair (BOBBLAIR at AUSVM1) 
- *                 Internet: bobblair@bobblair.austin.ibm.com 
- * 
- *            Extensively revised by: 
- *                 John Q. Walker II, Ph.D. (JOHHQ at RALVM6) 
- *                 Internet: johnq@ralvm6.vnet.ibm.com 
- * 
- *****************************************************************************/ 
-/****************************************************************************** 
- * getopt() 
- * 
- * The getopt() function is a command line parser.  It returns the next 
- * option character in argv that matches an option character in opstring. 
- * 
- * The argv argument points to an array of argc+1 elements containing argc 
- * pointers to character strings followed by a null pointer. 
- * 
- * The opstring argument points to a string of option characters; if an 
- * option character is followed by a colon, the option is expected to have 
- * an argument that may or may not be separated from it by white space. 
- * The external variable optarg is set to point to the start of the option 
- * argument on return from getopt(). 
- * 
- * The getopt() function places in optind the argv index of the next argument 
- * to be processed.  The system initializes the external variable optind to 
- * 1 before the first call to getopt(). 
- * 
- * When all options have been processed (that is, up to the first nonoption 
- * argument), getopt() returns EOF.  The special option "--" may be used to 
- * delimit the end of the options; EOF will be returned, and "--" will be 
- * skipped. 
- * 
- * The getopt() function returns a question mark (?) when it encounters an 
- * option character not included in opstring.  This error message can be 
- * disabled by setting opterr to zero.  Otherwise, it returns the option 
- * character that was detected. 
- * 
- * If the special option "--" is detected, or all options have been 
- * processed, EOF is returned. 
- * 
- * Options are marked by either a minus sign (-) or a slash (/). 
- * 
- * No errors are defined. 
- *****************************************************************************/ 
-#include <stdio.h>                  /* for EOF */ 
-#include <string.h>                 /* for strchr() */ 
-/* static (global) variables that are specified as exported by getopt() */ 
-char *optarg = NULL;    /* pointer to the start of the option argument  */ 
-int   optind = 1;       /* number of the next argv[] to be evaluated    */ 
-int   opterr = 1;       /* non-zero if a question mark should be returned 
-                           when a non-valid option character is detected */ 
-/* handle possible future character set concerns by putting this in a macro */ 
-#define _next_char(string)  (char)(*(string+1)) 
-int getopt(int argc, char *argv[], char *opstring) 
-{ 
-    static char *pIndexPosition = NULL; /* place inside current argv string */ 
-    char *pArgString = NULL;        /* where to start from next */ 
-    char *pOptString;               /* the string in our program */ 
-    if (pIndexPosition != NULL) { 
-        /* we last left off inside an argv string */ 
-        if (*(++pIndexPosition)) { 
-            /* there is more to come in the most recent argv */ 
-            pArgString = pIndexPosition; 
-        } 
-    } 
-    if (pArgString == NULL) { 
-        /* we didn't leave off in the middle of an argv string */ 
-        if (optind >= argc) { 
-            /* more command-line arguments than the argument count */ 
-            pIndexPosition = NULL;  /* not in the middle of anything */ 
-            return EOF;             /* used up all command-line arguments */ 
-        } 
-        /*--------------------------------------------------------------------- 
-         * If the next argv[] is not an option, there can be no more options. 
-         *-------------------------------------------------------------------*/ 
-        pArgString = argv[optind++]; /* set this to the next argument ptr */ 
-        if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */ 
-            ('-' != *pArgString)) { 
-            --optind;               /* point to current arg once we're done */ 
-            optarg = NULL;          /* no argument follows the option */ 
-            pIndexPosition = NULL;  /* not in the middle of anything */ 
-            return EOF;             /* used up all the command-line flags */ 
-        } 
-        /* check for special end-of-flags markers */ 
-        if ((strcmp(pArgString, "-") == 0) || 
-            (strcmp(pArgString, "--") == 0)) { 
-            optarg = NULL;          /* no argument follows the option */ 
-            pIndexPosition = NULL;  /* not in the middle of anything */ 
-            return EOF;             /* encountered the special flag */ 
-        } 
-        pArgString++;               /* look past the / or - */ 
-    } 
-    if (':' == *pArgString) {       /* is it a colon? */ 
-        /*--------------------------------------------------------------------- 
-         * Rare case: if opterr is non-zero, return a question mark; 
-         * otherwise, just return the colon we're on. 
-         *-------------------------------------------------------------------*/ 
-        return (opterr ? (int)'?' : (int)':'); 
-    } 
-    else if ((pOptString = strchr(opstring, *pArgString)) == 0) { 
-        /*--------------------------------------------------------------------- 
-         * The letter on the command-line wasn't any good. 
-         *-------------------------------------------------------------------*/ 
-        optarg = NULL;              /* no argument follows the option */ 
-        pIndexPosition = NULL;      /* not in the middle of anything */ 
-        return (opterr ? (int)'?' : (int)*pArgString); 
-    } 
-    else { 
-        /*--------------------------------------------------------------------- 
-         * The letter on the command-line matches one we expect to see 
-         *-------------------------------------------------------------------*/ 
-        if (':' == _next_char(pOptString)) { /* is the next letter a colon? */ 
-            /* It is a colon.  Look for an argument string. */ 
-            if ('\0' != _next_char(pArgString)) {  /* argument in this argv? */ 
-                optarg = &pArgString[1];   /* Yes, it is */ 
-            } 
-            else { 
-                /*------------------------------------------------------------- 
-                 * The argument string must be in the next argv. 
-                 * But, what if there is none (bad input from the user)? 
-                 * In that case, return the letter, and optarg as NULL. 
-                 *-----------------------------------------------------------*/ 
-                if (optind < argc) 
-                    optarg = argv[optind++]; 
-                else { 
-                    optarg = NULL; 
-                    return (opterr ? (int)'?' : (int)*pArgString); 
-                } 
-            } 
-            pIndexPosition = NULL;  /* not in the middle of anything */ 
-        } 
-        else { 
-            /* it's not a colon, so just return the letter */ 
-            optarg = NULL;          /* no argument follows the option */ 
-            pIndexPosition = pArgString;    /* point to the letter we're on */ 
-        } 
-        return (int)*pArgString;    /* return the letter that matched */ 
-    } 
+/*****************************************************************************
+ *
+ *  MODULE NAME : GETOPT.C
+ *
+ *  COPYRIGHTS:
+ *             This module contains code made available by IBM
+ *             Corporation on an AS IS basis.  Any one receiving the
+ *             module is considered to be licensed under IBM copyrights
+ *             to use the IBM-provided source code in any way he or she
+ *             deems fit, including copying it, compiling it, modifying
+ *             it, and redistributing it, with or without
+ *             modifications.  No license under any IBM patents or
+ *             patent applications is to be implied from this copyright
+ *             license.
+ *
+ *             A user of the module should understand that IBM cannot
+ *             provide technical support for the module and will not be
+ *             responsible for any consequences of use of the program.
+ *
+ *             Any notices, including this one, are not to be removed
+ *             from the module without the prior written consent of
+ *             IBM.
+ *
+ *  AUTHOR:   Original author:
+ *                 G. R. Blair (BOBBLAIR at AUSVM1)
+ *                 Internet: bobblair@bobblair.austin.ibm.com
+ *
+ *            Extensively revised by:
+ *                 John Q. Walker II, Ph.D. (JOHHQ at RALVM6)
+ *                 Internet: johnq@ralvm6.vnet.ibm.com
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ * getopt()
+ *
+ * The getopt() function is a command line parser.  It returns the next
+ * option character in argv that matches an option character in opstring.
+ *
+ * The argv argument points to an array of argc+1 elements containing argc
+ * pointers to character strings followed by a null pointer.
+ *
+ * The opstring argument points to a string of option characters; if an
+ * option character is followed by a colon, the option is expected to have
+ * an argument that may or may not be separated from it by white space.
+ * The external variable optarg is set to point to the start of the option
+ * argument on return from getopt().
+ *
+ * The getopt() function places in optind the argv index of the next argument
+ * to be processed.  The system initializes the external variable optind to
+ * 1 before the first call to getopt().
+ *
+ * When all options have been processed (that is, up to the first nonoption
+ * argument), getopt() returns EOF.  The special option "--" may be used to
+ * delimit the end of the options; EOF will be returned, and "--" will be
+ * skipped.
+ *
+ * The getopt() function returns a question mark (?) when it encounters an
+ * option character not included in opstring.  This error message can be
+ * disabled by setting opterr to zero.  Otherwise, it returns the option
+ * character that was detected.
+ *
+ * If the special option "--" is detected, or all options have been
+ * processed, EOF is returned.
+ *
+ * Options are marked by either a minus sign (-) or a slash (/).
+ *
+ * No errors are defined.
+ *****************************************************************************/
+
+#include <stdio.h>                  /* for EOF */
+#include <string.h>                 /* for strchr() */
+
+
+/* static (global) variables that are specified as exported by getopt() */
+char *optarg = NULL;    /* pointer to the start of the option argument  */
+int   optind = 1;       /* number of the next argv[] to be evaluated    */
+int   opterr = 1;       /* non-zero if a question mark should be returned
+                           when a non-valid option character is detected */
+
+/* handle possible future character set concerns by putting this in a macro */
+#define _next_char(string)  (char)(*(string+1))
+
+int getopt(int argc, char *argv[], char *opstring)
+{
+    static char *pIndexPosition = NULL; /* place inside current argv string */
+    char *pArgString = NULL;        /* where to start from next */
+    char *pOptString;               /* the string in our program */
+
+
+    if (pIndexPosition != NULL) {
+        /* we last left off inside an argv string */
+        if (*(++pIndexPosition)) {
+            /* there is more to come in the most recent argv */
+            pArgString = pIndexPosition;
+        }
+    }
+
+    if (pArgString == NULL) {
+        /* we didn't leave off in the middle of an argv string */
+        if (optind >= argc) {
+            /* more command-line arguments than the argument count */
+            pIndexPosition = NULL;  /* not in the middle of anything */
+            return EOF;             /* used up all command-line arguments */
+        }
+
+        /*---------------------------------------------------------------------
+         * If the next argv[] is not an option, there can be no more options.
+         *-------------------------------------------------------------------*/
+        pArgString = argv[optind++]; /* set this to the next argument ptr */
+
+        if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */
+            ('-' != *pArgString)) {
+            --optind;               /* point to current arg once we're done */
+            optarg = NULL;          /* no argument follows the option */
+            pIndexPosition = NULL;  /* not in the middle of anything */
+            return EOF;             /* used up all the command-line flags */
+        }
+
+        /* check for special end-of-flags markers */
+        if ((strcmp(pArgString, "-") == 0) ||
+            (strcmp(pArgString, "--") == 0)) {
+            optarg = NULL;          /* no argument follows the option */
+            pIndexPosition = NULL;  /* not in the middle of anything */
+            return EOF;             /* encountered the special flag */
+        }
+
+        pArgString++;               /* look past the / or - */
+    }
+
+    if (':' == *pArgString) {       /* is it a colon? */
+        /*---------------------------------------------------------------------
+         * Rare case: if opterr is non-zero, return a question mark;
+         * otherwise, just return the colon we're on.
+         *-------------------------------------------------------------------*/
+        return (opterr ? (int)'?' : (int)':');
+    }
+    else if ((pOptString = strchr(opstring, *pArgString)) == 0) {
+        /*---------------------------------------------------------------------
+         * The letter on the command-line wasn't any good.
+         *-------------------------------------------------------------------*/
+        optarg = NULL;              /* no argument follows the option */
+        pIndexPosition = NULL;      /* not in the middle of anything */
+        return (opterr ? (int)'?' : (int)*pArgString);
+    }
+    else {
+        /*---------------------------------------------------------------------
+         * The letter on the command-line matches one we expect to see
+         *-------------------------------------------------------------------*/
+        if (':' == _next_char(pOptString)) { /* is the next letter a colon? */
+            /* It is a colon.  Look for an argument string. */
+            if ('\0' != _next_char(pArgString)) {  /* argument in this argv? */
+                optarg = &pArgString[1];   /* Yes, it is */
+            }
+            else {
+                /*-------------------------------------------------------------
+                 * The argument string must be in the next argv.
+                 * But, what if there is none (bad input from the user)?
+                 * In that case, return the letter, and optarg as NULL.
+                 *-----------------------------------------------------------*/
+                if (optind < argc)
+                    optarg = argv[optind++];
+                else {
+                    optarg = NULL;
+                    return (opterr ? (int)'?' : (int)*pArgString);
+                }
+            }
+            pIndexPosition = NULL;  /* not in the middle of anything */
+        }
+        else {
+            /* it's not a colon, so just return the letter */
+            optarg = NULL;          /* no argument follows the option */
+            pIndexPosition = pArgString;    /* point to the letter we're on */
+        }
+        return (int)*pArgString;    /* return the letter that matched */
+    }
 }
index 02a580f89a2c4b7d2c22df4238707eeee901e937..6e046337aac0bf488cdaa2968c0ca07bf27919e6 100644 (file)
  */
 
 /**@page localinfo list local network addresses
- * 
+ *
  * @section synopsis Synopsis
  *
  * <tt>localinfo [-imdn46gslh] [domainname]</tt>
  *
  * @section description Description
- * 
+ *
  * The @em localinfo utility will obtain the local network addresses
  * and print them.
  *
@@ -61,7 +61,7 @@
  *
  * @section examples Examples
  *
- * You want to find out local IPv6 addresses: 
+ * You want to find out local IPv6 addresses:
  * @code
  * $ localinfo -6
  * @endcode
index 3e375bb32047ce7a5aa78cbe1f77e97e8427f902..31298f8dc29e59247faeb5aba1a9d6441e4b89f5 100644 (file)
@@ -24,9 +24,9 @@
 
 /**@internal @file memccpy.c
  * @brief The memccpy() replacement function.
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Nov 17 17:45:51 EET 2005 ppessi
  */
 
@@ -46,7 +46,7 @@
  * @param n          size of destination area
  *
  * @return
- * Returns a pointer to the next character in @a dest after @a c, 
+ * Returns a pointer to the next character in @a dest after @a c,
  * or NULL if @a c was not found in the first @a n characters of @a src.
  */
 void *memccpy(void *dest, const void *src, int c, size_t n)
index 9b16594ed56aee2332d3b40849b94fdfebf46175..c873210ed2f3549e173de164cc0f31faf26eac0d 100644 (file)
@@ -24,9 +24,9 @@
 
 /**@internal @file memcspn.c
  * @brief The memcspn() replacement function.
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Nov 17 17:45:51 EET 2005 ppessi
  */
 
@@ -48,7 +48,7 @@
  * @return
  * The memspn() function returns the number of bytes in the memory area @a
  * which consists entirely of bytes not in @a reject.
- * @par 
+ * @par
  * If @a rejectlen is 0, or @a reject is NULL, it returns @a memlen, size of
  * the memory area.
  */
index 7398465e478bd5f652449782cba7dcc19c628abb..49a49c7050839562fb7e6e9253142fd396afdfc6 100644 (file)
 /**@internal @file memmem.c
  *
  * @brief Backup implementation of memmem()
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Sat Apr 12 19:32:33 2003 ppessi
- * 
+ *
  */
 
 #include "config.h"
index 74041c158184e20b40b84371f3ce503c1157a6aa..952ab4f0558ecba527d9d97e675737fbfe5694f0 100644 (file)
  */
 
 /**@internal @file memspn.c
- * 
+ *
  * The memspn() replacement function.
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Sat Apr 12 19:32:33 2003 ppessi
- * 
+ *
  */
 
 #include "config.h"
index 9421ab1a2923e0729bddab18945d4b8248496737..b0ddc82ee9126f6bdd4b72e5a8d72c6ca44c291a 100644 (file)
@@ -8,7 +8,7 @@
 
    Copyright (C) 1994,1996,1997,1998,1999,2001,2002
    Free Software Foundation, Inc.
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -57,7 +57,7 @@
 #define FDSETSIZE(n) (((n) + NFDBITS - 1) / NFDBITS * (NFDBITS / NBBY))
 #define roundup(n, x) (((n) + (x) - 1) / (x) * (x))
 
-/* Emulated poll() using select(). 
+/* Emulated poll() using select().
 
 This is used by su_wait().
 
@@ -241,7 +241,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
       break;
     }
 
-  if (ready > 0) 
+  if (ready > 0)
     for (f = fds; f < &fds[nfds]; ++f)
       {
        if (f->fd >= 0)
index 047fd7ad12be6f1700b0391c43d288206cad785c..ba46ee83ac61611e5f89165ed30cc8f515f59ed2 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@file smoothsort.c
  * @brief Smoothsort implementation
- * 
+ *
  * Smoothsort is a in-place sorting algorithm with performance of O(NlogN)
  * in worst case and O(n) in best case.
  *
@@ -60,7 +60,7 @@ static inline size_t stretch_up(stretch s[1])
   size_t next;
 
   s->p >>= 1;
-  
+
   next = s->b + s->c + 1, s->c = s->b, s->b = next;
 
   return next;
@@ -87,8 +87,8 @@ static char const *binary(unsigned long long p)
     return "0";
 
   binary[64] = 0;
-  
-  for (i = 64; p; p >>= 1) 
+
+  for (i = 64; p; p >>= 1)
     binary[--i] = "01"[p & 1];
 
   return binary + i;
@@ -107,7 +107,7 @@ static char const *binary(unsigned long long p)
  * @param s       description of current stretch
  */
 static void sift(array const *array, size_t r, stretch s)
-{ 
+{
   while (s.b >= 3) {
     size_t r2 = r - s.b + s.c;
 
@@ -115,7 +115,7 @@ static void sift(array const *array, size_t r, stretch s)
       r2 = r - 1;
       stretch_down(&s, 0);
     }
+
     if (array->less(array->m, r2, r))
       break;
 
@@ -125,8 +125,8 @@ static void sift(array const *array, size_t r, stretch s)
 
     stretch_down(&s, 0);
   }
-} 
+}
+
 /** Trinkle the roots of the given stretches
  *
  * @param array   description of array to sort
@@ -160,12 +160,12 @@ static void trinkle(array const *array, size_t r, stretch s)
     }
 
     r2 = r - s.b + s.c;
+
     if (array->less(array->m, r2, r - 1)) {
       r2 = r - 1;
       stretch_down(&s, 0);
     }
+
     if (array->less(array->m, r2, r3)) {
       DEBUG(("swap(%p [%zu]=[%zu])\n", array, r, r3));
       array->swap(array->m, r, r3); r = r3;
@@ -175,9 +175,9 @@ static void trinkle(array const *array, size_t r, stretch s)
     DEBUG(("\tswap(%p @%zu <=> @%zu b=%u)\n", array, r, r2, s.b));
     array->swap(array->m, r, r2); r = r2;
     stretch_down(&s, 0);
-    break; 
+    break;
   }
+
   sift(array, r, s);
 }
 
@@ -198,7 +198,7 @@ static void semitrinkle(array const *array, size_t r, stretch s)
     array->swap(array->m, r, r1);
     trinkle(array, r1, s);
   }
-} 
+}
 
 /** Sort array using smoothsort.
  *
@@ -251,10 +251,10 @@ void su_smoothsort(void *base, size_t r, size_t N,
     DEBUG(("loop1 q=%zu: b=%u p=%s\n", q, s.b, binary(s.p)));
 
     if (s.b <= 1) {
-      while ((s.p & 1) == 0) 
+      while ((s.p & 1) == 0)
        stretch_up(&s);
       --r;
-    } 
+    }
     else /* if b >= 3 */ {
       if (s.p) semitrinkle(array, r - (s.b - s.c), s);
       stretch_down(&s, 1);
index 83bae30f767409c35dec0018cd7dbe4bee7c0241..50007ce684fd6a41a4632eacf3a12f95f742390d 100644 (file)
@@ -32,7 +32,7 @@
  *
  * This file contain template macros implementing @a heap in C. The @a heap
  * keeps its element in a known order and it can be used to implement, for
- * example, a prioritye queue or an ordered queue. 
+ * example, a prioritye queue or an ordered queue.
  *
  * The ordering within the heap is defined as follows:
  * - indexing starts from 1
  * to be removed. The template defines also a predicate used to check if the
  * heap is full, and a function used to resize the heap.
  *
- * The heap user must define four primitives: 
- * - less than comparison 
+ * The heap user must define four primitives:
+ * - less than comparison
  * - array setter
  * - heap array allocator
  * - empty element
  *
  * Please note that in order to remove an entry in the heap, the application
- * must know its index in the heap array. 
+ * must know its index in the heap array.
  *
  * The heap struct is declared with macro HEAP_DECLARE(). The prototypes for
  * heap functions are instantiated with macro HEAP_PROTOS(). The
@@ -68,7 +68,7 @@
  *
  * Example code can be found from <su/torture_heap.c> and
  * <sresolv/sres_cache.c>.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  * @NEW_1_12_7.
  */
@@ -77,9 +77,9 @@
 #define HEAP_MIN_SIZE 31
 
 /** Declare heap structure type.
- * 
+ *
  * The macro #HEAP_TYPE contains declaration of the heap structure.
- * 
+ *
  * @showinitializer
  */
 #define HEAP_TYPE struct { void *private; }
  * @param heaptype  type of heap
  * @param prefix    function prefix
  * @param type      type of entries
- * 
+ *
  * The declared functions will have scope @a scope (for example, @c static
  * or @c static inline). The declared function names will have prefix @a
  * prefix. The heap structure has type @a heaptype. The heap element type is
@@ -144,7 +144,7 @@ scope type prefix##get(heaptype, size_t)
  * Functions have scope @a scope, e.g., @c static @c inline.
  * The heap structure has type @a type.
  * The function names start with @a prefix, the field names start
- * with @a pr. The entry type is @a entrytype. 
+ * with @a pr. The entry type is @a entrytype.
 
  * The function (or macro) @a less compares two entries in heap. It gets two
  * arguments and it returns true if its left argument is less than its right
index 7fc016274e4c8b6b8c83620825d7d04991747139..cc7e61bb124f5285bc26adb196fed1aad542e60a 100644 (file)
  * When a entry with new identical hash key is added to the table, it can be
  * either @e inserted (before any other entry with same key value) or
  * @e appended.
- * 
+ *
  * Example code can be found from <htable_test.c>.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Sep 25 17:42:40 2001 ppessi
  */
 
@@ -62,7 +62,7 @@ typedef unsigned long hash_value_t;
 #define HTABLE_MIN_SIZE 31
 
 /** Declare hash table structure type.
- * 
+ *
  * The macro HTABLE_DECLARE() expands to a declaration for hash table
  * structure.  The its typedef will be <em>prefix</em><code>_t</code>, the
  * field names start withb @a pr.  The entry type is @a entry_t.
index a5ac9ec6fbd232b8c13ad218ad6dcd1bc9550f3d..5b70aa45a80651655bdb5276a2af8edc4eb33f7b 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef HTABLE2_H
 /** Defined when <sofia-sip/htable2.h> has been included. */
-#define HTABLE2_H 
+#define HTABLE2_H
 
 /**@file sofia-sip/htable2.h
  *
@@ -33,7 +33,7 @@
  * Note: this version stores the given element types as entries (instead of
  * always storing a pointer to element). It can be used without
  * <sofia-sip/su_alloc.h>.
- * 
+ *
  * This file contain a hash table template for C. The hash tables are
  * resizeable, and they usually contain pointers to entries. The declaration
  * for template datatypes is instantiated with macro HTABLE2_DECLARE2(). The
@@ -51,9 +51,9 @@
  * When a entry with new identical key is added to the table, it can be
  * either @e inserted (before any other entry with same key value) or @e
  * appended.
- * 
+ *
  * Example code can be found from <htable_test.c>.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  *
  * @date Created: Tue Sep 25 17:42:40 2001 ppessi
@@ -65,7 +65,7 @@ typedef unsigned long hash_value_t;
 #define HTABLE2_MIN_SIZE 31
 
 /** Declare hash table structure type.
- * 
+ *
  * The macro HTABLE2_DECLARE2() expands to a declaration for hash table
  * structure. The its typedef will be @a type, the field names start with @a
  * pr. The entry type is @a entrytype.
@@ -127,8 +127,8 @@ HTABLE2_SCOPE int prefix##_remove(type *, entrytype const)
  * hash value of each entry is given as @a hfun.
  *
  * @param type      hash table type
- * @param prefix    function prefix for hash table 
- * @param pr        field prefix for hash table 
+ * @param prefix    function prefix for hash table
+ * @param pr        field prefix for hash table
  * @param entrytype type of entry element
  * @param sizetype  size_t type
  * @param hfun      function or macro returning hash value of entry
@@ -297,7 +297,7 @@ extern int const prefix##_dummy
 #define HTABLE2_BODIES(type, prefix, pr, entrytype, \
                        hfun, is_used, reclaim, is_equal, halloc) \
   HTABLE2_BODIES2(type, prefix, pr, entrytype, unsigned, \
-                       hfun, is_used, reclaim, is_equal, halloc) 
+                       hfun, is_used, reclaim, is_equal, halloc)
 
 
 #endif /** !defined(HTABLE2_H) */
index 2fb2ae67c8da329c17e2213275f09d398c9cd2f3..3b73d70a63b4f148f04c16d457cfb40b55eb7f06 100644 (file)
 
 #ifndef RBTREE_H
 /** Defined when <sofia-sip/rbtree.h> has been included. */
-#define RBTREE_H 
+#define RBTREE_H
 
 /**@file sofia-sip/rbtree.h
  *
  * Red-black tree.
  *
  * This file contain a red-black-tree template for C. The red-black-tree is
- * a balanced binary tree containing structures as nodes. 
+ * a balanced binary tree containing structures as nodes.
  *
  * The prototypes for red-black-tree functions are declared with macro
  * RBTREE_PROTOS(). The implementation is instantiated with macro
@@ -40,9 +40,9 @@
  * When a entry with new identical key is added to the tree, it can be
  * either @e inserted (replacing other node with same key value) or @e
  * appended.
- * 
+ *
  * Example code can be found from <rbtree_test.c>.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  *
  * @date Created: Tue Sep  7 19:45:11 EEST 2004 ppessi
@@ -80,7 +80,7 @@ void prefix ## _left_rotate(Type **top, Type *x)   \
   left(c) = x;                                    \
   parent(x) = c;                                  \
 } \
-extern int const prefix##_dummy 
+extern int const prefix##_dummy
 
   /*               x                c
    *              / \              / \
@@ -259,11 +259,11 @@ extern int const prefix##_dummy
  *
  * @param tree pointer to the root of the tree
  * @param node pointer to node to be inserted
- * @param return_old return value parameter for matching node 
+ * @param return_old return value parameter for matching node
  *                   already in the @a tree
  *
  * @retval 0 if node was inserted
- * @retval -1 if there already was an matching node 
+ * @retval -1 if there already was an matching node
  *            and return_old is NULL.
  */
 int rbtree_insert(Type **tree, Type *node, Type **return_old);
@@ -387,7 +387,7 @@ extern int const prefix##_dummy
  * @param tree pointer to the root of the tree
  * @param node pointer to node to be appended
  */
-void rbtree_remove(Type **tree, Type *node);                           
+void rbtree_remove(Type **tree, Type *node);
 #endif
 
 #define RBTREE_REMOVE(SCOPE, prefix, Type, left, right, parent,                \
@@ -584,7 +584,7 @@ SCOPE int prefix##_height(Type const *node)                 \
 } \
 extern int const prefix##_dummy
 
-/** Define prototypes for red-black tree functions. @HIDE 
+/** Define prototypes for red-black tree functions. @HIDE
  *
  * @param SCOPE function scope (e.g., su_inline)
  * @param prefix function prefix (e.g., rbtree)
@@ -605,12 +605,12 @@ extern int const prefix##_dummy
   SCOPE Type *prefix ## _last(Type const *);                           \
   SCOPE int prefix ## _height(Type const *)
 
-/** Define bodies for red-black tree functions. @HIDE 
+/** Define bodies for red-black tree functions. @HIDE
  *
  * @param SCOPE function scope (e.g., su_inline)
  * @param prefix function prefix (e.g., rbtree)
  * @param Type node type
- * @param left accessor of left node 
+ * @param left accessor of left node
  * @param right accessor of right node
  * @param parent accessor of parent node
  * @param IS_RED predicate testing if node is red
@@ -621,7 +621,7 @@ extern int const prefix##_dummy
  * @param CMP method comparing two nodes
  * @param INSERT setter marking node as inserted to the tree
  * @param REMOVE method marking node as removed and possibly deleting node
- * 
+ *
  * @par Example
  *
  * @code
@@ -637,7 +637,7 @@ extern int const prefix##_dummy
  * #define INSERT(node) ((node)->inserted = 1)
  * #define REMOVE(node) ((node)->left = (node)->right = (node)->parent = NULL, \
  *                       (node)->inserted = 0)
- * 
+ *
  * RBTREE_BODIES(su_inline, rbtree, struct node,
  *               LEFT, RIGHT, PARENT,
  *               IS_RED, SET_RED, IS_BLACK, SET_BLACK, COPY_COLOR,
index 2b1eb660077079858461c2fe814bdd2b1cacb84c..7ffd10b05c6af93dcc996bfdceb3dc9d6a7190df 100644 (file)
 #ifndef SU_H
 /** Defined when <sofia-sip/su.h> has been included. */
 #define SU_H
-/**@ingroup su_socket 
+/**@ingroup su_socket
  * @file sofia-sip/su.h Socket and network address interface
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
 
@@ -83,14 +83,14 @@ SOFIA_BEGIN_DECLS
 
 #if SU_HAVE_BSDSOCK || DOCUMENTATION_ONLY
 enum {
-  /** Invalid socket descriptor, error from socket() or accept() */ 
+  /** Invalid socket descriptor, error from socket() or accept() */
   INVALID_SOCKET = -1,
 #define INVALID_SOCKET ((su_socket_t)INVALID_SOCKET)
   /** Error from other socket calls */
   SOCKET_ERROR = -1,
 #define SOCKET_ERROR SOCKET_ERROR
   /** Return code for a successful call */
-  su_success = 0, 
+  su_success = 0,
   /** Return code for an unsuccessful call */
   su_failure = -1
 };
@@ -98,9 +98,9 @@ enum {
 #define MSG_NOSIGNAL (0)
 #endif
 #elif SU_HAVE_WINSOCK
-enum { 
-  su_success = 0, 
-  su_failure = 0xffffffffUL 
+enum {
+  su_success = 0,
+  su_failure = 0xffffffffUL
 };
 
 #define MSG_NOSIGNAL (0)
@@ -168,7 +168,7 @@ union su_sockaddr_u {
 #define               su_len          su_array[0]
   short               su_family;
 #endif
-#define               su_port         su_sin.sin_port  
+#define               su_port         su_sin.sin_port
 #endif
 
   char                su_array[32];   /**< Presented as chars */
@@ -230,8 +230,8 @@ typedef size_t su_ioveclen_t;
  * For historical reasons, the structure is known as #msg_iovec_t in @msg
  * module.
  *
- * @sa #su_ioveclen_t, SU_IOVECLEN_MAX, su_vsend(), su_vrecv(), 
- * #msg_iovec_t, msg_iovec(), msg_recv_iovec(), 
+ * @sa #su_ioveclen_t, SU_IOVECLEN_MAX, su_vsend(), su_vrecv(),
+ * #msg_iovec_t, msg_iovec(), msg_recv_iovec(),
  * @c struct @c iovec defined in <sys/uio.h>, writev(2), readv(2),
  * sendmsg(), recvmsg(),
  * <a href="http://msdn.microsoft.com/library/en-us/winsock/winsock/wsabuf_2.asp">
@@ -242,7 +242,7 @@ typedef struct su_iovec_s {
   su_ioveclen_t siv_len;               /**< Size of buffer.  */
 } su_iovec_t;
 
-/** Maximum size of buffer in a single su_iovec_t element. 
+/** Maximum size of buffer in a single su_iovec_t element.
  * @sa #su_ioveclen_t, #su_iovec_t
  *
  * @since New in @VERSION_1_12_2.
@@ -277,7 +277,7 @@ SOFIAPUBFUN int su_close(su_socket_t s);
 SOFIAPUBFUN int su_ioctl(su_socket_t s, int request, ...);
 
 /**Check for in-progress error codes.
- * 
+ *
  * Checks if the @a errcode indicates that the socket call failed because
  * it would have blocked.
  *
@@ -287,7 +287,7 @@ SOFIAPUBFUN int su_ioctl(su_socket_t s, int request, ...);
  */
 SOFIAPUBFUN int su_is_blocking(int errcode);
 
-/** Set/reset blocking option. */ 
+/** Set/reset blocking option. */
 SOFIAPUBFUN int su_setblocking(su_socket_t s, int blocking);
 /** Set/reset address reusing option. */
 SOFIAPUBFUN int su_setreuseaddr(su_socket_t s, int reuse);
@@ -314,7 +314,7 @@ SOFIAPUBFUN int su_getlocalip(su_sockaddr_t *sin);
 #define su_ioctl  ioctl
 /*
  * Note: before 1.12.2, there was su_isblocking() which did not take argument
- * and which was missing from WINSOCK 
+ * and which was missing from WINSOCK
  */
 #define su_is_blocking(e) \
   ((e) == EINPROGRESS || (e) == EAGAIN || (e) == EWOULDBLOCK)
@@ -324,7 +324,7 @@ SOFIAPUBFUN int su_getlocalip(su_sockaddr_t *sin);
 SOFIAPUBFUN int su_inet_pton(int af, char const *src, void *dst);
 SOFIAPUBFUN const char *su_inet_ntop(int af, void const *src,
                                  char *dst, size_t size);
-SOFIAPUBFUN ssize_t 
+SOFIAPUBFUN ssize_t
   su_send(su_socket_t s, void *buffer, size_t length, int flags),
   su_sendto(su_socket_t s, void *buffer, size_t length, int flags,
            su_sockaddr_t const *to, socklen_t tolen),
@@ -424,7 +424,7 @@ uint32_t su_ntohl(uint32_t l)
 
 #define SU_SOCKADDR_INADDR_ANY(su) SU_HAS_INADDR_ANY(su)
 
-/**@HI Calculate correct size of su_sockaddr_t structure. */ 
+/**@HI Calculate correct size of su_sockaddr_t structure. */
 #if SU_HAVE_IN6
 #define SU_SOCKADDR_SIZE(su) \
   ((socklen_t)((su)->su_family == AF_INET ? sizeof((su)->su_sin)         \
index b13a6952475aa9421c359af0eb9979a306b5e043..2059381137fbd3edd6e61f2edf5bf185d3a8cc0c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 #ifndef SU_ADDRINFO_H
 /* Defined when <sofia-sip/su_addrinfo.h> has been included */
 #define SU_ADDRINFO_H
-/**@ingroup su_socket 
+/**@ingroup su_socket
  *
  * @file sofia-sip/su_addrinfo.h Network address and service translation.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Wed Nov 30 17:07:04 EET 2005 ppessi
  */
 
@@ -115,10 +115,10 @@ struct addrinfo {
 };
 #endif /* SU_WITH_GETADDRINFO */
 
-#ifndef EAI_BADHINTS     
+#ifndef EAI_BADHINTS
 #define EAI_BADHINTS   10012
 #endif
-#ifndef EAI_PROTOCOL  
+#ifndef EAI_PROTOCOL
 #define EAI_PROTOCOL   10013
 #endif
 
index 8eb12fdd67fb44fb6ef08f2d6817959ac653c8ed..3a9f31f2f0e8270d32ba242056d1a75b327b73aa 100644 (file)
@@ -30,7 +30,7 @@
  * @file sofia-sip/su_alloc.h Home-based memory management interface
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Aug 19 01:12:25 1999 ppessi
  */
 
@@ -54,7 +54,7 @@ typedef struct su_block_s su_block_t;
 typedef struct su_alock su_alock_t;
 
 /** Memory home structure */
-struct su_home_s { 
+struct su_home_s {
   int         suh_size;
   su_block_t *suh_blocks;
   su_alock_t *suh_lock;
@@ -140,7 +140,7 @@ SU_DLL char *su_vsprintf(su_home_t *home, char const *fmt, va_list ap)
      __attribute__((__malloc__));
 
 /* free an independent block */
-SU_DLL void su_free(su_home_t *h, void *);             
+SU_DLL void su_free(su_home_t *h, void *);
 
 /** Check if a memory home is threadsafe */
 SU_DLL int su_home_is_threadsafe(su_home_t const *home);
index 0d30b7484ad2a7341a43adb0edb8ea5561404552..ecbc8c2738883d2db7252d0d665ab877901f4f64 100644 (file)
 
 #ifndef SU_ALLOC_STAT_H
 /** Defined when <sofia-sip/su_alloc_stat.h> has been included. */
-#define SU_ALLOC_STAT_H 
+#define SU_ALLOC_STAT_H
 
 /**@ingroup su_alloc
  *
  * @file sofia-sip/su_alloc_stat.h Home-based memory management statistics
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Apr  9 10:24:05 2002 ppessi
  */
 
@@ -48,10 +48,10 @@ SOFIA_BEGIN_DECLS
 typedef struct su_home_stat_t su_home_stat_t;
 
 SU_DLL void su_home_init_stats(su_home_t *h);
-SU_DLL void su_home_get_stats(su_home_t *, int include_clones, 
+SU_DLL void su_home_get_stats(su_home_t *, int include_clones,
                              su_home_stat_t *stats, isize_t statssize);
 
-SU_DLL void su_home_stat_add(su_home_stat_t *total, 
+SU_DLL void su_home_stat_add(su_home_stat_t *total,
                             su_home_stat_t const *hs);
 
 struct su_home_stat_t
index a9ee6ba991efb95688dcf2e14d81cf66a96894ba..365f65c31c45d161846b2a613f7fd60c17825888 100644 (file)
@@ -29,9 +29,9 @@
 /**
  * @file sofia-sip/su_bm.h
  * @brief Boyer-Moore search algorithm
- *  
+ *
  * @author Pekka.Pessi@nokia.com
- * 
+ *
  * @date Created: Mon Apr 11 17:03:13 2005 ppessi
  */
 
index 39fa918fe212e466238faaa704cab0921beba159..18f0002728a2aafb65906b74f44f6efe02a7384c 100644 (file)
 #ifndef SU_CONFIG_H
 /** Defined when <sofia-sip/su_config.h> has been included. */
 #define SU_CONFIG_H
-/**@file sofia-sip/su_config.h 
- * 
+/**@file sofia-sip/su_config.h
+ *
  * @b su library configuration
- * 
+ *
  * This file includes an appropriate <sofia-sip/su_configure*.h> include file.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
 
@@ -45,7 +45,7 @@
 #define __malloc__             /* avoid spurious warnigns */
 #endif
 #elif !defined(__attribute__)
-#  define __attribute__(x) 
+#  define __attribute__(x)
 #endif
 
 /* C++ linkage needs to know that types and declarations are C, not C++.  */
index cbd1fa44c6d6573514992e508fb63cff52e88a51..8875f28462a5e4cb937234a0a1de21ec79d26b44 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef SU_CONFIGURE_H
 /** Defined when <sofia-sip/su_configure.h> has been included. */
-#define SU_CONFIGURE_H 
+#define SU_CONFIGURE_H
 
 /**@file sofia-sip/su_configure.h
  *
@@ -37,7 +37,7 @@
  * in "config.h".
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Mon Aug 21 20:32:25 2000 ppessi
  */
 
@@ -70,7 +70,7 @@
 #undef SU_HAVE_WINSOCK
 
 /** Define as 1 if you have Winsock2 interface */
-#undef SU_HAVE_WINSOCK2        
+#undef SU_HAVE_WINSOCK2
 
 /** Define as 1 if you have OSX CoreFoundation interface */
 #undef SU_HAVE_OSX_CF_API
@@ -92,7 +92,7 @@
 #undef SU_INLINE_TAG_CAST
 
 /** Define this as 1 if we can use tags directly from stack. */
-#undef SU_HAVE_TAGSTACK 
+#undef SU_HAVE_TAGSTACK
 
 /* These are valid only for GCC */
 
index 86c6e5b243e839c7e75dccfff7057fbcdede6b6b..3764fbd9c7f69ec542accccf1112af9bc3fac630 100644 (file)
 
 #ifndef SU_DEBUG_H
 /** Defined when <sofia-sip/su_debug.h> has been included */
-#define SU_DEBUG_H 
+#define SU_DEBUG_H
 
 /**@ingroup su_log
  * @file sofia-sip/su_debug.h
  * @brief SU debugging macros
  *
  * The logging levels and macros to use are defined as follows:
- *  - SU_DEBUG_0()  fatal errors, panic 
+ *  - SU_DEBUG_0()  fatal errors, panic
  *  - SU_DEBUG_1()  critical errors, minimal progress at subsystem level
  *  - SU_DEBUG_2()  non-critical errors
  *  - SU_DEBUG_3()  warnings, progress messages
  * structure, e.g., "iptsec_debug.h".
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Feb  8 10:06:33 2000 ppessi
  *
- * @sa @ref debug_logs, su_llog(), su_vllog(), #su_log_t, 
+ * @sa @ref debug_logs, su_llog(), su_vllog(), #su_log_t,
  */
 
 #ifndef SU_LOG_H
@@ -82,7 +82,7 @@ SOFIAPUBVAR su_log_t SU_LOG[];
 SU_DEBUG_DEF(0)
 /** Log messages at level 0.
  *
- * Fatal errors and panic messages should be logged at level 0. 
+ * Fatal errors and panic messages should be logged at level 0.
  *
  * @sa su_llog(), su_vllog(), #su_log_t, @ref debug_logs
  */
@@ -115,7 +115,7 @@ SU_DEBUG_DEF(1)
 
 #if SU_DEBUG_MAX >= 2
 SU_DEBUG_DEF(2)
-/**Log messages at level 2. 
+/**Log messages at level 2.
  *
  * Non-critical errors should be logged at level 2.
  *
@@ -173,7 +173,7 @@ SU_DEBUG_DEF(6)
 SU_DEBUG_DEF(7)
 /** Log messages at level 7.
  *
- * Media protocol actions (incoming packets, etc) should be logged at level 7. 
+ * Media protocol actions (incoming packets, etc) should be logged at level 7.
  *
  * @sa su_llog(), su_vllog(), #su_log_t, @ref debug_logs
  */
index 0d6449c8ca619debd8ee44db372b7a182eb5815c..9faafa71314c04508f7e21f8906c459320867020 100644 (file)
@@ -32,7 +32,7 @@
  * socket library and C libraries).
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Dec 22 18:16:06 EET 2005 pessi
  */
 
index 51df140e659b39485c0f86e68a0d54cba9145d5b..f1c9a4d331237b3a38782db759db556613198a63 100644 (file)
 
 #ifndef SU_LOCALINFO_H
 /** Defined when <sofia-sip/su_localinfo.h> has been included. */
-#define SU_LOCALINFO_H 
+#define SU_LOCALINFO_H
 
 
 /**@ingroup su_socket
  * @file sofia-sip/su_localinfo.h  Interface for obtaining local addresses.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Aug 10 18:58:01 2000 ppessi
  */
 
@@ -46,8 +46,8 @@ typedef struct su_localinfo_s su_localinfo_t;
 
 /** Local address info structure. */
 struct su_localinfo_s {
-  /**Bitwise or of flags: 
-   * #LI_V4MAPPED, #LI_CANONNAME, #LI_NAMEREQD, 
+  /**Bitwise or of flags:
+   * #LI_V4MAPPED, #LI_CANONNAME, #LI_NAMEREQD,
    * #LI_NUMERIC, #LI_DOWN, #LI_IFNAME */
   int li_flags;
   int li_family;               /**< Address family. */
index 5f9ae57da0d3919b5b96d1891d7126c254621667..128bf7aa768ed487ea41386be5a21000b645025d 100644 (file)
@@ -22,9 +22,9 @@
  *
  */
 
-/**@ingroup su_log 
+/**@ingroup su_log
  * @file sofia-sip/su_log.h   SU logging interface
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
  *
  * @date Created: Thu Feb 22 18:09:02 2001 ppessi
@@ -79,7 +79,7 @@ SOFIAPUBFUN void su_log(char const *fmt, ...)
 
 SOFIAPUBFUN void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
   __attribute__ ((__format__ (printf, 3, 4)));
-SOFIAPUBFUN void su_vllog(su_log_t *log, unsigned level, 
+SOFIAPUBFUN void su_vllog(su_log_t *log, unsigned level,
                          char const *fmt, va_list ap);
 SOFIAPUBFUN void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream);
 SOFIAPUBFUN void su_log_set_level(su_log_t *log, unsigned level);
index b8eaedb36aae5c386e807262a308d0064d14bb40..0c562d9ca69837543594c9ba0abc255865809a38 100644 (file)
@@ -40,7 +40,7 @@
 /** @file sofia-sip/su_md5.h MD5 digest interface.
  *
  * @author <Pekka.Pessi@nokia.com>
- */ 
+ */
 
 #ifndef SU_TYPES_H
 #include "sofia-sip/su_types.h"
index eb6d24d147dc0062b01672d3e725484fe2c2d595..ed6cf386c0a2e5ef6a72ba8abd730d80017edfae 100644 (file)
@@ -98,9 +98,9 @@ typedef SU_NETWORK_CHANGED_MAGIC_T su_network_changed_magic_t;
 
 typedef struct su_network_changed_s su_network_changed_t;
 
-/** Function prototype for network-changed callback . 
+/** Function prototype for network-changed callback .
+ *
  *
- * 
  * @since New in @VERSION_1_12_2.
  */
 typedef void (su_network_changed_f)(su_network_changed_magic_t *, su_root_t *);
@@ -112,8 +112,8 @@ typedef void (su_network_changed_f)(su_network_changed_magic_t *, su_root_t *);
 /* Network-changed */
 SOFIAPUBFUN su_network_changed_t *
 su_root_add_network_changed(su_home_t *home,
-                           su_root_t *root, 
-                           su_network_changed_f *, 
+                           su_root_t *root,
+                           su_network_changed_f *,
                            su_network_changed_magic_t *);
 SOFIAPUBFUN int su_root_remove_network_changed(su_network_changed_t *);
 
index 209a12bc34d874628cc7b4a081f24e8bba50460f..d0bedd9d0a501cecfd2098c2dde61724e6d26bcb 100644 (file)
 /**
  * @file sofia-sip/su_osx_runloop.h
  * @brief OSX Run Loop integration.
- * 
+ *
  * @author Martti Mela <Martti.Mela@nokia.com>
- *  
+ *
  * @date Created: Fri Sep 22 16:49:51 EEST 2006 mela
- * 
+ *
  * @NEW_1_12_4.
  */
 
index 64a0d6b02e8334d1c3230f40e3ae3ffcd06ce29c..12a8207549f6cc02668b7cb0c73637f51fcc43b8 100644 (file)
@@ -28,7 +28,7 @@
  * @file sofia-sip/su_strlst.h String lists
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Fri May  3 09:13:22 2002 ppessi
  */
 
@@ -58,7 +58,7 @@ SU_DLL su_strlst_t *su_strlst_vcreate_with(su_home_t *,
      __attribute__((__malloc__));
 
 SU_DLL su_strlst_t *su_strlst_vcreate_with_dup(su_home_t *,
-                                              char const *, 
+                                              char const *,
                                               va_list va)
      __attribute__((__malloc__));
 
@@ -84,14 +84,14 @@ SU_DLL char const *su_slvprintf(su_strlst_t *self, char const *fmt, va_list ap);
 SU_DLL char const *su_strlst_item(su_strlst_t const *, usize_t i);
 
 /** Set a numbered item to list */
-SU_DLL char const *su_strlst_set_item(su_strlst_t *self, usize_t i, 
+SU_DLL char const *su_strlst_set_item(su_strlst_t *self, usize_t i,
                                      char const *s);
 
 /** Remove a numbered item from list. */
 SU_DLL char const *su_strlst_remove(su_strlst_t *, usize_t i);
 
 /** Concatenate list of strings to one string. */
-SU_DLL char *su_strlst_join(su_strlst_t *s, su_home_t *home, 
+SU_DLL char *su_strlst_join(su_strlst_t *s, su_home_t *home,
                             char const *sep)
      __attribute__((__malloc__));
 
@@ -100,7 +100,7 @@ SU_DLL su_strlst_t *su_strlst_split(su_home_t *, char *s, char const *sep)
      __attribute__((__malloc__));
 
 /** Duplicate and split a string. */
-SU_DLL su_strlst_t *su_strlst_dup_split(su_home_t *, char const *s, 
+SU_DLL su_strlst_t *su_strlst_dup_split(su_home_t *, char const *s,
                                        char const *sep)
      __attribute__((__malloc__));
 
index c95748bd193119fea607a375b2be003d398e3007..1b8c4ff775bc5f3008775ffa53c914bb52f64ff8 100644 (file)
@@ -30,7 +30,7 @@
  * @file sofia-sip/su_tag.h  Object-oriented tags and tag list interface.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Feb 20 19:48:18 2001 ppessi
  */
 
@@ -68,7 +68,7 @@ typedef struct {
 /** Tag type class */
 typedef struct tag_class_s const tag_class_t;
 
-/** Tag structure. 
+/** Tag structure.
  *
  * The tag structure contains the name, namespace and class of the tag. The
  * fourth field, @a tt_magic, is interpreted by the tag class.
@@ -77,7 +77,7 @@ struct tag_type_s {
   char const    *tt_ns;                /**< Tag namespace (e.g., "sip" or "nua") */
   char const   *tt_name;       /**< Tag name (e.g, "min_se")  */
   tag_class_t   *tt_class;     /**< Tag class defines the type of the value */
-  tag_value_t    tt_magic;     /**< Class-specific data 
+  tag_value_t    tt_magic;     /**< Class-specific data
                                   (e.g., pointer to header class structure) */
 };
 
@@ -96,12 +96,12 @@ SOFIAPUBVAR tag_typedef_t tag_next;
 /** Any tag accepted when filtering. */
 SOFIAPUBVAR tag_typedef_t tag_any;
 
-/** Filter tag using function as argument. 
+/** Filter tag using function as argument.
  * @since New in @VERSION_1_12_2.
  */
 SOFIAPUBVAR tag_typedef_t tag_filter;
 
-/** Prototype for filtering function used with TAG_FILTER(). 
+/** Prototype for filtering function used with TAG_FILTER().
  * @since New in @VERSION_1_12_2.
  */
 typedef int tag_filter_f(tagi_t const *filter, tagi_t const *dest);
@@ -121,11 +121,11 @@ typedef int tag_filter_f(tagi_t const *filter, tagi_t const *dest);
 /** @HI Initialize a filter tag item accepting any item. */
 #define TAG_ANY()   tag_any,  (tag_value_t)0
 
-/** @HI Initialize a @a item if condition is true; 
+/** @HI Initialize a @a item if condition is true;
  * otherwise, initialize an empty tag item. */
 #define TAG_IF(condition, item) !(condition) ? tag_skip : item
 
-/** @HI Initialize a filter tag item accepting any item. 
+/** @HI Initialize a filter tag item accepting any item.
  * @since New in @VERSION_1_12_2.
  */
 #define TAG_FILTER(function)  tag_filter, tag_filter_v(function)
@@ -134,7 +134,7 @@ typedef int tag_filter_f(tagi_t const *filter, tagi_t const *dest);
 SOFIAPUBFUN int t_snprintf(tagi_t const *t, char b[], size_t size);
 
 /** Convert string to a tag value */
-SOFIAPUBFUN int t_scan(tag_type_t tt, su_home_t *home, char const *s, 
+SOFIAPUBFUN int t_scan(tag_type_t tt, su_home_t *home, char const *s,
                       tag_value_t *return_value);
 
 /* Tagarg functions */
@@ -142,7 +142,7 @@ SOFIAPUBFUN tagi_t *tl_tlist(su_home_t *, tag_type_t, tag_value_t, ...);
 SOFIAPUBFUN size_t tl_tmove(tagi_t *dst, size_t, tag_type_t, tag_value_t, ...);
 SOFIAPUBFUN int tl_gets(tagi_t const lst[], tag_type_t, tag_value_t, ...);
 SOFIAPUBFUN int tl_tgets(tagi_t lst[], tag_type_t, tag_value_t, ...);
-SOFIAPUBFUN tagi_t *tl_tfilter(su_home_t *, tagi_t const lst[], 
+SOFIAPUBFUN tagi_t *tl_tfilter(su_home_t *, tagi_t const lst[],
                               tag_type_t, tag_value_t, ...);
 SOFIAPUBFUN int tl_tremove(tagi_t lst[], tag_type_t, tag_value_t, ...);
 
@@ -162,7 +162,7 @@ SOFIAPUBFUN tagi_t *tl_filter(tagi_t *, tagi_t const filter[],
 SOFIAPUBFUN tagi_t *tl_afilter(su_home_t *, tagi_t const filter[],
                               tagi_t const lst[]);
 
-SOFIAPUBFUN tagi_t *tl_filtered_tlist(su_home_t *home, tagi_t const filter[], 
+SOFIAPUBFUN tagi_t *tl_filtered_tlist(su_home_t *home, tagi_t const filter[],
                                      tag_type_t, tag_value_t, ...);
 
 SOFIAPUBFUN size_t  tl_vlen(va_list ap);
@@ -192,7 +192,7 @@ su_inline tag_value_t tag_ptr_v(void *v) { return (tag_value_t)v; }
 su_inline tag_value_t tag_ptr_vr(void *vp, void *v)
   { (void)v; return(tag_value_t)vp; }
 su_inline tag_value_t tag_cptr_v(void const *v) { return (tag_value_t)v; }
-su_inline tag_value_t tag_cptr_vr(void *vp, void const *v) 
+su_inline tag_value_t tag_cptr_vr(void *vp, void const *v)
   { (void)v; return(tag_value_t)vp; }
 su_inline tag_value_t tag_cstr_v(char const *v) { return (tag_value_t)v; }
 su_inline tag_value_t tag_cstr_vr(char const**vp) {return(tag_value_t)vp;}
@@ -202,7 +202,7 @@ su_inline tag_value_t tag_str_vr(char const **vp) {return(tag_value_t)vp;}
 extern "C++" {
   su_inline tag_value_t tag_ptr_v(void const *v)
   { return (tag_value_t)v; }
-  su_inline tag_value_t tag_ptr_vr(void *vp, void const *p) 
+  su_inline tag_value_t tag_ptr_vr(void *vp, void const *p)
   { return (tag_value_t)vp; }
   su_inline tag_value_t tag_str_v(char *v) { return (tag_value_t)v; }
   su_inline tag_value_t tag_str_vr(char **vp) {return (tag_value_t)vp;}
index ba9d983d4c55a9bc596a002b1a89313d1b50dcac..a1f00345ba1f564a9bdc681fbf7113205b29e162 100644 (file)
 
 #ifndef SU_TAG_CLASS_H
 /** Defined when <sofia-sip/su_tag_class.h> has been included. */
-#define SU_TAG_CLASS_H 
+#define SU_TAG_CLASS_H
 
 /**@SU_TAG
  * @file  su_tag_class.h
- * @brief Tag class interface for object-oriented tags 
+ * @brief Tag class interface for object-oriented tags
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Wed Feb 21 00:49:41 2001 ppessi
  */
 
index bceda1868a771f85167c8670d4f92b8bdd3fcb1f..c60d97ff7b6b0bdfe6df1e84957981daf0595c21 100644 (file)
 
 #ifndef SU_TAG_INLINE_H
 /** Defined when <sofia-sip/su_tag_inline.h> has been included */
-#define SU_TAG_INLINE_H 
+#define SU_TAG_INLINE_H
 /**@SU_TAG
  * @file sofia-sip/su_tag_inline.h
  * Inline functions for object tags and tag lists.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Feb 20 19:48:18 2001 ppessi
  */
 
@@ -69,7 +69,7 @@ su_inline tagi_t const *t_next(tagi_t const *t)
 {
   tag_type_t tt = TAG_TYPE_OF(t);
 
-  if (tt->tt_next) 
+  if (tt->tt_next)
     return tt->tt_next(t);
   else
     return t + 1;
@@ -79,7 +79,7 @@ su_inline tagi_t *t_move(tagi_t *dst, tagi_t const *src)
 {
   tag_type_t tt = TAG_TYPE_OF(src);
 
-  if (tt->tt_move) 
+  if (tt->tt_move)
     return tt->tt_move(dst, src);
 
   *dst = *src;
@@ -90,7 +90,7 @@ su_inline size_t t_xtra(tagi_t const *t, size_t offset)
 {
   tag_type_t tt = TAG_TYPE_OF(t);
 
-  if (tt->tt_xtra) 
+  if (tt->tt_xtra)
     return tt->tt_xtra(t, offset);
 
   return 0;
@@ -100,7 +100,7 @@ su_inline tagi_t *t_dup(tagi_t *dst, tagi_t const *src, void **bb)
 {
   tag_type_t tt = TAG_TYPE_OF(src);
 
-  if (tt->tt_dup) 
+  if (tt->tt_dup)
     return tt->tt_dup(dst, src, bb);
 
   *dst = *src;
@@ -112,7 +112,7 @@ su_inline tagi_t const *t_find(tag_type_t tt, tagi_t const *lst)
   if (!tt)
     return NULL;
 
-  if (tt->tt_find) 
+  if (tt->tt_find)
     return tt->tt_find(tt, lst);
 
   for (; lst; lst = t_next(lst)) {
@@ -127,7 +127,7 @@ su_inline tagi_t *t_free(tagi_t *t)
 {
   tag_type_t tt = TAG_TYPE_OF(t);
 
-  if (tt->tt_free) 
+  if (tt->tt_free)
     return tt->tt_free(t);
   else if (tt->tt_next)
     return (tagi_t *)tt->tt_next(t);
@@ -139,7 +139,7 @@ su_inline size_t t_len(tagi_t const *t)
 {
   tag_type_t tt = TAG_TYPE_OF(t);
 
-  if (tt->tt_len) 
+  if (tt->tt_len)
     return tt->tt_len(t);
 
   return sizeof(*t);
index 2cefff003dce6c6061982cacd325dadc7c6526e6..99295f6a2f3ed95513ae36186c202f9e4621cacd 100644 (file)
 
 #ifndef SU_TAG_IO_H
 /** Defined when <sofia-sip/su_tag_io.h> has been included */
-#define SU_TAG_IO_H 
+#define SU_TAG_IO_H
 
 /**@SU_TAG
  * @file sofia-sip/su_tag_io.h
  * @brief I/O interface for tag lists
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Wed Feb 21 12:10:06 2001 ppessi
  */
 
@@ -52,8 +52,8 @@ SOFIAPUBFUN void tl_print(FILE *f, char const *title, tagi_t const lst[]);
 su_inline tag_value_t tag_socket_v(su_socket_t v) {
   return (tag_value_t)v;
 }
-su_inline tag_value_t tag_socket_vr(su_socket_t *vp) { 
-  return (tag_value_t)vp; 
+su_inline tag_value_t tag_socket_vr(su_socket_t *vp) {
+  return (tag_value_t)vp;
 }
 #else
 #define tag_socket_v(v)   (tag_value_t)(v)
index d904c65974de5264de0ea0b39d42c3045d289db5..4add4b07fec624a677c853db8ed7d6781427d179 100644 (file)
 /** Defined when <sofia-sip/su_tagarg.h> has been included. */
 #define SU_TAGARG_H
 
-/**@SU_TAG 
+/**@SU_TAG
  * @file sofia-sip/su_tagarg.h  Tagged argument lists
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Feb 20 19:48:18 2001 ppessi
  */
 
@@ -54,14 +54,14 @@ SOFIA_BEGIN_DECLS
  *
  * Such a function could be called as follows:
  * @code
- *   tag_print(stdout, 
- *             TAG_STRING("a is"), TAG_INT(a), 
+ *   tag_print(stdout,
+ *             TAG_STRING("a is"), TAG_INT(a),
  *             TAG_STRING("b is"), URLTAG_URL(b),
  *             TAG_IF(c, TAG_STRING("and c is true")),
  *             TAG_END());
  * @endcode
  *
- * @note 
+ * @note
  * The tagged argument list @b must be terminated by a TAG_END(),
  * TAG_NULL() or TAG_NEXT().
  */
@@ -180,7 +180,7 @@ typedef struct {
   (ta).tl[0].t_tag, (ta).tl[0].t_value, (ta).tl[1].t_tag, (ta).tl[1].t_value
 
 /**Handle return from function with tagged argument list
- * 
+ *
  * The ta_end() macro handles return from function whose tagged argument
  * list was initialized by ta_start().
  *
index 86221ceb83cc8614fd5ca7cbd13b1c4225a2c0b8..bb991a1deb4b6dffb19df3b926835e345ed79762 100644 (file)
@@ -26,9 +26,9 @@
 /** Defined when <sofia-sip/su_time.h> has been included. */
 #define SU_TIME_H
 /**@ingroup su_time
- * @file sofia-sip/su_time.h 
+ * @file sofia-sip/su_time.h
  * @brief Time types and functions.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  *
 
 SOFIA_BEGIN_DECLS
 
-/** Time in seconds and microsecondcs. 
+/** Time in seconds and microsecondcs.
  *
  * The structure su_time_t contains time in seconds and microseconds since
  * epoch (January 1, 1900).
  */
-struct su_time_s { 
+struct su_time_s {
   unsigned long tv_sec;                /**< Seconds */
   unsigned long tv_usec;       /**< Microseconds  */
 };
 /** Time in seconds and microsecondcs. */
 typedef struct su_time_s su_time_t;
 
-/** Time difference in microseconds. 
- * 
+/** Time difference in microseconds.
+ *
  * The type su_duration_t is used to present small time differences (24
  * days), usually calculated between two su_time_t timestamps.  Note that
  * the su_duration_t is signed.
  */
 typedef long su_duration_t;
 
-enum { 
+enum {
   /** Maximum duration in milliseconds. */
-  SU_DURATION_MAX = 0x7fffffffL 
+  SU_DURATION_MAX = 0x7fffffffL
 };
 #define SU_DURATION_MAX SU_DURATION_MAX
 
-/** NTP timestamp. 
- * 
- * NTP timestamp is defined as microseconds since epoch (1-Jan-1900) 
+/** NTP timestamp.
+ *
+ * NTP timestamp is defined as microseconds since epoch (1-Jan-1900)
  * with 64-bit resolution.
  */
 typedef uint64_t su_ntp_t;
@@ -79,11 +79,11 @@ typedef uint64_t su_ntp_t;
 #define SU_TIME_CMP(t1, t2) su_time_cmp(t1, t2)
 
 /** Seconds from 1.1.1900 to 1.1.1970. @NEW_1_12_4. */
-#define SU_TIME_EPOCH 2208988800UL 
+#define SU_TIME_EPOCH 2208988800UL
 
 typedef uint64_t su_nanotime_t;
 
-#define SU_E9 (1000000000U) 
+#define SU_E9 (1000000000U)
 
 SOFIAPUBFUN su_nanotime_t su_nanotime(su_nanotime_t *return_time);
 SOFIAPUBFUN su_nanotime_t su_monotime(su_nanotime_t *return_time);
@@ -116,7 +116,7 @@ su_inline uint32_t su_ntp_fraq(su_time_t t)
 {
   /*
    * Multiply usec by 0.065536 (ie. 2**16 / 1E6)
-   * 
+   *
    * Utilize fact that 0.065536 == 1024 / 15625
    */
   return (t.tv_sec << 16) + (1024 * t.tv_usec + 7812) / 15625;
index ddac475d27cb0cd4a9529d285425b58b14da02a6..f7b9cef22956fefc1ccfd8eac4e50aa0e0e9ffa6 100644 (file)
@@ -28,7 +28,7 @@
 /**@file sofia-sip/su_types.h Basic integer types for @b su library.
  *
  * This include file provides <stdint.h> or <inttypes.h> types.
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
@@ -79,21 +79,21 @@ typedef SU_INTPTR_T intptr_t;
 typedef unsigned SU_INTPTR_T uintptr_t;
 #endif
 
-/** 64-bit unsigned integer */ 
+/** 64-bit unsigned integer */
 typedef SU_U64_T uint64_t;
-/** 64-bit signed integer */   
+/** 64-bit signed integer */
 typedef SU_S64_T int64_t;
-/** 32-bit unsigned integer */ 
+/** 32-bit unsigned integer */
 typedef SU_U32_T uint32_t;
-/** 32-bit signed integer */   
+/** 32-bit signed integer */
 typedef SU_S32_T int32_t;
-/** 16-bit unsigned integer */ 
+/** 16-bit unsigned integer */
 typedef SU_U16_T uint16_t;
-/** 16-bit signed integer */   
+/** 16-bit signed integer */
 typedef SU_S16_T int16_t;
-/** 8-bit unsigned integer */  
+/** 8-bit unsigned integer */
 typedef SU_U8_T  uint8_t;
-/** 8-bit signed integer */    
+/** 8-bit signed integer */
 typedef SU_S8_T  int8_t;
 
 /** At least 64-bit integer */
@@ -119,9 +119,9 @@ typedef SOFIA_SSIZE_T ssize_t;
 #endif
 
 #ifdef SOFIA_ISIZE_T
-/** Compatibility type. 
+/** Compatibility type.
  *
- * sofia-sip <= 1.12.1 often used int for count of bytes. 
+ * sofia-sip <= 1.12.1 often used int for count of bytes.
  * When configured for compatibility with sofia-sip 1.12.0, this is defined
  * as int, otherwise as size_t. Note that int is signed and size_t is
  * unsigned.
@@ -134,9 +134,9 @@ typedef size_t isize_t;
 #endif
 
 #ifdef SOFIA_ISSIZE_T
-/**Compatibility type. 
+/**Compatibility type.
  *
- * sofia-sip <= 1.12.1 used int for count of bytes. 
+ * sofia-sip <= 1.12.1 used int for count of bytes.
  * When configured for compatibility with sofia-sip 1.12.0, this is defined
  * as int, otherwise as ssize_t. (-1 is used for error indication).
  *
@@ -148,9 +148,9 @@ typedef ssize_t issize_t;
 #endif
 
 #ifdef SOFIA_USIZE_T
-/**Compatibility type. 
+/**Compatibility type.
  *
- * sofia-sip <= 1.12.1 sometimes used unsigned int for count of bytes. 
+ * sofia-sip <= 1.12.1 sometimes used unsigned int for count of bytes.
  * When configured for compatibility with sofia-sip 1.12.0, this is defined
  * as unsigned int, otherwise as size_t.
  *
index 53fd8fc9d1ec88d2021cf7fea9224a87c7edcad0..0afedce10f2cecee12b4c07620f44c72341f8da8 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef SU_UNIQUEID_H
 /** Defined when <sofia-sip/su_uniqueid.h> has been included. */
-#define SU_UNIQUEID_H 
+#define SU_UNIQUEID_H
 
 
 /**@ingroup su_uniqueid
@@ -33,7 +33,7 @@
  * Functions to handle GloballyUniqueIDs.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Apr 15 06:31:41 1997 pessi
  *
  */
@@ -45,8 +45,8 @@
 SOFIA_BEGIN_DECLS
 
 /** Globally unique identifier type. */
-typedef union GloballyUniqueIdentifier { 
-  unsigned char id[16]; 
+typedef union GloballyUniqueIdentifier {
+  unsigned char id[16];
   struct {
     uint32_t  time_low;
     uint16_t  time_mid;
@@ -60,8 +60,8 @@ typedef union GloballyUniqueIdentifier {
 /** Return node identifier */
 SOFIAPUBFUN size_t su_node_identifier(void *address, size_t addrlen);
 
-/** Generate a GUID 
- * 
+/** Generate a GUID
+ *
  * The function guid_generate() generates a new globally unique identifier
  * for an IP telephony call.  The guid follows the structure specified in
  * the ITU-T recommendation H.225.0 v2.  The guid is usable also in SIP
@@ -78,19 +78,19 @@ SOFIAPUBFUN void su_guid_generate(su_guid_t *guid);
  * H.225.0 v2.  The printed identifier can be used as a SIP @b Call-ID if
  * the colons in IEEE MAC address are replaced with '-', '+' or other
  * character allowed in SIP @e token.
- * 
+ *
  * @param buf  [out] buffer to store the formatted globally unique identifier
  * @param len  [in] size of buffer @a buf (should be at least guid_strlen bytes)
  * @param guid [in] pointer to structure containing globally unique identifier
- * 
- * @retval 
+ *
+ * @retval
  * The function guid_sprintf() returns length of the formatted
  * globally unique identifier excluding the final NUL.
  */
 SOFIAPUBFUN isize_t su_guid_sprintf(char* buf, size_t len, su_guid_t const *guid);
 
-enum { 
-  /** Length of guid in hex format */ 
+enum {
+  /** Length of guid in hex format */
   su_guid_strlen = 8 + 5 + 5 + 5 + 13
 };
 
@@ -102,7 +102,7 @@ enum {
  * @param lb [in] lower bound
  * @param ub [in] upper bound
  *
- * @return 
+ * @return
 * The function randint() returns a pseudo-random integer.
  */
 SOFIAPUBFUN int su_randint(int lb, int ub);
index b52f2495f78bce05e125aa5ed2444acd33043553..297d271beed97fc8f95268b0318c54342860c82f 100644 (file)
@@ -28,9 +28,9 @@
 
 /**@file sofia-sip/su_vector.h
  * @brief Vector interface
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Fri Sep 27 14:31:15 2002 ppessi
  */
 
index f8453baf8d9b9ddd635eb81545782c95e9b9fb47..d8d8ae2be2c6c81e830189aceeddf6eeadcc1549 100644 (file)
@@ -31,7 +31,7 @@
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Martti Mela <Martti.Mela@nokia.com>
- * 
+ *
  * @date Created: Tue Sep 14 15:51:04 1999 ppessi
  */
 
@@ -236,8 +236,8 @@ f * #include <sofia-sip/su_wait.h>
 typedef SU_ROOT_MAGIC_T su_root_magic_t;
 
 #ifndef SU_WAKEUP_ARG_T
-/**Default type of @link ::su_wakeup_f wakeup function @endlink 
- * @link ::su_wakeup_arg_t argument type @endlink.  
+/**Default type of @link ::su_wakeup_f wakeup function @endlink
+ * @link ::su_wakeup_arg_t argument type @endlink.
  *
  * The application can define the typedef ::su_wakeup_arg_t by defining
  * the SU_WAKEUP_ARG_T () before including <sofia-sip/su_wait.h>, for example,
@@ -249,7 +249,7 @@ typedef SU_ROOT_MAGIC_T su_root_magic_t;
 #define SU_WAKEUP_ARG_T void
 #endif
 
-/** @link ::su_wakeup_f Wakeup callback @endlink argument type. 
+/** @link ::su_wakeup_f Wakeup callback @endlink argument type.
  *
  * The application can define the typedef ::su_wakeup_arg_t by defining
  * the SU_WAKEUP_ARG_T () before including <sofia-sip/su_wait.h>, for example,
@@ -260,7 +260,7 @@ typedef SU_ROOT_MAGIC_T su_root_magic_t;
  */
 typedef SU_WAKEUP_ARG_T su_wakeup_arg_t;
 
-/** Wakeup callback function pointer type. 
+/** Wakeup callback function pointer type.
  *
  * Whenever a registered wait object receives an event, the @link
  * ::su_wakeup_f callback function @endlink is invoked.
@@ -269,7 +269,7 @@ typedef int (*su_wakeup_f)(su_root_magic_t *,
                           su_wait_t *,
                           su_wakeup_arg_t *arg);
 
-enum { 
+enum {
   su_pri_normal,               /**< Normal priority */
   su_pri_first,                        /**< Elevated priority */
   su_pri_realtime              /**< Real-time priority */
@@ -310,9 +310,9 @@ SOFIAPUBVAR int su_root_size_hint;
 typedef SU_PREPOLL_MAGIC_T su_prepoll_magic_t;
 
 
-/** Pre-poll callback function prototype. 
+/** Pre-poll callback function prototype.
+ *
  *
- * 
  */
 typedef void su_prepoll_f(su_prepoll_magic_t *, su_root_t *);
 
@@ -327,7 +327,7 @@ typedef void su_prepoll_f(su_prepoll_magic_t *, su_root_t *);
 /** Default type of timer expiration callback function argument type.
  * Application may define this to appropriate type before including
  * <sofia-sip/su_wait.h>. */
-#define SU_TIMER_ARG_T void 
+#define SU_TIMER_ARG_T void
 #endif
 
 /** Timer object type. */
@@ -337,7 +337,7 @@ typedef struct su_timer_s su_timer_t;
 typedef SU_TIMER_ARG_T su_timer_arg_t;
 
 /** Timeout function type. */
-typedef void (*su_timer_f)(su_root_magic_t *magic, 
+typedef void (*su_timer_f)(su_root_magic_t *magic,
                           su_timer_t *t,
                           su_timer_arg_t *arg);
 
@@ -372,7 +372,7 @@ typedef _su_task_t const *_su_task_r;
 /** Default type of su_msg_t message data.  Application may define this to
  * appropriate type before including <sofia-sip/su_wait.h>.
  */
-#define SU_MSG_ARG_T void 
+#define SU_MSG_ARG_T void
 #endif
 
 /** Message argument type. */
@@ -394,7 +394,7 @@ typedef su_msg_t * const su_msg_cr[1];
 #define SU_MSG_R_INIT   { NULL }
 
 /** Message delivery function type. */
-typedef void su_msg_function(su_root_magic_t *magic, 
+typedef void su_msg_function(su_root_magic_t *magic,
                             su_msg_r msg,
                             su_msg_arg_t *arg);
 
@@ -454,14 +454,14 @@ SOFIAPUBFUN void su_root_destroy(su_root_t*);
 SOFIAPUBFUN char const *su_root_name(su_root_t *self);
 SOFIAPUBFUN int su_root_set_magic(su_root_t *self, su_root_magic_t *magic);
 SOFIAPUBFUN su_root_magic_t *su_root_magic(su_root_t *root);
-SOFIAPUBFUN int su_root_register(su_root_t*, su_wait_t *, 
+SOFIAPUBFUN int su_root_register(su_root_t*, su_wait_t *,
                                 su_wakeup_f, su_wakeup_arg_t *,
                                 int priority);
 /* This is slow. Deprecated. */
-SOFIAPUBFUN int su_root_unregister(su_root_t*, su_wait_t *, 
+SOFIAPUBFUN int su_root_unregister(su_root_t*, su_wait_t *,
                                   su_wakeup_f, su_wakeup_arg_t*);
 SOFIAPUBFUN int su_root_deregister(su_root_t*, int);
-SOFIAPUBFUN int su_root_eventmask(su_root_t *, 
+SOFIAPUBFUN int su_root_eventmask(su_root_t *,
                                  int index, int socket, int events);
 SOFIAPUBFUN su_duration_t su_root_step(su_root_t *root, su_duration_t timeout);
 SOFIAPUBFUN su_duration_t su_root_sleep(su_root_t *root, su_duration_t);
@@ -471,8 +471,8 @@ SOFIAPUBFUN void su_root_break(su_root_t *root);
 SOFIAPUBFUN _su_task_r su_root_task(su_root_t const *root);
 SOFIAPUBFUN _su_task_r su_root_parent(su_root_t const *root);
 
-SOFIAPUBFUN int su_root_add_prepoll(su_root_t *root, 
-                                   su_prepoll_f *, 
+SOFIAPUBFUN int su_root_add_prepoll(su_root_t *root,
+                                   su_prepoll_f *,
                                    su_prepoll_magic_t *);
 SOFIAPUBFUN int su_root_remove_prepoll(su_root_t *root);
 
@@ -494,13 +494,13 @@ SOFIAPUBFUN int su_timer_set_interval(su_timer_t *t, su_timer_f,
 SOFIAPUBFUN int su_timer_set_at(su_timer_t *, su_timer_f,
                                su_timer_arg_t *, su_time_t);
 SOFIAPUBFUN int su_timer_run(su_timer_t *, su_timer_f, su_timer_arg_t *);
-SOFIAPUBFUN int su_timer_set_for_ever(su_timer_t *, su_timer_f, 
+SOFIAPUBFUN int su_timer_set_for_ever(su_timer_t *, su_timer_f,
                                      su_timer_arg_t *);
 SOFIAPUBFUN int su_timer_reset(su_timer_t *);
 
 SOFIAPUBFUN su_root_t *su_timer_root(su_timer_t const *);
 
-SOFIAPUBFUN int su_timer_expire(su_timer_queue_t * const, 
+SOFIAPUBFUN int su_timer_expire(su_timer_queue_t * const,
                                su_duration_t *tout,
                                su_time_t now);
 
@@ -526,7 +526,7 @@ SOFIAPUBFUN int su_task_execute(su_task_r const task,
 
 /* Messages */
 SOFIAPUBFUN int su_msg_create(su_msg_r msg,
-                             su_task_r const to, su_task_r const from, 
+                             su_task_r const to, su_task_r const from,
                              su_msg_f wakeup, isize_t size);
 SOFIAPUBFUN int su_msg_report(su_msg_r msg, su_msg_f report);
 SOFIAPUBFUN int su_msg_deinitializer(su_msg_r msg, su_msg_deinit_function *);
@@ -543,7 +543,7 @@ SOFIAPUBFUN int su_msg_send(su_msg_r msg);
 
 SOFIAPUBFUN int su_msg_new(su_msg_r msg, size_t size);
 SOFIAPUBFUN int su_msg_send_to(su_msg_r msg,
-                              su_task_r const to, 
+                              su_task_r const to,
                               su_msg_f wakeup);
 
 /** Does reference contain a message? */
@@ -559,10 +559,10 @@ int su_msg_is_non_null(su_msg_cr msg)
 
 /* Clones */
 SOFIAPUBFUN int su_root_threading(su_root_t *self, int enable);
-SOFIAPUBFUN int su_clone_start(su_root_t *root, 
+SOFIAPUBFUN int su_clone_start(su_root_t *root,
                               su_clone_r,
                               su_root_magic_t *magic,
-                              su_root_init_f, 
+                              su_root_init_f,
                               su_root_deinit_f);
 SOFIAPUBFUN _su_task_r su_clone_task(su_clone_r);
 SOFIAPUBFUN void su_clone_forget(su_clone_r);
index 8c1f8e0fe4357dba617c53df4025138e52a57c6f..e3bf348c71301e173768934cf44423efc1fefb7a 100644 (file)
 /**@file sofia-sip/tstdef.h Macros for unit tests
  *
  * The macros defined here can be used by unit test programs. When a test
- * fails, the TEST macros print the offending file name and line number. 
+ * fails, the TEST macros print the offending file name and line number.
  * They use format that is accepted by Emacs and other fine editors so you
  * can directly go to the source code of the failed test with next-error.
- * 
- * @note There is no protection agains multiple inclusion. 
+ *
+ * @note There is no protection agains multiple inclusion.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Wed Aug 22 13:53:24 2001 ppessi
  *
  * @par Example Program
  *
  * You should typedef longlong to integer type at least 64 bit wide before
  * including <sofia-sip/tstdef.h>, too.
- * 
+ *
  * As an example, we provide a test program making sure that inet_ntop() and
  * inet_pton() behave as expected and that we can create UDP/IPv4 sockets
  * with @b su library:
  *
  * @code
  * #include "config.h"
- * 
+ *
  * #include <stdio.h>
  * #include <limits.h>
- * 
+ *
  * #include <sofia-sip/su.h>
- * 
+ *
  * #define TSTFLAGS tstflags
  *
  * #include <stdlib.h>
  * #include <sofia-sip/tstdef.h>
  *
  * static int tstflags = 0;
- * 
+ *
  * void usage(void)
  * {
  *   fprintf(stderr, "usage: %s [-v|--verbatim]\n", name);
  *   exit(2);
  * }
- * 
+ *
  * static int socket_test(void);
- * 
+ *
  * int main(int argc, char *argv[])
  * {
  *   int retval = 0, i;
- * 
+ *
  *   for (i = 1; argv[i]; i++) {
  *     if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbatim") == 0)
  *       tstflags |= tst_verbatim;
  *     else
  *       usage();
  *   }
- * 
+ *
  *   retval |= socket_test(); fflush(stdout);
- * 
+ *
  *   return retval;
  * }
- * 
+ *
  * double max_bandwidth()
  *
  * int socket_test(void)
  *   unsigned long addr;
  *
  *   BEGIN();
- * 
+ *
  *   // Check inet_ntop() return value (Tests equality of integral values)
  *   TEST(inet_ntop(AF_INET, &localhost, buf, sizeof buf), buf);
- * 
+ *
  *   // Check inet_ntop() result (Tests equality of strings)
  *   TEST_S(buf, "127.0.0.1");
- * 
+ *
  *   // Check inet_pton() argument validation (Tests equality of ints)
  *   TEST(inet_pton(0, buf, &addr), -1);
- * 
+ *
  *   // Check inet_pton() return value (Tests for true value (non-zero))
  *   TEST_1(inet_pton(AF_INET, buf, &addr) > 0);
- * 
+ *
  *   // Check inet_pton() result (Tests equality of memory areas)
  *   TEST_M(&addr, &localhost, sizeof(addr));
  *
@@ -158,7 +158,7 @@ enum {
 /** End a test function. @HIDE */
 #define END() (void) tstdef_dummy; } END_(TSTFLAGS)
 /**Test that @a suite returns a nonzero value.
- * @deprecated Use TEST_1() 
+ * @deprecated Use TEST_1()
  * @HIDE */
 #define TEST0(suite) TEST_1_(TSTFLAGS, suite)
 /** Test that @a suite returns a nonzero value. @HIDE */
index 537b65ebad71b092feec91e264b277312dce96e6..8c28f25d35fe146866981accecf4ecef703f7c26 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@internal @file strcasestr.c
  * @brief Backup implementation of strcasestr()
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  */
 
@@ -67,7 +67,7 @@ char *strcasestr(const char *haystack,
       }
     }
     haystack++;
-  } 
+  }
 
   return NULL;         /* Not found */
 }
index 5a1afcd674ee270900a7e3e2fc67994a61898821..c4854aaeac1f02fd1b38d9bb898499bacdb8adbd 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * strtoull.c --
  *
  *     Source code for the "strtoull" library procedure.
@@ -8,7 +8,7 @@
  *
 The following license.terms for information on usage and redistribution
 of this individual file, and for a DISCLAIMER OF ALL WARRANTIES.
+
 This software is copyrighted by the Regents of the University of
 California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
 Corporation and other parties.  The following terms apply to all files
@@ -40,7 +40,7 @@ MODIFICATIONS.
 
 GOVERNMENT USE: If you are acquiring this software on behalf of the
 U.S. government, the Government shall have only "Restricted Rights"
-in the software and related documentation as defined in the Federal 
+in the software and related documentation as defined in the Federal
 Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
 are acquiring the software on behalf of the Department of Defense, the
 software shall be classified as "Commercial Computer Software" and the
@@ -48,7 +48,7 @@ Government shall have only "Restricted Rights" as defined in Clause
 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
 authors grant the U.S. Government and others acting in its behalf
 permission to use and distribute the software in accordance with the
-terms specified in this license. 
+terms specified in this license.
  */
 
 #include "config.h"
@@ -132,7 +132,7 @@ strtoull(const char *string, char **endPtr, int base)
      * If no base was provided, pick one from the leading characters
      * of the string.
      */
-    
+
     if (base == 0) {
        if (*p == '0') {
            p += 1;
index 4ee9fe4a85a383c307dc6f56ed740bd5be4a6c80..250b5d62d1ea064159511ea65bbc4c5c9381e18e 100644 (file)
 
 /**@ingroup su_socket
  * @CFILE su.c OS-independent socket functions
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
 
-#include "config.h" 
+#include "config.h"
 
 #if HAVE_SYS_SOCKIO_H
 #include <sys/sockio.h>
@@ -68,12 +68,12 @@ extern int su_get_local_ip_addr(su_sockaddr_t *su);
 
 /** Create a socket endpoint for communication.
  *
- * @param af addressing family 
- * @param socktype socket type 
+ * @param af addressing family
+ * @param socktype socket type
  * @param proto protocol number specific to the addressing family
  *
  * The newly created socket is nonblocking unless global variable
- * su_socket_blocking is set to true. 
+ * su_socket_blocking is set to true.
  *
  * Also, the newly created socket is closed on exec() if global variable
  * su_socket_close_on_exec is set to true. Note that a multithreaded program
@@ -109,7 +109,7 @@ su_socket_t su_socket(int af, int socktype, int proto)
 
   /* Assign socket to an already active access point (interface) */
   ioctl(s, SIOCSIFNAME, &ifr);
-  ioctl(s, SIOCIFSTART, &ifr); 
+  ioctl(s, SIOCIFSTART, &ifr);
 #endif
 
   return s;
@@ -123,7 +123,7 @@ void *aConnection;
 extern void *su_localinfo_ap_set(su_sockaddr_t *su, int *index);
 extern int su_localinfo_ap_deinit(void *aconn);
 #define NUMIFS 64
-  
+
 int su_localinfo_ap_name_to_index(int ap_index)
 {
   struct ifconf ifc;
@@ -136,7 +136,7 @@ int su_localinfo_ap_name_to_index(int ap_index)
   s= socket(AF_INET, SOCK_STREAM, 0);
   if (s < 0)
     return -1;
-  
+
   ifc.ifc_len = NUMIFS * sizeof (struct ifreq);
 
   memset(buf, 0, ifc.ifc_len);
@@ -179,12 +179,12 @@ return -1;
 #error Unknown index field in struct ifreq
 #endif
 
-    if (ap_index == if_index) 
+    if (ap_index == if_index)
     {
       strncpy(su_global_ap_name, (const char *) if_name, sizeof(su_global_ap_name));
       error = 0;
     };
-  
+
 #else
 #error su_localinfo() cannot map interface name to number
 #endif
@@ -200,8 +200,8 @@ return -1;
 /** Initialize socket implementation.
  *
  * Before using any sofia-sip-ua functions, the application should call
- * su_init() in order to initialize run-time environment including sockets. 
- * This function may prepare plugins if there are any. 
+ * su_init() in order to initialize run-time environment including sockets.
+ * This function may prepare plugins if there are any.
  *
  * @par POSIX Implementation
  * The su_init() initializes debugging logs and ignores the SIGPIPE signal.
@@ -260,7 +260,7 @@ int su_setblocking(su_socket_t s, int blocking)
   if (mode < 0)
      return -1;
 
-  if (blocking) 
+  if (blocking)
     mode &= ~(O_NDELAY | O_NONBLOCK);
   else
     mode |= O_NDELAY | O_NONBLOCK;
@@ -320,7 +320,7 @@ int su_is_blocking(int errcode)
 int su_setblocking(su_socket_t s, int blocking)
 {
   unsigned long nonBlock = !blocking;
-  
+
   return ioctlsocket(s, FIONBIO, &nonBlock);
 }
 
@@ -350,7 +350,7 @@ int su_getsocktype(su_socket_t s)
 
 int su_setreuseaddr(su_socket_t s, int reuse)
 {
-  return setsockopt(s, SOL_SOCKET, SO_REUSEADDR, 
+  return setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
                    (void *)&reuse, (socklen_t)sizeof(reuse));
 }
 
@@ -442,7 +442,7 @@ ssize_t su_recvfrom(su_socket_t s, void *buffer, size_t length, int flags,
   if (length > INT_MAX)
     length = INT_MAX;
 
-  retval = recvfrom(s, buffer, (int)length, flags, 
+  retval = recvfrom(s, buffer, (int)length, flags,
                    &from->su_sa, fromlen ? &ilen : NULL);
 
   if (fromlen)
@@ -458,7 +458,7 @@ issize_t su_vsend(su_socket_t s,
 {
   int ret;
   DWORD bytes_sent = (DWORD)su_failure;
-  
+
   ret = WSASendTo(s,
                  (LPWSABUF)iov,
                  (DWORD)iovlen,
@@ -552,13 +552,13 @@ int su_cmp_sockaddr(su_sockaddr_t const *a, su_sockaddr_t const *b)
 
   if ((rv = a->su_family - b->su_family))
     return rv;
-  
+
   if (a->su_family == AF_INET)
-    rv = memcmp(&a->su_sin.sin_addr, &b->su_sin.sin_addr, 
+    rv = memcmp(&a->su_sin.sin_addr, &b->su_sin.sin_addr,
                sizeof(struct in_addr));
 #if SU_HAVE_IN6
   else if (a->su_family == AF_INET6)
-    rv = memcmp(&a->su_sin6.sin6_addr, &b->su_sin6.sin6_addr, 
+    rv = memcmp(&a->su_sin6.sin6_addr, &b->su_sin6.sin6_addr,
                sizeof(struct in6_addr));
 #endif
   else
@@ -566,7 +566,7 @@ int su_cmp_sockaddr(su_sockaddr_t const *a, su_sockaddr_t const *b)
 
   if (rv)
     return rv;
-  
+
   return a->su_port - b->su_port;
 }
 
@@ -592,7 +592,7 @@ int su_match_sockaddr(su_sockaddr_t const *a, su_sockaddr_t const *b)
   if (a->su_family == 0 || SU_SOCKADDR_INADDR_ANY(a))
     ;
   else if (a->su_family == AF_INET) {
-    if (memcmp(&a->su_sin.sin_addr, &b->su_sin.sin_addr, 
+    if (memcmp(&a->su_sin.sin_addr, &b->su_sin.sin_addr,
               sizeof(struct in_addr)))
       return 0;
   }
@@ -600,7 +600,7 @@ int su_match_sockaddr(su_sockaddr_t const *a, su_sockaddr_t const *b)
   else if (a->su_family == AF_INET6) {
     if (a->su_scope_id != 0 && a->su_scope_id != b->su_scope_id)
       return 0;
-    if (memcmp(&a->su_sin6.sin6_addr, &b->su_sin6.sin6_addr, 
+    if (memcmp(&a->su_sin6.sin6_addr, &b->su_sin6.sin6_addr,
               sizeof(struct in6_addr)))
       return 0;
   }
@@ -610,7 +610,7 @@ int su_match_sockaddr(su_sockaddr_t const *a, su_sockaddr_t const *b)
 
   if (a->su_port == 0)
     return 1;
-  
+
   return a->su_port == b->su_port;
 }
 
@@ -624,10 +624,10 @@ void su_canonize_sockaddr(su_sockaddr_t *su)
   if (!IN6_IS_ADDR_V4MAPPED(&su->su_sin6.sin6_addr) &&
       !IN6_IS_ADDR_V4COMPAT(&su->su_sin6.sin6_addr))
     return;
-  
+
   su->su_family = AF_INET;
   su->su_array32[1] = su->su_array32[5];
-  su->su_array32[2] = 0; 
+  su->su_array32[2] = 0;
   su->su_array32[3] = 0;
 #endif
 }
index 6a26dad7c53335a48901923e809e33a799f2f605..70416e56187afb1ce101f02f44c2481d58b2ceb2 100644 (file)
@@ -6,11 +6,11 @@
  *
  * The @b su module contains a simple, portable socket/timing/synchronizing
  * library developed for Sofia communications software.
- * 
+ *
  * @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @STATUS @SofiaSIP Core library
- * 
+ *
  * @LICENSE LGPL
  *
  * @section su_overview Overview
@@ -19,9 +19,9 @@
  *
  * - <sofia-sip/su_types.h> - integral types
  * - <sofia-sip/su_alloc.h> - @ref su_alloc memory management
- * - <sofia-sip/su.h> - @ref su_socket 
+ * - <sofia-sip/su.h> - @ref su_socket
  *   - <sofia-sip/su_localinfo.h> - get list of local IP addresses
- * - <sofia-sip/su_wait.h> - @ref su_wait 
+ * - <sofia-sip/su_wait.h> - @ref su_wait
  * - <sofia-sip/su_time.h> - @ref su_time
  * - <sofia-sip/su_log.h> - @ref su_log
  * - <sofia-sip/su_tag.h> - @ref su_tag
  * - <a href=group_su_alloc.html>su_alloc</a> - memory management functions
  * - <a href=group_su_log.html>su_log</a> - generic logging functions
  * - <a href=group_su_tag.html>su_tag</a> - tag list function
- * - <a href=group_su_md5.html>su_md5</a> - MD5 hashing 
+ * - <a href=group_su_md5.html>su_md5</a> - MD5 hashing
  */
 
 /**@defgroup su_programs Shell Programs
- * 
+ *
  * The @b su module provides few shell utilities:
  * - @ref localinfo (localinfo.c)
- * - @ref addrinfo (addrinfo.c) 
+ * - @ref addrinfo (addrinfo.c)
  */
 
 /**@defgroup su_socket Socket Functions
  *
- *  @brief The <sofia-sip/su.h> contains the portable socket functions. 
+ *  @brief The <sofia-sip/su.h> contains the portable socket functions.
  *
  *  The <sofia-sip/su.h> contains following functions, macros, and types:
  *    - su_init(): initializes sockets
@@ -84,7 +84,7 @@
  *    - su_ioctl(): ioctl to a socket
  *    - su_setreuseaddr(): set/reset reusing the addresses/ports for a socket
  *    - su_setblocking(): enables/disables blocking
- *    - su_is_blocking(): checks if the previous call failed because it 
+ *    - su_is_blocking(): checks if the previous call failed because it
  *     would have blocked
  *    - su_errno(): the latest socket error
  *    - su_perror(): prints the latest socket error message to stderr
index 0b6d7acbf2cd6148adec285cb35fddf62098b3e1..c8005c0e1a78add9801c2543633d8523673bc1eb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,7 +13,7 @@
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -83,7 +83,7 @@ static const char in6_addrany[] = {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 
 };
-static const char in_loopback[] = { 127, 0, 0, 1 }; 
+static const char in_loopback[] = { 127, 0, 0, 1 };
 static const char in6_loopback[] = {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
 };
@@ -100,7 +100,7 @@ static struct gai_afd {
        int a_socklen;
        int a_off;
        const char *a_addrany;
-       const char *a_loopback; 
+       const char *a_loopback;
 } gai_afdl [] = {
 #if SU_HAVE_IN6
 #define N_INET6 0
@@ -142,7 +142,7 @@ static int get_name(const char *, struct gai_afd *,
 static int get_addr(const char *, int, struct addrinfo **,
                    struct addrinfo *, int);
 static int str_isnumber(const char *);
-       
+
 #define GET_CANONNAME(ai, str) \
 if (pai->ai_flags & AI_CANONNAME) {\
        if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\
@@ -243,7 +243,7 @@ getaddrinfo(hostname, servname, hints, res)
        pai->ai_addr = NULL;
        pai->ai_next = NULL;
        port = GAI_ANY;
-       
+
        if (hostname == NULL && servname == NULL)
                return EAI_NONAME;
        if (hints) {
@@ -373,7 +373,7 @@ getaddrinfo(hostname, servname, hints, res)
                        }
                }
        }
-       
+
        /*
         * hostname == NULL.
         * passive socket -> anyaddr (0.0.0.0 or ::)
@@ -408,7 +408,7 @@ getaddrinfo(hostname, servname, hints, res)
                else
                        ERR(EAI_FAMILY);
        }
-       
+
        /* hostname as numeric name */
        for (i = 0; gai_afdl[i].a_af; i++) {
                if (su_inet_pton(gai_afdl[i].a_af, hostname, pton)) {
@@ -432,7 +432,7 @@ getaddrinfo(hostname, servname, hints, res)
                                break;
 #endif
                        }
-                       
+
                        if (pai->ai_family == gai_afdl[i].a_af ||
                            pai->ai_family == PF_UNSPEC) {
                                if (! (pai->ai_flags & AI_CANONNAME)) {
@@ -450,7 +450,7 @@ getaddrinfo(hostname, servname, hints, res)
                                 */
                                get_name(pton, &gai_afdl[i], &top, pton, pai, port);
                                goto good;
-                       } else 
+                       } else
                                ERR(EAI_FAMILY);        /*xxx*/
                }
        }
@@ -489,7 +489,7 @@ get_name(addr, gai_afd, res, numaddr, pai, port0)
        struct hostent *hp;
        struct addrinfo *cur;
        int error = 0, h_error;
-       
+
 #if SU_HAVE_IN6
        hp = getipnodebyaddr(addr, gai_afd->a_addrlen, gai_afd->a_af, &h_error);
 #else
@@ -500,7 +500,7 @@ get_name(addr, gai_afd, res, numaddr, pai, port0)
                GET_CANONNAME(cur, hp->h_name);
        } else
                GET_AI(cur, gai_afd, numaddr, port);
-       
+
 #if SU_HAVE_IN6
        if (hp)
                freehostent(hp);
@@ -568,7 +568,7 @@ get_addr(hostname, af, res, pai, port0)
        if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
            (hp->h_addr_list[0] == NULL))
                ERR(EAI_FAIL);
-       
+
        for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
                switch (af) {
 #if SU_HAVE_IN6
@@ -700,7 +700,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
 #else
        len = salen;
 #endif
-       
+
        family = sa->sa_family;
        for (i = 0; gni_afdl[i].a_af; i++)
                if (gni_afdl[i].a_af == family) {
@@ -708,10 +708,10 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
                        goto found;
                }
        return ENI_FAMILY;
-       
+
  found:
        if (len != gni_afd->a_socklen) return ENI_SALEN;
-       
+
        port = ((struct gni_sockinet *)sa)->si_port; /* network byte order */
        addr = (char *)sa + gni_afd->a_off;
 
@@ -739,7 +739,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
                        flags |= NI_NUMERICHOST;
                v4a >>= IN_CLASSA_NSHIFT;
                if (v4a == 0 || v4a == IN_LOOPBACKNET)
-                       flags |= NI_NUMERICHOST;                        
+                       flags |= NI_NUMERICHOST;
                break;
 #if SU_HAVE_IN6
        case AF_INET6:
@@ -799,7 +799,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
 #endif /* !HAVE_GETNAMEINFO */
 
 #if !HAVE_FREEADDRINFO
-static 
+static
 void
 freeaddrinfo(ai)
        struct addrinfo *ai;
@@ -820,13 +820,13 @@ freeaddrinfo(ai)
 #endif
 
 #if !HAVE_GAI_STRERROR
-static 
+static
 char *
 gai_strerror(ecode)
        int ecode;
 {
   switch (ecode) {
-  case 0: 
+  case 0:
     return "success.";
 #if defined(EAI_ADDRFAMILY)
   case EAI_ADDRFAMILY:
@@ -908,7 +908,7 @@ int su_getaddrinfo(char const *node, char const *service,
     int socktype;
 
     socktype = hints->ai_socktype;
-    
+
     if (!(socktype == 0 ||
          socktype == SOCK_SEQPACKET ||
          socktype == SOCK_STREAM ||
@@ -950,7 +950,7 @@ int su_getaddrinfo(char const *node, char const *service,
        continue;
       }
 
-      if (ai->ai_family != AF_INET 
+      if (ai->ai_family != AF_INET
 #if SU_HAVE_IN6
          && ai->ai_family != AF_INET6
 #endif
@@ -992,7 +992,7 @@ su_getnameinfo(const su_sockaddr_t *su, size_t sulen,
               int flags)
 {
   return getnameinfo(&su->su_sa, (socklen_t)sulen,
-                    return_host, (socklen_t)hostlen, 
-                    return_serv, (socklen_t)servlen, 
+                    return_host, (socklen_t)hostlen,
+                    return_serv, (socklen_t)servlen,
                     flags);
 }
index f42514728d2af98cf8fb01f8b15cbc46f50febbc..ffc089765b02fe26db057f81caae43a2881febd0 100644 (file)
@@ -43,7 +43,7 @@
  *   ...
  * }
  * @endcode
- * 
+ *
  * A new home memory pool can be created with su_home_new():
  * @code
  * struct context *ctx = su_home_new(sizeof (struct context));
@@ -58,7 +58,7 @@
  *
  * Note that the tophome has a reference to @a ctx structure; whenever
  * tophome is freed, the @a ctx is also freed.
- * 
+ *
  * You can also create an independent home object by passing NULL as @a
  * tophome argument. This is identical to the call to su_home_new().
  *
@@ -92,7 +92,7 @@
  * @code
  *    su_free(tophome, ctx);
  * @endcode
- * 
+ *
  * @note
  *
  * The su_home_destroy() function is deprecated as it does not free the home
  * and one wants to keep the allocations, the allocations can be combined
  * into an existing home with su_home_move(). For example,
  * @code
- * int example(su_home_t *home, ...) 
+ * int example(su_home_t *home, ...)
  * {
  *   su_home_t temphome[1] = { SU_HOME_INIT(temphome) };
- *   
+ *
  *   ... do lot of allocations with temphome ...
- *  
- *   if (success) 
+ *
+ *   if (success)
  *     su_home_move(home, temphome);
  *   su_home_deinit(temphome);
  *
  * allocator is used. The overhead caused by the large number of small
  * allocations can be reduced by using su_home_preload(): it allocates or
  * preloads some a memory to home to be used as a kind of private heap. The
- * preloaded memory area is then used to satisfy small enough allocations. 
+ * preloaded memory area is then used to satisfy small enough allocations.
  * For instance, the SIP parser typically preloads some 2K of memory when it
  * starts to parse the message.
  *
  * @CFILE su_alloc.c  Home-based memory management.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>.
- * 
+ *
  * @date Created: Thu Aug 19 01:12:25 1999 ppessi
  */
 
@@ -224,13 +224,13 @@ su_inline void safefree(void *b) { b ? free(b) : (void)0; }
 #define MEMCHECK_EXTRA sizeof (size_t)
 #endif
 
-enum { 
+enum {
   SUB_N = 31,                  /**< Initial size */
   SUB_N_AUTO = 7,              /**< Initial size for autohome */
   SUB_P = 29                   /**< Secondary probe.
-                                * Secondary probe must be relative prime 
+                                * Secondary probe must be relative prime
                                 * with all sub_n values */
-};             
+};
 
 #define ALIGNMENT (8)
 #define ALIGN(n) (size_t)(((n) + (ALIGNMENT - 1)) & (size_t)~(ALIGNMENT - 1))
@@ -279,7 +279,7 @@ static void _su_home_deinit(su_home_t *home);
 size_t count_su_block_find, count_su_block_find_loop;
 size_t size_su_block_find, used_su_block_find;
 size_t max_size_su_block_find, max_used_su_block_find;
-size_t su_block_find_collision, su_block_find_collision_used, 
+size_t su_block_find_collision, su_block_find_collision_used,
   su_block_find_collision_size;
 #endif
 
@@ -287,7 +287,7 @@ su_inline su_alloc_t *su_block_find(su_block_t const *b, void const *p)
 {
   size_t h, h0, probe;
 
-#if SU_ALLOC_STATS  
+#if SU_ALLOC_STATS
   size_t collision = 0;
 
   count_su_block_find++;
@@ -315,7 +315,7 @@ su_inline su_alloc_t *su_block_find(su_block_t const *b, void const *p)
       h -= b->sub_n;
 #if SU_ALLOC_STATS
     if (++collision > su_block_find_collision)
-      su_block_find_collision = collision, 
+      su_block_find_collision = collision,
        su_block_find_collision_used = b->sub_used,
        su_block_find_collision_size = b->sub_n;
     count_su_block_find_loop++;
@@ -350,8 +350,8 @@ su_inline su_alloc_t *su_block_add(su_block_t *b, void *p)
 su_inline int su_is_preloaded(su_block_t const *sub, char *data)
 {
   return
-    sub->sub_preload && 
-    sub->sub_preload <= data && 
+    sub->sub_preload &&
+    sub->sub_preload <= data &&
     sub->sub_preload + sub->sub_prsize > data;
 }
 
@@ -414,14 +414,14 @@ enum sub_zero { do_malloc, do_calloc, do_clone };
  *             if > 1, allocate a subhome
  *
  */
-static 
-void *sub_alloc(su_home_t *home, 
+static
+void *sub_alloc(su_home_t *home,
                su_block_t *sub,
                size_t size,
                enum sub_zero zero)
 {
   void *data, *preload = NULL;
-  
+
   assert (size < (((size_t)1) << SIZEBITS));
 
   if (size >= ((size_t)1) << SIZEBITS)
@@ -472,7 +472,7 @@ void *sub_alloc(su_home_t *home,
   if (size && sub && zero < do_clone &&
       sub->sub_preload && size <= sub->sub_prsize) {
     /* Use preloaded memory */
-    size_t prused = sub->sub_prused + size + MEMCHECK_EXTRA; 
+    size_t prused = sub->sub_prused + size + MEMCHECK_EXTRA;
     prused = ALIGN(prused);
     if (prused <= sub->sub_prsize) {
       preload = (char *)sub->sub_preload + sub->sub_prused;
@@ -501,13 +501,13 @@ void *sub_alloc(su_home_t *home,
       sub->sub_auto_all = 0;
 
     if (zero >= do_clone) {
-      /* Prepare cloned home */ 
+      /* Prepare cloned home */
       su_home_t *subhome = data;
 
       assert(preload == 0);
 
       subhome->suh_blocks = su_hash_alloc(SUB_N);
-      if (!subhome->suh_blocks) 
+      if (!subhome->suh_blocks)
        return (void)safefree(data), NULL;
 
       subhome->suh_size = (unsigned)size;
@@ -532,7 +532,7 @@ void *sub_alloc(su_home_t *home,
  *
  * Create a home object used to collect multiple memory allocations under
  * one handle. The memory allocations made using this home object is freed
- * either when this home is destroyed. 
+ * either when this home is destroyed.
  *
  * The maximum @a size of a home object is INT_MAX (2 gigabytes).
  *
@@ -580,7 +580,7 @@ void *su_home_ref(su_home_t const *home)
       UNLOCK(home);
       return NULL;
     }
-    
+
     if (sub->sub_ref != REF_MAX)
       sub->sub_ref++;
     UNLOCK(home);
@@ -746,7 +746,7 @@ void *su_home_clone(su_home_t *parent, isize_t size)
 /** Return true if home is a clone. */
 int su_home_has_parent(su_home_t const *home)
 {
-  return home && !home->suh_lock && 
+  return home && !home->suh_lock &&
     home->suh_blocks && home->suh_blocks->sub_parent;
 }
 
@@ -905,8 +905,8 @@ void su_home_check_blocks(su_block_t const *b)
  * Creates a home object. A home object is used to collect multiple memory
  * allocations, so that they all can be freed by calling su_home_unref().
  *
- * @return This function returns a pointer to an #su_home_t object, or 
- * NULL upon an error. 
+ * @return This function returns a pointer to an #su_home_t object, or
+ * NULL upon an error.
  */
 su_home_t *su_home_create(void)
 {
@@ -950,7 +950,7 @@ void su_home_destroy(su_home_t *home)
  *
  * @sa SU_HOME_INIT(), su_home_deinit(), su_home_new(), su_home_clone()
  *
- * @bug 
+ * @bug
  * Prior to @VERSION_1_12_8 the su_home_t structure should have been
  * initialized with SU_HOME_INIT() or otherwise zeroed before calling
  * su_home_init().
@@ -958,7 +958,7 @@ void su_home_destroy(su_home_t *home)
 int su_home_init(su_home_t *home)
 {
   su_block_t *sub;
-    
+
   if (home == NULL)
     return -1;
 
@@ -1089,7 +1089,7 @@ int su_home_move(su_home_t *dst, su_home_t *src)
        destructor(src);
       }
 
-      if (d) 
+      if (d)
        used = s->sub_used + d->sub_used;
       else
        used = s->sub_used;
@@ -1109,7 +1109,7 @@ int su_home_move(su_home_t *dst, su_home_t *src)
        dst->suh_blocks = d2;
 
        for (i = 0; i < n; i++)
-         if (d->sub_nodes[i].sua_data) 
+         if (d->sub_nodes[i].sua_data)
            su_block_add(d2, d->sub_nodes[i].sua_data)[0] = d->sub_nodes[i];
 
        if (d) {
@@ -1149,7 +1149,7 @@ int su_home_move(su_home_t *dst, su_home_t *src)
     UNLOCK(dst); UNLOCK(src);
   }
   else {
-    s = MEMLOCK(src); 
+    s = MEMLOCK(src);
 
     if (s && s->sub_used) {
       s->sub_used = 0;
@@ -1173,7 +1173,7 @@ void su_home_preload(su_home_t *home, isize_t n, isize_t isize)
   if (home == NULL)
     return;
 
-  if (home->suh_blocks == NULL) 
+  if (home->suh_blocks == NULL)
     su_home_init(home);
 
   sub = MEMLOCK(home);
@@ -1249,7 +1249,7 @@ su_home_t *su_home_auto(void *area, isize_t size)
  *   @param home  pointer to memory pool object
  *   @param data  pointer to old memory block
  *   @param size  size of the memory block to be allocated
- *   
+ *
  * @return
  *   A pointer to the allocated memory block or
  *   NULL if an error occurred.
@@ -1262,7 +1262,7 @@ void *su_realloc(su_home_t *home, void *data, isize_t size)
   size_t p;
   size_t term = 0 - size;
 
-  if (!home) 
+  if (!home)
     return realloc(data, size);
 
   if (size == 0) {
@@ -1282,11 +1282,11 @@ void *su_realloc(su_home_t *home, void *data, isize_t size)
 
   if (!su_alloc_check(sub, sua))
     return UNLOCK(home);
-  
+
   assert(!sua->sua_home);
   if (sua->sua_home)
     return UNLOCK(home);
-  
+
   if (!su_is_preloaded(sub, data)) {
     ndata = realloc(data, size + MEMCHECK_EXTRA);
     if (ndata) {
@@ -1356,7 +1356,7 @@ void *su_realloc(su_home_t *home, void *data, isize_t size)
       if (sub->sub_stats)
        su_home_stats_free(sub, data, data, sua->sua_size);
     }
-    
+
     memcpy(ndata, data,
           (size_t)sua->sua_size < size
           ? (size_t)sua->sua_size
@@ -1409,7 +1409,7 @@ int su_in_home(su_home_t *home, void const *memory)
 
     UNLOCK(home);
   }
-  
+
   return retval;
 }
 
@@ -1450,7 +1450,7 @@ void *su_zalloc(su_home_t *home, isize_t size)
  *
  * Allocates a structure with a given size, zeros
  * it, and initializes the size field to the given size.  The size field
- * is an int at the beginning of the structure. Note that it has type of int. 
+ * is an int at the beginning of the structure. Note that it has type of int.
  *
  * @param home  pointer to memory pool object
  * @param size  size of the structure
@@ -1463,12 +1463,12 @@ void *su_zalloc(su_home_t *home, isize_t size)
  *     char *tst_name;
  *     void *tst_ptr[3];
  *   };
- * 
+ *
  *   struct test *t;
  *   ...
- *   t = su_salloc(home, sizeof (*t)); 
+ *   t = su_salloc(home, sizeof (*t));
  *   assert(t && t->t_size == sizeof (*t));
- *   
+ *
  * @endcode
  * After calling su_salloc() we get a pointer t to a struct test,
  * initialized to zero except the tst_size field, which is initialized to
@@ -1505,13 +1505,13 @@ int su_home_is_threadsafe(su_home_t const *home)
   return home && home->suh_lock;
 }
 
-/** Increase refcount and obtain exclusive lock on home. 
+/** Increase refcount and obtain exclusive lock on home.
  *
  * @note The #su_home_t structure must be created with su_home_new() or
  * su_home_clone(), or initialized with su_home_init() before using this
- * function. 
+ * function.
  *
- * In order to enable actual locking, use su_home_threadsafe(), too. 
+ * In order to enable actual locking, use su_home_threadsafe(), too.
  * Otherwise the su_home_mutex_lock() will just increase the reference
  * count.
  */
@@ -1559,7 +1559,7 @@ int su_home_mutex_unlock(su_home_t *home)
 }
 
 
-/** Obtain exclusive lock on home without increasing refcount. 
+/** Obtain exclusive lock on home without increasing refcount.
  *
  * Unless su_home_threadsafe() has been used to intialize locking on home
  * object the function just returns -1.
@@ -1582,9 +1582,9 @@ int su_home_lock(su_home_t *home)
 }
 
 
-/** Try to obtain exclusive lock on home without increasing refcount. 
+/** Try to obtain exclusive lock on home without increasing refcount.
  *
- * @return 0 if successful, -1 if not threadsafe, 
+ * @return 0 if successful, -1 if not threadsafe,
  * EBUSY if already locked, error code otherwise.
  *
  * @sa su_home_lock(), su_home_unlock().
@@ -1649,7 +1649,7 @@ void su_home_init_stats(su_home_t *home)
   }
   else
     size = sub->sub_stats->hs_size;
-  
+
   memset(sub->sub_stats, 0, size);
   sub->sub_stats->hs_size = (int)size;
   sub->sub_stats->hs_blocksize = sub->sub_n;
@@ -1657,7 +1657,7 @@ void su_home_init_stats(su_home_t *home)
 
 /** Retrieve statistics from memory home.
  */
-void su_home_get_stats(su_home_t *home, int include_clones, 
+void su_home_get_stats(su_home_t *home, int include_clones,
                       su_home_stat_t *hs,
                       isize_t size)
 {
@@ -1683,7 +1683,7 @@ void su_home_get_stats(su_home_t *home, int include_clones,
   UNLOCK(home);
 }
 
-static 
+static
 void su_home_stats_alloc(su_block_t *sub, void *p, void *preload,
                         size_t size, int zero)
 {
@@ -1706,13 +1706,13 @@ void su_home_stats_alloc(su_block_t *sub, void *p, void *preload,
   hs->hs_allocs.hsa_rbytes += rsize;
   if (hs->hs_allocs.hsa_rbytes > hs->hs_allocs.hsa_maxrbytes)
     hs->hs_allocs.hsa_maxrbytes = hs->hs_allocs.hsa_rbytes;
-  
+
   hs->hs_blocks.hsb_number++;
   hs->hs_blocks.hsb_bytes += size;
   hs->hs_blocks.hsb_rbytes += rsize;
 }
 
-static 
+static
 void su_home_stats_free(su_block_t *sub, void *p, void *preload,
                        unsigned size)
 {
index ce5a958568fe3df7e88b6dd9a56b02d1bdcc9470..bdb4feba7dd9df0239d9d1db22a008ea958ab5d6 100644 (file)
  */
 
 /**@ingroup su_alloc
- * @CFILE su_alloc_lock.c 
+ * @CFILE su_alloc_lock.c
  * @brief Thread-locking for su_alloc module.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Fri Feb 23 17:38:11 2001 ppessi
  */
 
@@ -121,7 +121,7 @@ int su_home_threadsafe(su_home_t *home)
   if (mutex) {
     /* Mutex for memory operations */
     pthread_mutex_init(mutex, NULL);
-    /* Mutex used for explicit locking */ 
+    /* Mutex used for explicit locking */
     pthread_mutex_init(mutex + 1, NULL);
     home->suh_lock = (void *)mutex;
     return 0;
index cb75650fb9ddd4398a1bbfac0692e243d5bfa04f..4020400be05029494f9c4eb9cd1026457510039f 100644 (file)
@@ -39,7 +39,7 @@
 #include "config.h"
 
 #define su_base_port_s su_port_s
-#define SU_CLONE_T su_msg_t 
+#define SU_CLONE_T su_msg_t
 
 #include "sofia-sip/su.h"
 #include "su_port.h"
@@ -98,7 +98,7 @@ void su_base_port_unlock(su_port_t *self, char const *who)
  *
  * Currently this is only used if SU_HAVE_PTHREADS is 0.
  */
-int su_base_port_thread(su_port_t const *self, 
+int su_base_port_thread(su_port_t const *self,
                        enum su_port_thread_op op)
 {
   switch (op) {
@@ -120,7 +120,7 @@ int su_base_port_thread(su_port_t const *self,
 void su_base_port_incref(su_port_t *self, char const *who)
 {
   su_home_ref(self->sup_home);
-  PORT_REFCOUNT_DEBUG(("incref(%p) to %u by %s\n", self, 
+  PORT_REFCOUNT_DEBUG(("incref(%p) to %u by %s\n", self,
                       su_home_refcount(self->sup_home), who));
 }
 
@@ -128,14 +128,14 @@ int su_base_port_decref(su_port_t *self, int blocking, char const *who)
 {
   int zapped = su_home_unref(self->sup_home);
 
-  PORT_REFCOUNT_DEBUG(("%s(%p) to %u%s by %s\n", 
+  PORT_REFCOUNT_DEBUG(("%s(%p) to %u%s by %s\n",
                       blocking ? "zapref" : "decref",
                       self, zapped ? 0 : su_home_refcount(self->sup_home),
                       blocking && !zapped ? " FAILED" :"",
                       who));
 
   /* We should block until all references are destroyed */
-  if (blocking) 
+  if (blocking)
     /* ...but we just abort() */
     assert(zapped);
 
@@ -159,7 +159,7 @@ int su_base_port_send(su_port_t *self, su_msg_r rmsg)
     int wakeup;
 
     su_port_lock(self, "su_port_send");
-    
+
     wakeup = self->sup_head == NULL;
 
     *self->sup_tail = rmsg[0]; rmsg[0] = NULL;
@@ -219,7 +219,7 @@ int su_base_port_getmsgs_from(su_port_t *self, su_port_t *from)
       *tail = msg, *next = msg->sum_next, tail = &msg->sum_next;
     }
     else
-      next = &msg->sum_next;      
+      next = &msg->sum_next;
   }
 
   *tail = NULL, self->sup_tail = next;
@@ -248,11 +248,11 @@ int su_base_port_getmsgs_of_root(su_port_t *self, su_root_t *root)
       *tail = msg, *next = msg->sum_next, tail = &msg->sum_next;
     }
     else
-      next = &msg->sum_next;      
+      next = &msg->sum_next;
   }
 
   *tail = NULL, self->sup_tail = next;
-  
+
   su_port_unlock(self, "su_base_port_getmsgs_of_root");
 
   return su_base_port_execute_msgs(selected);
@@ -293,7 +293,7 @@ static int su_base_port_execute_msgs(su_msg_t *queue)
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -304,16 +304,16 @@ int su_base_port_multishot(su_port_t *self, int multishot)
 }
 
 /** @internal Main loop.
- * 
+ *
  * The function @c su_port_run() waits for wait objects and the timers
  * associated with the port object.  When any wait object is signaled or
  * timer is expired, it invokes the callbacks, and returns waiting.
- * 
+ *
  * The function @c su_port_run() runs until @c su_port_break() is called
  * from a callback.
- * 
+ *
  * @param self     pointer to port object
- * 
+ *
  */
 void su_base_port_run(su_port_t *self)
 {
@@ -395,27 +395,27 @@ void su_base_port_run_tune(su_port_t *self)
 /** @internal
  * The function @c su_port_break() is used to terminate execution of @c
  * su_port_run(). It can be called from a callback function.
- * 
+ *
  * @param self     pointer to port
- * 
+ *
  */
 void su_base_port_break(su_port_t *self)
 {
-  self->sup_running = 0; 
+  self->sup_running = 0;
 }
 
 /** @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
- * expired, it invokes the callbacks. 
- * 
+ * expired, it invokes the callbacks.
+ *
  *   This function returns when a callback has been invoked or @c tout
- *   milliseconds is elapsed. 
+ *   milliseconds is elapsed.
  *
  * @param self     pointer to port
  * @param tout     timeout in milliseconds
- * 
+ *
  * @return
  *   Milliseconds to the next invocation of timer, or @c SU_WAIT_FOREVER if
  *   there are no active timers.
@@ -465,8 +465,8 @@ su_duration_t su_base_port_step(su_port_t *self, su_duration_t tout)
  */
 
 int su_base_port_add_prepoll(su_port_t *self,
-                            su_root_t *root, 
-                            su_prepoll_f *callback, 
+                            su_root_t *root,
+                            su_prepoll_f *callback,
                             su_prepoll_magic_t *magic)
 {
   if (self->sup_prepoll)
@@ -501,8 +501,8 @@ su_timer_queue_t *su_base_port_timers(su_port_t *self)
   return &self->sup_timers;
 }
 
-/* ====================================================================== 
- * Clones 
+/* ======================================================================
+ * Clones
  */
 
 #define SU_TASK_COPY(d, s, by) (void)((d)[0]=(s)[0], \
@@ -529,7 +529,7 @@ int su_base_port_start_shared(su_root_t *parent,
   child->sur_deinit = deinit;
   child->sur_threading = parent->sur_threading;
 
-  SU_TASK_COPY(child->sur_parent, su_root_task(parent), 
+  SU_TASK_COPY(child->sur_parent, su_root_task(parent),
               su_base_port_clone_start);
   SU_TASK_COPY(child->sur_task, child->sur_parent,
               su_base_port_clone_start);
@@ -564,7 +564,7 @@ static void su_base_port_clone_break(su_root_magic_t *m,
  * @internal
  *
  * Called by su_port_wait() and su_clone_wait()
- */ 
+ */
 void su_base_port_wait(su_clone_r rclone)
 {
   su_port_t *self;
index 44a0942eaea88e3781b9ddad0cdbb108a0e5ae63..eb3e995218c4398063c0b671aa150360ace48d44 100644 (file)
 /**@internal
  * @file su_bm.c
  * @brief Search with Boyer-Moore algorithm
- *  
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Mon Apr 11 16:35:16 2005 ppessi
- * 
+ *
  */
 
 #include "config.h"
@@ -47,7 +47,7 @@
 #define TORTURELOG(x) (void)0
 #endif
 
-struct bw_fwd_table { 
+struct bw_fwd_table {
   unsigned char table[UCHAR_MAX + 1];
 };
 
@@ -81,7 +81,7 @@ bm_memmem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
  * naive implementation if the searched substring is shorter than the cache
  * line.
  *
- */ 
+ */
 
 /**@ingroup su_bm
  * @typedef struct bw_fwd_table bm_fwd_table_t;
@@ -90,7 +90,7 @@ bm_memmem_study0(char const *needle, size_t nlen, bm_fwd_table_t *fwd)
  *
  */
 
-/** Build case-sensitive forward skip table #bm_fwd_table_t 
+/** Build case-sensitive forward skip table #bm_fwd_table_t
  *  for Boyer-Moore algorithm.
  * @ingroup su_bm
  */
@@ -134,9 +134,9 @@ bm_memmem(char const *haystack, size_t hlen,
   for (i = j = nlen - 1; i < hlen;) {
     unsigned char h = haystack[i];
     if (h == needle[j]) {
-      TORTURELOG(("match \"%s\" at %u\nwith  %*s\"%.*s*%s\": %s\n", 
-                 haystack, (unsigned)i, 
-                 (int)(i - j), "", (int)j, needle, needle + j + 1, 
+      TORTURELOG(("match \"%s\" at %u\nwith  %*s\"%.*s*%s\": %s\n",
+                 haystack, (unsigned)i,
+                 (int)(i - j), "", (int)j, needle, needle + j + 1,
                  j == 0 ? "match!" : "back by 1"));
       if (j == 0)
        return (char *)haystack + i;
@@ -145,24 +145,24 @@ bm_memmem(char const *haystack, size_t hlen,
     else {
       if (fwd->table[h] > nlen - j) {
        TORTURELOG(("match \"%s\" at %u\n"
-                   "last  %*s\"%.*s*%s\": (by %u)\n", 
+                   "last  %*s\"%.*s*%s\": (by %u)\n",
                    haystack, (unsigned)i,
-                   (int)(i - j), "", 
+                   (int)(i - j), "",
                    (int)j, needle, needle + j + 1, fwd->table[h]));
        i += fwd->table[h];
       }
       else {
        TORTURELOG(("match \"%s\" at %u\n"
-                   "2nd   %*s\"%.*s*%s\": (by %u)\n", 
+                   "2nd   %*s\"%.*s*%s\": (by %u)\n",
                    haystack, (unsigned)i,
-                   (int)(i - j), "", 
+                   (int)(i - j), "",
                    (int)j, needle, needle + j + 1, (unsigned)(nlen - j)));
        i += nlen - j;
       }
       j = nlen - 1;
     }
   }
-  
+
   return NULL;
 }
 
@@ -233,7 +233,7 @@ bm_memcasemem(char const *haystack, size_t hlen,
 
   for (i = j = nlen - 1; i < hlen;) {
     unsigned char h = haystack[i], n = needle[j];
-    if (isupper(h)) 
+    if (isupper(h))
       h = tolower(h);
     if (isupper(n))
       n = tolower(n);
@@ -242,7 +242,7 @@ bm_memcasemem(char const *haystack, size_t hlen,
       TORTURELOG(("match \"%s\" at %u\n"
                  "with  %*s\"%.*s*%s\": %s\n",
                  haystack, (unsigned)i,
-                 (int)(i - j), "", (int)j, needle, needle + j + 1, 
+                 (int)(i - j), "", (int)j, needle, needle + j + 1,
                  j == 0 ? "match!" : "back by 1"));
       if (j == 0)
        return (char *)haystack + i;
@@ -253,21 +253,21 @@ bm_memcasemem(char const *haystack, size_t hlen,
        TORTURELOG(("match \"%s\" at %u\n"
                    "last  %*s\"%.*s*%s\": (by %u)\n",
                    haystack, (unsigned)i,
-                   (int)(i - j), "", (int)j, needle, needle + j + 1, 
+                   (int)(i - j), "", (int)j, needle, needle + j + 1,
                    fwd->table[h]));
        i += fwd->table[h];
       }
       else {
        TORTURELOG(("match \"%s\" at %u\n"
-                   "2nd   %*s\"%.*s*%s\": (by %u)\n", 
+                   "2nd   %*s\"%.*s*%s\": (by %u)\n",
                    haystack, (unsigned)i,
-                   (int)(i - j), "", (int)j, needle, needle + j + 1, 
+                   (int)(i - j), "", (int)j, needle, needle + j + 1,
                    (unsigned)(nlen - j)));
        i += nlen - j;
       }
       j = nlen - 1;
     }
   }
-  
+
   return NULL;
 }
index d54bfedf458a80e727e623a4a87e193e1fcd43ba..d6e58fd213aa3c78714b0e9b5149108e46e5e8f8 100644 (file)
@@ -26,7 +26,7 @@
  * @CFILE su_default_log.c
  *
  * Default debug log object.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Fri Feb 23 17:30:46 2001 ppessi
@@ -52,7 +52,7 @@ static void default_logger(void *stream, char const *fmt, va_list ap)
  *
  * The SOFIA_DEBUG environment variable is used to determine the default
  * debug logging level. The normal level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, su_log_global
  */
 extern char const SOFIA_DEBUG[];
@@ -63,7 +63,7 @@ extern char const SOFIA_DEBUG[];
 #define SOFIA_DEBUG_ 3
 #endif
 
-/**Default debug log. 
+/**Default debug log.
  *
  * If a source module does not define a log object, the output from su_log()
  * function or SU_DEBUG_X() macros use this log object. Also, if a log
@@ -80,13 +80,13 @@ extern char const SOFIA_DEBUG[];
  * The level of #su_log_default is set using SOFIA_DEBUG environment
  * variable.
  */
-su_log_t su_log_default[1] = {{ 
-  sizeof(su_log_t), 
+su_log_t su_log_default[1] = {{
+  sizeof(su_log_t),
   "sofia",             /* Log name */
   "SOFIA_DEBUG",       /* Environment variable controlling logging level */
   SOFIA_DEBUG_,                /* Default level */
   SU_LOG_MAX,          /* Maximum log level */
   0,
-  default_logger, 
+  default_logger,
   NULL
 }};
index 06081f9e4bcd51481896ba20f535bbd2bd00daa8..2d5f01a2d8d7480c517526912d64c6bffac8e62b 100644 (file)
@@ -58,7 +58,7 @@
 #define POLL2EPOLL_NEEDED \
   (POLLIN != EPOLLIN || POLLOUT != EPOLLOUT || POLLPRI != EPOLLPRI || \
    POLLERR != EPOLLERR || POLLHUP != EPOLLHUP)
+
 #define POLL2EPOLL(e) (e & (POLLIN|POLLOUT|POLLPRI|POLLERR|POLLHUP))
 #define EPOLL2POLL(e) (e & (POLLIN|POLLOUT|POLLPRI|POLLERR|POLLHUP))
 
@@ -71,8 +71,8 @@ struct su_devpoll_port_s {
   int              sup_devpoll;
   unsigned         sup_multishot; /**< Multishot operation? */
 
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                   */
   int              sup_n_registrations;
@@ -82,9 +82,9 @@ struct su_devpoll_port_s {
   /** Structure containing registration data */
   struct su_devpoll {
     struct su_devpoll *ser_next; /* Next in free list */
-    su_wakeup_f     ser_cb; 
-    su_wakeup_arg_t*ser_arg; 
-    su_root_t      *ser_root; 
+    su_wakeup_f     ser_cb;
+    su_wakeup_arg_t*ser_arg;
+    su_root_t      *ser_root;
     int             ser_id; /** registration identifier */
     su_wait_t       ser_wait[1];
   } **sup_indices;
@@ -99,19 +99,19 @@ static void su_devpoll_port_decref(su_port_t *self,
                                   int blocking,
                                   char const *who);
 static int su_devpoll_port_register(su_port_t *self,
-                                 su_root_t *root, 
-                                 su_wait_t *wait, 
+                                 su_root_t *root,
+                                 su_wait_t *wait,
                                  su_wakeup_f callback,
                                  su_wakeup_arg_t *arg,
                                  int priority);
 static int su_devpoll_port_unregister(su_port_t *port,
-                                   su_root_t *root, 
-                                   su_wait_t *wait,    
-                                   su_wakeup_f callback, 
+                                   su_root_t *root,
+                                   su_wait_t *wait,
+                                   su_wakeup_f callback,
                                    su_wakeup_arg_t *arg);
 static int su_devpoll_port_deregister(su_port_t *self, int i);
 static int su_devpoll_port_unregister_all(su_port_t *self, su_root_t *root);
-static int su_devpoll_port_eventmask(su_port_t *self, 
+static int su_devpoll_port_eventmask(su_port_t *self,
                                   int index,
                                   int socket,
                                   int events);
@@ -182,22 +182,22 @@ static void su_devpoll_port_deinit(void *arg)
  *
  *  Please note if identical wait objects are inserted, only first one is
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @return
- *   Positive index of the wait object, 
+ *   Positive index of the wait object,
  *   or -1 upon an error.
  */
 int su_devpoll_port_register(su_port_t *self,
-                            su_root_t *root, 
-                            su_wait_t *wait, 
+                            su_root_t *root,
+                            su_wait_t *wait,
                             su_wakeup_f callback,
                             su_wakeup_arg_t *arg,
                             int priority)
@@ -223,7 +223,7 @@ int su_devpoll_port_register(su_port_t *self,
 
   if (!ser) {
     i = self->sup_max_index, j = i == 0 ? 15 : i + 16;
-    
+
     if (j >= self->sup_size_indices) {
       /* Reallocate index table */
       n = n < 1024 ? 2 * n : n + 1024;
@@ -255,17 +255,17 @@ int su_devpoll_port_register(su_port_t *self,
   if ((size_t)wait->fd >= self->sup_n_devpoll_by_socket) {
     size_t n_devpoll_by_socket = ((size_t)wait->fd + 32) / 32 * 32;
 
-    devpoll_by_socket = su_realloc(h, devpoll_by_socket, 
-                                  n_devpoll_by_socket * 
+    devpoll_by_socket = su_realloc(h, devpoll_by_socket,
+                                  n_devpoll_by_socket *
                                   (sizeof devpoll_by_socket[0]));
     if (devpoll_by_socket == NULL)
       return -1;
-    
+
     memset(&devpoll_by_socket[self->sup_n_devpoll_by_socket],
           0,
-          (char *)&devpoll_by_socket[n_devpoll_by_socket] - 
+          (char *)&devpoll_by_socket[n_devpoll_by_socket] -
           (char *)&devpoll_by_socket[self->sup_n_devpoll_by_socket]);
-    
+
     self->sup_devpoll_by_socket = devpoll_by_socket;
     self->sup_n_devpoll_by_socket = n_devpoll_by_socket;
   }
@@ -273,7 +273,7 @@ int su_devpoll_port_register(su_port_t *self,
 
   if (devpoll_by_socket[wait->fd])
     /* XXX - we should lift this limitation with epoll, too */
-    return errno = EEXIST, -1;  
+    return errno = EEXIST, -1;
 
   i = ser->ser_id;
 
@@ -282,7 +282,7 @@ int su_devpoll_port_register(su_port_t *self,
   pollfd->revents = 0;
 
   if (write(self->sup_devpoll, pollfd, (sizeof pollfd)) != (sizeof pollfd)) {
-    return errno = EIO, -1;  
+    return errno = EIO, -1;
   }
 
   indices[0] = ser->ser_next;
@@ -327,7 +327,7 @@ static int su_devpoll_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
   if (destroy_wait)
     su_wait_destroy(ser->ser_wait);
-  
+
   memset(ser, 0, sizeof *ser);
   ser->ser_id = i;
   ser->ser_next = indices[0], indices[0] = ser;
@@ -341,25 +341,25 @@ static int su_devpoll_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
 
 /** Unregister a su_wait_t object.
- *  
+ *
  *  The function su_devpoll_port_unregister() unregisters a su_wait_t object. The
  *  wait object, a callback function and a argument are removed from the
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
  *
- * @deprecated Use su_devpoll_port_deregister() instead. 
+ * @deprecated Use su_devpoll_port_deregister() instead.
  *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_devpoll_port_unregister(su_port_t *self,
-                            su_root_t *root, 
-                            su_wait_t *wait,   
+                            su_root_t *root,
+                            su_wait_t *wait,
                             su_wakeup_f callback, /* XXX - ignored */
                             su_wakeup_arg_t *arg)
 {
@@ -387,14 +387,14 @@ int su_devpoll_port_unregister(su_port_t *self,
 }
 
 /** Deregister a su_wait_t object.
- *  
+ *
  *  Deregisters a registration by index. The wait object, a callback
  *  function and a argument are removed from the port object. The wait
  *  object is destroyed.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 int su_devpoll_port_deregister(su_port_t *self, int i)
@@ -417,10 +417,10 @@ int su_devpoll_port_deregister(su_port_t *self, int i)
  *
  * The function su_devpoll_port_unregister_all() unregisters all su_wait_t
  * objects associated with given root object.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @return Number of wait objects removed.
  */
 int su_devpoll_port_unregister_all(su_port_t *self, su_root_t *root)
@@ -479,7 +479,7 @@ int su_devpoll_port_eventmask(su_port_t *self, int index, int socket, int events
   w[1].revents = 0;
 
   if (write(self->sup_devpoll, w, (sizeof w)) == -1) {
-    SU_DEBUG_1(("su_devpoll_port_eventmask(%p): %d: %s\n", (void *)self, 
+    SU_DEBUG_1(("su_devpoll_port_eventmask(%p): %d: %s\n", (void *)self,
                socket, su_strerror(su_errno())));
     return -1;
   }
@@ -496,7 +496,7 @@ int su_devpoll_port_eventmask(su_port_t *self, int index, int socket, int events
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -508,7 +508,7 @@ int su_devpoll_port_multishot(su_port_t *self, int multishot)
     return self->sup_multishot;
   else if (multishot == 0 || multishot == 1)
     return self->sup_multishot = multishot;
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
@@ -546,7 +546,7 @@ int su_devpoll_port_wait_events(su_port_t *self, su_duration_t tout)
     if (socket < 0 || self->sup_n_devpoll_by_socket <= socket)
       continue;
     ser = self->sup_devpoll_by_socket[socket]; assert(ser);
-      
+
     magic = ser->ser_root ? su_root_magic(ser->ser_root) : NULL;
     ser->ser_wait->revents = ev[j].revents;
     ser->ser_cb(magic, ser->ser_wait, ser->ser_arg);
@@ -554,7 +554,7 @@ int su_devpoll_port_wait_events(su_port_t *self, su_duration_t tout)
     if (version != self->sup_registers)
       /* Callback function used su_register()/su_deregister() */
       break;
-  }    
+  }
 
   return events;
 }
@@ -568,7 +568,7 @@ su_port_t *su_devpoll_port_create(void)
 
   if (devpoll == -1) {
     /* Fallback to poll() */
-    SU_DEBUG_3(("%s(): open(\"%s\") => %u: %s\n", 
+    SU_DEBUG_3(("%s(): open(\"%s\") => %u: %s\n",
                "su_devpoll_port_create", "/dev/poll",
                errno, strerror(errno)));
     return su_poll_port_create();
@@ -581,9 +581,9 @@ su_port_t *su_devpoll_port_create(void)
   }
 
   if (su_home_destructor(su_port_home(self), su_devpoll_port_deinit) < 0 ||
-      !(self->sup_indices = 
+      !(self->sup_indices =
        su_zalloc(su_port_home(self),
-                 (sizeof self->sup_indices[0]) * 
+                 (sizeof self->sup_indices[0]) *
                  (self->sup_size_indices = 64)))) {
     su_home_unref(su_port_home(self));
     close(devpoll);
@@ -608,7 +608,7 @@ int su_devpoll_clone_start(su_root_t *parent,
                         su_root_init_f init,
                         su_root_deinit_f deinit)
 {
-  return su_pthreaded_port_start(su_devpoll_port_create, 
+  return su_pthreaded_port_start(su_devpoll_port_create,
                                 parent, return_clone, magic, init, deinit);
 }
 
index 719a9a7c328dd3494e172647996bd5945598b3a0..1cc6745e31ae24cfe117bbae6d4c2a1472667418 100644 (file)
@@ -58,7 +58,7 @@
 #define POLL2EPOLL_NEEDED \
   (POLLIN != EPOLLIN || POLLOUT != EPOLLOUT || POLLPRI != EPOLLPRI || \
    POLLERR != EPOLLERR || POLLHUP != EPOLLHUP)
+
 #define POLL2EPOLL(e) (e & (POLLIN|POLLOUT|POLLPRI|POLLERR|POLLHUP))
 #define EPOLL2POLL(e) (e & (POLLIN|POLLOUT|POLLPRI|POLLERR|POLLHUP))
 
@@ -71,8 +71,8 @@ struct su_epoll_port_s {
   int              sup_epoll;
   unsigned         sup_multishot; /**< Multishot operation? */
 
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                   */
   int              sup_n_registrations;
@@ -82,9 +82,9 @@ struct su_epoll_port_s {
   /** Structure containing registration data */
   struct su_epoll_register {
     struct su_epoll_register *ser_next; /* Next in free list */
-    su_wakeup_f     ser_cb; 
-    su_wakeup_arg_t*ser_arg; 
-    su_root_t      *ser_root; 
+    su_wakeup_f     ser_cb;
+    su_wakeup_arg_t*ser_arg;
+    su_root_t      *ser_root;
     int             ser_id; /** registration identifier */
     su_wait_t       ser_wait[1];
   } **sup_indices;
@@ -94,19 +94,19 @@ static void su_epoll_port_decref(su_port_t *self,
                                 int blocking,
                                 char const *who);
 static int su_epoll_port_register(su_port_t *self,
-                                 su_root_t *root, 
-                                 su_wait_t *wait, 
+                                 su_root_t *root,
+                                 su_wait_t *wait,
                                  su_wakeup_f callback,
                                  su_wakeup_arg_t *arg,
                                  int priority);
 static int su_epoll_port_unregister(su_port_t *port,
-                                   su_root_t *root, 
-                                   su_wait_t *wait,    
-                                   su_wakeup_f callback, 
+                                   su_root_t *root,
+                                   su_wait_t *wait,
+                                   su_wakeup_f callback,
                                    su_wakeup_arg_t *arg);
 static int su_epoll_port_deregister(su_port_t *self, int i);
 static int su_epoll_port_unregister_all(su_port_t *self, su_root_t *root);
-static int su_epoll_port_eventmask(su_port_t *self, 
+static int su_epoll_port_eventmask(su_port_t *self,
                                   int index,
                                   int socket,
                                   int events);
@@ -174,22 +174,22 @@ static void su_epoll_port_deinit(void *arg)
  *
  *  Please note if identical wait objects are inserted, only first one is
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @return
- *   Positive index of the wait object, 
+ *   Positive index of the wait object,
  *   or -1 upon an error.
  */
 int su_epoll_port_register(su_port_t *self,
-                          su_root_t *root, 
-                          su_wait_t *wait, 
+                          su_root_t *root,
+                          su_wait_t *wait,
                           su_wakeup_f callback,
                           su_wakeup_arg_t *arg,
                           int priority)
@@ -212,7 +212,7 @@ int su_epoll_port_register(su_port_t *self,
     su_home_t *h = su_port_home(self);
 
     i = self->sup_max_index, j = i == 0 ? 15 : i + 16;
-    
+
     if (j >= self->sup_size_indices) {
       /* Reallocate index table */
       n = n < 1024 ? 2 * n : n + 1024;
@@ -246,7 +246,7 @@ int su_epoll_port_register(su_port_t *self,
   ev.events = POLL2EPOLL(wait->events);
   ev.data.u64 = 0;
   ev.data.u32 = (uint32_t)i;
-  
+
   if (epoll_ctl(self->sup_epoll, EPOLL_CTL_ADD, wait->fd, &ev) == -1) {
     SU_DEBUG_0(("EPOLL_CTL_ADD(%u, %u) failed: %s\n",
                wait->fd, ev.events, strerror(errno)));
@@ -282,13 +282,13 @@ static int su_epoll_port_deregister0(su_port_t *self, int i, int destroy_wait)
   assert(ser->ser_id == i);
 
   if (epoll_ctl(self->sup_epoll, EPOLL_CTL_DEL, ser->ser_wait->fd, NULL) == -1) {
-    SU_DEBUG_1(("su_port(%p): EPOLL_CTL_DEL(%u): %s\n", (void *)self, 
+    SU_DEBUG_1(("su_port(%p): EPOLL_CTL_DEL(%u): %s\n", (void *)self,
                ser->ser_wait->fd, su_strerror(su_errno())));
   }
 
   if (destroy_wait)
     su_wait_destroy(ser->ser_wait);
-  
+
   memset(ser, 0, sizeof *ser);
   ser->ser_id = i;
   ser->ser_next = indices[0], indices[0] = ser;
@@ -301,25 +301,25 @@ static int su_epoll_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
 
 /** Unregister a su_wait_t object.
- *  
+ *
  *  The function su_epoll_port_unregister() unregisters a su_wait_t object. The
  *  wait object, a callback function and a argument are removed from the
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
  *
- * @deprecated Use su_epoll_port_deregister() instead. 
+ * @deprecated Use su_epoll_port_deregister() instead.
  *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_epoll_port_unregister(su_port_t *self,
-                            su_root_t *root, 
-                            su_wait_t *wait,   
+                            su_root_t *root,
+                            su_wait_t *wait,
                             su_wakeup_f callback, /* XXX - ignored */
                             su_wakeup_arg_t *arg)
 {
@@ -347,14 +347,14 @@ int su_epoll_port_unregister(su_port_t *self,
 }
 
 /** Deregister a su_wait_t object.
- *  
+ *
  *  Deregisters a registration by index. The wait object, a callback
  *  function and a argument are removed from the port object. The wait
  *  object is destroyed.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 int su_epoll_port_deregister(su_port_t *self, int i)
@@ -377,10 +377,10 @@ int su_epoll_port_deregister(su_port_t *self, int i)
  *
  * The function su_epoll_port_unregister_all() unregisters all su_wait_t
  * objects associated with given root object.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @return Number of wait objects removed.
  */
 int su_epoll_port_unregister_all(su_port_t *self, su_root_t *root)
@@ -437,7 +437,7 @@ int su_epoll_port_eventmask(su_port_t *self, int index, int socket, int events)
   ev.data.u32 = (uint32_t)index;
 
   if (epoll_ctl(self->sup_epoll, EPOLL_CTL_MOD, socket, &ev) == -1) {
-    SU_DEBUG_1(("su_port(%p): EPOLL_CTL_MOD(%u): %s\n", (void *)self, 
+    SU_DEBUG_1(("su_port(%p): EPOLL_CTL_MOD(%u): %s\n", (void *)self,
                socket, su_strerror(su_errno())));
     return -1;
   }
@@ -454,7 +454,7 @@ int su_epoll_port_eventmask(su_port_t *self, int index, int socket, int events)
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -466,7 +466,7 @@ int su_epoll_port_multishot(su_port_t *self, int multishot)
     return self->sup_multishot;
   else if (multishot == 0 || multishot == 1)
     return self->sup_multishot = multishot;
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
@@ -487,7 +487,7 @@ int su_epoll_port_wait_events(su_port_t *self, su_duration_t tout)
 
   int const M = 4;
   struct epoll_event ev[M];
-    
+
   n = epoll_wait(self->sup_epoll, ev, self->sup_multishot ? M : 1, tout);
 
   assert(n <= M);
@@ -508,7 +508,7 @@ int su_epoll_port_wait_events(su_port_t *self, su_duration_t tout)
     if (version != self->sup_registers)
       /* Callback function used su_register()/su_deregister() */
       return events;
-  }    
+  }
 
   return n;
 }
@@ -522,7 +522,7 @@ su_port_t *su_epoll_port_create(void)
 
   if (epoll == -1) {
     /* Fallback to poll() */
-    SU_DEBUG_3(("%s(): epoll_create() => %u: %s\n", 
+    SU_DEBUG_3(("%s(): epoll_create() => %u: %s\n",
                "su_port_create", epoll, strerror(errno)));
     return su_poll_port_create();
   }
@@ -537,9 +537,9 @@ su_port_t *su_epoll_port_create(void)
              "su_port_create", (void *)self, self->sup_epoll, "OK"));
 
   if (su_home_destructor(su_port_home(self), su_epoll_port_deinit) < 0 ||
-      !(self->sup_indices = 
+      !(self->sup_indices =
        su_zalloc(su_port_home(self),
-                 (sizeof self->sup_indices[0]) * 
+                 (sizeof self->sup_indices[0]) *
                  (self->sup_size_indices = 64)))) {
     su_home_unref(su_port_home(self));
     close(epoll);
@@ -561,7 +561,7 @@ int su_epoll_clone_start(su_root_t *parent,
                         su_root_init_f init,
                         su_root_deinit_f deinit)
 {
-  return su_pthreaded_port_start(su_epoll_port_create, 
+  return su_pthreaded_port_start(su_epoll_port_create,
                                 parent, return_clone, magic, init, deinit);
 }
 
index 6d9ff325e5811fcadf6465498be8baddfbdd79de..7b888bbacc1768461392a3fd20c44fca07225d15 100644 (file)
  */
 
 /**@CFILE su_errno.c errno compatibility
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Original: Thu Mar 18 19:40:51 1999 pessi
  * @date Split to su_errno.c: Thu Dec 22 18:37:02 EET 2005 pessi
  */
 
-#include "config.h" 
+#include "config.h"
 
 #include <sofia-sip/su_errno.h>
 #include <sofia-sip/su.h>
@@ -128,7 +128,7 @@ const char *su_strerror(int errcode)
   };
   static char buf[64];
 
-  if (errcode < WSABASEERR) 
+  if (errcode < WSABASEERR)
     return strerror(errcode);
 
   if (errcode < 20000)
index afee739954331092c3056958f3b743207fcbba85..cff096fe31637aa1f2ee542ed3b38e0d1c4b70af 100644 (file)
@@ -28,7 +28,7 @@
  * Global SU debug log.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Mon May  7 11:08:36 2001 ppessi
  */
 
@@ -45,7 +45,7 @@
  *
  * The SU_DEBUG environment variable is used to determine the debug logging
  * level for @b su module. The default level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, su_log_global
  */
 extern char const SU_DEBUG[];
@@ -57,18 +57,18 @@ extern char const SU_DEBUG[];
 #define SU_DEBUG_ 3
 #endif
 
-/**Debug log for @b su module. 
- * 
+/**Debug log for @b su module.
+ *
  * The su_log_global is the log object used by @b su module. The level of
  * #su_log_global is set using #SU_DEBUG environment variable.
  */
-su_log_t su_log_global[1] = {{ 
-  sizeof(su_log_t), 
-  "su", 
-  "SU_DEBUG", 
-  SU_DEBUG_, 
+su_log_t su_log_global[1] = {{
+  sizeof(su_log_t),
+  "su",
+  "SU_DEBUG",
+  SU_DEBUG_,
   SU_LOG_MAX,
   0,
-  NULL, 
+  NULL,
   NULL
 }};
index 331dc841ededc5b8e4ce069226b3cee8c18b5b89..c155a4b7f53595d55030ea29a8ebffd9232d52c7 100644 (file)
@@ -67,8 +67,8 @@ struct su_kqueue_port_s {
   int              sup_kqueue;
   unsigned         sup_multishot; /**< Multishot operation? */
 
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                   */
   int              sup_n_registrations;
@@ -80,9 +80,9 @@ struct su_kqueue_port_s {
   /** Structure containing registration data */
   struct su_register {
     struct su_register *ser_next; /* Next in free list */
-    su_wakeup_f     ser_cb; 
-    su_wakeup_arg_t*ser_arg; 
-    su_root_t      *ser_root; 
+    su_wakeup_f     ser_cb;
+    su_wakeup_arg_t*ser_arg;
+    su_root_t      *ser_root;
     int             ser_id; /** registration identifier */
     su_wait_t       ser_wait[1];
   } **sup_indices;
@@ -91,19 +91,19 @@ struct su_kqueue_port_s {
 static void su_kqueue_port_decref(su_port_t *, int blocking, char const *who);
 
 static int su_kqueue_port_register(su_port_t *self,
-                                su_root_t *root, 
-                                su_wait_t *wait, 
+                                su_root_t *root,
+                                su_wait_t *wait,
                                 su_wakeup_f callback,
                                 su_wakeup_arg_t *arg,
                                 int priority);
 static int su_kqueue_port_unregister(su_port_t *port,
-                                  su_root_t *root, 
-                                  su_wait_t *wait,     
-                                  su_wakeup_f callback, 
+                                  su_root_t *root,
+                                  su_wait_t *wait,
+                                  su_wakeup_f callback,
                                   su_wakeup_arg_t *arg);
 static int su_kqueue_port_deregister(su_port_t *self, int i);
 static int su_kqueue_port_unregister_all(su_port_t *self, su_root_t *root);
-static int su_kqueue_port_eventmask(su_port_t *self, 
+static int su_kqueue_port_eventmask(su_port_t *self,
                                  int index,
                                  int socket,
                                  int events);
@@ -171,22 +171,22 @@ static void su_kqueue_port_decref(su_port_t *self, int blocking, char const *who
  *
  *  Please note if identical wait objects are inserted, only first one is
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @return
- *   Positive index of the wait object, 
+ *   Positive index of the wait object,
  *   or -1 upon an error.
  */
 int su_kqueue_port_register(su_port_t *self,
-                           su_root_t *root, 
-                           su_wait_t *wait, 
+                           su_root_t *root,
+                           su_wait_t *wait,
                            su_wakeup_f callback,
                            su_wakeup_arg_t *arg,
                            int priority)
@@ -210,7 +210,7 @@ int su_kqueue_port_register(su_port_t *self,
     su_home_t *h = su_port_home(self);
 
     i = self->sup_max_index, j = i == 0 ? 15 : i + 16;
-    
+
     if (j >= self->sup_size_indices) {
       /* Reallocate index table */
       n = n < 1024 ? 2 * n : n + 1024;
@@ -310,7 +310,7 @@ static int su_kqueue_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
   if (destroy_wait)
     su_wait_destroy(wait);
-  
+
   memset(ser, 0, sizeof *ser);
   ser->ser_id = i;
   ser->ser_next = indices[0], indices[0] = ser;
@@ -323,25 +323,25 @@ static int su_kqueue_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
 
 /** Unregister a su_wait_t object.
- *  
+ *
  *  The function su_kqueue_port_unregister() unregisters a su_wait_t object. The
  *  wait object, a callback function and a argument are removed from the
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
  *
- * @deprecated Use su_kqueue_port_deregister() instead. 
+ * @deprecated Use su_kqueue_port_deregister() instead.
  *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_kqueue_port_unregister(su_port_t *self,
-                             su_root_t *root, 
-                             su_wait_t *wait,  
+                             su_root_t *root,
+                             su_wait_t *wait,
                              su_wakeup_f callback, /* XXX - ignored */
                              su_wakeup_arg_t *arg)
 {
@@ -369,14 +369,14 @@ int su_kqueue_port_unregister(su_port_t *self,
 }
 
 /** Deregister a su_wait_t object.
- *  
+ *
  *  Deregisters a registration by index. The wait object, a callback
  *  function and a argument are removed from the port object. The wait
  *  object is destroyed.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 int su_kqueue_port_deregister(su_port_t *self, int i)
@@ -398,13 +398,13 @@ int su_kqueue_port_deregister(su_port_t *self, int i)
  *
  * The function su_kqueue_port_unregister_all() unregisters all su_wait_t objects
  * and destroys all queued timers associated with given root object.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @return Number of wait objects removed.
  */
-int su_kqueue_port_unregister_all(su_port_t *self, 
+int su_kqueue_port_unregister_all(su_port_t *self,
                                su_root_t *root)
 {
   int i, I, n;
@@ -490,7 +490,7 @@ int su_kqueue_port_eventmask(su_port_t *self, int index, int socket, int events)
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -502,7 +502,7 @@ int su_kqueue_port_multishot(su_port_t *self, int multishot)
     return self->sup_multishot;
   else if (multishot == 0 || multishot == 1)
     return self->sup_multishot = multishot;
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
@@ -523,7 +523,7 @@ int su_kqueue_port_wait_events(su_port_t *self, su_duration_t tout)
 
   int const M = 4;
   struct kevent ev[M];
-  
+
   struct timespec ts;
 
   ts.tv_sec = tout / 1000;
@@ -534,7 +534,7 @@ int su_kqueue_port_wait_events(su_port_t *self, su_duration_t tout)
             tout < SU_DURATION_MAX ? &ts : NULL);
 
   assert(n <= M);
-  
+
   for (j = 0; j < n; j++) {
     struct su_register *ser;
     su_root_magic_t *magic;
@@ -559,7 +559,7 @@ int su_kqueue_port_wait_events(su_port_t *self, su_duration_t tout)
        /* Callback function used su_register()/su_deregister() */
        return events;
     }
-  }    
+  }
 
   return n;
 }
@@ -589,7 +589,7 @@ su_port_t *su_kqueue_port_create(void)
 
   self->sup_kqueue = kq, kq = -1;
   self->sup_indices = su_zalloc(su_port_home(self),
-                               (sizeof self->sup_indices[0]) * 
+                               (sizeof self->sup_indices[0]) *
                                (self->sup_size_indices = 64));
   if (!self->sup_indices)
     goto failed;
@@ -614,7 +614,7 @@ int su_kqueue_clone_start(su_root_t *parent,
                        su_root_init_f init,
                        su_root_deinit_f deinit)
 {
-  return su_pthreaded_port_start(su_kqueue_port_create, 
+  return su_pthreaded_port_start(su_kqueue_port_create,
                                 parent, return_clone, magic, init, deinit);
 }
 
index 603b07d4f13ab29b590eabce63dc86c08ae56906..1a0dbc172749af968873275b286e60fb213b6c4d 100644 (file)
@@ -29,7 +29,7 @@
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Martti Mela <Martti.Mela@nokia.com>
- * 
+ *
  * @date Created: Wed Oct  4 14:09:29 EET 2000 ppessi
  */
 
@@ -118,9 +118,9 @@ static int li_scope4(uint32_t ip4);
  * - #LI_V4MAPPED: when returning IPv4 addresses, map them as IPv6
  *   addresses.  If this flag is specified, IPv4 addresses are returned even
  *   if @a hints->li_family is set to @c AF_INET6.
- * - #LI_CANONNAME: return the domain name (DNS PTR) corresponding to the 
+ * - #LI_CANONNAME: return the domain name (DNS PTR) corresponding to the
  *   local address in @a li_canonname.
- * - #LI_NAMEREQD: Do not return addresses not in DNS. 
+ * - #LI_NAMEREQD: Do not return addresses not in DNS.
  * - #LI_NUMERIC: instead of domain name, return the text presentation of
  *   the addresss in @a li_canonname.
  * - #LI_DOWN: include interfaces and their addresses even if the interfaces
@@ -151,12 +151,12 @@ static int li_scope4(uint32_t ip4);
  * matching scope are returned. The different address scopes can be combined
  * with bitwise or. They are defined as follows
  * - #LI_SCOPE_HOST: host-local address, valid within host (::1, 127.0.0.1/8)
- * - #LI_SCOPE_LINK: link-local address, valid within link 
- *   (IP6 addresses with prefix fe80::/10, 
+ * - #LI_SCOPE_LINK: link-local address, valid within link
+ *   (IP6 addresses with prefix fe80::/10,
  *    IP4 addresses in net 169.254.0.0/16).
  * - #LI_SCOPE_SITE: site-local address, addresses valid within organization
  *   (IPv6 addresses with prefix  fec::/10,
- *    private IPv4 addresses in nets 10.0.0.0/8, 172.16.0.0/12, 
+ *    private IPv4 addresses in nets 10.0.0.0/8, 172.16.0.0/12,
  *    and 192.168.0.0/16 as defined in @RFC1918)
  * - #LI_SCOPE_GLOBAL: global address.
  *
@@ -173,13 +173,13 @@ static int li_scope4(uint32_t ip4);
  *
  * @return Zero (#ELI_NOERROR) when successful, or negative error code when
  * failed.
- * 
+ *
  * @par Diagnostics
  * Use su_gli_strerror() in order to obtain a string describing the error
  * code returned by su_getlocalinfo().
  *
  */
-int su_getlocalinfo(su_localinfo_t const *hints, 
+int su_getlocalinfo(su_localinfo_t const *hints,
                    su_localinfo_t **return_localinfo)
 {
   int error = 0, ip4 = 0, ip6 = 0;
@@ -214,14 +214,14 @@ int su_getlocalinfo(su_localinfo_t const *hints,
     break;
 
   case 0:
-    ip6 = ip4 = 1;    
+    ip6 = ip4 = 1;
     break;
 
   default:
     return -1;
   }
 
-#if USE_LOCALINFO0 
+#if USE_LOCALINFO0
   error = localinfo0(hh, rr);
 #else
 
@@ -230,8 +230,8 @@ int su_getlocalinfo(su_localinfo_t const *hints,
     error = localinfo6(hh, rr);
     if (error == ELI_NOADDRESS && ip4)
       error = 0;
-    
-    if (!error) 
+
+    if (!error)
       /* Search end of list */
       for (; *rr; rr = &(*rr)->li_next)
        ;
@@ -254,7 +254,7 @@ int su_getlocalinfo(su_localinfo_t const *hints,
   return error;
 }
 
-/** Free local address information. 
+/** Free local address information.
  *
  * Free a list of su_localinfo_t structures obtained with su_getlocalinfo()
  * or su_copylocalinfo() along with socket addresses and strings associated
@@ -274,7 +274,7 @@ void su_freelocalinfo(su_localinfo_t *tbf)
   }
 }
 
-/** Describe su_localinfo errors. 
+/** Describe su_localinfo errors.
  *
  * The function su_gli_strerror() returns a string describing the error
  * condition indicated by the code that was returned by the function
@@ -332,7 +332,7 @@ su_localinfo_t *su_copylocalinfo(su_localinfo_t const *li0)
     }
 
     if (li0->li_ifname)
-      li->li_ifname = strcpy(li->li_addrlen + (char *)li->li_addr, 
+      li->li_ifname = strcpy(li->li_addrlen + (char *)li->li_addr,
                             li0->li_ifname);
   }
 
@@ -341,7 +341,7 @@ su_localinfo_t *su_copylocalinfo(su_localinfo_t const *li0)
 
 
 /** Return IPv4 address scope */
-static int 
+static int
 li_scope4(uint32_t ip4)
 {
   ip4 = ntohl(ip4);
@@ -369,16 +369,16 @@ IN6_IS_ADDR_LOOPBACK(void const *ip6)
 {
   uint8_t const *u = ip6;
 
-  return 
-    u[0] == 0 && u[1] == 0 && u[2] == 0 && u[3] == 0 && 
-    u[4] == 0 && u[5] == 0 && u[6] == 0 && u[7] == 0 && 
-    u[8] == 0 && u[9] == 0 && u[10] == 0 && u[11] == 0 && 
+  return
+    u[0] == 0 && u[1] == 0 && u[2] == 0 && u[3] == 0 &&
+    u[4] == 0 && u[5] == 0 && u[6] == 0 && u[7] == 0 &&
+    u[8] == 0 && u[9] == 0 && u[10] == 0 && u[11] == 0 &&
     u[12] == 0 && u[13] == 0 && u[14] == 0 && u[15] == 1;
 }
 #endif
 
 /** Return IPv6 address scope */
-static int 
+static int
 li_scope6(struct in6_addr const *ip6)
 {
   if (IN6_IS_ADDR_V4MAPPED(ip6) || IN6_IS_ADDR_V4COMPAT(ip6)) {
@@ -446,7 +446,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 
   s = su_socket(AF_INET, SOCK_DGRAM, 0);
   if (s == -1) {
-    SU_DEBUG_1(("su_localinfo: su_socket failed: %s\n", 
+    SU_DEBUG_1(("su_localinfo: su_socket failed: %s\n",
                su_strerror(su_errno())));
     return ELI_SYSTEM;
   }
@@ -475,7 +475,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 
   if (scope == LI_SCOPE_HOST || scope == LI_SCOPE_LINK)
     gni_flags = NI_NUMERICHOST;
-    
+
   if (su_xtra) {
     /* Map IPv4 address to IPv6 address */
     memset(sa, 0, sizeof(*sa));
@@ -500,7 +500,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
   }
   else
     li->li_flags = 0;
-  
+
   li->li_canonname = canonname;
 
   canonname = NULL;
@@ -546,7 +546,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 
   s = su_socket(AF_INET, SOCK_DGRAM, 0);
   if (s == -1) {
-    SU_DEBUG_1(("su_localinfo: su_socket failed: %s\n", 
+    SU_DEBUG_1(("su_localinfo: su_socket failed: %s\n",
                su_strerror(su_errno())));
     return ELI_SYSTEM;
   }
@@ -555,13 +555,13 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
   /* Get the list of known IP address from the kernel */
   if (ioctl(s, SIOCGIFNUM, (char *) &numifs) < 0) {
     /* can't get number of interfaces -- fall back */
-    SU_DEBUG_1(("su_localinfo: SIOCGIFNUM failed: %s\n", 
+    SU_DEBUG_1(("su_localinfo: SIOCGIFNUM failed: %s\n",
                su_strerror(su_errno())));
     error = ELI_SYSTEM;
     goto err;
   }
 
-  SU_DEBUG_9(("su_localinfo: %d active interfaces according to SIOCGIFNUM\n", 
+  SU_DEBUG_9(("su_localinfo: %d active interfaces according to SIOCGIFNUM\n",
              numifs));
 
   if (numifs < 0)
@@ -584,20 +584,20 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
     error = ELI_MEMORY;
     goto err;
   }
-  
+
   li_first = (su_localinfo_t *)buffer;
   memset(li_first, 0, sizeof(su_localinfo_t) + su_xtra);
   ifc.ifc_buf = buffer + sizeof(su_localinfo_t) + su_xtra;
 #if HAVE_OPEN_C
   if (ioctl(s, SIOCGIFACTIVECONF, (char *)&ifc) < 0) {
-    SU_DEBUG_1(("su_localinfo: SIOCGIFCONF failed: %s\n", 
+    SU_DEBUG_1(("su_localinfo: SIOCGIFCONF failed: %s\n",
                su_strerror(su_errno())));
     error = ELI_SYSTEM;
     goto err;
   }
 #else
   if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) {
-    SU_DEBUG_1(("su_localinfo: SIOCGIFCONF failed: %s\n", 
+    SU_DEBUG_1(("su_localinfo: SIOCGIFCONF failed: %s\n",
                su_strerror(su_errno())));
     error = ELI_SYSTEM;
     goto err;
@@ -628,7 +628,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 #if defined(SIOCGIFINDEX)
     ifreq[0] = *ifr;
     if (ioctl(s, SIOCGIFINDEX, ifreq) < 0) {
-      SU_DEBUG_1(("su_localinfo: SIOCGIFINDEX failed: %s\n", 
+      SU_DEBUG_1(("su_localinfo: SIOCGIFINDEX failed: %s\n",
                  su_strerror(su_errno())));
       error = ELI_SYSTEM;
       goto err;
@@ -657,7 +657,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 
     if (su_get_local_ip_addr(sa) < 0)
       goto err;
-      
+
     li->li_family = sa->su_family;
     li->li_scope = LI_SCOPE_GLOBAL /* scope */;
     li->li_index = if_index;
@@ -687,14 +687,14 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 #if defined(SIOCGIFFLAGS)
     ifreq[0] = *ifr;
     if (ioctl(s, SIOCGIFFLAGS, ifreq) < 0) {
-      SU_DEBUG_1(("su_localinfo: SIOCGIFFLAGS failed: %s\n", 
+      SU_DEBUG_1(("su_localinfo: SIOCGIFFLAGS failed: %s\n",
                  su_strerror(su_errno())));
       error = ELI_SYSTEM;
       goto err;
     }
     /* Do not include interfaces that are down unless explicitly asked */
     if ((ifreq->ifr_flags & IFF_UP) == 0 && (hints->li_flags & LI_DOWN) == 0) {
-      SU_DEBUG_9(("su_localinfo: if %s with index %d is down\n", 
+      SU_DEBUG_9(("su_localinfo: if %s with index %d is down\n",
                  if_name, if_index));
       continue;
     }
@@ -708,7 +708,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
     *ifreq = *ifr;
     ifreq->ifr_addr.sa_family = AF_INET;
     if (ioctl(s, SIOCGIFADDR, ifreq) < 0) {
-      SU_DEBUG_1(("su_localinfo: SIOCGIFADDR failed: %s\n", 
+      SU_DEBUG_1(("su_localinfo: SIOCGIFADDR failed: %s\n",
                  su_strerror(su_errno())));
       error = ELI_SYSTEM;
       goto err;
@@ -746,7 +746,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
       goto err;
     else if (error > 0)
       continue;
-    
+
     if (canonname)
       if (strchr(canonname, ':') ||
          strspn(canonname, "0123456789.") == strlen(canonname))
@@ -807,7 +807,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
   su_localinfo_t *li = NULL, **lli = &tbf;
   su_sockaddr_t *su;
 #if SU_HAVE_IN6
-  socklen_t su_sockaddr_size = 
+  socklen_t su_sockaddr_size =
     (hints->li_flags & LI_V4MAPPED) ? sizeof(*su) : sizeof(struct sockaddr_in);
   flags = hints->li_flags & (LI_V4MAPPED|LI_CANONNAME|LI_NUMERIC|LI_IFNAME);
 #else
@@ -822,7 +822,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
       name = hints->li_canonname;
     else if (gethostname(name = hostname, sizeof(hostname)) != 0)
       return ELI_SYSTEM;
-  
+
     h = gethostbyname(name);
 
     if (name)
@@ -845,7 +845,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
 
       li->li_addrlen = su_sockaddr_size;
       li->li_addr = su = (su_sockaddr_t *)(li + 1);
-      su->su_family = li->li_family = 
+      su->su_family = li->li_family =
        li->li_flags & LI_V4MAPPED ? AF_INET6 : AF_INET;
 
 #if SU_HAVE_IN6
@@ -854,10 +854,10 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
        memcpy(&((int32_t*)&su->su_sin6.sin6_addr)[3],
               h->h_addr_list[i], h->h_length);
       }
-      else 
+      else
 #endif
        memcpy(&su->su_sin.sin_addr.s_addr, h->h_addr_list[i], h->h_length);
-      if (li->li_flags & LI_IFNAME) 
+      if (li->li_flags & LI_IFNAME)
        li->li_ifname = ifname;
       if (li->li_scope == LI_SCOPE_HOST || li->li_scope == LI_SCOPE_LINK)
        gni_flags = NI_NUMERICHOST;
@@ -876,7 +876,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
       error = ELI_MEMORY;
       goto err;
     }
-    li->li_flags = hints->li_flags & 
+    li->li_flags = hints->li_flags &
       (LI_V4MAPPED|LI_CANONNAME|LI_NUMERIC|LI_IFNAME);
     li->li_scope = LI_SCOPE_HOST, li->li_index = 1;
     if (li->li_flags & LI_IFNAME)
@@ -889,7 +889,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
       ((int32_t*)&su->su_sin6.sin6_addr)[2] = htonl(0xffff);
       ((int32_t*)&su->su_sin6.sin6_addr)[3] = htonl(0x7f000001);
     }
-    else 
+    else
 #endif
       su->su_family = li->li_family = AF_INET,
       su->su_sin.sin_addr.s_addr = htonl(0x7f000001);
@@ -897,7 +897,7 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
     if ((error = li_name(hints, NI_NUMERICHOST, su, &li->li_canonname)) < 0) {
       goto err;
     } else if (error > 0) {
-      free(li); li = NULL; 
+      free(li); li = NULL;
     } else {
       *lli = li; lli = &li->li_next; li = NULL;
     }
@@ -918,7 +918,7 @@ err:
 
 #if USE_LOCALINFO0 || !SU_HAVE_IN6
 
-#elif HAVE_PROC_NET_IF_INET6 
+#elif HAVE_PROC_NET_IF_INET6
 /** Build a list of local IPv6 addresses and append it to *return_result. */
 static
 int localinfo6(su_localinfo_t const *hints, su_localinfo_t **return_result)
@@ -947,7 +947,7 @@ int localinfo6(su_localinfo_t const *hints, su_localinfo_t **return_result)
                 &in6.s6_addr32[0],
                 &in6.s6_addr32[1],
                 &in6.s6_addr32[2],
-                &in6.s6_addr32[3], 
+                &in6.s6_addr32[3],
                 &if_index, &prefix_len, &scope, &flags, ifname) != 9)
        break;
 
@@ -970,10 +970,10 @@ int localinfo6(su_localinfo_t const *hints, su_localinfo_t **return_result)
          (hints->li_index && hints->li_index != if_index) ||
          (hints->li_ifname && strcmp(hints->li_ifname, ifname) != 0))
        continue;
-      
+
       su->su_family = AF_INET6;
-      su->su_sin6.sin6_addr = in6; 
-      
+      su->su_sin6.sin6_addr = in6;
+
       addrlen = su_sockaddr_size(su);
 
       if ((error = li_name(hints, 0, su, &canonname)) < 0)
@@ -983,7 +983,7 @@ int localinfo6(su_localinfo_t const *hints, su_localinfo_t **return_result)
       else
        error = ELI_NOADDRESS;
 
-      if (canonname && 
+      if (canonname &&
          (strchr(canonname, ':') ||
           strspn(canonname, "0123456789.") == strlen(canonname)))
        flags |= LI_NUMERIC;
@@ -1009,14 +1009,14 @@ int localinfo6(su_localinfo_t const *hints, su_localinfo_t **return_result)
       li->li_canonname = canonname;
       if (if_namelen)
        li->li_ifname = memcpy(addrlen + (char *)addr, ifname, if_namelen);
-      
+
       canonname = NULL;
     }
 
     fclose(f);
   }
 
-  if (canonname) 
+  if (canonname)
     free(canonname);
 
   return error;
@@ -1031,7 +1031,7 @@ int localinfo6(su_localinfo_t const *hints, su_localinfo_t **rresult)
   su_localinfo_t *li = NULL;
   su_sockaddr_t *su;
   int const su_sockaddr_size = sizeof(*su);
-  
+
   error = ELI_NOADDRESS;
 
 #if defined(__APPLE_CC__)
@@ -1049,39 +1049,39 @@ int localinfo6(su_localinfo_t const *hints, su_localinfo_t **rresult)
        sa->su_family = AF_INET6;
        if (su_inet_pton(AF_INET6, addr, &sa->su_sin6.sin6_addr) <= 0)
          goto err;
-       
+
        s = su_socket(AF_INET6, SOCK_DGRAM, 0);
        if (s == -1) {
-         SU_DEBUG_1(("su_localinfo: su_socket failed: %s\n", 
+         SU_DEBUG_1(("su_localinfo: su_socket failed: %s\n",
                      su_strerror(su_errno())));
          return ELI_SYSTEM;
        }
-       
+
        error = getsockname(s, (struct sockaddr *) sa, &salen);
        if (error < 0 && errno == SOCKET_ERROR) {
          SU_DEBUG_1(("%s: getsockname() failed: %s\n", __func__,
                      su_strerror(su_errno())));
        }
-       
+
        error = bind(s, (struct sockaddr *) sa, salen);
-       
+
        if (error < 0) {
          SU_DEBUG_1(("%s: bind() failed: %s\n", __func__,
                      su_strerror(su_errno())));
          goto err;
        }
-       
+
        su_close(s);
-       
+
        li->li_family = sa->su_family;
        li->li_scope = LI_SCOPE_GLOBAL;
        li->li_index = 0;
        li->li_addrlen = su_sockaddr_size(sa);
        li->li_addr = sa;
-       
+
        if ((error = li_name(hints, NI_NUMERICHOST, sa, &li->li_canonname)) < 0)
          goto err;
-       
+
        li->li_flags = NI_NUMERICHOST;
       }
     }
@@ -1107,12 +1107,12 @@ int localinfo6(su_localinfo_t const *hints, su_localinfo_t **rresult)
       su->su_family = li->li_family = AF_INET6;
       if (su_inet_pton(AF_INET6, addr, &su->su_sin6.sin6_addr) <= 0)
        goto err;
-      if (li->li_flags & LI_IFNAME) 
+      if (li->li_flags & LI_IFNAME)
        li->li_ifname = ifname;
       if ((error = li_name(hints, NI_NUMERICHOST, su, &li->li_canonname)) < 0)
        goto err;
       else if (error > 0) {
-       free(li); li = NULL; 
+       free(li); li = NULL;
       }
     }
   }
@@ -1133,7 +1133,7 @@ err:
 #include <ifaddrs.h>
 
 static
-int bsd_localinfo(su_localinfo_t const hints[1], 
+int bsd_localinfo(su_localinfo_t const hints[1],
                  su_localinfo_t **return_result)
 {
   struct ifaddrs *ifa, *results;
@@ -1186,7 +1186,7 @@ int bsd_localinfo(su_localinfo_t const hints[1],
       scope = li_scope6(&su->su_sin6.sin6_addr);
     }
 #endif
-    else 
+    else
       continue;
 
     if (hints->li_flags & LI_IFNAME) {
@@ -1200,7 +1200,7 @@ int bsd_localinfo(su_localinfo_t const hints[1],
        (hints->li_ifname && (!ifname || strcmp(hints->li_ifname, ifname))) ||
        (hints->li_index && hints->li_index != if_index))
       continue;
-    
+
     if (scope == LI_SCOPE_HOST || scope == LI_SCOPE_LINK)
       gni_flags = NI_NUMERICHOST;
 
@@ -1222,7 +1222,7 @@ int bsd_localinfo(su_localinfo_t const hints[1],
       error = 0;
       continue;
     }
-    
+
     if (canonname)
       if (strchr(canonname, ':') ||
          canonname[strspn(canonname, "0123456789.")] == '\0')
@@ -1232,7 +1232,7 @@ int bsd_localinfo(su_localinfo_t const hints[1],
       SU_DEBUG_1(("su_getlocalinfo: memory exhausted\n"));
       error = ELI_MEMORY;
       break;
-    } 
+    }
     *return_result = li, return_result = &li->li_next;
 
     li->li_flags = flags;
@@ -1259,7 +1259,7 @@ int bsd_localinfo(su_localinfo_t const hints[1],
 
 #elif USE_LOCALINFO0 && HAVE_IPHLPAPI_H && SU_HAVE_IN6
 
-static 
+static
 char const *ws2ifname(DWORD iftype)
 {
   switch (iftype) {
@@ -1321,21 +1321,21 @@ int win_localinfo(su_localinfo_t const hints[1], su_localinfo_t **rresult)
       goto err;
     }
 
-    if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
-                      FORMAT_MESSAGE_FROM_SYSTEM | 
+    if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                      FORMAT_MESSAGE_FROM_SYSTEM |
                       FORMAT_MESSAGE_IGNORE_INSERTS,
                       NULL,
                       error,
                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                       msg, 0, NULL))
       msg = empty;
+
     SU_DEBUG_1(("su_localinfo: GetAdaptersAddresses: %s (%d)\n", msg, error));
     if (msg != empty) LocalFree((LPVOID)msg);
     error = ELI_SYSTEM;
     goto err;
   }
-  
+
   for (iaa = iaa0; iaa; iaa = iaa->Next) {
     IP_ADAPTER_UNICAST_ADDRESS *ua;
     IP_ADAPTER_UNICAST_ADDRESS lua[1];
@@ -1382,11 +1382,11 @@ int win_localinfo(su_localinfo_t const hints[1], su_localinfo_t **rresult)
          continue;
        scope = li_scope6(&su->su_sin6.sin6_addr);
       }
-      else 
+      else
        continue;
 
       if (hints->li_flags & LI_IFNAME) {
-       snprintf(ifname, sizeof(ifname), "%s%u", 
+       snprintf(ifname, sizeof(ifname), "%s%u",
                 ws2ifname(iaa->IfType), if_index);
        ifnamelen = strlen(ifname) + 1;
       }
@@ -1396,7 +1396,7 @@ int win_localinfo(su_localinfo_t const hints[1], su_localinfo_t **rresult)
          /* (hints->li_ifname && strcmp(hints->li_ifname, ifname) != 0) || */
          (hints->li_index && hints->li_index != if_index))
        continue;
-    
+
       if (scope == LI_SCOPE_HOST || scope == LI_SCOPE_LINK)
        gni_flags = NI_NUMERICHOST;
 
@@ -1413,7 +1413,7 @@ int win_localinfo(su_localinfo_t const hints[1], su_localinfo_t **rresult)
        goto err;
       else if (error > 0)
        continue;
-    
+
       if (canonname)
        if (strchr(canonname, ':') ||
            strspn(canonname, "0123456789.") == strlen(canonname))
@@ -1422,7 +1422,7 @@ int win_localinfo(su_localinfo_t const hints[1], su_localinfo_t **rresult)
       if (!(li = calloc(1, sizeof(*li) + sulen + ifnamelen))) {
        SU_DEBUG_1(("su_getlocalinfo: memory exhausted\n"));
        error = ELI_MEMORY; goto err;
-      } 
+      }
       *next = li, next = &li->li_next;
 
       li->li_flags = flags;
@@ -1463,7 +1463,7 @@ int localinfo0(su_localinfo_t const *hints, su_localinfo_t **rresult)
   union {
     SOCKET_ADDRESS_LIST sal[1];
 #if HAVE_INTERFACE_INFO_EX
-    INTERFACE_INFO_EX   ii[1];    
+    INTERFACE_INFO_EX   ii[1];
 #else
     INTERFACE_INFO      ii[1];
 #endif
@@ -1497,7 +1497,7 @@ int localinfo0(su_localinfo_t const *hints, su_localinfo_t **rresult)
     SU_DEBUG_1(("su_getlocalinfo: no local addresses\n"));
     error = -1; goto err;
   }
-  
+
   for (i = 0; i < b.sal->iAddressCount; i++) {
     su_sockaddr_t *su = (su_sockaddr_t *)b.sal->Address[i].lpSockaddr;
 #if SU_HAVE_IN6
@@ -1512,7 +1512,7 @@ int localinfo0(su_localinfo_t const *hints, su_localinfo_t **rresult)
 
     if (hints->li_scope && (hints->li_scope & scope) == 0)
       continue;
-    
+
     if (scope == LI_SCOPE_HOST || scope == LI_SCOPE_LINK)
       gni_flags = NI_NUMERICHOST;
 
@@ -1537,12 +1537,12 @@ int localinfo0(su_localinfo_t const *hints, su_localinfo_t **rresult)
       goto err;
     else if (error > 0)
       continue;
-    
+
     if (canonname)
       if (strchr(canonname, ':') ||
          strspn(canonname, "0123456789.") == strlen(canonname))
        flags |= LI_NUMERIC;
-   
+
     li->li_flags = flags;
     li->li_family = su->su_family;
     li->li_scope = scope;
@@ -1552,7 +1552,7 @@ int localinfo0(su_localinfo_t const *hints, su_localinfo_t **rresult)
     li->li_canonname = canonname, canonname = NULL;
     if (hints->li_flags & LI_IFNAME)
       li->li_ifname = if_name;
-    li->li_addr = (su_sockaddr_t *)(li + 1); 
+    li->li_addr = (su_sockaddr_t *)(li + 1);
     li->li_addrlen = sulen;
     memcpy(li->li_addr, su, sulen);
   }
@@ -1571,10 +1571,10 @@ err:
 }
 #endif
 
-static 
-int li_name(su_localinfo_t const *hints, 
+static
+int li_name(su_localinfo_t const *hints,
            int gni_flags,
-           su_sockaddr_t const *su, 
+           su_sockaddr_t const *su,
            char **ccanonname)
 {
   char name[SU_MAXHOST];
@@ -1585,11 +1585,11 @@ int li_name(su_localinfo_t const *hints,
 
   if ((flags & LI_CANONNAME) || hints->li_canonname) {
     if ((flags & LI_NAMEREQD) == LI_NAMEREQD)
-      gni_flags |= NI_NAMEREQD;      
+      gni_flags |= NI_NAMEREQD;
     if (flags & LI_NUMERIC)
       gni_flags |= NI_NUMERICHOST;
 
-    error = su_getnameinfo(su, su_sockaddr_size(su), 
+    error = su_getnameinfo(su, su_sockaddr_size(su),
                           name, sizeof(name), NULL, 0,
                           gni_flags);
     if (error) {
@@ -1654,6 +1654,6 @@ int su_getlocalip(su_sockaddr_t *sa)
     su_freelocalinfo(li);
     return 0;
   }
-  else 
+  else
     return -1;
 }
index 0b874237e6433b5bcbcc6236fb35660479d84ca5..ad977312bba5101bb09e3672cd6ab6a39bb9f573 100644 (file)
@@ -28,7 +28,7 @@
  * Implementation of generic logging interface.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Fri Feb 23 17:30:13 2001 ppessi
  */
 
@@ -51,7 +51,7 @@
 #else
 #define SU_LOG_IS_INIT(log) ((log)->log_init)
 #define SU_LOG_DO_INIT(log) ((log)->log_init = 1)
-#define SU_LOG_LOCK(log) 
+#define SU_LOG_LOCK(log)
 #define SU_LOG_UNLOCK(log)
 #endif
 
@@ -63,9 +63,9 @@
  * interface provides means for redirecting the log and filtering log
  * messages based on message priority.
  *
- * @sa @ref debug_logs, <sofia-sip/su_log.h>, 
+ * @sa @ref debug_logs, <sofia-sip/su_log.h>,
  * su_llog(), su_vllog(), #su_log_t, #SU_DEBUG,
- * SU_DEBUG_0(), SU_DEBUG_1(), SU_DEBUG_2(), SU_DEBUG_3(), SU_DEBUG_5(), 
+ * SU_DEBUG_0(), SU_DEBUG_1(), SU_DEBUG_2(), SU_DEBUG_3(), SU_DEBUG_5(),
  * SU_DEBUG_7(), SU_DEBUG_9()
  */
 
@@ -81,7 +81,7 @@ void su_perror(const char *s)
   su_perror2(s, su_errno());
 }
 
-/** Log a message to default log. 
+/** Log a message to default log.
  *
  * This function is a replacement for printf().
  *
@@ -96,7 +96,7 @@ void su_log(char const *fmt, ...)
   va_end(ap);
 }
 
-/** Log a message with level. 
+/** Log a message with level.
  *
  * @note This function is used mainly by SU_DEBUG_n() macros.
  */
@@ -120,7 +120,7 @@ void su_vllog(su_log_t *log, unsigned level, char const *fmt, va_list ap)
   if (!log->log_init)
     su_log_init(log);
 
-  if (log->log_init > 1 ? 
+  if (log->log_init > 1 ?
       level > log->log_level :
       level > su_log_default->log_level)
     return;
@@ -156,14 +156,14 @@ void su_log_init(su_log_t *log)
 
   if (log->log_env && (env = getenv(log->log_env))) {
     int level = atoi(env);
-    
+
     /* Why? */
     /* if (level == 0) level = 1; */
     log->log_level = level;
     log->log_init = 2;
 
-    if (explicitly_initialized) 
-      su_llog(log, 0, "%s: initialized log to level %u (%s=%s)\n", 
+    if (explicitly_initialized)
+      su_llog(log, 0, "%s: initialized log to level %u (%s=%s)\n",
              log->log_name, log->log_level, log->log_env, env);
   }
   else {
@@ -171,10 +171,10 @@ void su_log_init(su_log_t *log)
     log->log_init = 1;
     if (explicitly_initialized) {
       if (log != su_log_default)
-       su_llog(log, 0, "%s: logging at default level %u\n", 
+       su_llog(log, 0, "%s: logging at default level %u\n",
                log->log_name, su_log_default->log_level);
       else
-       su_llog(log, 0, "%s: initialized log to level %u (default)\n", 
+       su_llog(log, 0, "%s: initialized log to level %u (default)\n",
                log->log_name, log->log_level);
     }
   }
@@ -188,7 +188,7 @@ void su_log_init(su_log_t *log)
  * @code
  * void logger(void *logarg, char const *format, va_list ap);
  * @endcode
- * 
+ *
  * If @a logger is NULL, the default logger will be used. If @a log is NULL,
  * the default logger is changed.
  */
@@ -206,7 +206,7 @@ void su_log_redirect(su_log_t *log, su_logger_f *logger, void *logarg)
  * The function su_log_set_level() sets the logging level.  The log events
  * have certain level (0..9); if logging level is lower than the level of
  * the event, the log message is ignored.
- * 
+ *
  * If @a log is NULL, the default log level is changed.
  */
 void su_log_set_level(su_log_t *log, unsigned level)
@@ -221,7 +221,7 @@ void su_log_set_level(su_log_t *log, unsigned level)
     explicitly_initialized = getenv("SHOW_DEBUG_LEVELS");
 
   if (explicitly_initialized)
-    su_llog(log, 0, "%s: set log to level %u\n", 
+    su_llog(log, 0, "%s: set log to level %u\n",
            log->log_name, log->log_level);
 }
 
@@ -229,11 +229,11 @@ void su_log_set_level(su_log_t *log, unsigned level)
  *
  * The function su_log_soft_set_level() sets the logging level if it is not
  * already set, or the environment variable controlling the log level is not
- * set. 
+ * set.
  *
  * The log events have certain level (0..9); if logging level is lower than
  * the level of the event, the log message is ignored.
- * 
+ *
  * If @a log is NULL, the default log level is changed.
  */
 void su_log_soft_set_level(su_log_t *log, unsigned level)
@@ -254,7 +254,7 @@ void su_log_soft_set_level(su_log_t *log, unsigned level)
       explicitly_initialized = getenv("SHOW_DEBUG_LEVELS");
 
     if (explicitly_initialized)
-      su_llog(log, 0, "%s: soft set log to level %u\n", 
+      su_llog(log, 0, "%s: soft set log to level %u\n",
              log->log_name, log->log_level);
   }
 }
index 798a739282139444f586d9a9d4e76ba6cb05a1e9..af88c93a7389774dd5163b50c2c38beb29adacbf 100644 (file)
@@ -38,7 +38,7 @@
  */
 
 /** @ingroup su_md5
- * 
+ *
  * @CFILE su_md5.c MD5 Implementation
  *
  * To compute the message digest of a chunk of bytes, declare an su_md5_t
@@ -58,7 +58,7 @@
  * @note Regarding su_* namespace: this avoids potential conflicts
  * with libraries such as some versions of Kerberos.  No particular
  * need to worry about whether the system supplies an MD5 library, as
- * this file is only about 3k of object code. 
+ * this file is only about 3k of object code.
  *
  */
 
@@ -93,7 +93,7 @@ static void putu32(uint32_t data, unsigned char *addr)
  *
  * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
  * initialization constants.
- * 
+ *
  * @param ctx Pointer to context structure.
  */
 void
@@ -103,7 +103,7 @@ su_md5_init(su_md5_t *ctx)
   ctx->buf[1] = 0xefcdab89;
   ctx->buf[2] = 0x98badcfe;
   ctx->buf[3] = 0x10325476;
-  
+
   ctx->bits[0] = 0;
   ctx->bits[1] = 0;
 }
@@ -111,7 +111,7 @@ su_md5_init(su_md5_t *ctx)
 /** Clear MD5 context.
  *
  * The function su_md5_deinit() clears MD5 context.
- * 
+ *
  * @param context  Pointer to MD5 context structure.
  */
 void su_md5_deinit(su_md5_t *context)
@@ -142,14 +142,14 @@ su_md5_update(su_md5_t *ctx,
   if ((ctx->bits[0] = (t + ((uint32_t)len << 3)) & 0xffffffff) < t)
     ctx->bits[1]++;    /* Carry from low to high */
   ctx->bits[1] += (uint32_t)(len >> 29);
-  
+
   t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-  
+
   /* Handle any leading odd-sized chunks */
-  
+
   if ( t ) {
     unsigned char *p = ctx->in + t;
-    
+
     t = 64 - t;
 
     if (len < t) {
@@ -162,9 +162,9 @@ su_md5_update(su_md5_t *ctx,
     buf += t;
     len -= t;
   }
-  
+
   /* Process data in 64-byte chunks */
-  
+
   while (len >= 64) {
     su_md5_transform(ctx->buf, buf);
     buf += 64;
@@ -176,7 +176,7 @@ su_md5_update(su_md5_t *ctx,
 }
 
 /** Copy memory, fix case to lower. */
-static 
+static
 void mem_i_cpy(unsigned char *d, unsigned char const *s, size_t len)
 {
   size_t i;
@@ -211,14 +211,14 @@ su_md5_iupdate(su_md5_t *ctx,
   if ((ctx->bits[0] = (t + ((uint32_t)len << 3)) & 0xffffffff) < t)
     ctx->bits[1]++;    /* Carry from low to high */
   ctx->bits[1] += (uint32_t)(len >> 29);
-  
+
   t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-  
+
   /* Handle any leading odd-sized chunks */
-  
+
   if ( t ) {
     unsigned char *p = ctx->in + t;
-    
+
     t = sizeof(ctx->in) - t;
 
     if (len < t) {
@@ -230,7 +230,7 @@ su_md5_iupdate(su_md5_t *ctx,
     buf += t;
     len -= t;
   }
-  
+
   /* Process data in 64-byte chunks */
   while (len >= sizeof(ctx->in)) {
     mem_i_cpy(ctx->in, buf, sizeof(ctx->in));
@@ -253,7 +253,7 @@ su_md5_iupdate(su_md5_t *ctx,
  */
 void su_md5_strupdate(su_md5_t *ctx, char const *s)
 {
-  if (s) 
+  if (s)
     su_md5_update(ctx, s, strlen(s));
 }
 
@@ -267,7 +267,7 @@ void su_md5_strupdate(su_md5_t *ctx, char const *s)
  */
 void su_md5_str0update(su_md5_t *ctx, char const *s)
 {
-  if (!s) 
+  if (!s)
     s = "";
 
   su_md5_update(ctx, s, strlen(s) + 1);
@@ -283,7 +283,7 @@ void su_md5_str0update(su_md5_t *ctx, char const *s)
  */
 void su_md5_striupdate(su_md5_t *ctx, char const *s)
 {
-  if (s) 
+  if (s)
     su_md5_iupdate(ctx, s, strlen(s));
 }
 
@@ -298,7 +298,7 @@ void su_md5_striupdate(su_md5_t *ctx, char const *s)
  */
 void su_md5_stri0update(su_md5_t *ctx, char const *s)
 {
-  if (!s) 
+  if (!s)
     s = "";
 
   su_md5_iupdate(ctx, s, strlen(s) + 1);
@@ -323,35 +323,35 @@ su_md5_digest(su_md5_t const *context, uint8_t digest[16])
   su_md5_t ctx[1];
 
   ctx[0] = context[0];
-  
+
   /* Compute number of bytes mod 64 */
   count = (ctx->bits[0] >> 3) & 0x3F;
-  
+
   /* Set the first char of padding to 0x80.  This is safe since there is
      always at least one byte free */
   p = ctx->in + count;
   *p++ = 0x80;
-  
+
   /* Bytes of padding needed to make 64 bytes */
   count = 64 - 1 - count;
-  
+
   /* Pad out to 56 mod 64 */
   if (count < 8) {
     /* Two lots of padding:  Pad the first block to 64 bytes */
     memset(p, 0, count);
     su_md5_transform (ctx->buf, ctx->in);
-    
+
     /* Now fill the next block with 56 bytes */
     memset(ctx->in, 0, 56);
   } else {
     /* Pad block to 56 bytes */
     memset(p, 0, count-8);
   }
-  
+
   /* Append length in bits and transform */
   putu32(ctx->bits[0], ctx->in + 56);
   putu32(ctx->bits[1], ctx->in + 60);
-  
+
   su_md5_transform(ctx->buf, ctx->in);
   putu32(ctx->buf[0], digest);
   putu32(ctx->buf[1], digest + 4);
index 0845c225cae2195e47b52587b0ceb5a4933fd818..dcc90076bf7395c01d331970b61872e2e4ee2ddc 100644 (file)
@@ -34,9 +34,9 @@
  * functions within @b su module.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Wed Jan 29 18:18:49 2003 ppessi
- * 
+ *
  */
 
 #include <sofia-sip/su_log.h>
index 55c289e5659dda9c3b70349368724dfdb723e01c..74ecd90cb15fa623dcc1762a6638aab88488d1d0 100644 (file)
@@ -35,7 +35,7 @@
 #include "config.h"
 
 #include <unistd.h>
-#include <in_sock.h> 
+#include <in_sock.h>
 #include <es_sock.h>
 #include <e32base.h>
 #include <s32mem.h>
@@ -58,7 +58,7 @@ extern "C" int su_get_local_ip_addr(su_sockaddr_t *su)
        su->su_sin.sin_addr.s_addr = sa_global->su_sin.sin_addr.s_addr;
        su->su_family = sa_global->su_family;
        su->su_len = sa_global->su_len;
-       
+
        return 0;
 }
 
@@ -76,32 +76,32 @@ extern "C" void *su_localinfo_ap_set(su_sockaddr_t *su, int *ifindex)
   TCommDbConnPref iPref;
   RSocketServ aSocketServ;
   RSocket sock;
-  
+
   /* Get the IAP id of the underlying interface of this RConnection */
   TUint32 iapId;
-  
+
   iPref.SetDirection(ECommDbConnectionDirectionOutgoing);
   iPref.SetDialogPreference(ECommDbDialogPrefPrompt);
   iPref.SetBearerSet(KCommDbBearerUnknown /*PSD*/);
-  
+
   aSocketServ = RSocketServ();
   aSocketServ.Connect();
   RConnection *aConnection = new RConnection();
   aConnection->Open(aSocketServ);
   aConnection->Start(iPref);
-  
+
   User::LeaveIfError(sock.Open(aSocketServ, KAfInet, KSockStream,
                               KProtocolInetTcp));
-  
+
   User::LeaveIfError(aConnection->GetIntSetting(_L("IAP\\Id"), iapId));
-  
+
   /* Get IP information from the socket */
   TSoInetInterfaceInfo ifinfo;
   TPckg<TSoInetInterfaceInfo> ifinfopkg(ifinfo);
-  
+
   TSoInetIfQuery ifquery;
   TPckg<TSoInetIfQuery> ifquerypkg(ifquery);
-  
+
   /* To find out which interfaces are using our current IAP, we
    * must enumerate and go through all of them and make a query
    * by name for each. */
@@ -109,7 +109,7 @@ extern "C" void *su_localinfo_ap_set(su_sockaddr_t *su, int *ifindex)
   while(sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifinfopkg) == KErrNone) {
     ifquery.iName = ifinfo.iName;
     TInt err = sock.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifquerypkg);
-    
+
     /* IAP ID is index 1 of iZone */
     if(err == KErrNone && ifquery.iZone[1] == iapId) {
       /* We have found an interface using the IAP we are interested in. */
@@ -126,7 +126,7 @@ extern "C" void *su_localinfo_ap_set(su_sockaddr_t *su, int *ifindex)
     else if(err != KErrNone)
       break;
   }
-  
+
   sock.Close();
 }
 
index 8bb973f799e7cea0ad6e968c39ade3fd63344d9e..3dc882dd1e2ab996f1606d094f21a59d904d5077 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@ingroup su_os_nw
  *
- * @CFILE su_os_nw.c  
+ * @CFILE su_os_nw.c
  * Implementation of OS-specific network events interface.
  *
  * @author Martti Mela <Martti.Mela@nokia.com>
@@ -97,8 +97,8 @@ static void su_nw_changed_msg_recv(su_root_magic_t *rm,
 }
 
 
-void nw_changed_cb(SCDynamicStoreRef store, 
-                  CFArrayRef changedKeys, 
+void nw_changed_cb(SCDynamicStoreRef store,
+                  CFArrayRef changedKeys,
                   void *info)
 {
   su_network_changed_t *snc = (su_network_changed_t *) info;
index e3d7ea2ce95881310c20cd58225c857303b4bf42..45e8f73b68dde5ff265d843c933320718a638aa3 100644 (file)
@@ -46,7 +46,7 @@
 #include <limits.h>
 #include <errno.h>
 
-#define su_port_s su_osx_port_s 
+#define su_port_s su_osx_port_s
 
 #include "su_port.h"
 #include "sofia-sip/su_osx_runloop.h"
 static su_port_t *su_osx_runloop_create(void) __attribute__((__malloc__));
 
 /* Callback for CFObserver and CFSocket */
-static void cf_observer_cb(CFRunLoopObserverRef observer, 
-                          CFRunLoopActivity activity, 
+static void cf_observer_cb(CFRunLoopObserverRef observer,
+                          CFRunLoopActivity activity,
                           void *info);
 
-static void su_osx_port_socket_cb(CFSocketRef s, 
-                                 CFSocketCallBackType callbackType, 
-                                 CFDataRef address, 
-                                 const void *data, 
+static void su_osx_port_socket_cb(CFSocketRef s,
+                                 CFSocketCallBackType callbackType,
+                                 CFDataRef address,
+                                 const void *data,
                                  void *info);
 
 static void su_osx_port_deinit(void *arg);
@@ -87,15 +87,15 @@ static CFSocketCallBackType map_poll_event_to_cf_event(int events);
 static int su_osx_port_send(su_port_t *self, su_msg_r rmsg);
 
 static int su_osx_port_register(su_port_t *self,
-                           su_root_t *root, 
-                           su_wait_t *wait, 
+                           su_root_t *root,
+                           su_wait_t *wait,
                            su_wakeup_f callback,
                            su_wakeup_arg_t *arg,
                            int priority);
 static int su_osx_port_unregister(su_port_t *port,
-                             su_root_t *root, 
-                             su_wait_t *wait,  
-                             su_wakeup_f callback, 
+                             su_root_t *root,
+                             su_wait_t *wait,
+                             su_wakeup_f callback,
                              su_wakeup_arg_t *arg);
 
 static int su_osx_port_deregister(su_port_t *self, int i);
@@ -118,9 +118,9 @@ static char const *su_osx_port_name(su_port_t const *self)
 }
 
 /*
- * 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_osx_port_s {
   su_socket_port_t sup_socket[1];
@@ -143,11 +143,11 @@ struct su_osx_port_s {
     int        o_current;
     int        o_count;
   } osx_magic[1];
-  
+
   unsigned         sup_multishot; /**< Multishot operation? */
 
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                   */
   int              sup_n_waits; /**< Active su_wait_t in su_waits */
@@ -157,21 +157,21 @@ struct su_osx_port_s {
 
 #define INDEX_MAX (0x7fffffff)
 
-  /** Indices from index returned by su_root_register() to tables below. 
+  /** Indices from index returned by su_root_register() to tables below.
    *
    * Free elements are negative. Free elements form a list, value of free
    * element is (0 - index of next free element).
    *
-   * First element sup_indices[0] points to first free element. 
+   * First element sup_indices[0] points to first free element.
    */
   int             *sup_indices;
 
   int             *sup_reverses; /** Reverse index */
-  su_wakeup_f     *sup_wait_cbs; 
-  su_wakeup_arg_t**sup_wait_args; 
-  su_root_t      **sup_wait_roots; 
+  su_wakeup_f     *sup_wait_cbs;
+  su_wakeup_arg_t**sup_wait_args;
+  su_root_t      **sup_wait_roots;
 
-  su_wait_t       *sup_waits; 
+  su_wait_t       *sup_waits;
 };
 
 
@@ -223,10 +223,10 @@ su_root_t *su_root_osx_runloop_create(su_root_magic_t *magic)
   return su_root_create_with_port(magic, su_osx_runloop_create());
 }
 
-void osx_enabler_cb(CFSocketRef s, 
-                   CFSocketCallBackType type, 
-                   CFDataRef address, 
-                   const void *data, 
+void osx_enabler_cb(CFSocketRef s,
+                   CFSocketCallBackType type,
+                   CFDataRef address,
+                   const void *data,
                    void *info)
 {
   CFRunLoopRef  rl;
@@ -234,21 +234,21 @@ void osx_enabler_cb(CFSocketRef s,
   su_port_t    *self = magic->o_port;
   su_duration_t tout = 0;
   su_time_t     now = su_now();
-  
+
   rl = CFRunLoopGetCurrent();
 
   if (self->sup_base->sup_running) {
-    
+
     if (self->sup_base->sup_prepoll)
       self->sup_base->sup_prepoll(self->sup_base->sup_pp_magic, self->sup_base->sup_pp_root);
-    
+
     if (self->sup_base->sup_head)
       su_base_port_getmsgs(self);
-    
+
     if (self->sup_base->sup_timers)
       su_timer_expire(&self->sup_base->sup_timers, &tout, now);
   }
-  
+
   CFRunLoopWakeUp(rl);
 }
 
@@ -259,7 +259,7 @@ void osx_enabler_cb(CFSocketRef s,
  *
  * @return
  *   If successful a pointer to the new message port is returned, otherwise
- *   NULL is returned.  
+ *   NULL is returned.
  */
 su_port_t *su_osx_runloop_create(void)
 {
@@ -279,7 +279,7 @@ su_port_t *su_osx_runloop_create(void)
     self->osx_magic->o_port = self;
     self->sup_observer_cntx->info = self->osx_magic;
     self->sup_observer =
-      CFRunLoopObserverCreate(NULL, 
+      CFRunLoopObserverCreate(NULL,
                              kCFRunLoopAfterWaiting | kCFRunLoopBeforeWaiting,
                              TRUE, 0, cf_observer_cb, self->sup_observer_cntx);
 #if 0
@@ -295,8 +295,8 @@ su_port_t *su_osx_runloop_create(void)
 }
 
 static
-void cf_observer_cb(CFRunLoopObserverRef observer, 
-                   CFRunLoopActivity activity, 
+void cf_observer_cb(CFRunLoopObserverRef observer,
+                   CFRunLoopActivity activity,
                    void *info)
 {
   CFRunLoopRef  rl;
@@ -311,17 +311,17 @@ void cf_observer_cb(CFRunLoopObserverRef observer,
 
     if (self->sup_base->sup_prepoll)
       self->sup_base->sup_prepoll(self->sup_base->sup_pp_magic, self->sup_base->sup_pp_root);
-    
+
     if (self->sup_base->sup_head)
       su_port_getmsgs(self);
-    
+
     if (self->sup_base->sup_timers)
       su_timer_expire(&self->sup_base->sup_timers, &tout, now);
   } else
     SU_DEBUG_9(("cf_observer_cb(): PORT IS NOT RUNNING!\n"));
 
   CFRunLoopWakeUp(rl);
-  
+
   return;
 }
 
@@ -342,14 +342,14 @@ CFSocketCallBackType map_poll_event_to_cf_event(int events)
 
   if (events & SU_WAIT_IN)
     type |= kCFSocketReadCallBack;
-  
+
   if (events & SU_WAIT_OUT)
     type |= kCFSocketWriteCallBack;
-  
+
 #if 0
   if (events & SU_WAIT_CONNECT)
     type |= kCFSocketConnectCallBack;
-  
+
   if (events & SU_WAIT_ACCEPT)
     type |= kCFSocketAcceptCallBack;
 #endif
@@ -366,13 +366,13 @@ int map_cf_event_to_poll_event(CFSocketCallBackType type)
 
   if (type & kCFSocketReadCallBack)
     event |= SU_WAIT_IN;
-  
+
   if (type & kCFSocketWriteCallBack)
     event |= SU_WAIT_OUT;
-  
+
   if (type & kCFSocketConnectCallBack)
     event |= SU_WAIT_CONNECT;
-  
+
   if (type & kCFSocketAcceptCallBack)
     event |= SU_WAIT_ACCEPT;
 
@@ -381,37 +381,37 @@ int map_cf_event_to_poll_event(CFSocketCallBackType type)
 #endif
 
 static
-void su_osx_port_socket_cb(CFSocketRef s, 
-                          CFSocketCallBackType type, 
-                          CFDataRef address, 
-                          const void *data, 
+void su_osx_port_socket_cb(CFSocketRef s,
+                          CFSocketCallBackType type,
+                          CFDataRef address,
+                          const void *data,
                           void *info)
 {
   struct osx_magic *magic = (struct osx_magic *) info;
   su_port_t        *self = magic->o_port;
   int               curr = magic->o_current;
   su_duration_t tout = 0;
-  
+
 #if SU_HAVE_POLL
   {
     su_root_t *root;
     su_wait_t *waits = self->sup_waits;
     int n = self->sup_indices[curr];
-    
+
     assert(self->sup_reverses[n] == curr);
-    
+
     SU_DEBUG_9(("socket_cb(%p): count %u index %d\n", self->sup_sources[n], magic->o_count, curr));
-    
+
     waits[n].revents = map_poll_event_to_cf_event(type);
 
     root = self->sup_wait_roots[n];
-    self->sup_wait_cbs[n](root ? su_root_magic(root) : NULL, 
-                         &waits[n], 
+    self->sup_wait_cbs[n](root ? su_root_magic(root) : NULL,
+                         &waits[n],
                          self->sup_wait_args[n]);
-    
+
     if (self->sup_base->sup_running) {
       su_port_getmsgs(self);
-      
+
       if (self->sup_base->sup_timers)
        su_timer_expire(&self->sup_base->sup_timers, &tout, su_now());
 
@@ -420,12 +420,12 @@ void su_osx_port_socket_cb(CFSocketRef s,
 
       /* CFRunLoopWakeUp(CFRunLoopGetCurrent()); */
     }
-    
+
     /* Tell to run loop an su socket fired */
     self->sup_source_fired = 1;
   }
 #endif
-  
+
 }
 
 /** @internal Send a message to the port. */
@@ -437,7 +437,7 @@ int su_osx_port_send(su_port_t *self, su_msg_r rmsg)
     int wakeup;
 
     //XXX - mela SU_OSX_PORT_LOCK(self, "su_osx_port_send");
-    
+
     wakeup = self->sup_base->sup_head == NULL;
 
     *self->sup_base->sup_tail = rmsg[0]; rmsg[0] = NULL;
@@ -480,21 +480,21 @@ static int o_count;
  *
  *  Please note if identical wait objects are inserted, only first one is
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @return
- *   The function @su_osx_port_register returns nonzero index of the wait object, 
+ *   The function @su_osx_port_register returns nonzero index of the wait object,
  *   or -1 upon an error.  */
 int su_osx_port_register(su_port_t *self,
-                        su_root_t *root, 
-                        su_wait_t *wait, 
+                        su_root_t *root,
+                        su_wait_t *wait,
                         su_wakeup_f callback,
                         su_wakeup_arg_t *arg,
                         int priority)
@@ -527,7 +527,7 @@ int su_osx_port_register(su_port_t *self,
 
     if (self->sup_size_waits == 0)
       size = su_root_size_hint;
-    else 
+    else
       size = 2 * self->sup_size_waits;
 
     if (size < SU_WAIT_MIN)
@@ -551,7 +551,7 @@ int su_osx_port_register(su_port_t *self,
        reverses[i] = -1;
       self->sup_reverses = reverses;
     }
-      
+
     sources = realloc(self->sup_sources, size * sizeof(*sources));
     if (sources)
       self->sup_sources = sources;
@@ -574,10 +574,10 @@ int su_osx_port_register(su_port_t *self,
 
     /* Add sup_wait_roots array, if needed */
     wait_tasks = realloc(self->sup_wait_roots, size * sizeof(*wait_tasks));
-    if (wait_tasks) 
+    if (wait_tasks)
       self->sup_wait_roots = wait_tasks;
 
-    if (!(indices && 
+    if (!(indices &&
          reverses && sources && sockets && waits && wait_cbs && wait_args && wait_tasks)) {
       return -1;
     }
@@ -598,7 +598,7 @@ int su_osx_port_register(su_port_t *self,
       self->sup_waits[n] = self->sup_waits[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_roots[n] = self->sup_wait_roots[n-1];     
+      self->sup_wait_roots[n] = self->sup_wait_roots[n-1];
     }
 
     self->sup_pri_offset++;
@@ -672,7 +672,7 @@ int su_osx_port_deregister0(su_port_t *self, int i)
   n = indices[i]; assert(n >= 0); assert(i == reverses[n]);
 
   N = --self->sup_n_waits;
-  
+
   rl = CFRunLoopGetCurrent();
   CFSocketInvalidate(self->sup_sockets[n]);
   CFRelease(self->sup_sockets[n]);
@@ -723,7 +723,7 @@ int su_osx_port_deregister0(su_port_t *self, int i)
   self->sup_wait_cbs[n] = NULL;
   self->sup_wait_args[n] = NULL;
   self->sup_wait_roots[n] = NULL;
-  
+
   indices[i] = indices[0];
   indices[0] = -i;
 
@@ -734,23 +734,23 @@ int su_osx_port_deregister0(su_port_t *self, int i)
 
 
 /** Unregister a su_wait_t object.
- *  
+ *
  *  The function su_osx_port_unregister() unregisters a su_wait_t object. The
  *  wait object, a callback function and a argument are removed from the
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
- * 
+ *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_osx_port_unregister(su_port_t *self,
-                      su_root_t *root, 
-                      su_wait_t *wait, 
+                      su_root_t *root,
+                      su_wait_t *wait,
                       su_wakeup_f callback, /* XXX - ignored */
                       su_wakeup_arg_t *arg)
 {
@@ -773,14 +773,14 @@ int su_osx_port_unregister(su_port_t *self,
 }
 
 /** Deregister a su_wait_t object.
- *  
- *  The function su_osx_port_deregister() deregisters a su_wait_t registrattion. 
+ *
+ *  The function su_osx_port_deregister() deregisters a su_wait_t registrattion.
  *  The wait object, a callback function and a argument are removed from the
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 int su_osx_port_deregister(su_port_t *self, int i)
@@ -796,7 +796,7 @@ int su_osx_port_deregister(su_port_t *self, int i)
 
   if (self->sup_indices[i] < 0)
     return su_seterrno(EBADF);
-    
+
   retval = su_osx_port_deregister0(self, i);
 
   su_wait_destroy(wait);
@@ -810,13 +810,13 @@ int su_osx_port_deregister(su_port_t *self, int i)
  *
  * The function su_osx_port_unregister_all() unregisters all su_wait_t objects
  * and destroys all queued timers associated with given root object.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @return Number of wait objects removed.
  */
-int su_osx_port_unregister_all(su_port_t *self, 
+int su_osx_port_unregister_all(su_port_t *self,
                           su_root_t *root)
 {
   int i, j, index, N;
@@ -834,13 +834,13 @@ int su_osx_port_unregister_all(su_port_t *self,
   N          = self->sup_n_waits;
   indices    = self->sup_indices;
   reverses   = self->sup_reverses;
-  sources    = self->sup_sources; 
-  sockets    = self->sup_sockets; 
-  waits      = self->sup_waits; 
-  wait_cbs   = self->sup_wait_cbs; 
+  sources    = self->sup_sources;
+  sockets    = self->sup_sockets;
+  waits      = self->sup_waits;
+  wait_cbs   = self->sup_wait_cbs;
   wait_args  = self->sup_wait_args;
-  wait_roots = self->sup_wait_roots; 
-  
+  wait_roots = self->sup_wait_roots;
+
   rl = CFRunLoopGetCurrent();
 
   for (i = j = 0; i < N; i++) {
@@ -871,7 +871,7 @@ int su_osx_port_unregister_all(su_port_t *self,
       wait_args[j]  = wait_args[i];
       wait_roots[j] = wait_roots[i];
     }
-    
+
     j++;
   }
 
@@ -931,7 +931,7 @@ int su_osx_port_eventmask(su_port_t *self, int index, int socket, int events)
 
   CFSocketSetSocketFlags(self->sup_sockets[n],
                         map_poll_event_to_cf_event(events));
-  
+
   return ret;
 }
 
@@ -939,7 +939,7 @@ int su_osx_port_eventmask(su_port_t *self, int index, int socket, int events)
  *
  *  Copies the su_wait_t objects from the port. The number of wait objects
  *  can be found out by calling su_osx_port_query() with @a n_waits as zero.
- * 
+ *
  * @note This function is called only by friends.
  *
  * @param self     - pointer to port object
@@ -976,7 +976,7 @@ unsigned su_osx_port_query(su_port_t *self, su_wait_t *waits, unsigned n_waits)
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -987,7 +987,7 @@ int su_osx_port_multishot(su_port_t *self, int multishot)
     return self->sup_multishot;
   else if (multishot == 0 || multishot == 1)
     return self->sup_multishot = multishot;
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
@@ -1007,9 +1007,9 @@ int su_osx_port_threadsafe(su_port_t *port)
  * using Core Foundation's Run Loop.
  *
  * The function su_root_osx_prepare_run() returns immmediately.
- * 
+ *
  * @param root     pointer to root object
- * 
+ *
  * @NEW_1_12_4.
  */
 void su_root_osx_prepare_run(su_root_t *root)
@@ -1030,7 +1030,7 @@ void su_root_osx_prepare_run(su_root_t *root)
 
   if (self->sup_base->sup_head)
     su_port_getmsgs(self);
-  
+
   if (self->sup_base->sup_timers)
     su_timer_expire(&self->sup_base->sup_timers, &tout, su_now());
 
@@ -1044,16 +1044,16 @@ void su_root_osx_prepare_run(su_root_t *root)
 }
 
 /** @internal Main loop.
- * 
+ *
  * The function @c su_osx_port_run() waits for wait objects and the timers
  * associated with the port object.  When any wait object is signaled or
  * timer is expired, it invokes the callbacks, and returns waiting.
- * 
+ *
  * The function @c su_osx_port_run() runs until @c su_osx_port_break() is called
  * from a callback.
- * 
+ *
  * @param self     pointer to port object
- * 
+ *
  */
 void su_osx_port_run(su_port_t *self)
 {
@@ -1072,7 +1072,7 @@ void su_osx_port_run(su_port_t *self)
 
   if (self->sup_base->sup_head)
     su_port_getmsgs(self);
-  
+
   if (self->sup_base->sup_timers)
     su_timer_expire(&self->sup_base->sup_timers, &tout, su_now());
 
@@ -1144,16 +1144,16 @@ void su_osx_port_run_tune(su_port_t *self)
 /** @internal
  * The function @c su_osx_port_break() is used to terminate execution of @c
  * su_osx_port_run(). It can be called from a callback function.
- * 
+ *
  * @param self     pointer to port
- * 
+ *
  */
 void su_osx_port_break(su_port_t *self)
 {
   if (self->sup_main_loop)
     CFRunLoopStop(self->sup_main_loop);
 
-  self->sup_base->sup_running = 0; 
+  self->sup_base->sup_running = 0;
 }
 
 /** @internal
@@ -1178,7 +1178,7 @@ int su_osx_port_wait_events(su_port_t *self, su_duration_t tout)
   i = su_wait(waits, n, tout);
 
   if (i >= 0 && (unsigned)i < n) {
-#if HAVE_POLL                  
+#if HAVE_POLL
     /* poll() can return events for multiple wait objects */
     if (self->sup_multishot) {
       for (; i < n; i++) {
@@ -1212,16 +1212,16 @@ int su_osx_port_wait_events(su_port_t *self, su_duration_t tout)
 
 /** @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
- * expired, it invokes the callbacks. 
- * 
+ * expired, it invokes the callbacks.
+ *
  *   This function returns when a callback has been invoked or @c tout
- *   milliseconds is elapsed. 
+ *   milliseconds is elapsed.
  *
  * @param self     pointer to port
  * @param tout     timeout in milliseconds
- * 
+ *
  * @return
  *   Milliseconds to the next invocation of timer, or @c SU_WAIT_FOREVER if
  *   there are no active timers.
index a345cf2e4fdf3d5dcf732f22f01cfa2d7c513114..08247d5a036746b5f5499b37f98901228d7f9298 100644 (file)
@@ -28,7 +28,7 @@
  * Performance test for su message passing
  *
  * @internal
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
@@ -80,7 +80,7 @@ do_print(struct perf *p, su_msg_r msg, struct message *m)
 {
   su_time_t now = su_now();
   double dur = su_time_diff(now, m->started);
-  
+
   printf("su_perf: %g message exchanges per second"
         " (%d message exchanges in %g seconds)\n",
         (double)p->n / dur, p->n, dur);
@@ -126,7 +126,7 @@ void usage(char *name)
  *
  * Create a ponger and pinger, responding to incoming message do_ping
  *
- * After "target" rounds, print out elapsed time and number of messages 
+ * After "target" rounds, print out elapsed time and number of messages
  * passed.
  *
  */
@@ -136,8 +136,8 @@ int main(int argc, char *argv[])
   su_clone_r ping = SU_CLONE_R_INIT, pong = SU_CLONE_R_INIT;
   su_msg_r start_msg = SU_MSG_R_INIT;
 
-  struct perf 
-    pinger = { PINGER, "ping", 1, 0 }, 
+  struct perf
+    pinger = { PINGER, "ping", 1, 0 },
     ponger = { PONGER, "pong", 1, 0x7fffffff};
 
   int have_threads = 1;
@@ -158,15 +158,15 @@ int main(int argc, char *argv[])
   su_init(); atexit(su_deinit);
 
   root = su_root_create(NULL);
-  
+
   su_root_threading(root, have_threads);
 
   if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0)
     perror("su_clone_start"), exit(1);
   if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0)
-    perror("su_clone_start"), exit(1); 
+    perror("su_clone_start"), exit(1);
 
-  if (su_msg_create(start_msg, su_clone_task(pong), su_clone_task(ping), 
+  if (su_msg_create(start_msg, su_clone_task(pong), su_clone_task(ping),
                    do_ping, sizeof(struct message)) == 0) {
     su_msg_data(start_msg)->started = su_now();
     su_msg_send(start_msg);
index 9b95b28b03e7a2510aa4e7bb73e0938305b54e93..3936884123931d3e29648c8433ea33e0f0f7c6a5 100644 (file)
@@ -61,8 +61,8 @@ struct su_poll_port_s {
 
   unsigned         sup_multishot; /**< Multishot operation? */
 
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                   */
 
@@ -72,39 +72,39 @@ struct su_poll_port_s {
 
 #define INDEX_MAX (0x7fffffff)
 
-  /** Indices from index returned by su_root_register() to tables below. 
+  /** Indices from index returned by su_root_register() to tables below.
    *
    * Free elements are negative. Free elements form a list, value of free
    * element is (0 - index of next free element).
    *
-   * First element sup_indices[0] points to first free element. 
+   * First element sup_indices[0] points to first free element.
    */
   int             *sup_indices;
 
   int             *sup_reverses; /** Reverse index */
-  su_wakeup_f     *sup_wait_cbs; 
-  su_wakeup_arg_t**sup_wait_args; 
-  su_root_t      **sup_wait_roots; 
-  su_wait_t       *sup_waits; 
+  su_wakeup_f     *sup_wait_cbs;
+  su_wakeup_arg_t**sup_wait_args;
+  su_root_t      **sup_wait_roots;
+  su_wait_t       *sup_waits;
 
 };
 
 static void su_poll_port_decref(su_port_t *, int blocking, char const *who);
 
 static int su_poll_port_register(su_port_t *self,
-                                su_root_t *root, 
-                                su_wait_t *wait, 
+                                su_root_t *root,
+                                su_wait_t *wait,
                                 su_wakeup_f callback,
                                 su_wakeup_arg_t *arg,
                                 int priority);
 static int su_poll_port_unregister(su_port_t *port,
-                                  su_root_t *root, 
-                                  su_wait_t *wait,     
-                                  su_wakeup_f callback, 
+                                  su_root_t *root,
+                                  su_wait_t *wait,
+                                  su_wakeup_f callback,
                                   su_wakeup_arg_t *arg);
 static int su_poll_port_deregister(su_port_t *self, int i);
 static int su_poll_port_unregister_all(su_port_t *self, su_root_t *root);
-static int su_poll_port_eventmask(su_port_t *self, 
+static int su_poll_port_eventmask(su_port_t *self,
                                  int index,
                                  int socket,
                                  int events);
@@ -170,22 +170,22 @@ static void su_poll_port_decref(su_port_t *self, int blocking, char const *who)
  *
  *  Please note if identical wait objects are inserted, only first one is
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @return
- *   Positive index of the wait object, 
+ *   Positive index of the wait object,
  *   or -1 upon an error.
  */
 int su_poll_port_register(su_port_t *self,
-                         su_root_t *root, 
-                         su_wait_t *wait, 
+                         su_root_t *root,
+                         su_wait_t *wait,
                          su_wakeup_f callback,
                          su_wakeup_arg_t *arg,
                          int priority)
@@ -212,7 +212,7 @@ int su_poll_port_register(su_port_t *self,
 
     if (self->sup_size_waits == 0)
       size = su_root_size_hint;
-    else 
+    else
       size = 2 * self->sup_size_waits;
 
     if (size < SU_WAIT_MIN)
@@ -239,7 +239,7 @@ int su_poll_port_register(su_port_t *self,
        reverses[i] = -1;
       self->sup_reverses = reverses;
     }
-      
+
     waits = su_realloc(h, self->sup_waits, size * sizeof(*waits));
     if (waits)
       self->sup_waits = waits;
@@ -254,10 +254,10 @@ int su_poll_port_register(su_port_t *self,
 
     /* Add sup_wait_roots array, if needed */
     wait_tasks = su_realloc(h, self->sup_wait_roots, size * sizeof(*wait_tasks));
-    if (wait_tasks) 
+    if (wait_tasks)
       self->sup_wait_roots = wait_tasks;
 
-    if (!(indices && 
+    if (!(indices &&
          reverses && waits && wait_cbs && wait_args && wait_tasks)) {
       return -1;
     }
@@ -276,7 +276,7 @@ int su_poll_port_register(su_port_t *self,
       self->sup_waits[n] = self->sup_waits[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_roots[n] = self->sup_wait_roots[n-1];     
+      self->sup_wait_roots[n] = self->sup_wait_roots[n-1];
     }
 
     self->sup_pri_offset++;
@@ -316,9 +316,9 @@ static int su_poll_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
   if (destroy_wait)
     su_wait_destroy(&self->sup_waits[n]);
-  
+
   N = --self->sup_n_waits;
-  
+
   if (n < self->sup_pri_offset) {
     int j = --self->sup_pri_offset;
     if (n != j) {
@@ -354,7 +354,7 @@ static int su_poll_port_deregister0(su_port_t *self, int i, int destroy_wait)
   self->sup_wait_cbs[n] = NULL;
   self->sup_wait_args[n] = NULL;
   self->sup_wait_roots[n] = NULL;
-  
+
   indices[i] = indices[0];
   indices[0] = -i;
 
@@ -365,25 +365,25 @@ static int su_poll_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
 
 /** Unregister a su_wait_t object.
- *  
+ *
  *  The function su_poll_port_unregister() unregisters a su_wait_t object. The
  *  wait object, a callback function and a argument are removed from the
  *  port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
  *
- * @deprecated Use su_poll_port_deregister() instead. 
+ * @deprecated Use su_poll_port_deregister() instead.
  *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_poll_port_unregister(su_port_t *self,
-                           su_root_t *root, 
-                           su_wait_t *wait,    
+                           su_root_t *root,
+                           su_wait_t *wait,
                            su_wakeup_f callback, /* XXX - ignored */
                            su_wakeup_arg_t *arg)
 {
@@ -406,14 +406,14 @@ int su_poll_port_unregister(su_port_t *self,
 }
 
 /** Deregister a su_wait_t object.
- *  
+ *
  *  Deregisters a registration by index. The wait object, a callback
  *  function and a argument are removed from the port object. The wait
  *  object is destroyed.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 int su_poll_port_deregister(su_port_t *self, int i)
@@ -429,7 +429,7 @@ int su_poll_port_deregister(su_port_t *self, int i)
 
   if (self->sup_indices[i] < 0)
     return su_seterrno(EBADF);
-    
+
   retval = su_poll_port_deregister0(self, i, 1);
 
   su_wait_destroy(wait);
@@ -443,13 +443,13 @@ int su_poll_port_deregister(su_port_t *self, int i)
  *
  * The function su_poll_port_unregister_all() unregisters all su_wait_t objects
  * and destroys all queued timers associated with given root object.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @return Number of wait objects removed.
  */
-int su_poll_port_unregister_all(su_port_t *self, 
+int su_poll_port_unregister_all(su_port_t *self,
                                su_root_t *root)
 {
   int i, j, index, N;
@@ -464,11 +464,11 @@ int su_poll_port_unregister_all(su_port_t *self,
   N          = self->sup_n_waits;
   indices    = self->sup_indices;
   reverses   = self->sup_reverses;
-  waits      = self->sup_waits; 
-  wait_cbs   = self->sup_wait_cbs; 
+  waits      = self->sup_waits;
+  wait_cbs   = self->sup_wait_cbs;
   wait_args  = self->sup_wait_args;
-  wait_roots = self->sup_wait_roots; 
-  
+  wait_roots = self->sup_wait_roots;
+
   for (i = j = 0; i < N; i++) {
     index = reverses[i]; assert(index > 0 && indices[index] == i);
 
@@ -490,10 +490,10 @@ int su_poll_port_unregister_all(su_port_t *self,
       wait_args[j]  = wait_args[i];
       wait_roots[j] = wait_roots[i];
     }
-    
+
     j++;
   }
-  
+
   for (i = j; i < N; i++) {
     reverses[i] = -1;
     wait_cbs[i] = NULL;
@@ -545,7 +545,7 @@ int su_poll_port_eventmask(su_port_t *self, int index, int socket, int events)
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -557,7 +557,7 @@ int su_poll_port_multishot(su_port_t *self, int multishot)
     return self->sup_multishot;
   else if (multishot == 0 || multishot == 1)
     return self->sup_multishot = multishot;
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
@@ -637,7 +637,7 @@ void su_port_dump(su_port_t const *self, FILE *f)
 #endif
   fprintf(f, "\t%d wait objects\n", self->sup_n_waits);
   for (i = 0; i < self->sup_n_waits; i++) {
-    
+
   }
 }
 
@@ -669,7 +669,7 @@ int su_poll_clone_start(su_root_t *parent,
                        su_root_init_f init,
                        su_root_deinit_f deinit)
 {
-  return su_pthreaded_port_start(su_poll_port_create, 
+  return su_pthreaded_port_start(su_poll_port_create,
                                 parent, return_clone, magic, init, deinit);
 }
 
index 8a3b26b74afd121e4e15883e0627436232e192ae..d9df350a4f902ca32ad0525028364862456826f9 100644 (file)
@@ -28,7 +28,7 @@
  * OS-Independent Socket Syncronization Interface.
  *
  * This looks like nth reincarnation of "reactor". It implements the
- * poll/select/WaitForMultipleObjects and message passing functionality. 
+ * poll/select/WaitForMultipleObjects and message passing functionality.
  * This is virtual implementation:
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -149,17 +149,17 @@ void su_port_set_system_preferences(char const *name)
   }
 #endif
 
-  if (create == NULL) 
+  if (create == NULL)
     create = su_default_port_create;
 
   if (!preferred_su_port_create ||
-      preferred_su_port_create == su_default_port_create) 
+      preferred_su_port_create == su_default_port_create)
     preferred_su_port_create = create;
 
   if (start == NULL)
     start = su_default_clone_start;
 
-  if (!preferred_su_clone_start || 
+  if (!preferred_su_clone_start ||
       preferred_su_clone_start == su_default_clone_start)
     preferred_su_clone_start = start;
 }
@@ -184,25 +184,25 @@ char const *su_port_name(su_port_t const *port)
  */
 
 /**@ingroup su_wait
- * 
+ *
  * @page su_clone_t Clone Objects
  *
  * The process may be divided into many tasks via cloning. Several tasks may
- * run in context of one thread, or each task may be run by its own thread. 
+ * run in context of one thread, or each task may be run by its own thread.
  * However, only a single thread can execute code within a task. There can
  * be a 1-to-N mapping from thread to tasks. Thus, software using tasks can
  * be executed by multiple threads in a multithreaded environment and by a
  * single thread in a singlethreaded environment.
- * 
+ *
  * The clones are useful for handling tasks that can be executed by a
  * separate threads, but which do not block excessively. When threads are
  * not available or they are not needed, clones can also be run in a
  * single-threaded mode. Running in single-threaded mode is especially
  * useful while debugging.
- * 
+ *
  * A clone task is created with function su_clone_start(). Each clone has
  * its own root object (su_root_t), which holds a context pointer
- * (su_root_magic_t *). The context object can be different from that of 
+ * (su_root_magic_t *). The context object can be different from that of
  * parent task.
  *
  * When a clone is started, the clone initialization function is called. The
@@ -211,7 +211,7 @@ char const *su_port_name(su_port_t const *port)
  * initialization is successful, the clone task reverts to run the event
  * loop and invoking the event callbacks until its parent stops it by
  * calling su_clone_wait() which invokes the deinit function. The clone task
- * is destroyed when the deinit function returns. 
+ * is destroyed when the deinit function returns.
  *
  * The public API consists of following functions:
  *    - su_clone_start()
@@ -219,7 +219,7 @@ char const *su_port_name(su_port_t const *port)
  *    - su_clone_wait()
  *    - su_clone_forget()
  *
- * @note 
+ * @note
  * There is only one event loop for each thread which can be shared by
  * multiple clone tasks. Therefore, the clone tasks can not explicitly run
  * or step the event loop, but they are limited to event callbacks. A clone
@@ -239,7 +239,7 @@ static void su_root_deinit_nothing(su_root_t *root, su_root_magic_t *magic)
  *
  * Allocate and initialize a sub-task. Depending on the su_root_threading()
  * settings, a separate thread may be created to execute the sub-task. The
- * sub-task is represented by clone handle to the rest of the application. 
+ * sub-task is represented by clone handle to the rest of the application.
  * The function su_clone_start() returns the clone handle in @a
  * return_clone. The clone handle is used to communicate with the newly
  * created clone task using messages.
@@ -255,14 +255,14 @@ static void su_root_deinit_nothing(su_root_t *root, su_root_magic_t *magic)
  * Messages can also be used to pass information between tasks or threads.
  *
  * In multi-threaded implementation, su_clone_start() launches a new thread,
- * and the initialization routine is executed by this newly created thread. 
+ * and the initialization routine is executed by this newly created thread.
  * The calling thread blocks until the initialization routine completes. If
  * the initialization routine returns #su_success (0), the sub-task is
  * considered to be created successfully. After the successful
  * initialization, the sub-task continues to execeute the function
  * su_root_run().
  *
- * In single-threaded implementations, just a new root object is created. 
+ * In single-threaded implementations, just a new root object is created.
  * The initialization routine is called directly from su_clone_start().
  *
  * If the initalization function @a init fails, the sub-task (either the
@@ -297,7 +297,7 @@ int su_clone_start(su_root_t *parent,
   if (deinit == NULL)
     deinit = su_root_deinit_nothing;
 
-    
+
   if (parent == NULL || parent->sur_threading) {
     if (preferred_su_clone_start == NULL)
       su_port_set_system_preferences(getenv("SU_PORT"));
@@ -314,7 +314,7 @@ int su_clone_start(su_root_t *parent,
 }
 
 /** Get reference to a clone task.
- * 
+ *
  * @param clone Clone pointer
  *
  * @return A reference to the task structure of the clone.
@@ -325,7 +325,7 @@ _su_task_r su_clone_task(su_clone_r clone)
 }
 
 /**Forget the clone.
- * 
+ *
  * Normally, the clone task executes until it is stopped.  If the parent
  * task does not need to stop the task, it can "forget" the clone.  The
  * clone exits independently of the parent task.
@@ -341,7 +341,7 @@ void su_clone_forget(su_clone_r rclone)
  *
  * This can used only if clone task has sent no report messages (messages
  * with delivery report sent back to clone).
- * 
+ *
  * @deprecated. Use su_clone_wait().
  */
 void su_clone_stop(su_clone_r rclone)
index 00e491bc825b4292daee30c9294675b278460425..03775eb64e084859f8a1b8ea98d5d15eaf45ba6b 100644 (file)
 /** Defined when <su_port.h> has been included. */
 #define SU_PORT_H
 
-/**@internal @file su_port.h 
+/**@internal @file su_port.h
  *
  * @brief Internal OS-independent syncronization interface.
  *
  * This looks like the "reactor" pattern.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Fri May 12 14:13:34 2000 ppessi
  */
 
@@ -91,7 +91,7 @@ enum su_port_thread_op {
   su_port_thread_op_release,
   su_port_thread_op_obtain
 };
-  
+
 /** @internal Virtual function table for port */
 typedef struct su_port_vtable {
   unsigned su_vtable_size;
@@ -102,15 +102,15 @@ typedef struct su_port_vtable {
   struct _GSource *(*su_port_gsource)(su_port_t *port);
   int (*su_port_send)(su_port_t *self, su_msg_r rmsg);
   int (*su_port_register)(su_port_t *self,
-                         su_root_t *root, 
-                         su_wait_t *wait, 
+                         su_root_t *root,
+                         su_wait_t *wait,
                          su_wakeup_f callback,
                          su_wakeup_arg_t *arg,
                          int priority);
   int (*su_port_unregister)(su_port_t *port,
-                           su_root_t *root, 
-                           su_wait_t *wait,    
-                           su_wakeup_f callback, 
+                           su_root_t *root,
+                           su_wait_t *wait,
+                           su_wakeup_f callback,
                            su_wakeup_arg_t *arg);
   int (*su_port_deregister)(su_port_t *self, int i);
   int (*su_port_unregister_all)(su_port_t *self,
@@ -119,15 +119,15 @@ typedef struct su_port_vtable {
   void (*su_port_run)(su_port_t *self);
   void (*su_port_break)(su_port_t *self);
   su_duration_t (*su_port_step)(su_port_t *self, su_duration_t tout);
-  
+
   /* Reused slot */
   int (*su_port_thread)(su_port_t *port, enum su_port_thread_op op);
-  
+
   int (*su_port_add_prepoll)(su_port_t *port,
-                            su_root_t *root, 
-                            su_prepoll_f *, 
+                            su_root_t *root,
+                            su_prepoll_f *,
                             su_prepoll_magic_t *);
-  
+
   int (*su_port_remove_prepoll)(su_port_t *port,
                                su_root_t *root);
 
@@ -149,7 +149,7 @@ typedef struct su_port_vtable {
   void (*su_port_wait)(su_clone_r rclone);
   int (*su_port_execute)(su_task_r const task,
                         int (*function)(void *), void *arg,
-                        int *return_value);  
+                        int *return_value);
 } su_port_vtable_t;
 
 SOFIAPUBFUN su_port_t *su_port_create(void)
@@ -170,7 +170,7 @@ SOFIAPUBFUN char const *su_port_name(su_port_t const *port);
 
 /* ---------------------------------------------------------------------- */
 
-/* React to multiple events per one poll() to make sure 
+/* React to multiple events per one poll() to make sure
  * that high-priority events can never completely mask other events.
  * Enabled by default on all platforms except WIN32 */
 #if !defined(WIN32)
@@ -245,8 +245,8 @@ int su_port_send(su_port_t *self, su_msg_r rmsg)
 
 su_inline
 int su_port_register(su_port_t *self,
-                    su_root_t *root, 
-                    su_wait_t *wait, 
+                    su_root_t *root,
+                    su_wait_t *wait,
                     su_wakeup_f callback,
                     su_wakeup_arg_t *arg,
                     int priority)
@@ -258,9 +258,9 @@ int su_port_register(su_port_t *self,
 
 su_inline
 int su_port_unregister(su_port_t *self,
-                      su_root_t *root, 
-                      su_wait_t *wait, 
-                      su_wakeup_f callback, 
+                      su_root_t *root,
+                      su_wait_t *wait,
+                      su_wakeup_f callback,
                       su_wakeup_arg_t *arg)
 {
   su_virtual_port_t *base = (su_virtual_port_t *)self;
@@ -353,8 +353,8 @@ su_inline int su_port_obtain(su_port_t *self)
 
 su_inline
 int su_port_add_prepoll(su_port_t *self,
-                       su_root_t *root, 
-                       su_prepoll_f *prepoll, 
+                       su_root_t *root,
+                       su_prepoll_f *prepoll,
                        su_prepoll_magic_t *magic)
 {
   su_virtual_port_t *base = (su_virtual_port_t *)self;
@@ -415,9 +415,9 @@ typedef struct su_base_port_s {
   su_port_vtable_t const *sup_vtable;
 
   /* Implementation may vary stuff below, too. */
-  
+
   /* Pre-poll callback */
-  su_prepoll_f    *sup_prepoll; 
+  su_prepoll_f    *sup_prepoll;
   su_prepoll_magic_t *sup_pp_magic;
   su_root_t       *sup_pp_root;
 
@@ -460,8 +460,8 @@ SOFIAPUBFUN su_duration_t su_base_port_step(su_port_t *self,
                                            su_duration_t tout);
 
 SOFIAPUBFUN int su_base_port_add_prepoll(su_port_t *self,
-                                        su_root_t *root, 
-                                        su_prepoll_f *, 
+                                        su_root_t *root,
+                                        su_prepoll_f *,
                                         su_prepoll_magic_t *);
 
 SOFIAPUBFUN int su_base_port_remove_prepoll(su_port_t *self, su_root_t *root);
@@ -483,10 +483,10 @@ SOFIAPUBFUN void su_base_port_wait(su_clone_r rclone);
 
 #include <pthread.h>
 
-/** @internal Pthread port object */ 
+/** @internal Pthread port object */
 typedef struct su_pthread_port_s {
   su_base_port_t   sup_base[1];
-  struct su_pthread_port_waiting_parent 
+  struct su_pthread_port_waiting_parent
                   *sup_waiting_parent;
   pthread_t        sup_tid;
   pthread_mutex_t  sup_obtained[1];
@@ -564,7 +564,7 @@ typedef struct su_socket_port_s {
   su_socket_t       sup_mbox[SU_MBOX_SIZE];
 } su_socket_port_t;
 
-SOFIAPUBFUN int su_socket_port_init(su_socket_port_t *, 
+SOFIAPUBFUN int su_socket_port_init(su_socket_port_t *,
                                    su_port_vtable_t const *);
 SOFIAPUBFUN void su_socket_port_deinit(su_socket_port_t *self);
 SOFIAPUBFUN int su_socket_port_send(su_port_t *self, su_msg_r rmsg);
index bbc2b0db0a235f6bb473db7b1735f148a8e11096..65eb3933c4065a99d2a411630a8cc05f5b42d0da 100644 (file)
 
 /**@internal @ingroup su_root_ex
  *
- * @file su_proxy.c 
+ * @file su_proxy.c
  *
  * @brief Transport level proxy demonstrating various @b su features.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Wed May 23 17:42:40 2001 ppessi
  */
 
@@ -63,7 +63,7 @@ typedef struct buffer_s buffer_t;
 #define __func__ "su_proxy"
 #endif
 
-struct proxy_s 
+struct proxy_s
 {
   su_home_t      pr_home[1];
   su_root_t     *pr_root;
@@ -71,7 +71,7 @@ struct proxy_s
   forwarder_t   *pr_forwarders;
 };
 
-struct forwarder_s 
+struct forwarder_s
 {
   forwarder_t  *f_next;
   forwarder_t **f_prev;
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
     error = pr_run(pr);
 
   pr_deinit(pr);
-   
+
   su_deinit();
 
   exit(error);
@@ -189,14 +189,14 @@ int pr_config(proxy_t *pr, int argc, char *argv[])
     return 2;
 
   if ((error = su_getaddrinfo(argv[1], argv[2], hints, &res))) {
-    fprintf(stderr, "getaddrinfo: %s:%s: %s\n", 
+    fprintf(stderr, "getaddrinfo: %s:%s: %s\n",
            argv[1], argv[2], su_gai_strerror(error));
     return 1;
   }
 
     pr->pr_addrinfo = res;
 
-  if (argv[3]) 
+  if (argv[3])
     service = argv[3];
   else
     service = argv[2];
@@ -208,14 +208,14 @@ int pr_config(proxy_t *pr, int argc, char *argv[])
     return 1;
   }
 
-  for (ai = res; 
+  for (ai = res;
        ai;
        ai = ai->ai_next) {
     forwarder_create_listener(pr, ai);
   }
 
   su_freeaddrinfo(res);
-  
+
   if (!pr->pr_forwarders) {
     fprintf(stderr, "%s:%s: %s\n", argv[1], argv[2], "unable to forward");
     return 1;
@@ -233,7 +233,7 @@ void pr_deinit(proxy_t *pr)
     su_root_destroy(pr->pr_root), pr->pr_root = NULL;
 
   su_home_deinit(pr->pr_home);
-  
+
   su_deinit();
 }
 
@@ -315,8 +315,8 @@ static forwarder_t *forwarder_create_listener(proxy_t *pr, su_addrinfo_t *ai)
       su_setblocking(s, 0);
       su_setreuseaddr(s, 1);
       if (bind(s, ai->ai_addr, ai->ai_addrlen) >= 0) {
-       if (ai->ai_socktype == SOCK_STREAM ? 
-           forwarder_init_stream(f) >= 0 : 
+       if (ai->ai_socktype == SOCK_STREAM ?
+           forwarder_init_stream(f) >= 0 :
            forwarder_init_dgram(f) >= 0)
          return f;
       }
@@ -327,7 +327,7 @@ static forwarder_t *forwarder_create_listener(proxy_t *pr, su_addrinfo_t *ai)
   }
 
   forwarder_destroy(f);
-  
+
   return NULL;
 }
 
@@ -335,11 +335,11 @@ int forwarder_init_stream(forwarder_t *f)
 {
   if (listen(f->f_socket, SOMAXCONN) < 0)
     return SOCKET_ERROR;
-  
+
   if (su_wait_create(f->f_wait, f->f_socket, SU_WAIT_ACCEPT) < 0)
     return SOCKET_ERROR;
 
-  if (su_root_register(f->f_pr->pr_root, f->f_wait, 
+  if (su_root_register(f->f_pr->pr_root, f->f_wait,
                       forwarder_accept, f, 0) < 0)
     return SOCKET_ERROR;
 
@@ -359,7 +359,7 @@ int forwarder_accept(proxy_t *pr, su_wait_t *w, forwarder_t *f0)
   su_sockaddr_t *su;
   socklen_t  sulen;
   int events;
-  
+
   events = su_wait_events(w, f0->f_socket);
 
   f = forwarder_create(pr);
@@ -371,7 +371,7 @@ int forwarder_accept(proxy_t *pr, su_wait_t *w, forwarder_t *f0)
     f->f_upstream = 1;
     if (f->f_socket != INVALID_SOCKET) {
       char buf[SU_ADDRSIZE];
-      
+
       SU_DEBUG_3(("accept: connection from %s:%u\n",
                  su_inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
                  ntohs(su->su_port)));
@@ -400,7 +400,7 @@ int forwarder_stream_peer(proxy_t *pr, forwarder_t *f_peer)
   su_addrinfo_t *ai;
 
   assert(f_peer);
-  
+
   f = forwarder_create(pr);
   if (!f) {
     SU_DEBUG_1(("%s: cannot allocate peer\n", __func__));
@@ -440,7 +440,7 @@ int forwarder_stream_peer(proxy_t *pr, forwarder_t *f_peer)
     goto error;
   }
 
-  if (su_root_register(pr->pr_root, f->f_wait + 1, 
+  if (su_root_register(pr->pr_root, f->f_wait + 1,
                       forwarder_connected, f, 0) == -1) {
     SU_DEBUG_1(("%s: cannot register\n", __func__));
     goto error;
@@ -495,13 +495,13 @@ int forwarder_recv(proxy_t *pr, su_wait_t *w, forwarder_t *f)
   if (n > 0) {
     b->b_sent = 0; b->b_used = n;
     if (f->f_peer->f_buf) {
-      forwarder_append(f, b); 
+      forwarder_append(f, b);
       return 0;
     }
     if (forwarder_send(pr, f->f_peer, b) >= 0) {
       if (b->b_sent < b->b_used) {
        su_root_unregister(pr->pr_root, w, forwarder_recv, f);
-       su_root_register(pr->pr_root, f->f_peer->f_wait + 1, 
+       su_root_register(pr->pr_root, f->f_peer->f_wait + 1,
                         forwarder_empty, f->f_peer, 0);
        forwarder_append(f, b);
       }
@@ -514,7 +514,7 @@ int forwarder_recv(proxy_t *pr, su_wait_t *w, forwarder_t *f)
   if (n < 0) {
     int error = su_errno();
     SU_DEBUG_1(("recv: %s\n", su_strerror(error)));
-  
+
     if (error == EINTR || error == EAGAIN || error == EWOULDBLOCK) {
       return 0;
     }
@@ -523,7 +523,7 @@ int forwarder_recv(proxy_t *pr, su_wait_t *w, forwarder_t *f)
   }
 
   /* shutdown */
-  forwarder_shutdown(f);       
+  forwarder_shutdown(f);
 
   return 0;
 }
@@ -531,7 +531,7 @@ int forwarder_recv(proxy_t *pr, su_wait_t *w, forwarder_t *f)
 int forwarder_send(proxy_t *pr, forwarder_t *f, buffer_t *b)
 {
   int n, error;
-  
+
   do {
     n = send(f->f_socket, b->b_data + b->b_sent, b->b_used - b->b_sent, 0);
 
@@ -626,11 +626,11 @@ int forwarder_shutdown(forwarder_t *f)
   forwarder_t *f_peer = f->f_peer;
   su_sockaddr_t *su = f->f_dest;
   char buf[SU_ADDRSIZE];
-  
+
   SU_DEBUG_3(("forwarder_shutdown: shutdown from %s:%u\n",
              su_inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
              ntohs(su->su_port)));
-  
+
   if (su_root_unregister(f->f_pr->pr_root, f->f_wait, forwarder_recv, f) < 0) {
     SU_DEBUG_1(("%s: su_root_unregister failed\n", __func__));
   }
index fe52976dd24feaae4e31b8487f5ec37aa5a869fb..defed9b9a1bf5d7b1365b233bea2d38c8fa32049 100644 (file)
@@ -99,7 +99,7 @@ void su_pthread_port_lock(su_port_t *self, char const *who)
 
   su_home_lock(self->sup_base->sup_home);
 
-  PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...", 
+  PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
                   (void *)pthread_self(), who, self));
 }
 
@@ -107,7 +107,7 @@ void su_pthread_port_unlock(su_port_t *self, char const *who)
 {
   su_home_unlock(self->sup_base->sup_home);
 
-  PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n", 
+  PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
                   (void *)pthread_self(), who, self));
 }
 
@@ -116,7 +116,7 @@ void su_pthread_port_unlock(su_port_t *self, char const *who)
  * Change or query ownership of the port object.
  *
  * @param self pointer to a port object
- * @param op operation 
+ * @param op operation
  *
  * @ERRORS
  * @ERROR EALREADY port already has an owner (or has no owner)
@@ -224,7 +224,7 @@ struct su_pthread_port_waiting_parent {
  *
  * @sa su_root_threading(), su_clone_task(), su_clone_stop(), su_clone_wait(),
  * su_clone_forget().
- * 
+ *
  */
 int su_pthreaded_port_start(su_port_create_f *create,
                            su_root_t *parent,
@@ -302,7 +302,7 @@ static void *su_pthread_port_clone_main(void *varg)
 
       task->sut_root->sur_threading = 1;       /* By default */
 
-      SU_TASK_COPY(task->sut_root->sur_parent, su_root_task(arg->parent), 
+      SU_TASK_COPY(task->sut_root->sur_parent, su_root_task(arg->parent),
                   su_pthread_port_clone_main);
       SU_TASK_COPY(task->sut_root->sur_task, task,
                   su_pthread_port_clone_main);
@@ -329,7 +329,7 @@ static void *su_pthread_port_clone_main(void *varg)
            mom->waiting = 0;
            pthread_cond_signal(mom->cv);
            pthread_mutex_unlock(mom->mutex);
-    
+
            pthread_mutex_lock(mom->deinit);
            su_port_getmsgs(task->sut_port);
            pthread_mutex_unlock(mom->deinit);
@@ -345,7 +345,7 @@ static void *su_pthread_port_clone_main(void *varg)
     }
 
     task->sut_port->sup_base->sup_vtable->
-      su_port_decref(task->sut_port, zap, 
+      su_port_decref(task->sut_port, zap,
                     "su_pthread_port_clone_main");
   }
 
@@ -373,7 +373,7 @@ static void su_pthread_port_return_to_parent(struct clone_args *arg,
 /** "Stop" message function for pthread clone.
  *
  * @sa su_clone_wait()
- * @internal 
+ * @internal
  */
 static void su_pthread_port_clone_break(su_root_magic_t *m,
                                        su_msg_r msg,
@@ -406,8 +406,8 @@ void su_pthread_port_wait(su_clone_r rclone)
     su_base_port_wait(rclone);
     return;
   }
-  
-  assert(parent); assert(clone); 
+
+  assert(parent); assert(clone);
   assert(rclone[0]->sum_func == su_pthread_port_clone_break);
 #if 0
   assert(!clone->sup_paused);
@@ -418,7 +418,7 @@ void su_pthread_port_wait(su_clone_r rclone)
   if (!clone->sup_thread) {    /* Already died */
     su_msg_destroy(rclone);
     pthread_join(tid, NULL);
-    return;  
+    return;
   }
 
   pthread_mutex_init(mom->deinit, NULL);
index 8ed26c1dde992c12bf210502073d752aa5fd16fd..9aba660c2ec34ef88c264a0e4a9f70fcb2b85f03 100644 (file)
  */
 
 /**@ingroup su_wait
- * @CFILE su_root.c 
- * OS-independent synchronization interface. 
+ * @CFILE su_root.c
+ * OS-independent synchronization interface.
  * @internal
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Sep 14 15:51:04 1999 ppessi
  */
 
@@ -56,7 +56,7 @@ struct su_root_s;
 #include "sofia-sip/su_alloc.h"
 
 /**@ingroup su_wait
- * 
+ *
  * @page su_root_t Tasks and root objects
  *
  * A task is the basic execution unit for the Sofia event-driven programming
@@ -91,8 +91,8 @@ struct su_root_s;
  * New tasks can be created via su_clone_start() function.
  */
 
-/**@ingroup su_wait 
- * 
+/**@ingroup su_wait
+ *
  * @page su_root_register Registering Wait Objects
  *
  * When application expects I/O events, it can create a wait object and
@@ -111,8 +111,8 @@ struct su_root_s;
  */
 
 /**@ingroup su_wait
- * 
- * Contains hint of number of sockets supported by su_root_t */ 
+ *
+ * Contains hint of number of sockets supported by su_root_t */
 int su_root_size_hint = 64;
 
 /* =========================================================================
@@ -187,7 +187,7 @@ _su_task_r su_task_new(su_task_r task, su_root_t *root, su_port_t *port)
 void su_task_copy(su_task_r dst, su_task_r const src)
 {
   su_port_t *port;
-  
+
   assert(src); assert(dst);
 
   SU_TASK_ZAP(dst, su_task_copy);
@@ -219,10 +219,10 @@ void su_task_move(su_task_r dst, su_task_r src)
 
 /**
  * Compare two tasks with each other.
- * 
+ *
  * @param a  First task
  * @param b  Second task
- * 
+ *
  * @retval negative number, if a < b
  * @retval positive number, if a > b
  * @retval 0, if a == b.
@@ -249,14 +249,14 @@ int su_task_cmp(su_task_r const a, su_task_r const b)
  *
  * @param task  task handle
  *
- * @retval true (nonzero) if task is not stopped, 
+ * @retval true (nonzero) if task is not stopped,
  * @retval zero if it is null or stopped.
  */
 int su_task_is_running(su_task_r const task)
 {
-  return 
-    task && 
-    task->sut_port && 
+  return
+    task &&
+    task->sut_port &&
     task->sut_root;
 }
 
@@ -265,7 +265,7 @@ int su_task_is_running(su_task_r const task)
  *
  * @param self task handle
  * @param root pointer to the root object
- * 
+ *
  * @retval 0 if successful,
  * @retval -1 otherwise.
  */
@@ -275,16 +275,16 @@ int su_task_attach(su_task_r self, su_root_t *root)
     self->sut_root = root;
     return 0;
   }
-  else 
+  else
     return -1;
 }
 
-/** 
+/**
  * Get root pointer attached to a task handle.
  *
  * @param self task handle
  *
- * @return 
+ * @return
  * A pointer to root object attached to the task handle, or NULL if no root
  * object has been attached.
  */
@@ -307,7 +307,7 @@ int su_task_detach(su_task_r self)
 
 /**
  * Return the timer list associated with given task.
- * 
+ *
  * @param task task handle
  *
  * @return A timer list of the task. If there are no timers, it returns
@@ -408,7 +408,7 @@ su_root_t *su_root_create_with_port(su_root_magic_t *magic,
     /* This one creates a new reference to port */
     su_task_new(self->sur_task, self, port);
     /* ... so we zap the old one below */
-  } 
+  }
 
   su_port_decref(port, "su_root_create_with_port");
 
@@ -416,7 +416,7 @@ su_root_t *su_root_create_with_port(su_root_magic_t *magic,
 }
 
 /** Destroy a root object.
- * 
+ *
  *  Stop and free an instance of su_root_t
  *
  * @param self     pointer to a root object.
@@ -541,7 +541,7 @@ struct _GSource *su_root_gsource(su_root_t *self)
   return su_port_gsource(self->sur_port);
 }
 
-/** Register a su_wait_t object. 
+/** Register a su_wait_t object.
  *
  *  The function su_root_register() registers a su_wait_t object. The wait
  *  object, a callback function and a argument are stored to the root
@@ -655,7 +655,7 @@ int su_root_eventmask(su_root_t *self, int index, int socket, int events)
  *
  * @param self      pointer to root object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -808,8 +808,8 @@ _su_task_r su_root_parent(su_root_t const *self)
 }
 
 /** Add a pre-poll callback. */
-int su_root_add_prepoll(su_root_t *root, 
-                       su_prepoll_f *callback, 
+int su_root_add_prepoll(su_root_t *root,
+                       su_prepoll_f *callback,
                        su_prepoll_magic_t *magic)
 {
   if (root == NULL)
@@ -840,7 +840,7 @@ int su_root_release(su_root_t *root)
   return su_port_release(root->sur_port);
 }
 
-/** Obtain the root port from other thread. 
+/** Obtain the root port from other thread.
  *
  * @param root pointer to root object
  *
@@ -848,7 +848,7 @@ int su_root_release(su_root_t *root)
  * @retval -1 upon an error
  *
  * @ERRORS
- * @ERROR EFAULT 
+ * @ERROR EFAULT
  * @NEW_1_12_7
  */
 int su_root_obtain(su_root_t *root)
@@ -858,7 +858,7 @@ int su_root_obtain(su_root_t *root)
   return su_port_obtain(root->sur_port);
 }
 
-/**Check if a thread has obtained the root. 
+/**Check if a thread has obtained the root.
  *
  * @param root a pointer to root object
  *
@@ -883,13 +883,13 @@ int su_root_has_thread(su_root_t *root)
 /**
  * Allocate a su message of given size.
  *
- * Allocate a su message with given data size. 
+ * Allocate a su message with given data size.
  *
  * @param  rmsg   handle to the new message (may be uninitialized prior calling)
  * @param  size   size of the message data
  *
  * @retval  0 if successful,
- * @retval -1 if message allocation fails.  
+ * @retval -1 if message allocation fails.
  *
  * @NEW_1_12_8
  */
@@ -919,7 +919,7 @@ int su_msg_new(su_msg_r rmsg, size_t size)
  * @param  size   size of the message data
  *
  * @retval  0 if successful,
- * @retval -1 if message allocation fails.  
+ * @retval -1 if message allocation fails.
  */
 int su_msg_create(su_msg_r        rmsg,
                  su_task_r const to,
@@ -932,17 +932,17 @@ int su_msg_create(su_msg_r        rmsg,
     SU_TASK_COPY(rmsg[0]->sum_from, from, su_msg_create);
     rmsg[0]->sum_func = wakeup;
     return 0;
-  } 
+  }
 
   return -1;
 }
 
 /** Add a delivery report function to a message.
- * 
+ *
  * The delivery report funcgtion gets called by the sending task after the
  * message was delivered and the message function was executed. (The
- * su_root_t message delivery loop calls su_msg_delivery_report() 
- * 
+ * su_root_t message delivery loop calls su_msg_delivery_report()
+ *
  */
 int su_msg_report(su_msg_r msg,
                  su_msg_f report)
@@ -1068,7 +1068,7 @@ void su_msg_destroy(su_msg_r rmsg)
   }
 }
 
-/** Gets a pointer to the message data area. 
+/** Gets a pointer to the message data area.
  *
  * The function @c su_msg_data() returns a pointer to the message data
  * area. If @c rmsg contains a @c NULL handle, or message size is 0, @c NULL
@@ -1076,7 +1076,7 @@ void su_msg_destroy(su_msg_r rmsg)
  *
  * @param rmsg       message handle
  *
- * @return A pointer to the message data area is returned.  
+ * @return A pointer to the message data area is returned.
  */
 su_msg_arg_t *su_msg_data(su_msg_cr rmsg)
 {
@@ -1101,7 +1101,7 @@ isize_t su_msg_size(su_msg_cr rmsg)
  *
  * @param rmsg       message handle
  *
- * @return The task handle of the sender is returned.  
+ * @return The task handle of the sender is returned.
  */
 _su_task_r su_msg_from(su_msg_cr rmsg)
 {
@@ -1118,14 +1118,14 @@ _su_task_r su_msg_from(su_msg_cr rmsg)
  *
  * @param rmsg       message handle
  *
- * @return The task handle of the recipient is returned.  
+ * @return The task handle of the recipient is returned.
  */
 _su_task_r su_msg_to(su_msg_cr rmsg)
 {
   return rmsg[0] ? rmsg[0]->sum_to : NULL;
 }
 
-/** Remove references to 'from' and 'to' tasks from a message. 
+/** Remove references to 'from' and 'to' tasks from a message.
  *
  * @param rmsg       message handle
  */
@@ -1137,7 +1137,7 @@ void su_msg_remove_refs(su_msg_cr rmsg)
   }
 }
 
-/**Send a message. 
+/**Send a message.
  *
  * The function @c su_msg_send() sends the message. The message is added to
  * the recipients message queue, and recipient is waken up. The caller may
@@ -1156,7 +1156,7 @@ int su_msg_send(su_msg_r rmsg)
   if (rmsg[0]) {
     su_msg_t *msg = rmsg[0];
 
-    if (msg->sum_to->sut_port) 
+    if (msg->sum_to->sut_port)
       return su_port_send(msg->sum_to->sut_port, rmsg);
 
     su_msg_destroy(rmsg);
@@ -1164,7 +1164,7 @@ int su_msg_send(su_msg_r rmsg)
     return -1;
   }
 
-  return 0;            
+  return 0;
 }
 
 /** Send message to the @a to_task and mark @a from_task as sender.
@@ -1183,9 +1183,9 @@ SOFIAPUBFUN int su_msg_send_to(su_msg_r rmsg,
     if (wakeup)
       msg->sum_func = wakeup;
 
-    if (msg->sum_to->sut_port && 
+    if (msg->sum_to->sut_port &&
        msg->sum_to->sut_port != to_task->sut_port) {
-      SU_TASK_ZAP(msg->sum_to, "su_msg_send_to"); 
+      SU_TASK_ZAP(msg->sum_to, "su_msg_send_to");
     }
 
     if (to_task->sut_port != NULL) {
index 2196ee951a8dafcd2ee9ae666a4474ad707872b3..abb5cdc2c12af6f9c047fcc7de0fea45089c1191 100644 (file)
@@ -83,8 +83,8 @@ struct su_select_port_s {
   int              sup_epoll;
   unsigned         sup_multishot; /**< Multishot operation? */
 
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                   */
   int              sup_n_registrations;
@@ -94,15 +94,15 @@ struct su_select_port_s {
   /** Structure containing registration data */
   struct su_select_register {
     struct su_select_register *ser_next; /* Next in free list */
-    su_wakeup_f     ser_cb; 
-    su_wakeup_arg_t*ser_arg; 
-    su_root_t      *ser_root; 
+    su_wakeup_f     ser_cb;
+    su_wakeup_arg_t*ser_arg;
+    su_root_t      *ser_root;
     int             ser_id; /** registration identifier */
     su_wait_t       ser_wait[1];
   } **sup_indices;
 
   int               sup_maxfd, sup_allocfd;
-  
+
   fd_set           *sup_readfds, *sup_readfds2;
   fd_set           *sup_writefds, *sup_writefds2;
 };
@@ -111,19 +111,19 @@ static void su_select_port_decref(su_port_t *self,
                                 int blocking,
                                 char const *who);
 static int su_select_port_register(su_port_t *self,
-                                 su_root_t *root, 
-                                 su_wait_t *wait, 
+                                 su_root_t *root,
+                                 su_wait_t *wait,
                                  su_wakeup_f callback,
                                  su_wakeup_arg_t *arg,
                                  int priority);
 static int su_select_port_unregister(su_port_t *port,
-                                   su_root_t *root, 
-                                   su_wait_t *wait,    
-                                   su_wakeup_f callback, 
+                                   su_root_t *root,
+                                   su_wait_t *wait,
+                                   su_wakeup_f callback,
                                    su_wakeup_arg_t *arg);
 static int su_select_port_deregister(su_port_t *self, int i);
 static int su_select_port_unregister_all(su_port_t *self, su_root_t *root);
-static int su_select_port_eventmask(su_port_t *self, 
+static int su_select_port_eventmask(su_port_t *self,
                                   int index,
                                   int socket,
                                   int events);
@@ -189,22 +189,22 @@ static void su_select_port_deinit(void *arg)
  *
  *  Please note if identical wait objects are inserted, only first one is
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @return
- *   Positive index of the wait object, 
+ *   Positive index of the wait object,
  *   or -1 upon an error.
  */
 int su_select_port_register(su_port_t *self,
-                          su_root_t *root, 
-                          su_wait_t *wait, 
+                          su_root_t *root,
+                          su_wait_t *wait,
                           su_wakeup_f callback,
                           su_wakeup_arg_t *arg,
                           int priority)
@@ -225,7 +225,7 @@ int su_select_port_register(su_port_t *self,
 
   self->sup_registers++;
 
-  if (wait->fd >= allocfd) 
+  if (wait->fd >= allocfd)
     allocfd += __NFDBITS;              /* long at a time */
 
   if (allocfd >= self->sup_allocfd) {
@@ -259,7 +259,7 @@ int su_select_port_register(su_port_t *self,
     su_home_t *h = su_port_home(self);
 
     i = self->sup_max_index, j = i == 0 ? 15 : i + 16;
-    
+
     if (j >= self->sup_size_indices) {
       /* Reallocate index table */
       n = n < 1024 ? 2 * n : n + 1024;
@@ -291,7 +291,7 @@ int su_select_port_register(su_port_t *self,
   i = ser->ser_id;
 
   indices[0] = ser->ser_next;
-  
+
   ser->ser_next = NULL;
   *ser->ser_wait = *wait;
   ser->ser_cb = callback;
@@ -358,25 +358,25 @@ static int su_select_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
 
 /** Unregister a su_wait_t object.
- *  
- * The function su_select_port_unregister() unregisters a su_wait_t object. 
+ *
+ * The function su_select_port_unregister() unregisters a su_wait_t object.
  * The registration defined by the wait object, the callback function and
  * the argument pointer are removed from the port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
  *
- * @deprecated Use su_select_port_deregister() instead. 
+ * @deprecated Use su_select_port_deregister() instead.
  *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_select_port_unregister(su_port_t *self,
-                            su_root_t *root, 
-                            su_wait_t *wait,   
+                            su_root_t *root,
+                            su_wait_t *wait,
                             su_wakeup_f callback, /* XXX - ignored */
                             su_wakeup_arg_t *arg)
 {
@@ -404,14 +404,14 @@ int su_select_port_unregister(su_port_t *self,
 }
 
 /** Deregister a su_wait_t object.
- *  
+ *
  *  Deregisters a registration by index. The wait object, a callback
  *  function and a argument are removed from the port object. The wait
  *  object is destroyed.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 int su_select_port_deregister(su_port_t *self, int i)
@@ -434,10 +434,10 @@ int su_select_port_deregister(su_port_t *self, int i)
  *
  * The function su_select_port_unregister_all() unregisters all su_wait_t
  * objects associated with given root object.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @return Number of wait objects removed.
  */
 int su_select_port_unregister_all(su_port_t *self, su_root_t *root)
@@ -498,7 +498,7 @@ int su_select_port_eventmask(su_port_t *self,
     return -1;
 
   assert(socket < self->sup_maxfd);
-  
+
   if (events & SU_WAIT_IN)
     FD_SET(socket, self->sup_readfds);
   else
@@ -521,7 +521,7 @@ int su_select_port_eventmask(su_port_t *self,
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -533,7 +533,7 @@ int su_select_port_multishot(su_port_t *self, int multishot)
     return self->sup_multishot;
   else if (multishot == 0 || multishot == 1)
     return self->sup_multishot = multishot;
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
@@ -563,7 +563,7 @@ int su_select_port_wait_events(su_port_t *self, su_duration_t tout)
   if (bytes) {
     rset = memcpy(self->sup_readfds2, self->sup_readfds, bytes);
     wset = memcpy(self->sup_writefds2, self->sup_writefds, bytes);
-  }  
+  }
 
   tv.tv_sec = tout / 1000;
   tv.tv_usec = (tout % 1000) * 1000;
@@ -609,7 +609,7 @@ int su_select_port_wait_events(su_port_t *self, su_duration_t tout)
 
     if (n == 0)
       break;
-  }    
+  }
 
   assert(n == 0);
 
@@ -627,9 +627,9 @@ su_port_t *su_select_port_create(void)
     return NULL;
 
   if (su_home_destructor(su_port_home(self), su_select_port_deinit) < 0 ||
-      !(self->sup_indices = 
+      !(self->sup_indices =
        su_zalloc(su_port_home(self),
-                 (sizeof self->sup_indices[0]) * 
+                 (sizeof self->sup_indices[0]) *
                  (self->sup_size_indices = __NFDBITS)))) {
     su_home_unref(su_port_home(self));
     return NULL;
@@ -649,7 +649,7 @@ int su_select_clone_start(su_root_t *parent,
                         su_root_init_f init,
                         su_root_deinit_f deinit)
 {
-  return su_pthreaded_port_start(su_select_port_create, 
+  return su_pthreaded_port_start(su_select_port_create,
                                 parent, return_clone, magic, init, deinit);
 }
 
index 684313307bc33b8a01781e1f8a12a9d886176762..3de4a9a61f257da589f79a3bf5d86b98ebd70a1a 100644 (file)
@@ -84,7 +84,7 @@ int su_socket_port_init(su_port_t *self, su_port_vtable_t const *vtable)
   su_wait_t wait[1] = { SU_WAIT_INIT };
   char const *why;
 
-  SU_DEBUG_9(("su_socket_port_init(%p, %p) called\n", 
+  SU_DEBUG_9(("su_socket_port_init(%p, %p) called\n",
              (void *)self, (void *)vtable));
 
   if (su_pthread_port_init(self, vtable) != 0)
@@ -109,17 +109,17 @@ int su_socket_port_init(su_port_t *self, su_port_vtable_t const *vtable)
     struct sockaddr_in sin = { sizeof(struct sockaddr_in), 0 };
     socklen_t sinsize = sizeof sin;
     struct sockaddr *sa = (struct sockaddr *)&sin;
-    
+
     af = PF_INET;
-      
+
     self->sup_mbox[0] = mb = su_socket(af, SOCK_DGRAM, IPPROTO_UDP);
     if (mb == INVALID_SOCKET) {
       why = "socket"; goto error;
     }
-    
+
     sin.sin_family = AF_INET;
     sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* 127.1 */
-      
+
     /* Get a port for us */
     if (bind(mb, sa, sizeof sin) == -1) {
       why = "bind"; goto error;
@@ -128,20 +128,20 @@ int su_socket_port_init(su_port_t *self, su_port_vtable_t const *vtable)
     if (getsockname(mb, sa, &sinsize) == -1) {
       why = "getsockname"; goto error;
     }
-    
+
     if (connect(mb, sa, sinsize) == -1) {
       why = "connect"; goto error;
     }
   }
-#endif    
+#endif
 
   if (su_wait_create(wait, mb, SU_WAIT_IN) == -1) {
     why = "su_wait_create";
     goto error;
   }
 
-  self->sup_mbox_index = su_port_register(self, NULL, wait, 
-                                         su_mbox_port_wakeup, 
+  self->sup_mbox_index = su_port_register(self, NULL, wait,
+                                         su_mbox_port_wakeup,
                                          (void *)self->sup_mbox, 0);
 
   if (self->sup_mbox_index <= 0) {
@@ -151,9 +151,9 @@ int su_socket_port_init(su_port_t *self, su_port_vtable_t const *vtable)
   }
 
   return 0;
-  
+
   error:
-    su_log("%s: %s: %s\n", "su_socket_port_init", 
+    su_log("%s: %s: %s\n", "su_socket_port_init",
           why, su_strerror(su_errno()));
 
   return retval;
index b79337327e077b552480ddccb89b19b7c6b1da85..799e8b235954620354fb528cd5a29efde9ac7172 100644 (file)
@@ -27,7 +27,7 @@
  * @CFILE su_sprintf.c  su_*sprintf() functions
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Apr 17 20:05:21 2001 ppessi
  */
 
@@ -50,7 +50,7 @@
 
 #include "sofia-sip/su_alloc.h"
 
-/**Copy a formatted string. 
+/**Copy a formatted string.
  *
  * The function su_vsprintf() print a string according to a @a fmt like
  * vprintf() or vsnprintf(). The resulting string is copied to a memory area
@@ -61,7 +61,7 @@
  * @param home pointer to memory home (may be NULL)
  * @param fmt format string
  * @param ap @e stdarg argument list (must match with the @a fmt format string)
- * 
+ *
  * @return A pointer to a fresh copy of formatting result, or NULL upon an
  * error.
  */
@@ -76,9 +76,9 @@ char *su_vsprintf(su_home_t *home, char const *fmt, va_list ap)
   n = vsnprintf(s, sizeof(s), fmt, aq);
   va_end(aq);
 
-  if (n >= 0 && (size_t)n + 1 < sizeof(s)) 
+  if (n >= 0 && (size_t)n + 1 < sizeof(s))
     return su_strdup(home, s);
-  
+
   len = n > 0 ? (size_t)n + 1 : 2 * sizeof(s);
 
   for (rv = su_alloc(home, len);
@@ -90,7 +90,7 @@ char *su_vsprintf(su_home_t *home, char const *fmt, va_list ap)
     if (n > -1 && (size_t)n < len)
       break;
     if (n > -1)                        /* glibc >2.1 */
-      len = (size_t)n + 1;             
+      len = (size_t)n + 1;
     else                       /* glibc 2.0 */
       len *= 2;
 
@@ -101,7 +101,7 @@ char *su_vsprintf(su_home_t *home, char const *fmt, va_list ap)
   return rv;
 }
 
-/**Copy a formatted string. 
+/**Copy a formatted string.
  *
  * The function su_sprintf() print a string according to a @a fmt like
  * printf() or snprintf(). The resulting string is copied to a memory area
@@ -112,7 +112,7 @@ char *su_vsprintf(su_home_t *home, char const *fmt, va_list ap)
  * @param home pointer to memory home (may be NULL)
  * @param fmt format string
  * @param ... argument list (must match with the @a fmt format string)
- * 
+ *
  * @return A pointer to a fresh copy of formatting result, or NULL upon an
  * error.
  */
index d3c37178fb94ba22d7f987116f156dacccd90912..773f93844967637c026e03434c602a41cab4effb 100644 (file)
@@ -27,7 +27,7 @@
  * @CFILE su_strdup.c  Home-based string duplication functions
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Wed Jul 19 10:06:14 2000 ppessi
  */
 
@@ -44,7 +44,7 @@
  *
  * @param home  pointer to memory home
  * @param s     string to be duplicated
- * 
+ *
  * @return The function su_strdup() returns pointer to the newly created
  *         string, or @c NULL upon an error.
  */
@@ -70,7 +70,7 @@ char *su_strdup(su_home_t *home, char const *s)
  * @param home  pointer to memory home
  * @param s1    string to be first string
  * @param s2    string to be first string
- * 
+ *
  * @return Pointer to the newly created string is returned, or @c NULL upon
  * an error.
  */
@@ -104,7 +104,7 @@ char *su_strcat(su_home_t *home, char const *s1, char const *s2)
  *
  * @param home  pointer to memory home
  * @param ...  NULL-terminated list of strings to be concatenated
- * 
+ *
  * @return Pointer to the newly created string is returned, or @c NULL upon
  * an error.
  */
@@ -152,7 +152,7 @@ char *su_strcat_all(su_home_t *home, ...)
  * @param home  pointer to memory home
  * @param s     string to be duplicated
  * @param n     size of the resulting string
- * 
+ *
  * @return The function su_strndup() returns pointer to the newly created
  *         string, or @c NULL upon an error.
  */
index c94858c5710aea06a2eb34c7d4a70657f3b9d362..93de99023a3e4113f007852aaeb538458410be38 100644 (file)
  * @code
  * usize_t i, n;
  * su_strlst_t *l;
- * 
+ *
  * l = su_strlst_split(NULL, buf, "\n");
- * 
+ *
  * nonempty = 0;
- * 
+ *
  * for (i = 0; i < su_strlst_len(l); i++) {
  *   n = strcspn(su_strlst_item(l, i), " \t");
  *   if (su_strlst_item(l, i)[n])
  *     nonempty++;
  * }
- * 
+ *
  * su_strlst_destroy(l);
  * @endcode
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Fri May  3 09:22:59 2002 ppessi
  */
 
@@ -250,8 +250,8 @@ su_strlst_t *su_strlst_vcreate_with_dup(su_home_t *home,
 
 /** Copy a string list */
 static
-su_strlst_t *su_strlst_copy_by(su_home_t *home, 
-                              su_strlst_t const *orig, 
+su_strlst_t *su_strlst_copy_by(su_home_t *home,
+                              su_strlst_t const *orig,
                               int deeply)
 {
   su_strlst_t *self;
@@ -330,7 +330,7 @@ static int su_strlst_increase(su_strlst_t *self)
       if (list)
        memcpy(list, self->sl_list, self->sl_len * sizeof(*self->sl_list));
     }
-    
+
     if (!list)
       return 0;
 
@@ -341,7 +341,7 @@ static int su_strlst_increase(su_strlst_t *self)
   return 1;
 }
 
-/**Duplicate and append a string to list. 
+/**Duplicate and append a string to list.
  *
  * @param self  pointer to a string list object
  * @param str   string to be duplicated and appended
@@ -448,7 +448,7 @@ char const *su_slvprintf(su_strlst_t *self, char const *fmt, va_list ap)
 
 /**Returns a numbered item from the list of strings. The numbering starts from
  * 0.
- * 
+ *
  * @param self  pointer to a string list object
  * @param i     string index
  *
@@ -464,10 +464,10 @@ char const *su_strlst_item(su_strlst_t const *self, usize_t i)
     return NULL;
 }
 
-/**Sets a item to the list of strings. 
+/**Sets a item to the list of strings.
  *
  * Note that the item numbering starts from 0.
- * 
+ *
  * @param self  pointer to a string list object
  * @param i     string index
  * @param s     string to be set as item @a i
@@ -499,7 +499,7 @@ char const *su_strlst_set_item(su_strlst_t *self, usize_t i, char const *s)
 
 /**Removes a numbered item from the list of strings. The numbering starts from
  * 0. The caller is responsible of reclaiming memory used by the removed string.
- * 
+ *
  * @param self  pointer to a string list object
  * @param i     string index
  *
@@ -512,7 +512,7 @@ SU_DLL char const *su_strlst_remove(su_strlst_t *self, usize_t i)
   if (self && i < self->sl_len) {
     char const *s = self->sl_list[i];
 
-    memmove(&self->sl_list[i], &self->sl_list[i + 1], 
+    memmove(&self->sl_list[i], &self->sl_list[i + 1],
            &self->sl_list[self->sl_len] - &self->sl_list[i]);
 
     self->sl_len--;
@@ -539,7 +539,7 @@ SU_DLL char const *su_strlst_remove(su_strlst_t *self, usize_t i)
  * @param home  home pointer
  * @param sep   separator (may be NULL)
  *
- * @return 
+ * @return
  *
  * The function su_strlst_join() returns a concatenation of the strings in
  * list, or NULL upon an error.
@@ -599,7 +599,7 @@ su_strlst_split0(su_strlst_t *l, char *str, char const *sep)
   return l;
 }
 
-/**Split a string. 
+/**Split a string.
  *
  * Splits a string to substrings. It returns a string list object. The
  * string to be split is not copied but instead modified in place. Use
@@ -626,7 +626,7 @@ su_strlst_split(su_home_t *home, char *str, char const *sep)
   return NULL;
 }
 
-/**Duplicate and split a string. 
+/**Duplicate and split a string.
  *
  * Duplicates a string and splits the result to substrings. It returns a
  * string list object. The string to be splitted is not modified.
@@ -638,8 +638,8 @@ su_strlst_split(su_home_t *home, char *str, char const *sep)
  * @return
  * Pointer to list of strings, if successful, or NULL upon an error.
  */
-su_strlst_t *su_strlst_dup_split(su_home_t *home, 
-                                char const *cstr, 
+su_strlst_t *su_strlst_dup_split(su_home_t *home,
+                                char const *cstr,
                                 char const *sep)
 {
   if (cstr) {
@@ -657,23 +657,23 @@ su_strlst_t *su_strlst_dup_split(su_home_t *home,
   return NULL;
 }
 
-/** Get number of items in list. 
+/** Get number of items in list.
  *
- * The function su_strlst_len() returns the number of items in the 
+ * The function su_strlst_len() returns the number of items in the
  * string list.
- * 
+ *
  */
 usize_t su_strlst_len(su_strlst_t const *l)
 {
   return l ? l->sl_len : 0;
 }
 
-/**Get a string array from list. 
+/**Get a string array from list.
  *
  * The function su_strlst_get_array() returns an array of strings. The
  * length of the array is always one longer than the length of the string
  * list, and the last string in the returned array is always NULL.
- * 
+ *
  * @param self pointer to a string list object
  *
  * @return
@@ -686,7 +686,7 @@ char const **su_strlst_get_array(su_strlst_t *self)
     size_t size = sizeof(retval[0]) * (self->sl_len + 1);
 
     retval = su_alloc(self->sl_home, size);
-    
+
     if (retval) {
       memcpy(retval, self->sl_list, sizeof(retval[0]) * self->sl_len);
       retval[self->sl_len] = NULL;
@@ -697,11 +697,11 @@ char const **su_strlst_get_array(su_strlst_t *self)
   return NULL;
 }
 
-/**Free a string array. 
+/**Free a string array.
  *
  * The function su_strlst_free_array() discards a string array allocated
  * with su_strlst_get_array().
- * 
+ *
  * @param self  pointer to a string list object
  * @param array  string array to be freed
  *
index fbedf535686d31d3f49fedb41e8d233e57ae921f..23aa48495b5e288d2122ba7e4a70984855a06f9d 100644 (file)
  */
 
 /**@SU_TAG
- * 
- * @CFILE su_tag.c  
+ *
+ * @CFILE su_tag.c
  *
  * Special tags.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
  * @date Created: Tue Feb 20 20:03:38 2001 ppessi
index 7da3b17d1bcff01067bdd388cc7b29a053b3f5a3..47e0c441c814cb22543cfd9936fc8805e5e2f6a2 100644 (file)
  */
 
 /**@SU_TAG
- * 
+ *
  * @CFILE su_tag_io.c
  * @brief Printing tag lists.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Wed Feb 21 12:12:27 2001 ppessi
  */
 
@@ -62,7 +62,7 @@ void tl_print(FILE *f, char const *title, tagi_t const lst[])
       if (n > 0 && buffer[n - 1] == '\n')
        fmt = "   %s";
     }
-    else 
+    else
       buffer[sizeof(buffer) - 1] = '\0';
     fprintf(f, fmt, buffer);
   }
index 80630e69687f4fae85e91a0e143a9b296f477191..0fc08c03576a4456a744262ab6b71de200cc7de2 100644 (file)
@@ -23,8 +23,8 @@
  */
 
 /**@SU_TAG
- * 
- * @CFILE su_taglist.c  
+ *
+ * @CFILE su_taglist.c
  *
  * Implementation of tag items and lists.
  *
@@ -66,7 +66,7 @@ unsigned longlong strtoull(const char *, char **, int);
  *
  * Object-oriented tag routines for Sofia utility library.
  *
- * The <sofia-sip/su_tag.h> defines a interface to object-oriented tag list routines. 
+ * The <sofia-sip/su_tag.h> defines a interface to object-oriented tag list routines.
  * A tag list is a linear list (array) of tag items, tagi_t structures,
  * terminated by a TAG_END() item. Each tag item has a label, tag, (@c
  * t_tag) and a value (@c t_value). The tag is a pointer (tag_type_t) to a
@@ -86,7 +86,7 @@ unsigned longlong strtoull(const char *, char **, int);
  * be used to a list of named arguments to a @ref tagarg "@em tagarg"
  * function, to store variable amount of data in a memory area, and pass
  * data between processes and threads.
- * 
+ *
  * The tagged argument lists can be used like named arguments in
  * higher-level languages. The argument list consists of tag-value pairs;
  * tags specify the name and type of the value. All the tag items are not
@@ -94,21 +94,21 @@ unsigned longlong strtoull(const char *, char **, int);
  * to other functions. This feature is used also by the Sofia APIs, the
  * lower-layer settings and options are frequently passed through the
  * upper-layer API in the tag lists.
- * 
+ *
  * The tagged argument lists are constructed using special macros that
  * expand to two function arguments, tag and value. Each tag item macro
  * checks its arguments type so the tagged argument lists are typesafe if
  * the list is correctly constructed.
- * 
+ *
  * Each function documents the tags it accepts and also the tags it may pass
  * to the lower layers (at least in theory).
- * 
+ *
  * @par Special Tags
  *
  * There are a new special tags that are used to control and modify the tag
  * list processing itself. These special tags are as follows:
  * - TAG_NULL() or TAG_END() - indicates the end of tag list
- * - TAG_SKIP() - indicates an empty (overwritten) tag item 
+ * - TAG_SKIP() - indicates an empty (overwritten) tag item
  * - TAG_NEXT() - contains a pointer to the next tag list.
  *
  * The tag type structures are declared as tag_typedef_t. They can be
@@ -137,8 +137,8 @@ int t_snprintf(tagi_t const *t, char b[], size_t size)
 {
   tag_type_t tt = TAG_TYPE_OF(t);
   int n, m;
-  
-  n = snprintf(b, size, "%s::%s: ", 
+
+  n = snprintf(b, size, "%s::%s: ",
                tt->tt_ns ? tt->tt_ns : "",
               tt->tt_name ? tt->tt_name : "null");
   if (n < 0)
@@ -177,10 +177,10 @@ tagi_t *tl_next(tagi_t const *t)
 }
 
 /**Move a tag list.
- * 
+ *
  * The function tl_tmove() moves the tag list arguments to @a dst.  The @a
  * dst must have big enough for all arguments.
- * 
+ *
  * @param dst   pointer to the destination buffer
  * @param size  sizeof @a dst
  * @param t_tag,t_value,... tag list
@@ -188,14 +188,14 @@ tagi_t *tl_next(tagi_t const *t)
  * @return
  * The function tl_tmove() returns number of tag list items initialized.
  */
-size_t tl_tmove(tagi_t *dst, size_t size, 
+size_t tl_tmove(tagi_t *dst, size_t size,
                tag_type_t t_tag, tag_value_t t_value, ...)
 {
   size_t n = 0, N = size / sizeof(tagi_t);
   tagi_t tagi[1];
   va_list ap;
-  
-  va_start(ap, t_value); 
+
+  va_start(ap, t_value);
 
   tagi->t_tag = t_tag, tagi->t_value = t_value;
 
@@ -204,7 +204,7 @@ size_t tl_tmove(tagi_t *dst, size_t size,
     if (n < N)
       dst[n] = *tagi;
     n++;
-    if (t_end(tagi)) 
+    if (t_end(tagi))
       break;
 
     tagi->t_tag = va_arg(ap, tag_type_t);
@@ -217,16 +217,16 @@ size_t tl_tmove(tagi_t *dst, size_t size,
 }
 
 /**Move a tag list.
- * 
+ *
  * The function tl_move() copies the tag list @a src to the buffer @a
  * dst. The size of the @a dst list must be at least @c tl_len(src) bytes.
- * 
+ *
  * @param dst pointer to the destination buffer
  * @param src tag list to be moved
  *
  * @return
  * The function tl_move() returns a pointer to the @a dst list after last
- * moved element.  
+ * moved element.
  */
 tagi_t *tl_move(tagi_t *dst, tagi_t const src[])
 {
@@ -242,10 +242,10 @@ tagi_t *tl_move(tagi_t *dst, tagi_t const src[])
 size_t tl_len(tagi_t const lst[])
 {
   size_t len = 0;
-  
+
   do {
     len += t_len(lst);
-  } 
+  }
   while ((lst = t_next(lst)));
 
   return len;
@@ -271,15 +271,15 @@ size_t tl_xtra(tagi_t const lst[], size_t offset)
  * functionality.
  *
  * The size of the @a dst buffer must be at least @c tl_len(src) bytes.  The
- * size of buffer @a **bb must be at least @c tl_dup_xtra(src) bytes. 
- * 
+ * size of buffer @a **bb must be at least @c tl_dup_xtra(src) bytes.
+ *
  * @param[out] dst pointer to the destination buffer
  * @param[in] src tag list to be duplicated
  * @param[in,out] bb  pointer to pointer to buffer
  *
  * @return
  * A pointer to the @a dst list after last
- * duplicated taglist element.  
+ * duplicated taglist element.
  *
  * The pointer at @a *bb is updated to the byte after last duplicated memory
  * area.
@@ -292,12 +292,12 @@ tagi_t *tl_dup(tagi_t dst[], tagi_t const src[], void **bb)
 
   return dst;
 }
-              
+
 
 /** Free a tag list.
  *
  * The function tl_free() frees resources associated with a tag list.
- * In other words, it calls t_free on each tag item on the list. 
+ * In other words, it calls t_free on each tag item on the list.
  *
  */
 void tl_free(tagi_t list[])
@@ -349,7 +349,7 @@ tagi_t *tl_find(tagi_t const lst[], tag_type_t tt)
 tagi_t *tl_find_last(tagi_t const lst[], tag_type_t tt)
 {
   tagi_t const *last, *next;
-  
+
   for (next = last = t_find(tt, lst); next; next = t_find(tt, t_next(last)))
     last = next;
 
@@ -373,9 +373,9 @@ int t_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
 static int tl_get(tag_type_t tt, void *p, tagi_t const lst[])
 {
   tagi_t const *t, *latest = NULL;
-  
+
   assert(tt);
-  
+
   if (tt == NULL || p == NULL)
     return 0;
 
@@ -414,14 +414,14 @@ int tl_gets(tagi_t const lst[], tag_type_t tag, tag_value_t value, ...)
       assert(tt->tt_class == ref_tag_class);
     }
 #endif
-  } 
+  }
 
   ta_end(ta);
 
   return n;
 }
 
-/** Find tags from given list. 
+/** Find tags from given list.
  *
  * Copies values of argument tag list into the reference tags in the tag
  * list @a lst.
@@ -453,7 +453,7 @@ int tl_tgets(tagi_t lst[], tag_type_t tag, tag_value_t value, ...)
       assert(tt->tt_class == ref_tag_class);
     }
 #endif
-  } 
+  }
 
   ta_end(ta);
 
@@ -462,9 +462,9 @@ int tl_tgets(tagi_t lst[], tag_type_t tag, tag_value_t value, ...)
 
 
 /** Filter an element in tag list */
-tagi_t *t_filter(tagi_t *dst, 
-                tagi_t const filter[], 
-                tagi_t const *src, 
+tagi_t *t_filter(tagi_t *dst,
+                tagi_t const filter[],
+                tagi_t const *src,
                 void **bb)
 {
   tag_type_t tt = TAG_TYPE_OF(src);
@@ -475,7 +475,7 @@ tagi_t *t_filter(tagi_t *dst,
       if (TAG_TYPE_OF(f)->tt_filter)
        dst = TAG_TYPE_OF(f)->tt_filter(dst, f, src, bb);
       else if (f->t_tag == tt)
-       dst = t_dup(dst, src, bb); 
+       dst = t_dup(dst, src, bb);
     }
   }
   else {
@@ -500,7 +500,7 @@ tagi_t *t_filter(tagi_t *dst,
  *
  * Each tag in @a src is checked against tags in list @a filter. If the tag
  * is in the @a filter list, or there is a special filter tag in the list
- * which matches with the tag in @a src, the tag is duplicated to @a dst using 
+ * which matches with the tag in @a src, the tag is duplicated to @a dst using
  * memory buffer in @a b.
  *
  * When @a dst is NULL, this function calculates the size of the filtered list.
@@ -508,9 +508,9 @@ tagi_t *t_filter(tagi_t *dst,
  * @sa tl_afilter(), tl_tfilter(), tl_filtered_tlist(),
  * TAG_FILTER(), TAG_ANY(), #ns_tag_class
  */
-tagi_t *tl_filter(tagi_t dst[], 
-                 tagi_t const filter[], 
-                 tagi_t const src[], 
+tagi_t *tl_filter(tagi_t dst[],
+                 tagi_t const filter[],
+                 tagi_t const src[],
                  void **b)
 {
   tagi_t const *s;
@@ -536,13 +536,13 @@ tagi_t *tl_filter(tagi_t dst[],
 
 
 
-/**Filter a tag list. 
- * 
+/**Filter a tag list.
+ *
  * The function tl_afilter() will build a tag list containing tags specified
  * in @a filter and extracted from @a src.  It will allocate the memory used by
  * tag list via the specified memory @a home, which may be also @c NULL.
  *
- * @sa tl_afilter(), tl_tfilter(), tl_filtered_tlist(), 
+ * @sa tl_afilter(), tl_tfilter(), tl_filtered_tlist(),
  * TAG_FILTER(), TAG_ANY(), #ns_tag_class
  */
 tagi_t *tl_afilter(su_home_t *home, tagi_t const filter[], tagi_t const src[])
@@ -574,10 +574,10 @@ tagi_t *tl_afilter(su_home_t *home, tagi_t const filter[], tagi_t const src[])
 }
 
 /** Filter tag list @a src with given tags.
- * 
+ *
  * @sa tl_afilter(), tl_filtered_tlist(), TAG_FILTER(), TAG_ANY(), #ns_tag_class
  */
-tagi_t *tl_tfilter(su_home_t *home, tagi_t const src[], 
+tagi_t *tl_tfilter(su_home_t *home, tagi_t const src[],
                   tag_type_t tag, tag_value_t value, ...)
 {
   tagi_t *tl;
@@ -592,7 +592,7 @@ tagi_t *tl_tfilter(su_home_t *home, tagi_t const src[],
  *
  * @sa tl_afilter(), tl_tfilter(), TAG_FILTER(), TAG_ANY(), #ns_tag_class
  */
-tagi_t *tl_filtered_tlist(su_home_t *home, tagi_t const filter[], 
+tagi_t *tl_filtered_tlist(su_home_t *home, tagi_t const filter[],
                          tag_type_t tag, tag_value_t value, ...)
 {
   tagi_t *tl;
@@ -687,13 +687,13 @@ tagi_t *tl_vlist2(tag_type_t tag, tag_value_t value, va_list ap)
   for (;t;) {
     *t++ = *tagi;
 
-    if (t_end(tagi)) 
+    if (t_end(tagi))
       break;
 
     tagi->t_tag = va_arg(ap, tag_type_t);
     tagi->t_value = va_arg(ap, tag_value_t);
   }
-  
+
   assert((char *)rv + size == (char *)t);
 
   return rv;
@@ -702,7 +702,7 @@ tagi_t *tl_vlist2(tag_type_t tag, tag_value_t value, va_list ap)
 /** Make a tag list until TAG_NEXT() or TAG_END() */
 tagi_t *tl_list(tag_type_t tag, tag_value_t value, ...)
 {
-  va_list ap;  
+  va_list ap;
   tagi_t *t;
 
   va_start(ap, value);
@@ -728,7 +728,7 @@ size_t tl_vllen(tag_type_t tag, tag_value_t value, va_list ap)
     next = tl_next(tagi);
     if (next != tagi + 1)
       break;
-    
+
     if (tagi->t_tag != tag_skip)
       len += sizeof(tagi_t);
     tagi->t_tag = va_arg(ap, tag_type_t);
@@ -791,7 +791,7 @@ tagi_t *tl_vllist(tag_type_t tag, tag_value_t value, va_list ap)
  */
 tagi_t *tl_llist(tag_type_t tag, tag_value_t value, ...)
 {
-  va_list ap;  
+  va_list ap;
   tagi_t *t;
 
   va_start(ap, value);
@@ -809,7 +809,7 @@ void tl_vfree(tagi_t *t)
 }
 
 /** Convert a string to the a value of a tag. */
-int t_scan(tag_type_t tt, su_home_t *home, char const *s, 
+int t_scan(tag_type_t tt, su_home_t *home, char const *s,
           tag_value_t *return_value)
 {
   if (tt == NULL || s == NULL || return_value == NULL)
@@ -856,9 +856,9 @@ tagi_t const * t_null_find(tag_type_t tt, tagi_t const lst[])
   return NULL;
 }
 
-tagi_t *t_null_filter(tagi_t *dst, 
-                     tagi_t const filter[], 
-                     tagi_t const *src, 
+tagi_t *t_null_filter(tagi_t *dst,
+                     tagi_t const filter[],
+                     tagi_t const *src,
                      void **bb)
 {
   if (TAG_TYPE_OF(src) == tag_null) {
@@ -871,9 +871,9 @@ tagi_t *t_null_filter(tagi_t *dst,
   return dst;
 }
 
-tag_class_t null_tag_class[1] = 
-  {{ 
-    sizeof(null_tag_class), 
+tag_class_t null_tag_class[1] =
+  {{
+    sizeof(null_tag_class),
     /* tc_next */     t_null_next,
     /* tc_len */      NULL,
     /* tc_move */     t_null_move,
@@ -939,15 +939,15 @@ tagi_t *t_skip_dup(tagi_t *dst, tagi_t const *src, void **bb)
   return dst;
 }
 
-tagi_t *t_skip_filter(tagi_t *dst, 
-                   tagi_t const filter[], 
-                   tagi_t const *src, 
+tagi_t *t_skip_filter(tagi_t *dst,
+                   tagi_t const filter[],
+                   tagi_t const *src,
                    void **bb)
 {
   return dst;
 }
 
-tag_class_t skip_tag_class[1] = 
+tag_class_t skip_tag_class[1] =
   {{
     sizeof(skip_tag_class),
     /* tc_next */     t_skip_next,
@@ -994,15 +994,15 @@ tagi_t *t_next_dup(tagi_t *dst, tagi_t const *src, void **bb)
   return dst;
 }
 
-tagi_t *t_next_filter(tagi_t *dst, 
-                   tagi_t const filter[], 
-                   tagi_t const *src, 
+tagi_t *t_next_filter(tagi_t *dst,
+                   tagi_t const filter[],
+                   tagi_t const *src,
                    void **bb)
 {
   return dst;
 }
 
-tag_class_t next_tag_class[1] = 
+tag_class_t next_tag_class[1] =
   {{
     sizeof(next_tag_class),
     /* tc_next */     t_next_next,
@@ -1024,8 +1024,8 @@ tag_typedef_t tag_next = TAG_TYPEDEF(tag_next, next);
 /* filter tag  - use function to filter tag */
 
 tagi_t *t_filter_with(tagi_t *dst,
-                     tagi_t const *t, 
-                     tagi_t const *src, 
+                     tagi_t const *t,
+                     tagi_t const *src,
                      void **bb)
 {
   tag_filter_f *function;
@@ -1039,7 +1039,7 @@ tagi_t *t_filter_with(tagi_t *dst,
     return dst;
 
   if (dst) {
-    return t_dup(dst, src, bb); 
+    return t_dup(dst, src, bb);
   }
   else {
     dst = (tagi_t *)((char *)dst + t_len(src));
@@ -1047,8 +1047,8 @@ tagi_t *t_filter_with(tagi_t *dst,
     return dst;
   }
 }
-                  
-tag_class_t filter_tag_class[1] = 
+
+tag_class_t filter_tag_class[1] =
   {{
     sizeof(filter_tag_class),
     /* tc_next */     NULL,
@@ -1071,14 +1071,14 @@ tag_typedef_t tag_filter = TAG_TYPEDEF(tag_filter, filter);
 /* any tag - match to any tag when filtering */
 
 tagi_t *t_any_filter(tagi_t *dst,
-                    tagi_t const filter[], 
-                    tagi_t const *src, 
+                    tagi_t const filter[],
+                    tagi_t const *src,
                     void **bb)
 {
   if (!src)
     return dst;
   else if (dst) {
-    return t_dup(dst, src, bb); 
+    return t_dup(dst, src, bb);
   }
   else {
     dst = (tagi_t *)((char *)dst + t_len(src));
@@ -1086,8 +1086,8 @@ tagi_t *t_any_filter(tagi_t *dst,
     return dst;
   }
 }
-                  
-tag_class_t any_tag_class[1] = 
+
+tag_class_t any_tag_class[1] =
   {{
     sizeof(any_tag_class),
     /* tc_next */     NULL,
@@ -1111,8 +1111,8 @@ tag_typedef_t tag_any = TAG_TYPEDEF(tag_any, any);
 
 static
 tagi_t *t_ns_filter(tagi_t *dst,
-                   tagi_t const filter[], 
-                   tagi_t const *src, 
+                   tagi_t const filter[],
+                   tagi_t const *src,
                    void **bb)
 {
   char const *match, *ns;
@@ -1137,7 +1137,7 @@ tagi_t *t_ns_filter(tagi_t *dst,
     return dst;
 
   if (dst) {
-    return t_dup(dst, src, bb); 
+    return t_dup(dst, src, bb);
   }
   else {
     dst = (tagi_t *)((char *)dst + t_len(src));
@@ -1146,8 +1146,8 @@ tagi_t *t_ns_filter(tagi_t *dst,
   }
 }
 
-/** Namespace filtering class */                  
-tag_class_t ns_tag_class[1] = 
+/** Namespace filtering class */
+tag_class_t ns_tag_class[1] =
   {{
     sizeof(ns_tag_class),
     /* tc_next */     NULL,
@@ -1178,15 +1178,15 @@ int t_int_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
   return 1;
 }
 
-int t_int_scan(tag_type_t tt, su_home_t *home, 
-              char const *s, 
+int t_int_scan(tag_type_t tt, su_home_t *home,
+              char const *s,
               tag_value_t *return_value)
 {
   int value;
   char *rest;
 
   value = strtol(s, &rest, 0);
-  
+
   if (s != rest) {
     *return_value = (tag_value_t)value;
     return 1;
@@ -1197,7 +1197,7 @@ int t_int_scan(tag_type_t tt, su_home_t *home,
   }
 }
 
-tag_class_t int_tag_class[1] = 
+tag_class_t int_tag_class[1] =
   {{
     sizeof(int_tag_class),
     /* tc_next */     NULL,
@@ -1228,15 +1228,15 @@ int t_uint_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
   return 1;
 }
 
-int t_uint_scan(tag_type_t tt, su_home_t *home, 
-              char const *s, 
+int t_uint_scan(tag_type_t tt, su_home_t *home,
+              char const *s,
               tag_value_t *return_value)
 {
   unsigned value;
   char *rest;
 
   value = strtoul(s, &rest, 0);
-  
+
   if (s != rest) {
     *return_value = (tag_value_t)value;
     return 1;
@@ -1247,7 +1247,7 @@ int t_uint_scan(tag_type_t tt, su_home_t *home,
   }
 }
 
-tag_class_t uint_tag_class[1] = 
+tag_class_t uint_tag_class[1] =
   {{
     sizeof(int_tag_class),
     /* tc_next */     NULL,
@@ -1282,15 +1282,15 @@ int t_size_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
 }
 
 static
-int t_size_scan(tag_type_t tt, su_home_t *home, 
-                char const *s, 
+int t_size_scan(tag_type_t tt, su_home_t *home,
+                char const *s,
                 tag_value_t *return_value)
 {
   unsigned longlong value;
   char *rest;
 
   value = strtoull(s, &rest, 0);
-  
+
   if (s != rest && value <= SIZE_MAX) {
     *return_value = (tag_value_t)value;
     return 1;
@@ -1302,7 +1302,7 @@ int t_size_scan(tag_type_t tt, su_home_t *home,
 }
 
 /** Tag class for tags with size_t value. @NEW_1_12_5. */
-tag_class_t size_tag_class[1] = 
+tag_class_t size_tag_class[1] =
   {{
     sizeof(int_tag_class),
     /* tc_next */     NULL,
@@ -1330,15 +1330,15 @@ int t_usize_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
 }
 
 static
-int t_usize_scan(tag_type_t tt, su_home_t *home, 
-                char const *s, 
+int t_usize_scan(tag_type_t tt, su_home_t *home,
+                char const *s,
                 tag_value_t *return_value)
 {
   unsigned longlong value;
   char *rest;
 
   value = strtoull(s, &rest, 0);
-  
+
   if (s != rest && value <= USIZE_MAX) {
     *return_value = (tag_value_t)value;
     return 1;
@@ -1350,7 +1350,7 @@ int t_usize_scan(tag_type_t tt, su_home_t *home,
 }
 
 /** Tag class for tags with usize_t value. @NEW_1_12_5. */
-tag_class_t usize_tag_class[1] = 
+tag_class_t usize_tag_class[1] =
   {{
     sizeof(int_tag_class),
     /* tc_next */     NULL,
@@ -1382,17 +1382,17 @@ int t_bool_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
   return 1;
 }
 
-int t_bool_scan(tag_type_t tt, su_home_t *home, 
-              char const *s, 
+int t_bool_scan(tag_type_t tt, su_home_t *home,
+              char const *s,
               tag_value_t *return_value)
 {
   int retval;
   int value = 0;
 
-  if (strncasecmp(s, "true", 4) == 0 
+  if (strncasecmp(s, "true", 4) == 0
       && strlen(s + 4) == strspn(s + 4, " \t\r\n")) {
     value = 1, retval = 1;
-  } else if (strncasecmp(s, "false", 5) == 0 
+  } else if (strncasecmp(s, "false", 5) == 0
             && strlen(s + 5) == strspn(s + 5, " \t\r\n")) {
     value = 0, retval = 1;
   } else {
@@ -1404,11 +1404,11 @@ int t_bool_scan(tag_type_t tt, su_home_t *home,
     *return_value = (tag_value_t)value;
   else
     *return_value = (tag_value_t)0;
-  
+
   return retval;
 }
 
-tag_class_t bool_tag_class[1] = 
+tag_class_t bool_tag_class[1] =
   {{
     sizeof(bool_tag_class),
     /* tc_next */     NULL,
@@ -1440,8 +1440,8 @@ int t_ptr_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
 }
 
 /* This is not usually very safe, so it is not used */
-int t_ptr_scan(tag_type_t tt, su_home_t *home, 
-              char const *s, 
+int t_ptr_scan(tag_type_t tt, su_home_t *home,
+              char const *s,
               tag_value_t *return_value)
 {
   int retval;
@@ -1453,11 +1453,11 @@ int t_ptr_scan(tag_type_t tt, su_home_t *home,
     *return_value = (tag_value_t)ptr;
   else
     *return_value = (tag_value_t)NULL;
-  
+
   return retval;
 }
 
-tag_class_t ptr_tag_class[1] = 
+tag_class_t ptr_tag_class[1] =
   {{
     sizeof(ptr_tag_class),
     /* tc_next */     NULL,
@@ -1491,7 +1491,7 @@ int t_socket_ref_set(tag_type_t tt, void *ref, tagi_t const value[])
   return 1;
 }
 
-tag_class_t socket_tag_class[1] = 
+tag_class_t socket_tag_class[1] =
   {{
     sizeof(socket_tag_class),
     /* tc_next */     NULL,
@@ -1512,25 +1512,25 @@ tag_class_t socket_tag_class[1] =
 
 int t_str_snprintf(tagi_t const *t, char b[], size_t size)
 {
-  if (t->t_value) 
+  if (t->t_value)
     return snprintf(b, size, "\"%s\"", (char const *)t->t_value);
   else
     return snprintf(b, size, "<null>");
 }
 
-int t_str_scan(tag_type_t tt, su_home_t *home, 
-              char const *s, 
+int t_str_scan(tag_type_t tt, su_home_t *home,
+              char const *s,
               tag_value_t *return_value)
 {
   int retval;
 
   s = su_strdup(home, s);
-    
+
   if (s)
     *return_value = (tag_value_t)s, retval = 1;
   else
     *return_value = (tag_value_t)NULL, retval = -1;
-  
+
   return retval;
 }
 
@@ -1540,10 +1540,10 @@ tagi_t *t_str_dup(tagi_t *dst, tagi_t const *src, void **bb)
   if (src->t_value) {
     char const *s = (char const *)src->t_value;
     size_t len = strlen(s) + 1;
-    dst->t_value = (tag_value_t)strcpy(*bb, s); 
+    dst->t_value = (tag_value_t)strcpy(*bb, s);
     *bb = (char *)*bb + len;
   }
-  else 
+  else
     dst->t_value = (tag_value_t)0;
 
   return dst + 1;
@@ -1554,7 +1554,7 @@ size_t t_str_xtra(tagi_t const *t, size_t offset)
   return t->t_value ? strlen((char *)t->t_value) + 1 : 0;
 }
 
-tag_class_t str_tag_class[1] = 
+tag_class_t str_tag_class[1] =
   {{
     sizeof(str_tag_class),
     /* tc_next */     NULL,
@@ -1574,7 +1574,7 @@ tag_class_t str_tag_class[1] =
 /* cstr tag - pass constant string value (no need to dup) */
 
 /** Tag class for constant strings */
-tag_class_t cstr_tag_class[1] = 
+tag_class_t cstr_tag_class[1] =
   {{
     sizeof(cstr_tag_class),
     /* tc_next */     NULL,
@@ -1593,7 +1593,7 @@ tag_class_t cstr_tag_class[1] =
 /* ====================================================================== */
 /* ref tag - pass reference */
 
-tag_class_t ref_tag_class[1] = 
+tag_class_t ref_tag_class[1] =
   {{
     sizeof(ref_tag_class),
     /* tc_next */     NULL,
index 0474e4430a8c141f4a40f757a8e979086ce556cf..fa043fcdc4e6bd22d2325c33d758cde2d1b1ca4d 100644 (file)
@@ -30,7 +30,7 @@
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Jari Selin <Jari.Selin@nokia.com>
  * @author Kai Vehmanen <first.surname@nokia.com>
- * 
+ *
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
 
 /**@defgroup su_time Time Handling
  *
  * OS-independent timing functions and types for the @b su library.
- *  
+ *
  * The @b su library provides three different time formats with different
  * ranges and epochs in <sofia-sip/su_time.h>:
  *
  *   - #su_time_t, second and microsecond as 32-bit values since 1900,
  *   - #su_duration_t, milliseconds between two times, and
- *   - #su_ntp_t, standard NTP timestamp (seconds since 1900 as 
- *     a fixed-point 64-bit value with 32 bits representing subsecond 
+ *   - #su_ntp_t, standard NTP timestamp (seconds since 1900 as
+ *     a fixed-point 64-bit value with 32 bits representing subsecond
  *     value).
  */
 
 /**
  * Compare two timestamps.
- * 
+ *
  * The function su_time_cmp() compares two su_time_t timestamps.
- * 
+ *
  * @param t1 first NTP timestamp in su_time_t structure
  * @param t2 second NTP timestamp in su_time_t structure
- * 
+ *
  * @retval  Negative, if @a t1 is before @a t2,
  * @retval  Zero, if @a t1 is same as @a t2, or
  * @retval  Positive, if @a t1 is after @a t2.
- * 
+ *
  */
 long su_time_cmp(su_time_t const t1, su_time_t const t2)
 {
   long retval = 0;
 
-  if (t1.tv_sec > t2.tv_sec) 
+  if (t1.tv_sec > t2.tv_sec)
     retval = 1;
-  else if (t1.tv_sec < t2.tv_sec) 
+  else if (t1.tv_sec < t2.tv_sec)
     retval = -1;
   else {
-    if (t1.tv_usec > t2.tv_usec) 
+    if (t1.tv_usec > t2.tv_usec)
       retval = 1;
-    else if (t1.tv_usec < t2.tv_usec) 
+    else if (t1.tv_usec < t2.tv_usec)
       retval = -1;
   }
 
   return retval;
 }
 
-/**@def SU_TIME_CMP(t1, t2) 
+/**@def SU_TIME_CMP(t1, t2)
  *
  * Compare two timestamps.
  *
@@ -109,7 +109,7 @@ long su_time_cmp(su_time_t const t1, su_time_t const t2)
  *
  * @param t1   first NTP timestamp in su_time_t structure
  * @param t2   second NTP timestamp in su_time_t  structure
- * 
+ *
  * @retval negative, if t1 is before t2,
  * @retval zero,     if t1 is same as t2, or
  * @retval positive, if t1 is after t2.
@@ -119,19 +119,19 @@ long su_time_cmp(su_time_t const t1, su_time_t const t2)
 
 /** Difference between two timestamps.
  *
- * The function returns difference between two timestamps 
+ * The function returns difference between two timestamps
  * in seconds (t1 - t2).
  *
  * @param t1   first timeval
  * @param t2   second timeval
- * 
+ *
  * @return
  *    The difference between two timestamps in seconds as a double.
  */
 double su_time_diff(su_time_t const t1, su_time_t const t2)
 {
   return
-    ((double)t1.tv_sec - (double)t2.tv_sec) 
+    ((double)t1.tv_sec - (double)t2.tv_sec)
     + (double)((long)t1.tv_usec - (long)t2.tv_usec) / 1000000.0;
 }
 
@@ -151,14 +151,14 @@ su_time_t su_now(void)
 
 /** Print su_time_t timestamp.
  *
- *   This function prints a su_time_t timestamp as a decimal number to the 
+ *   This function prints a su_time_t timestamp as a decimal number to the
  *   given buffer.
  *
  * @param s    pointer to buffer
  * @param n    buffer size
  * @param tv   pointer to the timeval object
- * 
- * @return 
+ *
+ * @return
  *   The number of characters printed, excluding the final @c NUL.
  */
 int su_time_print(char *s, int n, su_time_t const *tv)
@@ -172,11 +172,11 @@ int su_time_print(char *s, int n, su_time_t const *tv)
 
 /** Time difference in milliseconds.
  *
- * Calculates the duration from t2 to t1 in milliseconds.  
+ * Calculates the duration from t2 to t1 in milliseconds.
  *
  * @param t1   after time
  * @param t2   before time
- * 
+ *
  * @return The duration in milliseconds between the two times.
  * If the difference is bigger than #SU_DURATION_MAX, return #SU_DURATION_MAX
  * instead.
@@ -215,7 +215,7 @@ const su_t64_t su_res64 = (su_t64_t)1000000UL;
  *
  * The function su_ntp_now() returns the current NTP timestamp.  NTP
  * timestamp is seconds elapsed since January 1st, 1900.
- * 
+ *
  * @return
  * The current time as NTP timestamp is returned.
  */
@@ -235,20 +235,20 @@ su_ntp_t su_ntp_now(void)
 
     usec = now / 1000;
     nsec = now % 1000;
-    
+
     /*
      * Multiply usec by 4294.967296 (ie. 2**32 / 1E6)
-     * 
-     * Utilize fact that 4294.967296 == 4295 - 511 / 15625 
+     *
+     * Utilize fact that 4294.967296 == 4295 - 511 / 15625
      */
     now = 4295 * usec - 511 * usec / 15625;
     rem = (511U * usec) % 15625U;
-  
+
     /* Multiply nsec by 4.294967296 */
     nsec = 4295 * 125 * nsec - (511 * nsec) / 125;
     nsec -= 8 * rem; /* usec rounding */
     nsec = (nsec + (nsec < 0 ? -62499 : +62499)) / 125000;
-    
+
     return now + nsec;
   }
 }
@@ -317,7 +317,7 @@ su_time_t su_t64_to_time(su_t64_t const us)
   return tv;
 }
 
-/** 
+/**
  * Add milliseconds to the time.
  *
  * @param t0  time in seconds and microseconds as @c su_time_t
@@ -328,7 +328,7 @@ su_time_t su_time_add(su_time_t t0, su_duration_t dur)
   return su_t64_to_time(SU_TIME_TO_T64(t0) + SU_DUR_TO_T64(dur));
 }
 
-/** 
+/**
  * Add seconds to the time.
  *
  * @param t0  time in seconds and microseconds as @c su_time_t
@@ -354,7 +354,7 @@ uint64_t su_nanocounter(void)
 
   if(!counterfreq) {
     LARGE_INTEGER Freq = { 0, 0 };
-    if (!QueryPerformanceFrequency(&Freq)) { 
+    if (!QueryPerformanceFrequency(&Freq)) {
       SU_DEBUG_1(("su_counter: QueryPerformanceFrequency failed\n"));
       return 0;
     }
@@ -366,9 +366,9 @@ uint64_t su_nanocounter(void)
      return 0;
   }
   count = (ULONGLONG) LargeIntCount.QuadPart;
+
   /* return value is in ns */
-  return  ((count * 1000 * 1000 * 1000) / counterfreq) ; 
+  return  ((count * 1000 * 1000 * 1000) / counterfreq) ;
 }
 
 uint64_t su_counter(void)
@@ -384,7 +384,7 @@ uint64_t su_counter(void)
  * for timing purposes.
  *
  * Parameters:
- * 
+ *
  * @return
  *   The current CPU counter value in nanoseconds
  */
@@ -396,7 +396,7 @@ uint64_t su_nanocounter(void)
   static clockid_t cpu = CLOCK_REALTIME;
 
 # define CLOCK_GETTIMEOFDAY 0xdedbeefUL
-  
+
   if (init == 0) {
     init = 1;
 
@@ -425,8 +425,8 @@ uint64_t su_nanocounter(void)
     perror("clock_gettime");
 
   /* return value is in nanoseconds */
-  return 
-    (uint64_t)((unsigned long)tp.tv_nsec) + 
+  return
+    (uint64_t)((unsigned long)tp.tv_nsec) +
     (uint64_t)((unsigned long)tp.tv_sec) * 1000000000ULL;
 }
 
@@ -436,7 +436,7 @@ uint64_t su_nanocounter(void)
  * for timing purposes.
  *
  * Parameters:
- * 
+ *
  * @return
  *   The current CPU counter value in microseconds.
  */
@@ -451,8 +451,8 @@ uint64_t su_counter(void)
   struct timeval tv;
   gettimeofday(&tv, NULL);
   /* return value is in microseconds */
-  return 
-    (uint64_t)((unsigned long)tv.tv_usec) + 
+  return
+    (uint64_t)((unsigned long)tv.tv_usec) +
     (uint64_t)((unsigned long)tv.tv_sec) * 1000000ULL;
 }
 
@@ -461,8 +461,8 @@ uint64_t su_nanocounter(void)
   struct timeval tv;
   gettimeofday(&tv, NULL);
   /* return value is in nanoseconds */
-  return 
-    (uint64_t)((unsigned long)tv.tv_usec) * 1000ULL + 
+  return
+    (uint64_t)((unsigned long)tv.tv_usec) * 1000ULL +
     (uint64_t)((unsigned long)tv.tv_sec) * 1000000000ULL;
 }
 
index 466bb7a4ab256e54dd9c799d80f1d874f86f1f5c..8ae8972cf22f8420e40a0b3fcc3c85b5658db5ff 100644 (file)
@@ -31,7 +31,7 @@
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Jari Selin <Jari.Selin@nokia.com>
- * 
+ *
  * @date Created: Fri May 10 18:13:19 2002 ppessi
  */
 
@@ -61,7 +61,7 @@
 #endif
 
 /** Seconds from 1.1.1900 to 1.1.1970 */
-#define NTP_EPOCH 2208988800UL 
+#define NTP_EPOCH 2208988800UL
 #define E9 (1000000000U)
 #define E7 (10000000U)
 
@@ -92,7 +92,7 @@ void su_time(su_time_t *tv)
   GetSystemTimeAsFileTime(date.ft);
 
   tv->tv_usec = (unsigned long) ((date.ull->QuadPart % E7) / 10);
-  tv->tv_sec = (unsigned long) ((date.ull->QuadPart / E7) - 
+  tv->tv_sec = (unsigned long) ((date.ull->QuadPart / E7) -
     /* 1900-Jan-01 - 1601-Jan-01: 299 years, 72 leap years */
     (299 * 365 + 72) * 24 * 60 * (uint64_t)60);
 #else
@@ -122,7 +122,7 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time)
 #if HAVE_CLOCK_GETTIME
   {
     struct timespec tv;
-  
+
     if (clock_gettime(CLOCK_REALTIME, &tv) == 0) {
       now = ((su_nanotime_t)tv.tv_sec + NTP_EPOCH) * E9 + tv.tv_nsec;
       *return_time = now;
@@ -139,11 +139,11 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time)
       FILETIME       ft[1];
       ULARGE_INTEGER ull[1];
     } date;
-    
+
     GetSystemTimeAsFileTime(date.ft);
 
-    now = 100 * 
-      (date.ull->QuadPart - 
+    now = 100 *
+      (date.ull->QuadPart -
        /* 1900-Jan-01 - 1601-Jan-01: 299 years, 72 leap years */
        ((su_nanotime_t)(299 * 365 + 72) * 24 * 60 * 60) * E7);
   }
@@ -173,16 +173,16 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time)
  * monotonic and never goes back - if the underlying system supports such a
  * clock.
  *
- * @param return_time optional pointer to return the current time 
+ * @param return_time optional pointer to return the current time
  *
- * @return Current time as nanoseconds 
+ * @return Current time as nanoseconds
  */
 su_nanotime_t su_monotime(su_nanotime_t *return_time)
 {
 #if HAVE_CLOCK_GETTIME && CLOCK_MONOTONIC
   {
     struct timespec tv;
-  
+
     if (clock_gettime(CLOCK_MONOTONIC, &tv) == 0) {
       su_nanotime_t now = (su_nanotime_t)tv.tv_sec * E9 + tv.tv_nsec;
       if (return_time)
@@ -195,7 +195,7 @@ su_nanotime_t su_monotime(su_nanotime_t *return_time)
 #if HAVE_NANOUPTIME
   {
     struct timespec tv;
-  
+
     nanouptime(&tv);
     now = (su_nanotime_t)tv.tv_sec * E9 + tv.tv_nsec;
     if (return_time)
index 91a4951543a4ebdfcbc4d8c859ab04c02d5112d5..723126783e751afea53d02cb4fd31d3573cd75ed 100644 (file)
@@ -63,7 +63,7 @@
  *   - su_timer_set_interval(),
  *   - su_timer_set_at(),
  *   - su_timer_set(),
- *   - su_timer_set_for_ever(), 
+ *   - su_timer_set_for_ever(),
  *   - su_timer_run(),
  *   - su_timer_reset(), and
  *   - su_timer_root().
@@ -90,7 +90,7 @@
  * The default duration is given in milliseconds.
  *
  * Usually, timer wakeup function should be called at regular intervals. In
- * such case, the timer is activated using function su_timer_set_for_ever(). 
+ * such case, the timer is activated using function su_timer_set_for_ever().
  * When the timer is activated it is given the wakeup function and pointer to
  * context data:
  * @code
@@ -158,7 +158,7 @@ struct su_timer_s {
   unsigned char   sut_set;     /**< Timer is set (inserted in tree) */
 };
 
-/** Timer running status */ 
+/** Timer running status */
 enum sut_running {
   reset = 0,           /**< Timer is not running */
   run_at_intervals = 1, /**< Compensate missed wakeup calls */
@@ -195,7 +195,7 @@ RBTREE_BODIES(su_inline, timers, su_timer_t,
              IS_RED, SET_RED, IS_BLACK, SET_BLACK, COPY_COLOR,
              CMP, INSERT, REMOVE);
 
-/**@internal Set the timer. 
+/**@internal Set the timer.
  *
  * @retval 0 when successful (always)
  */
@@ -217,7 +217,7 @@ su_timer_set0(su_timer_queue_t *timers,
   return timers_append(timers, t);
 }
 
-/**@internal Reset the timer. 
+/**@internal Reset the timer.
  *
  * @retval 0 when successful (always)
  */
@@ -238,7 +238,7 @@ su_timer_reset0(su_timer_queue_t *timers,
 }
 
 /**@internal Validate timer @a t and return pointer to per-port timer tree.
- * 
+ *
  * @retval pointer to pointer to timer tree when successful
  * @retval NULL upon an error
  */
@@ -263,7 +263,7 @@ su_timer_queue_t *su_timer_tree(su_timer_t const *t,
 
   if (use_sut_duration && t->sut_duration == 0) {
     assert(t->sut_duration > 0);
-    SU_DEBUG_1(("%s(%p): %s\n", caller, (void *)t, 
+    SU_DEBUG_1(("%s(%p): %s\n", caller, (void *)t,
                "timer without default duration"));
     return NULL;
   }
index a37b94749555eb47aa84b794dfaed207ac5be41a..b96d9ea61d9e45fb3c8db7ae2097f94f29094658 100644 (file)
@@ -32,7 +32,7 @@
  * not unique if multiple processes are run on the same node.
  *
  * Use su_guid_sprintf() to convert #su_guid_t to printable format.
- * 
+ *
  * The random integers can be generated with functions
  * - su_randint(),
  * - su_randmem(), or
@@ -44,7 +44,7 @@
  * @CFILE su_uniqueid.c Construct a GloballyUniqueID as per H.225.0 v2.
  *
  * @author Pekka Pessi <pessi@research.nokia.com>
- * 
+ *
  * @date Created: Tue Apr 15 06:31:41 1997 pessi
  */
 
@@ -87,7 +87,7 @@ static const uint64_t mask60 = SU_U64_C(0xfffFFFFffffFFFF);
 #define MAGIC (16384)
 
 /* 100-nanosecond intervals between 15 October 1582 and 1 January 1900 */
-static const uint64_t ntp_epoch = 
+static const uint64_t ntp_epoch =
 (uint64_t)(141427) * (24 * 60 * 60L) * granularity;
 
 /* State */
@@ -104,7 +104,7 @@ static uint64_t timestamp(void)
 {
   uint64_t tl = su_ntp_now();
   uint64_t hi = su_ntp_hi(tl), lo = su_ntp_lo(tl);
-  
+
   lo *= granularity;
   hi *= granularity;
 
@@ -143,7 +143,7 @@ static void init(void)
 
   /* Initialize our random number generator */
 #if HAVE_DEV_URANDOM
-  if (!urandom) 
+  if (!urandom)
     urandom = fopen("/dev/urandom", "rb");
 #endif /* HAVE_DEV_URANDOM */
 
@@ -161,7 +161,7 @@ static void init(void)
       seed[2*i] ^= now.tv_sec; seed[2*i+1] ^= now.tv_sec;
     }
 
-    seed[30] ^= getuid(); 
+    seed[30] ^= getuid();
     seed[31] ^= getpid();
   }
 
@@ -252,12 +252,12 @@ void su_guid_generate(su_guid_t *v)
   uint64_t time;
   unsigned clock;
 
-  if (!initialized) init(); 
+  if (!initialized) init();
 
   time = timestamp();
   clock = clock_sequence;
 
-  v->s.time_high_and_version = 
+  v->s.time_high_and_version =
     htons((unsigned short)(((time >> 48) & 0x0fff) | (version << 12)));
   v->s.time_mid = htons((unsigned short)((time >> 32) & 0xffff));
   v->s.time_low = htonl((unsigned long)(time & 0xffffffffUL));
@@ -278,20 +278,20 @@ isize_t su_guid_sprintf(char* buf, size_t len, su_guid_t const *v)
          ntohs(v->s.time_high_and_version),
          v->s.clock_seq_low,
          v->s.clock_seq_hi_and_reserved,
-         v->s.node[0], v->s.node[1], v->s.node[2], 
+         v->s.node[0], v->s.node[1], v->s.node[2],
          v->s.node[3], v->s.node[4], v->s.node[5]);
   memcpy(buf, mybuf, len > sizeof(mybuf) ? sizeof(mybuf) : len);
   return su_guid_strlen;
 }
 
-/* 
- * Generate random integer in range [lb, ub] (inclusive) 
+/*
+ * Generate random integer in range [lb, ub] (inclusive)
  */
 int su_randint(int lb, int ub)
 {
   unsigned rnd = 0;
-  
-  if (!initialized) init(); 
+
+  if (!initialized) init();
 
   if (urandom) {
     size_t len = fread(&rnd, 1, sizeof rnd, urandom); (void)len;
@@ -309,7 +309,7 @@ void *su_randmem(void *mem, size_t siz)
 {
   size_t i;
 
-  if (!initialized) init(); 
+  if (!initialized) init();
 
   if (urandom) {
     size_t len = fread(mem, 1, siz, urandom); (void)len;
@@ -322,14 +322,14 @@ void *su_randmem(void *mem, size_t siz)
   return mem;
 }
 
-/** Get random number for RTP timestamps. 
+/** Get random number for RTP timestamps.
  *
  * This function returns a 32-bit random integer. It also initializes the
  * random number generator, if needed.
  */
 uint32_t su_random(void)
 {
-  if (!initialized) init(); 
+  if (!initialized) init();
 
   if (urandom) {
     uint32_t rnd;
index 6961dc1e6623de7224160818a9583421866f551b..490fbc0b18c0c473aa8b5808fb9a6209f5cd714d 100644 (file)
@@ -37,7 +37,7 @@
  * The vectors are resizeable unidimensional arrays.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Fri Sep 27 14:43:29 2002 ppessi
  */
 
@@ -66,7 +66,7 @@ struct su_vector_s
   void              **v_list;
 };
 
-/** Create a vector. 
+/** Create a vector.
  *
  * The function su_vector_create() creates a pointer vector object. The
  * vector is initially empty. The function clones a memory home for the
@@ -126,19 +126,19 @@ static int su_vector_make_place(su_vector_t *vector, usize_t index)
        return 0;
 
       memcpy(list, vector->v_list, index * sizeof(vector->v_list[0]));
-      memcpy(list + index + 1, vector->v_list + index, 
+      memcpy(list + index + 1, vector->v_list + index,
             (vector->v_len - index) * sizeof(vector->v_list[0]));
 
       if (vector->v_list != (void **)(vector + 1)) {
        su_free(vector->v_home, vector->v_list);
       }
     }
-    
+
     vector->v_list = list;
     vector->v_size *= 2;
   }
   else {
-    memmove(vector->v_list + index + 1, vector->v_list + index, 
+    memmove(vector->v_list + index + 1, vector->v_list + index,
            (vector->v_len - index) * sizeof(vector->v_list[0]));
   }
 
@@ -147,7 +147,7 @@ static int su_vector_make_place(su_vector_t *vector, usize_t index)
   return 1;
 }
 
-/**Insert an item to vector. 
+/**Insert an item to vector.
  *
  * The function su_vector_insert() inserts an @a item to the @a vector.
  * The items after the @a index will be moved further within the vector.
@@ -161,7 +161,7 @@ static int su_vector_make_place(su_vector_t *vector, usize_t index)
  */
 int su_vector_insert(su_vector_t *vector, usize_t index, void *item)
 {
-  if (vector && 
+  if (vector &&
       index <= vector->v_len &&
       su_vector_make_place(vector, index) > 0) {
     vector->v_list[index] = item;
@@ -170,7 +170,7 @@ int su_vector_insert(su_vector_t *vector, usize_t index, void *item)
   return -1;
 }
 
-/**Remove an item from vector. 
+/**Remove an item from vector.
  *
  * The function su_vector_remove() removes an item from the @a vector.
  * The items after the @a index will be moved backwards within the vector.
@@ -186,8 +186,8 @@ int su_vector_remove(su_vector_t *vector, usize_t index)
   if (vector && index < vector->v_len) {
     if (vector->v_free_func)
         (vector->v_free_func)(vector->v_list[index]);
-    
-    memmove(vector->v_list + index, 
+
+    memmove(vector->v_list + index,
             vector->v_list + index + 1,
             (vector->v_len - index - 1) * sizeof(vector->v_list[0]));
     vector->v_len--;
@@ -197,7 +197,7 @@ int su_vector_remove(su_vector_t *vector, usize_t index)
   return -1;
 }
 
-/**Remove all items from vector. 
+/**Remove all items from vector.
  *
  * The function su_vector_empty() removes all items from the @a vector.
  *
@@ -224,7 +224,7 @@ int su_vector_empty(su_vector_t *vector)
   return -1;
 }
 
-/**Append an item to vector. 
+/**Append an item to vector.
  *
  * The function su_vector_append() appends an @a item to the @a vector.
  *
@@ -250,11 +250,11 @@ int su_vector_append(su_vector_t *vector, void *item)
   return 0;
 }
 
-/**Get a numbered item from list. 
+/**Get a numbered item from list.
  *
  * The function su_vector_item() returns a numbered item from vector. The
  * numbering starts from 0.
- * 
+ *
  * @param vector  pointer to a vector object
  * @param i     index
  *
@@ -269,9 +269,9 @@ void *su_vector_item(su_vector_t const *vector, usize_t i)
     return NULL;
 }
 
-/** Get number of items in list. 
+/** Get number of items in list.
  *
- * The function su_vector_len() returns the number of items in the 
+ * The function su_vector_len() returns the number of items in the
  * vector.
  */
 usize_t su_vector_len(su_vector_t const *l)
@@ -284,12 +284,12 @@ int su_vector_is_empty(su_vector_t const *vector)
   return su_vector_len(vector) == 0;
 }
 
-/**Get a pointer array from list. 
+/**Get a pointer array from list.
  *
  * The function su_vector_get_array() returns an array of pointer. The
  * length of the array is always one longer than the length of the vector,
  * and the last item in the returned array is always NULL.
- * 
+ *
  * @param vector  pointer to a vector object
  *
  * @return
@@ -302,7 +302,7 @@ void **su_vector_get_array(su_vector_t *vector)
     size_t newsize = sizeof(retval[0]) * (vector->v_len + 1);
 
     retval = su_alloc(vector->v_home, newsize);
-    
+
     if (retval) {
       retval[vector->v_len] = NULL;
       return memcpy(retval, vector->v_list, sizeof(retval[0]) * vector->v_len);
@@ -312,11 +312,11 @@ void **su_vector_get_array(su_vector_t *vector)
   return NULL;
 }
 
-/**Free a string array. 
+/**Free a string array.
  *
  * The function su_vector_free_array() discards a string array allocated
  * with su_vector_get_array().
- * 
+ *
  * @param vector  pointer to a vector object
  * @param array  string array to be freed
  *
index 8bb9a03f3c1b4a91b723cac47ce78e5dea6837f0..a281470fcbf7791f43b493cc9cd25eb0402a5963 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@ingroup su_wait
  *
- * @CFILE su_wait.c  
+ * @CFILE su_wait.c
  * Implementation of OS-independent socket synchronization interface.
  *
  * This looks like nth reincarnation of "reactor".  It implements the
@@ -121,13 +121,13 @@ void su_wait_init(su_wait_t dst[1])
  *
  * As a side-effect the socket is put into non-blocking mode when wait
  * object is created.
- * 
+ *
  * @param newwait  the newly created wait object (output)
  * @param socket   socket
  * @param events   mask for events that can signal this wait object
- * 
+ *
  * @retval 0 if the call was successful,
- * @retval -1 upon an error.  
+ * @retval -1 upon an error.
 */
 int su_wait_create(su_wait_t *newwait, su_socket_t socket, int events)
 {
@@ -164,7 +164,7 @@ int su_wait_create(su_wait_t *newwait, su_socket_t socket, int events)
   mode |= O_NDELAY | O_NONBLOCK;
   if (fcntl(socket, F_SETFL, mode) < 0)
     return -1;
-  
+
   newwait->fd = socket;
   newwait->events = events;
   newwait->revents = 0;
@@ -177,7 +177,7 @@ int su_wait_create(su_wait_t *newwait, su_socket_t socket, int events)
  *
  * The function su_wait_destroy() destroys a su_wait_t object.
  *
- * @param waitobj  pointer to wait object   
+ * @param waitobj  pointer to wait object
  *
  * @retval 0 when successful,
  * @retval -1 upon an error.
@@ -206,11 +206,11 @@ int su_wait_destroy(su_wait_t *waitobj)
  * The function su_wait() blocks until an event specified by wait objects in
  * @a wait array.  If @a timeout is not SU_WAIT_FOREVER, a timeout occurs
  * after @a timeout milliseconds.
- * 
+ *
  * In Unix, this is @c poll() or @c select().
- * 
+ *
  * In Windows, this is @c WSAWaitForMultipleEvents().
- * 
+ *
  * @param waits    array of wait objects
  * @param n        number of wait objects in array waits
  * @param timeout  timeout in milliseconds
@@ -250,20 +250,20 @@ int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout)
          return j;
       }
     }
-  
+
     if (errno == EINTR)
       continue;
 
     return -1;
-  }  
+  }
 #endif
 }
 
 /** Get events.
- * 
+ *
  *   The function su_wait_events() returns an mask describing events occurred.
  *
- * @param waitobj  pointer to wait object   
+ * @param waitobj  pointer to wait object
  * @param s        socket
  *
  * @return Binary mask describing the events.
@@ -285,15 +285,15 @@ int su_wait_events(su_wait_t *waitobj, su_socket_t s)
 }
 
 /** Set event mask.
- * 
+ *
  *   The function su_wait_mask() sets the mask describing events that can
  *   signal the wait object.
  *
- * @param waitobj  pointer to wait object   
+ * @param waitobj  pointer to wait object
  * @param s        socket
  * @param events   new event mask
  *
- * @retval  0 when successful, 
+ * @retval  0 when successful,
  * @retval -1 upon an error.
  */
 int su_wait_mask(su_wait_t *waitobj, su_socket_t s, int events)
index 241fee77b5b80ba9f6daf74db73e8f8d87c9a4c8..cc4a3852df5fa4139fe243049f8fdc7bd00940ed 100644 (file)
@@ -61,8 +61,8 @@ struct su_wsaevent_port_s {
 
   unsigned         sup_multishot; /**< Multishot operation? */
 
-  unsigned         sup_registers; /** Counter incremented by 
-                                     su_port_register() or 
+  unsigned         sup_registers; /** Counter incremented by
+                                     su_port_register() or
                                      su_port_unregister()
                                   */
 
@@ -70,39 +70,39 @@ struct su_wsaevent_port_s {
   int              sup_size_waits; /**< Size of allocated su_waits */
   int              sup_pri_offset; /**< Offset to prioritized waits */
 
-  /** Indices from index returned by su_root_register() to tables below. 
+  /** Indices from index returned by su_root_register() to tables below.
    *
    * Free elements are negative. Free elements form a list, value of free
    * element is (0 - index of next free element).
    *
-   * First element sup_indices[0] points to first free element. 
+   * First element sup_indices[0] points to first free element.
    */
   int             *sup_indices;
 
   int             *sup_reverses; /** Reverse index */
-  su_wakeup_f     *sup_wait_cbs; 
-  su_wakeup_arg_t**sup_wait_args; 
-  su_root_t      **sup_wait_roots; 
-  su_wait_t       *sup_waits; 
+  su_wakeup_f     *sup_wait_cbs;
+  su_wakeup_arg_t**sup_wait_args;
+  su_root_t      **sup_wait_roots;
+  su_wait_t       *sup_waits;
 
 };
 
 static void su_wsevent_port_decref(su_port_t *, int blocking, char const *who);
 
 static int su_wsevent_port_register(su_port_t *self,
-                                su_root_t *root, 
-                                su_wait_t *wait, 
+                                su_root_t *root,
+                                su_wait_t *wait,
                                 su_wakeup_f callback,
                                 su_wakeup_arg_t *arg,
                                 int priority);
 static int su_wsevent_port_unregister(su_port_t *port,
-                                  su_root_t *root, 
-                                  su_wait_t *wait,     
-                                  su_wakeup_f callback, 
+                                  su_root_t *root,
+                                  su_wait_t *wait,
+                                  su_wakeup_f callback,
                                   su_wakeup_arg_t *arg);
 static int su_wsevent_port_deregister(su_port_t *self, int i);
 static int su_wsevent_port_unregister_all(su_port_t *self, su_root_t *root);
-static int su_wsevent_port_eventmask(su_port_t *self, 
+static int su_wsevent_port_eventmask(su_port_t *self,
                                  int index,
                                  int socket,
                                  int events);
@@ -168,22 +168,22 @@ static void su_wsevent_port_decref(su_port_t *self, int blocking, char const *wh
  *
  *  Please note if identical wait objects are inserted, only first one is
  *  ever signalled.
- * 
+ *
  * @param self      pointer to port
  * @param root      pointer to root object
  * @param waits             pointer to wait object
  * @param callback   callback function pointer
  * @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)
- * 
+ *
  * @return
- *   Positive index of the wait object, 
+ *   Positive index of the wait object,
  *   or -1 upon an error.
  */
 int su_wsevent_port_register(su_port_t *self,
-                         su_root_t *root, 
-                         su_wait_t *wait, 
+                         su_root_t *root,
+                         su_wait_t *wait,
                          su_wakeup_f callback,
                          su_wakeup_arg_t *arg,
                          int priority)
@@ -210,7 +210,7 @@ int su_wsevent_port_register(su_port_t *self,
 
     if (self->sup_size_waits == 0)
       size = su_root_size_hint;
-    else 
+    else
       size = 2 * self->sup_size_waits;
 
     if (size < SU_WAIT_MIN)
@@ -237,7 +237,7 @@ int su_wsevent_port_register(su_port_t *self,
        reverses[i] = -1;
       self->sup_reverses = reverses;
     }
-      
+
     waits = su_realloc(h, self->sup_waits, size * sizeof(*waits));
     if (waits)
       self->sup_waits = waits;
@@ -252,10 +252,10 @@ int su_wsevent_port_register(su_port_t *self,
 
     /* Add sup_wait_roots array, if needed */
     wait_tasks = su_realloc(h, self->sup_wait_roots, size * sizeof(*wait_tasks));
-    if (wait_tasks) 
+    if (wait_tasks)
       self->sup_wait_roots = wait_tasks;
 
-    if (!(indices && 
+    if (!(indices &&
          reverses && waits && wait_cbs && wait_args && wait_tasks)) {
       return -1;
     }
@@ -274,7 +274,7 @@ int su_wsevent_port_register(su_port_t *self,
       self->sup_waits[n] = self->sup_waits[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_roots[n] = self->sup_wait_roots[n-1];     
+      self->sup_wait_roots[n] = self->sup_wait_roots[n-1];
     }
 
     self->sup_pri_offset++;
@@ -314,9 +314,9 @@ static int su_wsevent_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
   if (destroy_wait)
     su_wait_destroy(&self->sup_waits[n]);
-  
+
   N = --self->sup_n_waits;
-  
+
   if (n < self->sup_pri_offset) {
     int j = --self->sup_pri_offset;
     if (n != j) {
@@ -352,7 +352,7 @@ static int su_wsevent_port_deregister0(su_port_t *self, int i, int destroy_wait)
   self->sup_wait_cbs[n] = NULL;
   self->sup_wait_args[n] = NULL;
   self->sup_wait_roots[n] = NULL;
-  
+
   indices[i] = indices[0];
   indices[0] = -i;
 
@@ -363,24 +363,24 @@ static int su_wsevent_port_deregister0(su_port_t *self, int i, int destroy_wait)
 
 
 /** Unregister a su_wait_t object.
- *  
+ *
  * Unregisters a su_wait_t object. The wait object, a callback function and
  * a argument are removed from the port object.
- * 
+ *
  * @param self     - pointer to port object
  * @param root     - pointer to root object
  * @param wait     - pointer to wait object
  * @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)
  *
- * @deprecated Use su_wsevent_port_deregister() instead. 
+ * @deprecated Use su_wsevent_port_deregister() instead.
  *
  * @return Nonzero index of the wait object, or -1 upon an error.
  */
 int su_wsevent_port_unregister(su_port_t *self,
-                           su_root_t *root, 
-                           su_wait_t *wait,    
+                           su_root_t *root,
+                           su_wait_t *wait,
                            su_wakeup_f callback, /* XXX - ignored */
                            su_wakeup_arg_t *arg)
 {
@@ -403,14 +403,14 @@ int su_wsevent_port_unregister(su_port_t *self,
 }
 
 /** Deregister a su_wait_t object.
- *  
+ *
  *  Deregisters a registration by index. The wait object, a callback
  *  function and a argument are removed from the port object. The wait
  *  object is destroyed.
- * 
+ *
  * @param self     - pointer to port object
  * @param i        - registration index
- * 
+ *
  * @return Index of the wait object, or -1 upon an error.
  */
 int su_wsevent_port_deregister(su_port_t *self, int i)
@@ -426,7 +426,7 @@ int su_wsevent_port_deregister(su_port_t *self, int i)
 
   if (self->sup_indices[i] < 0)
     return su_seterrno(EBADF);
-    
+
   retval = su_wsevent_port_deregister0(self, i, 1);
 
   su_wait_destroy(wait);
@@ -440,13 +440,13 @@ int su_wsevent_port_deregister(su_port_t *self, int i)
  *
  * Unregisters all su_wait_t objects and destroys all queued timers
  * associated with given root object.
- * 
+ *
  * @param  self     - pointer to port object
  * @param  root     - pointer to root object
- * 
+ *
  * @return Number of wait objects removed.
  */
-int su_wsevent_port_unregister_all(su_port_t *self, 
+int su_wsevent_port_unregister_all(su_port_t *self,
                                su_root_t *root)
 {
   int i, j, index, N;
@@ -461,11 +461,11 @@ int su_wsevent_port_unregister_all(su_port_t *self,
   N          = self->sup_n_waits;
   indices    = self->sup_indices;
   reverses   = self->sup_reverses;
-  waits      = self->sup_waits; 
-  wait_cbs   = self->sup_wait_cbs; 
+  waits      = self->sup_waits;
+  wait_cbs   = self->sup_wait_cbs;
   wait_args  = self->sup_wait_args;
-  wait_roots = self->sup_wait_roots; 
-  
+  wait_roots = self->sup_wait_roots;
+
   for (i = j = 0; i < N; i++) {
     index = reverses[i]; assert(index > 0 && indices[index] == i);
 
@@ -487,10 +487,10 @@ int su_wsevent_port_unregister_all(su_port_t *self,
       wait_args[j]  = wait_args[i];
       wait_roots[j] = wait_roots[i];
     }
-    
+
     j++;
   }
-  
+
   for (i = j; i < N; i++) {
     reverses[i] = -1;
     wait_cbs[i] = NULL;
@@ -541,7 +541,7 @@ int su_wsevent_port_eventmask(su_port_t *self, int index, int socket, int events
  *
  * @param self      pointer to port object
  * @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
- * 
+ *
  * @retval 0 multishot mode is disabled
  * @retval 1 multishot mode is enabled
  * @retval -1 an error occurred
@@ -553,7 +553,7 @@ int su_wsevent_port_multishot(su_port_t *self, int multishot)
     return self->sup_multishot;
   else if (multishot == 0 || multishot == 1)
     return self->sup_multishot = multishot;
-  else 
+  else
     return (errno = EINVAL), -1;
 }
 
@@ -635,7 +635,7 @@ int su_wsaevent_clone_start(su_root_t *parent,
                            su_root_init_f init,
                            su_root_deinit_f deinit)
 {
-  return su_pthreaded_port_start(su_wsaevent_port_create, 
+  return su_pthreaded_port_start(su_wsaevent_port_create,
                                 parent, return_clone, magic, init, deinit);
 }
 
index 42ce16f765dbd8825f192c97cad45db7dfb79450..76886b7c92657bbe1755bd998c64b6f774dc8e6e 100644 (file)
@@ -105,18 +105,18 @@ HEADER {
   print "" > REF;
 }
 
-/^#define TAG_NAMESPACE/ { 
-  print "#undef TAG_NAMESPACE" > REF; 
-  print $0 > REF; 
+/^#define TAG_NAMESPACE/ {
+  print "#undef TAG_NAMESPACE" > REF;
+  print $0 > REF;
   print "" > REF;
-  print "#undef TAG_NAMESPACE" > DLL; 
-  print $0 > DLL; 
+  print "#undef TAG_NAMESPACE" > DLL;
+  print $0 > DLL;
   print "" > DLL;
 }
 
-/SU_HAVE_EXPERIMENTAL/ { 
-  print $0 > REF; 
-  print $0 > DLL; 
+/SU_HAVE_EXPERIMENTAL/ {
+  print $0 > REF;
+  print $0 > DLL;
 }
 
 !DEFS && /^tag_typedef_t/ { DEFS = 1; }
@@ -139,7 +139,7 @@ DEFS && /tag_typedef_t/ {
 END {
   if (LIST) {
     print "\nEXPORT tag_type_t " LIST "[] =\n{" > REF;
-    print "\nEXPORT tag_type_t " LIST "[] =\n{" > DLL; 
+    print "\nEXPORT tag_type_t " LIST "[] =\n{" > DLL;
     for (tag in typedefs) {
       if (typedefs[tag] !~ /NSTAG_TYPEDEF/) {
         print "  " tag "," > REF;
index 2be1ddfadeb76c20b4957a1bfa161eb6dbb2e613..dcf427c810d6ec7b536ccb4d338d75140a161871 100644 (file)
@@ -85,7 +85,7 @@ typedef struct hentry_s entry_t;
 HTABLE_DECLARE(htable, ht, entry_t);
 HTABLE_PROTOS(htable, ht, entry_t);
 
-struct hentry_s 
+struct hentry_s
 {
   unsigned long e_value;
   unsigned long e_n;
@@ -101,7 +101,7 @@ typedef struct context_s
   htable_t c_hash[1];
 } context_t;
 
-context_t *context_create(void) 
+context_t *context_create(void)
 {
   context_t *c = su_home_clone(NULL, sizeof(*c));
 
@@ -131,7 +131,7 @@ entry_t *search(context_t *c, unsigned long value, unsigned long n, int add)
     /* Resize hash table */
     if (htable_is_full(ht)) {
       htable_resize(c->c_home, ht, 0);
-      fprintf(stderr, "htable: resized to %u with %u entries\n", 
+      fprintf(stderr, "htable: resized to %u with %u entries\n",
              ht->ht_size, ht->ht_used);
     }
 
@@ -157,9 +157,9 @@ void zap(context_t *c, entry_t *e)
   su_free(c->c_home, e);
 }
 
-/* 
- * Check that all n entries with hash h are in hash table 
- * and they are stored in same order 
+/*
+ * Check that all n entries with hash h are in hash table
+ * and they are stored in same order
  * in which they were added to the hash
  */
 static unsigned long count(context_t *c, hash_value_t h)
@@ -168,7 +168,7 @@ static unsigned long count(context_t *c, hash_value_t h)
   unsigned long n, expect = 1;
 
   for (ee = htable_hash(c->c_hash, h), n = 0;
-       (e = *ee); 
+       (e = *ee);
        ee = htable_next(c->c_hash, ee)) {
     if (e->e_value != h)
       continue;
@@ -225,10 +225,10 @@ int table_test(int flags)
 
     TEST_1(add(c, h, 1)); TEST_1(add(c, h, 2)); TEST_1(add(c, h, 3));
     TEST_1(add(c, h, 4)); TEST_1(add(c, h, 5)); TEST_1(add(c, h, 6));
-    TEST_1(add(c, h, 7)); TEST_1(add(c, h, 8)); TEST_1(add(c, h, 9)); 
+    TEST_1(add(c, h, 7)); TEST_1(add(c, h, 8)); TEST_1(add(c, h, 9));
 
     TEST(count(c, h), 9);
-    
+
     TEST(htable_resize(c->c_home, c->c_hash, ++size), 0);
     TEST(count(c, h), 9);
     TEST(htable_resize(c->c_home, c->c_hash, ++size), 0);
index 2d6fdd3057192c7ff543ab8be6dba0b55db61892..62f1dc33543ba33cb470fabd981f00fed46f89b7 100644 (file)
@@ -83,7 +83,7 @@ int main(int argc, char *argv[])
 
 typedef struct hentry_s entry_t;
 
-struct hentry_s 
+struct hentry_s
 {
   hash_value_t e_hash;
   unsigned long e_n;
@@ -108,7 +108,7 @@ typedef struct context_s
   htable2_t c_hash[1];
 } context_t;
 
-context_t *context_create(void) 
+context_t *context_create(void)
 {
   context_t *c = su_home_clone(NULL, sizeof(*c));
 
@@ -139,7 +139,7 @@ entry_t *search(context_t *c, unsigned long value, unsigned long n, int add)
     /* Resize hash table */
     if (htable2_is_full(ht)) {
       htable2_resize(c->c_home, ht, 0);
-      fprintf(stderr, "htable: resized to "MOD_ZU" with "MOD_ZU" entries\n", 
+      fprintf(stderr, "htable: resized to "MOD_ZU" with "MOD_ZU" entries\n",
              ht->ht2_size, ht->ht2_used);
     }
 
@@ -163,9 +163,9 @@ void zap(context_t *c, entry_t e)
   htable2_remove(c->c_hash, e);
 }
 
-/* 
- * Check that all n entries with hash h are in hash table 
- * and they are stored in same order 
+/*
+ * Check that all n entries with hash h are in hash table
+ * and they are stored in same order
  * in which they were added to the hash
  */
 static unsigned long count(context_t *c, hash_value_t h)
@@ -236,10 +236,10 @@ int table2_test(int flags)
 
     TEST_1(add(c, h, 1)); TEST_1(add(c, h, 2)); TEST_1(add(c, h, 3));
     TEST_1(add(c, h, 4)); TEST_1(add(c, h, 5)); TEST_1(add(c, h, 6));
-    TEST_1(add(c, h, 7)); TEST_1(add(c, h, 8)); TEST_1(add(c, h, 9)); 
+    TEST_1(add(c, h, 7)); TEST_1(add(c, h, 8)); TEST_1(add(c, h, 9));
 
     TEST(count(c, h), 9);
-    
+
     TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
     TEST(count(c, h), 9);
     TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
index c5a6a3bc3c49b4dcf6bf014ae60524661ad4378c..ca30b6cac8250740444fb4c7e19d78506addb4a4 100644 (file)
@@ -78,13 +78,13 @@ static int test_notfound(void)
 
   TEST_P(memmem(haystack, 12, needle, 3), haystack + 2);
   TEST_P(memmem(needle, 3, haystack, 12), NULL);
-  
+
 #if HAVE_MEMMEM
   if (memmem(haystack, 12, "", 0) == NULL) {
     fprintf(stderr, "test_memmem.c: "
            "*** WARNING: system memmem() fails with empty needle ***\n");
   }
-  else 
+  else
 #endif
   {
     TEST_P(memmem(haystack, 12, "", 0), haystack);
@@ -151,7 +151,7 @@ int test_strcasestr(void)
   }
 
   {
-    char const hs[] = 
+    char const hs[] =
 "A case-folding string searching test consisting of a Very Long String\n"
 
 "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer felis. "
@@ -194,14 +194,14 @@ int test_strcasestr(void)
 "non, mi. Suspendisse vestibulum nunc eu neque. Sed rutrum felis aliquam "
 "urna. Ut tincidunt orci vitae ipsum. Nullam eros. Quisque augue. Quisque "
 "lacinia. Nunc ligula diam, nonummy a, porta in, tristique quis, leo. "
-"Phasellus nunc nulla, fringilla vel, lacinia et, suscipit a, turpis. " 
+"Phasellus nunc nulla, fringilla vel, lacinia et, suscipit a, turpis. "
 "Integer a est. Curabitur mauris lacus, vehicula sit amet, sodales vel, "
 "iaculis vitae, massa. Nam diam est, ultrices vitae, varius et, tempor a, "
 "leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, "
 "per inceptos hymenaeos. Fusce felis nibh, ullamcorper non, malesuada eget, "
       "facilisis vel, purus.\n";
 
-char const needle[] = 
+char const needle[] =
 "Proin congue. Curabitur placerat diam id eros. "
 "Pellentesque vitae nulla. Quisque at lorem et dolor auctor consequat. Sed "
 "sed tellus non nibh imperdiet venenatis. Integer ultrices dapibus nisi. "
@@ -209,7 +209,7 @@ char const needle[] =
 "ullamcorper pretium lorem. Vestibulum ante ipsum primis in faucibus orci "
 "luctus et ultrices posuere cubilia Curae;\n";
 
-char const Needle[] = 
+char const Needle[] =
 "PROIN CONGUE. CURABITUR PLACERAT DIAM ID EROS. "
 "PELLENTESQUE VITAE NULLA. QUISQUE AT LOREM ET DOLOR AUCTOR CONSEQUAT. SED "
 "SED TELLUS NON NIBH IMPERDIET VENENATIS. INTEGER ULTRICES DAPIBUS NISI. "
index 31bc23b9084e5e3faeb7a9ba7ed3c352f78f1b16..5fc9f482ded3ddbf1ee57cd5abb411c75a71d47d 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@internal 
+/**@internal
  * @file test_poll.c
  * Example code for <sofia-sip/su_wait.h>.
  *
@@ -57,15 +57,15 @@ int main(int argc, char *argv[])
   char *port = host ? argv[2] : NULL;
   su_addrinfo_t *ai = NULL, hints[1] = {{ 0 }};
   int error;
-  
-  if (argv[1] && (strcmp(argv[1], "--help") == 0 || 
-                 strcmp(argv[1], "-?") == 0)) 
+
+  if (argv[1] && (strcmp(argv[1], "--help") == 0 ||
+                 strcmp(argv[1], "-?") == 0))
     usage(argv[0]);
 
   if (!port) port = "echo";
 
   if ((error = su_getaddrinfo(host, port, hints, &ai))) {
-    fprintf(stderr, "poll_test: su_getaddrinfo(): %s\n", 
+    fprintf(stderr, "poll_test: su_getaddrinfo(): %s\n",
            su_gai_strerror(error));
     exit(1);
   }
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
     su_wait_create(&w, s, SU_WAIT_OUT);
 
     n = su_wait(&w, 1, SU_WAIT_FOREVER);
-    
+
     printf("su_wait returned %d\n", n);
 
     err = su_soerror(s);
index 3d27dc3a53d7c0259989474dc6ce664075e4422a..56ef4b098d857f455ae454e209c3ff7408a5c5af 100644 (file)
@@ -30,7 +30,7 @@
  * @internal
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
 
@@ -87,7 +87,7 @@ short opt_family = AF_INET;
 short opt_verbatim = 0;
 short opt_singlethread = 0;
 
-static su_socket_t udpsocket(void) 
+static su_socket_t udpsocket(void)
 {
   su_socket_t s;
   su_sockaddr_t su = { 0 };
@@ -111,7 +111,7 @@ static su_socket_t udpsocket(void)
 
   if (getsockname(s, &su.su_sa, &sulen) == SOCKET_ERROR) {
     su_perror("udpsocket: getsockname");
-    exit(1); 
+    exit(1);
   }
 
   if (opt_verbatim)
@@ -131,7 +131,7 @@ static char *snow(su_time_t now)
   return buf;
 }
 
-void 
+void
 do_ping(struct pinger *p, su_timer_t *t, void *p0)
 {
   char buf[1024];
@@ -142,7 +142,7 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0)
   p->when = su_now();
 
   snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
-  if (su_sendto(p->s, buf, strlen(buf), 0, 
+  if (su_sendto(p->s, buf, strlen(buf), 0,
                &p->addr, su_sockaddr_size(&p->addr)) == -1) {
     su_perror("do_ping: send");
   }
@@ -202,7 +202,7 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0)
   p->id = 0;
 
   snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now()));
-  if (su_sendto(p->s, buf, strlen(buf), 0, 
+  if (su_sendto(p->s, buf, strlen(buf), 0,
                &p->addr, su_sockaddr_size(&p->addr)) == -1) {
     su_perror("do_pong: send");
   }
@@ -472,7 +472,7 @@ usage(int exitcode)
 /*
  * 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
  *
  * Create a pinger, executed from timer, scheduling do_ping(),
@@ -490,8 +490,8 @@ int main(int argc, char *argv[])
   int opt_alarm = 1;
 #endif
 
-  struct pinger 
-    pinger = { PINGER, "ping", 1 }, 
+  struct pinger
+    pinger = { PINGER, "ping", 1 },
     ponger = { PONGER, "pong", 1 };
 
   char *argv0 = argv[0];
@@ -545,13 +545,13 @@ int main(int argc, char *argv[])
 
   fprintf(stdout, "test_su: testing %s port implementation\n",
          su_root_name(root));
-  
+
   su_root_threading(root, !opt_singlethread);
 
   if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0)
     perror("su_clone_start"), exit(1);
   if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0)
-    perror("su_clone_start"), exit(1); 
+    perror("su_clone_start"), exit(1);
 
   /* Test timer, exiting after 200 milliseconds */
   t = su_timer_create(su_root_task(root), 200L);
@@ -559,7 +559,7 @@ int main(int argc, char *argv[])
     su_perror("su_timer_create"), exit(1);
   su_timer_set(t, (su_timer_f)do_exit, NULL);
 
-  su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong), 
+  su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong),
                init_ping, 0);
   su_msg_send(start_msg);
 
@@ -571,13 +571,13 @@ int main(int argc, char *argv[])
   su_timer_destroy(t);
 
   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);
   }
   su_root_destroy(root);
 
   if (opt_verbatim)
-    printf("%s exiting\n", argv0); 
+    printf("%s exiting\n", argv0);
 
   return 0;
 }
index cb32b476b8f065469ca2b86bc445003addc266bc..b126d75a3878370789325f13974dbd511d642816 100644 (file)
@@ -30,7 +30,7 @@
  *
  * @author Martti Mela <Martti.Mela@nokia.com>
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Sep 26 17:16:02 EEST 2006 mela
  */
 
@@ -96,13 +96,13 @@ short opt_root_run = 0;
 /* For run loop */
 int running = 0;
 
-static su_socket_t udpsocket(void) 
+static su_socket_t udpsocket(void)
 {
   su_socket_t s;
   su_sockaddr_t su = { 0 };
   socklen_t sulen = sizeof(su);
   char nbuf[64];
-  
+
   enter;
 
   su.su_family = opt_family;
@@ -122,7 +122,7 @@ static su_socket_t udpsocket(void)
 
   if (getsockname(s, &su.su_sa, &sulen) == SOCKET_ERROR) {
     su_perror("udpsocket: getsockname");
-    exit(1); 
+    exit(1);
   }
 
   if (opt_verbatim)
@@ -144,7 +144,7 @@ static char *snow(su_time_t now)
   return buf;
 }
 
-void 
+void
 do_ping(struct pinger *p, su_timer_t *t, void *p0)
 {
   char buf[1024];
@@ -159,7 +159,7 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0)
   p->when = su_now();
 
   snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
-  if (su_sendto(p->s, buf, strlen(buf), 0, 
+  if (su_sendto(p->s, buf, strlen(buf), 0,
                &p->addr, su_sockaddr_size(&p->addr)) == -1) {
     su_perror("do_ping: send");
   }
@@ -223,7 +223,7 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0)
   p->id = 0;
 
   snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now()));
-  if (su_sendto(p->s, buf, strlen(buf), 0, 
+  if (su_sendto(p->s, buf, strlen(buf), 0,
                &p->addr, su_sockaddr_size(&p->addr)) == -1) {
     su_perror("do_pong: send");
   }
@@ -467,7 +467,7 @@ usage(int exitcode)
 /*
  * 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
  *
  * Create a pinger, executed from timer, scheduling do_ping(),
@@ -483,8 +483,8 @@ int main(int argc, char *argv[])
   su_timer_t *t;
   unsigned long sleeppid = 0;
 
-  struct pinger 
-    pinger = { PINGER, "ping", 1 }, 
+  struct pinger
+    pinger = { PINGER, "ping", 1 },
     ponger = { PONGER, "pong", 1 };
 
   char *argv0 = argv[0];
@@ -528,16 +528,16 @@ int main(int argc, char *argv[])
 
   time_test();
 
-  root = su_root_osx_runloop_create(NULL); 
+  root = su_root_osx_runloop_create(NULL);
 
   if (!root) perror("su_root_osx_runloop_create"), exit(1);
-  
+
   su_root_threading(root, 0 && !opt_singlethread);
 
   if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0)
     perror("su_clone_start"), exit(1);
   if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0)
-    perror("su_clone_start"), exit(1); 
+    perror("su_clone_start"), exit(1);
 
   /* Test timer, exiting after 200 milliseconds */
   t = su_timer_create(su_root_task(root), 2000L);
@@ -545,7 +545,7 @@ int main(int argc, char *argv[])
     su_perror("su_timer_create"), exit(1);
   su_timer_set(t, (su_timer_f)do_exit, NULL);
 
-  su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong), 
+  su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong),
                init_ping, 0);
   su_msg_send(start_msg);
 
@@ -557,20 +557,20 @@ int main(int argc, char *argv[])
     while (running == 1) {
       su_root_step(root, 20);
     }
-  
+
   su_clone_wait(root, ping);
   su_clone_wait(root, pong);
 
   su_timer_destroy(t);
 
   if (pinger.rtt_n) {
-    printf("%s executed %u pings in %g, mean rtt=%g sec\n", name, 
+    printf("%s executed %u pings in %g, mean rtt=%g sec\n", name,
           pinger.rtt_n, pinger.rtt_total, pinger.rtt_total / pinger.rtt_n);
   }
   su_root_destroy(root);
 
   if (opt_verbatim)
-    printf("%s exiting\n", argv0); 
+    printf("%s exiting\n", argv0);
 
 #ifndef HAVE_WIN32
    if (sleeppid)
index 351c991b1f627d13d0cb3ad8ce7ff2b1b647ca62..3811e297d31f42aa724ab6c9c0d945f1683d4ba3 100644 (file)
@@ -175,7 +175,7 @@ int test_smooth_sort()
       TEST(array[i], i - n / 2);
     }
   }
-  
+
   END();
 }
 
@@ -472,7 +472,7 @@ int test_triplet()
   BEGIN();
 
   Heap2 heap = { NULL };
-  
+
   unsigned i, N;
   type1 *items;
 
@@ -498,7 +498,7 @@ int test_triplet()
     TEST(e->key, i);
     TEST(e->value, i);
   }
-  
+
   for (i = 1; i <= N; i++) {
     type2 e = heap2_remove(heap, 1);
     TEST(e->key, i);
index 88e146bd08361e3942b6f6c41d35688906128491..278cabf42081cbe7dbd3e93eb3a49a30721c199c 100644 (file)
@@ -85,7 +85,7 @@ static
 Node *node_new(su_home_t *home, int value)
 {
   Node *n = su_zalloc(home, sizeof (*n));
-  
+
   n->value = value;
 
   return n;
@@ -100,9 +100,9 @@ unsigned log2ceil(unsigned k)
   if (k > (1 << 32))
     result += 32, k = (k >> 32) + ((k & ((1 << 32) - 1)) != 0);
 #endif
-  if (k > (1 << 16)) 
+  if (k > (1 << 16))
     result += 16, k = (k >> 16) + ((k & ((1 << 16) - 1)) != 0);
-  if (k > (1 << 8)) 
+  if (k > (1 << 8))
     result += 8, k = (k >> 8) + ((k & ((1 << 8) - 1)) != 0);
   if (k > (1 << 4))
     result += 4, k = (k >> 4) + ((k & 15) != 0);
@@ -112,7 +112,7 @@ unsigned log2ceil(unsigned k)
     result += 1, k = (k >> 1) + (k & 1);
   if (k > 1)
     result += 1;
-  
+
   return result;
 }
 
@@ -127,7 +127,7 @@ Node *node_find(Node *tree, int value)
     else
       tree = tree->left;
   }
-   
+
   return tree;
 }
 
@@ -163,7 +163,7 @@ int test_insert(void)
   six = node_new(home, 6);
   seven = node_new(home, 7);
 
-  TEST_1(one); 
+  TEST_1(one);
   TEST_1(three);
   TEST_1(five);
   TEST_1(six);
@@ -175,16 +175,16 @@ int test_insert(void)
   TEST_P(five->left, NULL); TEST_P(five->right, NULL);
   TEST_P(five->parent, NULL); TEST(five->black, 1);
 
-  /* Check after another node: 
+  /* Check after another node:
    *
    *         5b
-   *        / 
+   *        /
    *       3r
    */
   TEST(redblack_insert(&tree, three, &o), 0); TEST_P(o, NULL);
   TEST_P(tree->left, three); TEST(tree->black, 1);
   TEST_P(three->left, NULL); TEST_P(three->right, NULL);
-  TEST_P(three->parent, tree); TEST(three->black, 0); 
+  TEST_P(three->parent, tree); TEST(three->black, 0);
 
   /* Check third node
    *         5b
@@ -194,21 +194,21 @@ int test_insert(void)
   TEST(redblack_insert(&tree, seven, &o), 0); TEST_P(o, NULL);
   TEST_P(tree->right, seven); TEST(tree->black, 1);
   TEST_P(seven->left, NULL); TEST_P(seven->right, NULL);
-  TEST_P(seven->parent, tree); TEST(seven->black, 0); 
+  TEST_P(seven->parent, tree); TEST(seven->black, 0);
 
   /* Check after fourth node:
    *         5b
    *        / \
    *       3b  7b
    *      /
-   *     1r  
+   *     1r
    */
   TEST(redblack_insert(&tree, one, &o), 0); TEST_P(o, NULL);
-  TEST_P(tree->left->left, one); 
-  TEST(tree->black, 1); 
+  TEST_P(tree->left->left, one);
+  TEST(tree->black, 1);
   TEST(tree->left->black, 1); TEST(tree->right->black, 1);
   TEST_P(one->left, NULL); TEST_P(one->right, NULL);
-  TEST_P(one->parent, tree->left); TEST(one->black, 0); 
+  TEST_P(one->parent, tree->left); TEST(one->black, 0);
 
   /* Checks that we got after fifth node:
    *         5b
@@ -256,7 +256,7 @@ int test_rotate(void)
   y = node_new(home, 2);
 
   TEST_1(x);
-  TEST_1(y); 
+  TEST_1(y);
 
   /*
    *              x                   y               x
@@ -298,8 +298,8 @@ int test_simple(void)
   um497 = node_new(home, 497); TEST_1(um497);
   um995 = node_new(home, 995); TEST_1(um995);
 
-  o = (void *)-1; TEST(redblack_insert(&tree, um995, &o), 0); TEST_P(o, NULL); 
-  o = (void *)-1; TEST(redblack_insert(&tree, um497, &o), 0); TEST_P(o, NULL); 
+  o = (void *)-1; TEST(redblack_insert(&tree, um995, &o), 0); TEST_P(o, NULL);
+  o = (void *)-1; TEST(redblack_insert(&tree, um497, &o), 0); TEST_P(o, NULL);
   o = (void *)-1; TEST(redblack_insert(&tree, um103, &o), 0); TEST_P(o, NULL);
 
   um = node_find(tree, 103); TEST_P(um, um103);
@@ -338,9 +338,9 @@ int test_balance(void)
 
   for (i = 0; i < N; i++) {
     node = node_find(tree, i);
-    TEST_1(node); 
+    TEST_1(node);
     TEST(node->value, i);
-    TEST_P(nodes[i], node); 
+    TEST_P(nodes[i], node);
   }
 
   node = node_find(tree, 0);
@@ -360,9 +360,9 @@ int test_balance(void)
     node = node_find(tree, i);
     TEST_1(node); TEST(node->value, i);
     redblack_remove(&tree, node);
-    TEST_1(node->parent == NULL && 
-          node->left == NULL && 
-          node->right == NULL); 
+    TEST_1(node->parent == NULL &&
+          node->left == NULL &&
+          node->right == NULL);
     TEST_1(redblack_height(tree) <= 2 * (int)log2ceil(N - i + 1));
     TEST_1(redblack_check(tree));
   }
@@ -371,7 +371,7 @@ int test_balance(void)
 
   for (i = N - 1; i >= 0; i--) {
     o = (void *)-1;
-    TEST(redblack_insert(&tree, nodes[i], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[i], &o), 0);
     TEST_P(o, NULL);
     TEST_1(redblack_height(tree) <= 2 * (int)log2ceil(N - i + 1));
     TEST_1(redblack_check(tree));
@@ -394,7 +394,7 @@ int test_balance(void)
     int sn = (i * 57) % N;
     o = (void *)-1;
     TEST(nodes[sn]->inserted, 0);
-    TEST(redblack_insert(&tree, nodes[sn], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[sn], &o), 0);
     nodes[sn]->inserted = 1;
     TEST_P(o, NULL);
     TEST_1(redblack_height(tree) <= 2 * (int)log2ceil(i + 1 + 1));
@@ -422,7 +422,7 @@ int test_balance(void)
     int sn = (i * 517) % N;    /* relative prime to N */
     o = (void *)-1;
     TEST(nodes[sn]->inserted, 0);
-    TEST(redblack_insert(&tree, nodes[sn], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[sn], &o), 0);
     nodes[sn]->inserted = 1;
     TEST_P(o, NULL);
     TEST_1(redblack_height(tree) <= 2 * (int)log2ceil(i + 1 + 1));
@@ -450,7 +450,7 @@ int test_balance(void)
     int sn = (i * 1957) % N;   /* relative prime to N */
     o = (void *)-1;
     TEST(nodes[sn]->inserted, 0);
-    TEST(redblack_insert(&tree, nodes[sn], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[sn], &o), 0);
     nodes[sn]->inserted = 1;
     TEST_P(o, NULL);
     TEST_1(redblack_height(tree) <= 2 * (int)log2ceil(i + 1 + 1));
@@ -480,13 +480,13 @@ int test_balance(void)
     int sn = N - i - 1;
     TEST(nodes[i]->inserted, 0);
     o = (void *)-1;
-    TEST(redblack_insert(&tree, nodes[i], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[i], &o), 0);
     TEST_P(o, NULL);
     nodes[i]->inserted = 1;
 
     TEST(nodes[sn]->inserted, 0);
     o = (void *)-1;
-    TEST(redblack_insert(&tree, nodes[sn], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[sn], &o), 0);
     TEST_P(o, NULL);
     nodes[sn]->inserted = 1;
   }
@@ -516,13 +516,13 @@ int test_balance(void)
     int sn = N - i - 1;
     TEST(nodes[i]->inserted, 0);
     o = (void *)-1;
-    TEST(redblack_insert(&tree, nodes[i], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[i], &o), 0);
     TEST_P(o, NULL);
     nodes[i]->inserted = 1;
 
     TEST(nodes[sn]->inserted, 0);
     o = (void *)-1;
-    TEST(redblack_insert(&tree, nodes[sn], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[sn], &o), 0);
     TEST_P(o, NULL);
     nodes[sn]->inserted = 1;
   }
@@ -552,13 +552,13 @@ int test_balance(void)
     int sn = N / 2 + i;
     TEST(nodes[i]->inserted, 0);
     o = (void *)-1;
-    TEST(redblack_insert(&tree, nodes[i], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[i], &o), 0);
     TEST_P(o, NULL);
     nodes[i]->inserted = 1;
 
     TEST(nodes[sn]->inserted, 0);
     o = (void *)-1;
-    TEST(redblack_insert(&tree, nodes[sn], &o), 0); 
+    TEST(redblack_insert(&tree, nodes[sn], &o), 0);
     TEST_P(o, NULL);
     nodes[sn]->inserted = 1;
   }
@@ -583,13 +583,13 @@ int test_balance(void)
   TEST_P(tree, NULL);
 
   /* Insert in perfect order ... */
-  
+
   for (j = N / 2; j > 0; j /= 2) {
     for (i = N - j; i >= 0; i -= j) {
       if (nodes[i]->inserted)
        continue;
       o = (void *)-1;
-      TEST(redblack_insert(&tree, nodes[i], &o), 0); 
+      TEST(redblack_insert(&tree, nodes[i], &o), 0);
       TEST_P(o, NULL);
       nodes[i]->inserted = 1;
     }
index 67d178070e02ff5b9cd24fd960845d4811d82888..75d6428a44195442db27957377673991239d0104 100644 (file)
@@ -57,7 +57,7 @@ static int test_sockaddr(void)
   su_sockaddr_t  su[1], a[1], b[1];
 
   BEGIN();
-  
+
   hints->li_family = AF_INET;
 
   TEST(su_getlocalinfo(hints, &res), 0);
@@ -66,7 +66,7 @@ static int test_sockaddr(void)
     if (li->li_addrlen != res->li_addrlen ||
        memcmp(li->li_addr, res->li_addr, li->li_addrlen) != 0)
       TEST_1(su_cmp_sockaddr(li->li_addr, res->li_addr) != 0);
-    else 
+    else
       TEST_1(su_cmp_sockaddr(li->li_addr, res->li_addr) == 0);
   }
 
@@ -115,8 +115,8 @@ static int test_sockaddr(void)
   su_getlocalinfo(hints, &res);
   su_freelocalinfo(res), res = NULL;
 
-  memset(a, 0, sizeof *a); 
-  memset(b, 0, sizeof *b); 
+  memset(a, 0, sizeof *a);
+  memset(b, 0, sizeof *b);
 
   TEST_1(su_match_sockaddr(a, b));
   b->su_family = AF_INET;
@@ -206,7 +206,7 @@ int test_sendrecv(void)
   TEST(listen(l, 5), 0);
 
   TEST(su_setblocking(s, 1), 0);
-  
+
   TEST(connect(s, &su.su_sa, sulen), 0);
   a = accept(l, &csu.su_sa, &csulen); TEST_1(a != -1);
 
@@ -253,12 +253,12 @@ int test_sendrecv(void)
   su_close(a);
 
   su_close(l);
-  su_close(s); 
+  su_close(s);
 
   END();
 }
 
-#if HAVE_SELECT 
+#if HAVE_SELECT
 
 #if HAVE_WIN32
 int test_select(void)
@@ -307,7 +307,7 @@ int test_select(void)
   TEST(su_inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
   TEST(bind(s, &su.su_sa, sulen), 0);
   TEST(getsockname(s, &su.su_sa, &sulen), 0);
-  
+
   tv.tv_sec = 0; tv.tv_usec = 1000;
   TEST(select(0, NULL, NULL, NULL, &tv), 0);
 
@@ -320,20 +320,20 @@ int test_select(void)
   TEST(select(s + 1, NULL, wset, NULL, &tv), 1);
   TEST_1(FD_ISSET(s, wset));
 
-  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset); 
+  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset);
   FD_SET(s, rset); FD_SET(s, wset);
   tv.tv_sec = 0, tv.tv_usec = 1000;
   TEST(select(s + 1, rset, wset, NULL, &tv), 1);
   TEST_1(!FD_ISSET(s, rset));
   TEST_1(FD_ISSET(s, wset));
 
-  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset); 
+  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset);
   FD_SET(s, rset); FD_SET(s, wset);
   tv.tv_sec = 0, tv.tv_usec = 1000;
   TEST(select(s + 1, rset, NULL, NULL, &tv), 0);
   TEST_1(!FD_ISSET(s, rset));
 
-  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset); 
+  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset);
   FD_SET(s, rset); FD_CLR(s, wset);
   tv.tv_sec = 0, tv.tv_usec = 1000;
   TEST(select(s + 1, rset, wset, NULL, &tv), 0);
@@ -342,14 +342,14 @@ int test_select(void)
 
   TEST(su_sendto(s, "foo", 3, 0, &su, sulen), 3);
 
-  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset); 
+  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset);
   FD_SET(s, rset); FD_CLR(s, wset);
   tv.tv_sec = 0, tv.tv_usec = 1000;
   TEST(select(s + 1, rset, wset, NULL, &tv), 1);
   TEST_1(FD_ISSET(s, rset));
   TEST_1(!FD_ISSET(s, wset));
 
-  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset); 
+  FD_ZERO_TO(s, rset); FD_ZERO_TO(s, wset);
   FD_SET(s, rset); FD_SET(s, wset);
   tv.tv_sec = 0, tv.tv_usec = 1000;
   TEST(select(s + 1, rset, wset, NULL, &tv), 2);
@@ -383,14 +383,14 @@ int test_md5(void)
   char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1];
 
   struct { char *input; uint8_t digest[SU_MD5_DIGEST_SIZE]; } suite[] = {
-    { (""), 
+    { (""),
        { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
          0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e } },
     { ("a"), { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
               0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 } },
     { ("abc"), { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
                 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 } },
-    { ("message digest"), 
+    { ("message digest"),
       { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
        0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 } },
     { ("abcdefghijklmnopqrstuvwxyz"),
@@ -456,13 +456,13 @@ int test_md5(void)
   TEST_S(hexdigest, "93b885adfe0da089cdf634904fd59f71");
   su_md5_deinit(md5);
 
-  su_md5_init(md5);   
+  su_md5_init(md5);
   su_md5_stri0update(md5, NULL);
   su_md5_stri0update(md5, "ABBADABBADOO");
   su_md5_hexdigest(md5, hexdigest);
   TEST_S(hexdigest, "101e6dd7cfabdb5c74f44b4c545c05cc");
 
-  su_md5_init(md5); 
+  su_md5_init(md5);
   su_md5_update(md5, "\0abbadabbadoo\0", 14);
   su_md5_hexdigest(md5, hexdigest);
   TEST_S(hexdigest, "101e6dd7cfabdb5c74f44b4c545c05cc");
@@ -512,7 +512,7 @@ int main(int argc, char *argv[])
     else
       usage(1);
   }
-  
+
   retval |= test_sockaddr();
   retval |= test_sendrecv();
   retval |= test_select();
index 76a01b74f2431ceb67556d3668385af8525d4477..336422aaf55d142f26e78a02812e9b90a6b147d3 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-/**@internal 
+/**@internal
  * @file su_alloc_test.c
  *
  * Testing functions for su_alloc functions.
@@ -489,7 +489,7 @@ static int test_strlst(void)
 
     TEST_1(su_strlst_append(l, ""));
 
-    TEST_S(su_strlst_join(l, home, "\n"), 
+    TEST_S(su_strlst_join(l, home, "\n"),
           "a\n" "b\n" "1: 1\n" "1.0: 1\n");
 
     TEST_VOID(su_strlst_destroy(l));
@@ -698,7 +698,7 @@ static int test_auto(void)
 
   su_home_get_stats(tmphome, 0, hs, sizeof *hs);
 
-  TEST64(hs->hs_allocs.hsa_preload + hs->hs_allocs.hsa_number, 
+  TEST64(hs->hs_allocs.hsa_preload + hs->hs_allocs.hsa_number,
          8191 + 8191 + 8191 / 32);
   TEST64(hs->hs_frees.hsf_preload + hs->hs_frees.hsf_number,
         8191 + 8191 + 8191 / 32 - 1);
index f50dce2e1f20cc008c0b295844df9eb77f35f6c5..e030404b473187978b9e0c329ef12cb9fe3542ef 100644 (file)
@@ -24,8 +24,8 @@
 
 /**@internal
  * @file torture_su_bm.c
- * @brief Test string search with Boyer-Moore algorithm 
- *  
+ * @brief Test string search with Boyer-Moore algorithm
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @date Created: Sun Apr 17 21:02:10 2005 ppessi
  */
@@ -50,9 +50,9 @@ int tstflags;
 int test_bm(void)
 {
   BEGIN();
-  
+
   {
-    char const hs[] = 
+    char const hs[] =
       "A Boyer-Moore string searching test consisting of a Long String";
     char const *s;
 
@@ -106,9 +106,9 @@ int test_bm(void)
 int test_bm_long(void)
 {
   BEGIN();
-  
+
   {
-    char const hs[] = 
+    char const hs[] =
 "A Boyer-Moore string searching test consisting of a Very Long String\n"
 
 "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer felis. "
@@ -151,14 +151,14 @@ int test_bm_long(void)
 "non, mi. Suspendisse vestibulum nunc eu neque. Sed rutrum felis aliquam "
 "urna. Ut tincidunt orci vitae ipsum. Nullam eros. Quisque augue. Quisque "
 "lacinia. Nunc ligula diam, nonummy a, porta in, tristique quis, leo. "
-"Phasellus nunc nulla, fringilla vel, lacinia et, suscipit a, turpis. " 
+"Phasellus nunc nulla, fringilla vel, lacinia et, suscipit a, turpis. "
 "Integer a est. Curabitur mauris lacus, vehicula sit amet, sodales vel, "
 "iaculis vitae, massa. Nam diam est, ultrices vitae, varius et, tempor a, "
 "leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, "
 "per inceptos hymenaeos. Fusce felis nibh, ullamcorper non, malesuada eget, "
       "facilisis vel, purus.\n";
 
-char const needle[] = 
+char const needle[] =
 "Proin congue. Curabitur placerat diam id eros. "
 "Pellentesque vitae nulla. Quisque at lorem et dolor auctor consequat. Sed "
 "sed tellus non nibh imperdiet venenatis. Integer ultrices dapibus nisi. "
@@ -166,7 +166,7 @@ char const needle[] =
 "ullamcorper pretium lorem. Vestibulum ante ipsum primis in faucibus orci "
 "luctus et ultrices posuere cubilia Curae;\n";
 
-char const Needle[] = 
+char const Needle[] =
 "PROIN CONGUE. CURABITUR PLACERAT DIAM ID EROS. "
 "PELLENTESQUE VITAE NULLA. QUISQUE AT LOREM ET DOLOR AUCTOR CONSEQUAT. SED "
 "SED TELLUS NON NIBH IMPERDIET VENENATIS. INTEGER ULTRICES DAPIBUS NISI. "
@@ -211,8 +211,8 @@ char const Needle[] =
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
-         "usage: %s [-v] [-a]\n", 
+  fprintf(stderr,
+         "usage: %s [-v] [-a]\n",
          name);
   exit(exitcode);
 }
@@ -223,7 +223,7 @@ int main(int argc, char *argv[])
   int i;
 
   /* Set our name */
-  if (strchr(argv[0], '/')) 
+  if (strchr(argv[0], '/'))
     name = strrchr(argv[0], '/') + 1;
   else
     name = argv[0];
index 6542343eb5c56c5cff20a991523f1b4fab2a8e6f..1ce48fbccebfc1e3e1987eed5dd4e5e7dd9af657 100644 (file)
@@ -85,7 +85,7 @@ int test_sup_indices(su_port_t const *port)
 
   if (n != port->sup_n_waits)
     return 0;
-  
+
   n = 0;
 
   for (i = 1; i <= N; i++) {
@@ -108,19 +108,19 @@ int test_sup_indices(su_port_t const *port)
   return n == port->sup_size_waits;
 }
 
-struct su_root_magic_s 
+struct su_root_magic_s
 {
   int error, *sockets, *regs, *wakeups;
 };
 
-static int callback(su_root_magic_t *magic, 
+static int callback(su_root_magic_t *magic,
                    su_wait_t *w,
                    su_wakeup_arg_t *arg)
 {
   intptr_t i = (intptr_t)arg;
 
   assert(magic);
+
   if (i <= 0 || i > I)
     return ++magic->error;
 
@@ -208,7 +208,7 @@ int test_register(void)
 
     if (bind(sockets[i], &su->su_sa, sizeof su->su_sin) != 0)
       perror("bind"), assert(0);
-    
+
     TEST(su_wait_create(wait + i, sockets[i], SU_WAIT_IN), 0);
 
     reg[i] = su_port_register(port, root, wait + i, callback, (void*)i, 0);
@@ -285,7 +285,7 @@ int test_register(void)
 
 #if HAVE_EPOLL
   /* With epoll we do not bother to prioritize the wait list */
-  if (port->sup_epoll == -1) 
+  if (port->sup_epoll == -1)
 #endif
     TEST(port->sup_pri_offset, prioritized);
 
index 626cb4c649fca56bfdb2b344ae1177c38590eac5..e23a8ea3512087821f56513e4476280ae2a60f5c 100644 (file)
@@ -121,33 +121,33 @@ int test_api(root_test_t *rt)
 {
   BEGIN();
   TEST_1(rt->rt_root = su_root_create(NULL));
-  
+
   TEST_VOID(su_root_destroy(NULL));
-  TEST_P(su_root_name(NULL), NULL);  
-  TEST_1(su_root_name(rt->rt_root) != NULL);  
+  TEST_P(su_root_name(NULL), NULL);
+  TEST_1(su_root_name(rt->rt_root) != NULL);
   TEST(su_root_set_magic(NULL, rt), -1);
   TEST_P(su_root_magic(rt->rt_root), NULL);
   TEST(su_root_set_magic(rt->rt_root, rt), 0);
   TEST_P(su_root_magic(rt->rt_root), rt);
   TEST_P(su_root_magic(NULL), NULL);
-  TEST(su_root_register(NULL, NULL, NULL, NULL, 0), -1);  
-  TEST(su_root_unregister(NULL, NULL, NULL, NULL), -1);  
-  TEST(su_root_deregister(NULL, 0), -1);  
-  TEST(su_root_deregister(rt->rt_root, 0), -1);  
-  TEST(su_root_deregister(rt->rt_root, -1), -1);  
-  TEST(su_root_eventmask(NULL, 0, -1, -1), -1);  
-  TEST((long int)su_root_step(NULL, 0), -1L);  
-  TEST((long int)su_root_sleep(NULL, 0), -1L);  
-  TEST(su_root_multishot(NULL, 0), -1);  
-  TEST_VOID((void)su_root_run(NULL));  
-  TEST_VOID((void)su_root_break(NULL));  
+  TEST(su_root_register(NULL, NULL, NULL, NULL, 0), -1);
+  TEST(su_root_unregister(NULL, NULL, NULL, NULL), -1);
+  TEST(su_root_deregister(NULL, 0), -1);
+  TEST(su_root_deregister(rt->rt_root, 0), -1);
+  TEST(su_root_deregister(rt->rt_root, -1), -1);
+  TEST(su_root_eventmask(NULL, 0, -1, -1), -1);
+  TEST((long int)su_root_step(NULL, 0), -1L);
+  TEST((long int)su_root_sleep(NULL, 0), -1L);
+  TEST(su_root_multishot(NULL, 0), -1);
+  TEST_VOID((void)su_root_run(NULL));
+  TEST_VOID((void)su_root_break(NULL));
   TEST_M(su_root_task(NULL), su_task_null, sizeof su_task_null);
   TEST_M(su_root_parent(NULL), su_task_null, sizeof su_task_null);
-  TEST(su_root_add_prepoll(NULL, NULL, NULL), -1);  
-  TEST(su_root_remove_prepoll(NULL), -1);  
-  TEST_P(su_root_gsource(NULL), NULL);  
-  TEST_VOID((void)su_root_gsource(rt->rt_root));  
-  TEST(su_root_yield(NULL), -1);  
+  TEST(su_root_add_prepoll(NULL, NULL, NULL), -1);
+  TEST(su_root_remove_prepoll(NULL), -1);
+  TEST_P(su_root_gsource(NULL), NULL);
+  TEST_VOID((void)su_root_gsource(rt->rt_root));
+  TEST(su_root_yield(NULL), -1);
   TEST(su_root_release(NULL), -1);
   TEST(su_root_obtain(NULL), -1);
   TEST(su_root_has_thread(NULL), -1);
@@ -166,7 +166,7 @@ int test_api(root_test_t *rt)
 
 #include <pthread.h>
 
-void *suspend_resume_test_thread(void *_rt) 
+void *suspend_resume_test_thread(void *_rt)
 {
   root_test_t *rt = _rt;
 
@@ -221,7 +221,7 @@ int init_test(root_test_t *rt,
   TEST_1(rt->rt_root);
   TEST(su_root_obtain(rt->rt_root), 0);
   TEST(su_root_has_thread(rt->rt_root), 2);
-#else  
+#else
   TEST_1(rt->rt_root = su_root_create(rt));
 #endif
 
@@ -263,7 +263,7 @@ static int deinit_test(root_test_t *rt)
   pthread_mutex_destroy(rt->rt_sr.deinit);
 #else
   TEST_VOID(su_root_destroy(rt->rt_root)); rt->rt_root = NULL;
-#endif  
+#endif
 
   END();
 }
@@ -274,19 +274,19 @@ int wakeup(root_test_t *rt,
 {
   char buffer[64];
   int n, error;
+
   su_wait_events(w, ep->s);
 
   n = recv(ep->s, buffer, sizeof(buffer), 0);
   error = su_errno();
+
   if (n < 0)
     fprintf(stderr, "%s: %s\n", "recv", su_strerror(error));
 
   TEST_1(n > 0);
 
   rt->rt_received = ep->i;
-          
+
   return 0;
 }
 
@@ -340,15 +340,15 @@ static int register_test(root_test_t *rt)
   TEST_1((s = su_socket(rt->rt_family, SOCK_DGRAM, 0)) != -1);
 
   for (i = 0; i < 5; i++) {
-    rt->rt_ep[i]->registered = 
-      su_root_register(rt->rt_root, rt->rt_ep[i]->wait, 
+    rt->rt_ep[i]->registered =
+      su_root_register(rt->rt_root, rt->rt_ep[i]->wait,
                       wakeups[i], rt->rt_ep[i], 0);
     TEST(rt->rt_ep[i]->registered, i + 1 + SU_HAVE_PTHREADS);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
-    TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen), 
+    TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
              sizeof(msg));
     test_run(rt);
     TEST(rt->rt_received, i);
@@ -356,22 +356,22 @@ static int register_test(root_test_t *rt)
   }
 
   for (i = 0; i < 5; i++) {
-    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait, 
-                           wakeups[i], rt->rt_ep[i]), 
+    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait,
+                           wakeups[i], rt->rt_ep[i]),
         rt->rt_ep[i]->registered);
   }
 
 
   for (i = 0; i < 5; i++) {
-    rt->rt_ep[i]->registered = 
-      su_root_register(rt->rt_root, rt->rt_ep[i]->wait, 
+    rt->rt_ep[i]->registered =
+      su_root_register(rt->rt_root, rt->rt_ep[i]->wait,
                       wakeups[i], rt->rt_ep[i], 1);
     TEST_1(rt->rt_ep[i]->registered > 0);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
-    TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen), 
+    TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
              sizeof(msg));
     test_run(rt);
     TEST(rt->rt_received, i);
@@ -379,22 +379,22 @@ static int register_test(root_test_t *rt)
   }
 
   for (i = 0; i < 5; i++) {
-    TEST(su_root_deregister(rt->rt_root, rt->rt_ep[i]->registered), 
+    TEST(su_root_deregister(rt->rt_root, rt->rt_ep[i]->registered),
         rt->rt_ep[i]->registered);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
     TEST_1(su_wait_create(ep->wait, ep->s, SU_WAIT_IN|SU_WAIT_ERR) != -1);
-    ep->registered = 
-      su_root_register(rt->rt_root, ep->wait, 
+    ep->registered =
+      su_root_register(rt->rt_root, ep->wait,
                       wakeups[i], ep, 1);
     TEST_1(ep->registered > 0);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
-    TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen), 
+    TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
              sizeof(msg));
     test_run(rt);
     TEST(rt->rt_received, i);
@@ -402,8 +402,8 @@ static int register_test(root_test_t *rt)
   }
 
   for (i = 0; i < 5; i++) {
-    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait, 
-                           wakeups[i], rt->rt_ep[i]), 
+    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait,
+                           wakeups[i], rt->rt_ep[i]),
         rt->rt_ep[i]->registered);
   }
 
@@ -415,7 +415,7 @@ int wakeup_remove(root_test_t *rt, su_wait_t *w, test_ep_t *node)
 {
   char buffer[64];
   ssize_t x;
-  test_ep_t *n = node->next; 
+  test_ep_t *n = node->next;
 
   su_wait_events(w, node->s);
 
@@ -428,14 +428,14 @@ int wakeup_remove(root_test_t *rt, su_wait_t *w, test_ep_t *node)
     *node->prev = n;
 
     if (n) {
-      *node->prev = node->next;    
+      *node->prev = node->next;
       node->next->prev = node->prev;
       sendto(n->s, "foo", 3, 0, (void *)n->addr, n->addrlen);
     }
 
     node->next = NULL;
     node->prev = NULL;
-    
+
     if (!*node->list) {
       su_root_break(rt->rt_root);
     }
@@ -456,9 +456,9 @@ int event_test(root_test_t rt[1])
   test_ep_t *n, *nodes, *list = NULL;
   su_sockaddr_t su[1];
   socklen_t sulen;
-  
+
   TEST_1(nodes = calloc(N, sizeof *nodes));
-  
+
   memset(su, 0, sulen = sizeof su->su_sin);
   su->su_len = sizeof su->su_sin;
   su->su_family = AF_INET;
@@ -480,7 +480,7 @@ int event_test(root_test_t rt[1])
       su_close(n->s);
       break;
     }
-      
+
     if (getsockname(n->s, (void *)n->addr, &n->addrlen)) {
       su_perror("getsockname()");
       su_close(n->s);
@@ -499,7 +499,7 @@ int event_test(root_test_t rt[1])
       su_close(n->s);
       break;
     }
-    
+
     n->list = &list, n->prev = &list;
     if ((n->next = list))
       n->next->prev = &n->next;
@@ -559,21 +559,21 @@ void success_deinit(su_root_t *root, root_test_t *rt)
   rt->rt_success_deinit = 1;
 }
 
-void receive_a_reporter(root_test_t *rt, 
+void receive_a_reporter(root_test_t *rt,
                        su_msg_r msg,
                        su_msg_arg_t *arg)
 {
   rt->rt_recv_reporter = 1;
 }
 
-void receive_recv_report(root_test_t *rt, 
+void receive_recv_report(root_test_t *rt,
                         su_msg_r msg,
                         su_msg_arg_t *arg)
 {
   rt->rt_reported_reporter = 1;
 }
 
-void send_a_reporter_msg(root_test_t *rt, 
+void send_a_reporter_msg(root_test_t *rt,
                         su_msg_r msg,
                         su_msg_arg_t *arg)
 {
@@ -602,12 +602,12 @@ static void deinit_simple_msg(su_msg_arg_t *arg)
   rt->rt_msg_destroyed++;
 }
 
-static void receive_simple_msg(root_test_t *rt, 
+static void receive_simple_msg(root_test_t *rt,
                               su_msg_r msg,
                               su_msg_arg_t *arg)
 {
   assert(rt == *arg);
-  rt->rt_msg_received = 
+  rt->rt_msg_received =
     su_task_cmp(su_msg_from(msg), su_task_null) == 0 &&
     su_task_cmp(su_msg_to(msg), su_task_null) == 0;
 }
@@ -657,10 +657,10 @@ static int clone_test(root_test_t rt[1])
 
   rt->rt_msg_received = 0;
   rt->rt_msg_destroyed = 0;
-  
+
   TEST(su_msg_deinitializer(m, deinit_simple_msg), 0);
   TEST(su_msg_send_to(m, su_clone_task(rt->rt_clone), receive_simple_msg), 0);
-  
+
   while (rt->rt_msg_destroyed == 0)
     su_root_step(rt->rt_root, 1);
 
@@ -680,7 +680,7 @@ static int clone_test(root_test_t rt[1])
   TEST_1(rt->rt_sent_reporter);
   TEST_1(rt->rt_recv_reporter);
   TEST_1(rt->rt_reported_reporter);
-  
+
   rt->rt_recv_reporter = 0;
 
   /* Make sure we can handle messages done as expected */
@@ -701,8 +701,8 @@ static int clone_test(root_test_t rt[1])
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
-         "usage: %s [-v] [-a]\n", 
+  fprintf(stderr,
+         "usage: %s [-v] [-a]\n",
          name);
   exit(exitcode);
 }
index c9c48e7b43e5f4b0d88e5d0b5042aab5666b4632..21e043590a82fdb5bcb5d1730422fdfd5c8a400e 100644 (file)
@@ -135,19 +135,19 @@ int wakeup(root_test_t *rt,
 {
   char buffer[64];
   int n, error;
+
   su_wait_events(w, ep->s);
 
   n = recv(ep->s, buffer, sizeof(buffer), 0);
   error = su_errno();
+
   if (n < 0)
     fprintf(stderr, "%s: %s\n", "recv", su_strerror(error));
 
   TEST_1(n > 0);
 
   rt->rt_received = ep->i;
-          
+
   return 0;
 }
 
@@ -202,15 +202,15 @@ static int register_test(root_test_t *rt)
   TEST_1((s = su_socket(rt->rt_family, SOCK_DGRAM, 0)) != -1);
 
   for (i = 0; i < 5; i++) {
-    rt->rt_ep[i]->registered = 
-      su_root_register(rt->rt_root, rt->rt_ep[i]->wait, 
+    rt->rt_ep[i]->registered =
+      su_root_register(rt->rt_root, rt->rt_ep[i]->wait,
                       wakeups[i], rt->rt_ep[i], 0);
     TEST(rt->rt_ep[i]->registered, i + 1 + SU_HAVE_PTHREADS);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
-    TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen), 
+    TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
         sizeof(msg));
     test_run(rt);
     TEST(rt->rt_received, i);
@@ -218,22 +218,22 @@ static int register_test(root_test_t *rt)
   }
 
   for (i = 0; i < 5; i++) {
-    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait, 
-                           wakeups[i], rt->rt_ep[i]), 
+    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait,
+                           wakeups[i], rt->rt_ep[i]),
         rt->rt_ep[i]->registered);
   }
 
 
   for (i = 0; i < 5; i++) {
-    rt->rt_ep[i]->registered = 
-      su_root_register(rt->rt_root, rt->rt_ep[i]->wait, 
+    rt->rt_ep[i]->registered =
+      su_root_register(rt->rt_root, rt->rt_ep[i]->wait,
                       wakeups[i], rt->rt_ep[i], 1);
     TEST_1(rt->rt_ep[i]->registered > 0);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
-    TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen), 
+    TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
         sizeof(msg));
     test_run(rt);
     TEST(rt->rt_received, i);
@@ -241,22 +241,22 @@ static int register_test(root_test_t *rt)
   }
 
   for (i = 0; i < 5; i++) {
-    TEST(su_root_deregister(rt->rt_root, rt->rt_ep[i]->registered), 
+    TEST(su_root_deregister(rt->rt_root, rt->rt_ep[i]->registered),
         rt->rt_ep[i]->registered);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
     TEST_1(su_wait_create(ep->wait, ep->s, SU_WAIT_IN|SU_WAIT_ERR) != -1);
-    ep->registered = 
-      su_root_register(rt->rt_root, ep->wait, 
+    ep->registered =
+      su_root_register(rt->rt_root, ep->wait,
                       wakeups[i], ep, 1);
     TEST_1(ep->registered > 0);
   }
 
   for (i = 0; i < 5; i++) {
     test_ep_t *ep = rt->rt_ep[i];
-    TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen), 
+    TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
         sizeof(msg));
     test_run(rt);
     TEST(rt->rt_received, i);
@@ -264,8 +264,8 @@ static int register_test(root_test_t *rt)
   }
 
   for (i = 0; i < 5; i++) {
-    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait, 
-                           wakeups[i], rt->rt_ep[i]), 
+    TEST(su_root_unregister(rt->rt_root, rt->rt_ep[i]->wait,
+                           wakeups[i], rt->rt_ep[i]),
         rt->rt_ep[i]->registered);
   }
 
@@ -322,14 +322,14 @@ static int clone_test(root_test_t rt[1])
   TEST_VOID(su_clone_wait(rt->rt_root, rt->rt_clone));
 
   TEST_1(rt->rt_success_deinit);
-  
+
   END();
 }
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
-         "usage: %s [-v] [-a]\n", 
+  fprintf(stderr,
+         "usage: %s [-v] [-a]\n",
          name);
   exit(exitcode);
 }
index 8f28b3de4d320f9d98c59a873b870e0f90ca8855..5d8c310aca5d4d64cc86514a4797e5721f1e9bd7 100644 (file)
@@ -28,7 +28,7 @@
  * Testing functions for su_tag module.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- * 
+ *
  * @date Created: Tue Mar  6 18:33:42 2001 ppessi
  */
 
@@ -47,7 +47,7 @@
 #define DEVNULL "/dev/null"
 #else
 #define DEVNULL "nul"
-#endif 
+#endif
 
 int tstflags = 0;
 
@@ -127,27 +127,27 @@ static void init_tags(void)
 
   tag_typedef_t _tag_b = STRTAG_TYPEDEF(b);
   tag_typedef_t _tag_b_ref = REFTAG_TYPEDEF(tag_b);
+
   tag_typedef_t _tag_i = INTTAG_TYPEDEF(i);
   tag_typedef_t _tag_i_ref = REFTAG_TYPEDEF(tag_i);
+
   tag_typedef_t _tag_j = INTTAG_TYPEDEF(j);
   tag_typedef_t _tag_j_ref = REFTAG_TYPEDEF(tag_j);
+
   tag_typedef_t _tag_k = INTTAG_TYPEDEF(k);
   tag_typedef_t _tag_k_ref = REFTAG_TYPEDEF(tag_k);
-  
+
   tag_typedef_t _tag_n = INTTAG_TYPEDEF(n);
   tag_typedef_t _tag_n_ref = REFTAG_TYPEDEF(tag_n);
 
 #undef TAG_NAMESPACE
 #define TAG_NAMESPACE "pq"
-  
+
   tag_typedef_t _tag_any_pq = NSTAG_TYPEDEF(*);
 
   tag_typedef_t _tag_p = BOOLTAG_TYPEDEF(p);
   tag_typedef_t _tag_p_ref = REFTAG_TYPEDEF(tag_p);
-  
+
   tag_typedef_t _tag_q = BOOLTAG_TYPEDEF(q);
   tag_typedef_t _tag_q_ref = REFTAG_TYPEDEF(tag_q);
 
@@ -237,22 +237,22 @@ int main(int avc, char *av[])
               (tv)1, (tv)2, (tv)3, (tv)4, (tv)5,
               (tv)6, (tv)7, (tv)8, (tv)9, (tv)10);
 }
-], 
+],
 SAC_SU_DEFINE(SU_HAVE_TAGSTACK, 1, [
-Define this as 1 if your compiler puts the variable argument list nicely in memory]), 
+Define this as 1 if your compiler puts the variable argument list nicely in memory]),
 )
 
 */
 
 static int test_stackargs(int l, ...)
 {
-  va_list ap;  
+  va_list ap;
   int i, *p;
 
   BEGIN();
 
   va_start(ap, l);
-  
+
   p = &l;
 
   for (i = l; i <= 10; i++) {
@@ -287,10 +287,10 @@ static int test_dup(void)
 
   BEGIN();
 
-  lst = tl_list(TAG_A("Moro"), 
-               TAG_A("Vaan"), 
-               TAG_I(1), 
-               TAG_SKIP(2), 
+  lst = tl_list(TAG_A("Moro"),
+               TAG_A("Vaan"),
+               TAG_I(1),
+               TAG_SKIP(2),
                TAG_NEXT(rest));
 
   TEST_P(lst[0].t_tag, tag_a);
@@ -379,12 +379,12 @@ static int test_filters(void)
 
   home = su_home_new(sizeof *home); TEST_1(home);
 
-  lst = tl_list(TAG_A("Moro"), 
+  lst = tl_list(TAG_A("Moro"),
                TAG_I(2),
                TAG_Q(3),
-               TAG_SKIP(2), 
-               TAG_A("vaan"), 
-               TAG_I(1), 
+               TAG_SKIP(2),
+               TAG_A("vaan"),
+               TAG_I(1),
                TAG_P(2),
                TAG_NULL());
 
@@ -420,7 +420,7 @@ static int test_filters(void)
   su_free(NULL, b1); su_free(NULL, b2); su_free(NULL, b3); su_free(NULL, b4);
 
   nsfilter = tl_list(TAG_ANY_PQ(), TAG_END());
-  
+
   b5 = tl_afilter(NULL, nsfilter, lst);
   TEST_SIZE(tl_len(b5), 3 * sizeof(tagi_t));
   TEST_SIZE(tl_xtra(b5, 0), 0);
@@ -437,7 +437,7 @@ static int test_filters(void)
   b = tl_afilter(home, filter6, lst); TEST_1(b);
   TEST_P(b[0].t_tag, 0);
 
-  tl_vfree(filter1); tl_vfree(filter2); tl_vfree(filter3); 
+  tl_vfree(filter1); tl_vfree(filter2); tl_vfree(filter3);
   tl_vfree(filter4); tl_vfree(filter5); tl_vfree(filter6);
 
   tl_vfree(lst);
@@ -455,14 +455,14 @@ static int test_print(void)
   tagi_t *lst;
   FILE *out;
 
-  lst = tl_list(TAG_A("Moro"), 
-               TAG_I(2), 
+  lst = tl_list(TAG_A("Moro"),
+               TAG_I(2),
                TAG_J(3),
                TAG_K(5),
-               TAG_SKIP(2), 
-               TAG_A("Vaan"), 
+               TAG_SKIP(2),
+               TAG_A("Vaan"),
                TAG_B("b"),
-               TAG_I(1), 
+               TAG_I(1),
                TAG_NULL());
 
   if (tstflags & tst_verbatim)
@@ -524,15 +524,15 @@ static int test_gets(void)
 
   BEGIN();
 
-  lst = tl_list(TAG_A("Moro"), 
-               TAG_I(2), 
+  lst = tl_list(TAG_A("Moro"),
+               TAG_I(2),
                TAG_J(3),
                TAG_K(5),
                TAG_P(3),
-               TAG_SKIP(2), 
-               TAG_A("Vaan"), 
+               TAG_SKIP(2),
+               TAG_A("Vaan"),
                TAG_B("b"),
-               TAG_I(1), 
+               TAG_I(1),
                TAG_NULL());
 
   TEST_1(lst);
@@ -540,7 +540,7 @@ static int test_gets(void)
   TEST_1(t = tl_find(lst, tag_i)); TEST(t->t_value, 2);
   TEST_1(t = tl_find_last(lst, tag_i)); TEST(t->t_value, 1);
 
-  TEST(tl_gets(lst, 
+  TEST(tl_gets(lst,
               TAG_A_REF(a),
               TAG_B_REF(b),
               TAG_I_REF(i),
@@ -566,7 +566,7 @@ static int test_gets(void)
   lst = tl_list(TAG_A_REF(a),
                TAG_I_REF(i),
                TAG_NULL());
-  
+
   TEST(tl_tgets(lst, TAG_A("Foo"), TAG_I(-1), TAG_END()), 2);
 
   TEST_S(a, "Foo");
@@ -629,8 +629,8 @@ static int test_scan(void)
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
-         "usage: %s [-v] [-a]\n", 
+  fprintf(stderr,
+         "usage: %s [-v] [-a]\n",
          name);
   exit(exitcode);
 }
index e71e7ccea8471ea430082475fe031a8f82c9561d..b72d062bbe193ccf98fb03fa990a04a655598797 100644 (file)
  */
 
 /**@ingroup su_time
- * 
- * @IFILE torture_su_time.c  
+ *
+ * @IFILE torture_su_time.c
  *
  * Tests for su_time functions.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Kai Vehmanen <first.surname@nokia.com>
- * 
+ *
  * @date Created: Fri May 10 16:08:18 2002 ppessi
  */
 
@@ -81,7 +81,7 @@ int test1(int flags)
   su_time_t now;
   su_ntp_t ntp, ntp0, ntp1;
   uint64_t increment = 3019;
-  
+
   BEGIN();
 
   ntp_hi = 2208988800UL;
@@ -138,7 +138,7 @@ int test2(int flags)
   uint64_t tl;
   uint16_t seq1, seq2;
   const uint64_t granularity = 10000000U;
-  const uint64_t ntp_epoch = 
+  const uint64_t ntp_epoch =
     (uint64_t)(141427) * (24 * 60 * 60L) * granularity;
   isize_t i;
 
@@ -175,7 +175,7 @@ int test2(int flags)
 
   for (i = 0; i < 32000; i++) {
     su_guid_generate(g2);
-    seq2 = ((g2->s.clock_seq_hi_and_reserved & 0x3f) << 8) 
+    seq2 = ((g2->s.clock_seq_hi_and_reserved & 0x3f) << 8)
       + g2->s.clock_seq_low;
     TEST((seq1 + i + 2) % 16384, seq2);
   }
@@ -216,15 +216,15 @@ extern uint64_t (*_su_nanotime)(uint64_t *);
 
 void usage(int exitcode)
 {
-  fprintf(stderr, 
-         "usage: %s [-v] [-a]\n", 
+  fprintf(stderr,
+         "usage: %s [-v] [-a]\n",
          name);
   exit(exitcode);
 }
 
 char *lastpart(char *path)
 {
-  if (strchr(path, '/')) 
+  if (strchr(path, '/'))
     return strrchr(path, '/') + 1;
   else
     return path;
index 6d6e0903dba66e53592c95609e372ef3e2ddb4c3..b862625097f87eaff992e2c33ae7fc3e4fe1c0f2 100644 (file)
@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
 
   now = su_now();
 
-  printf("Inserting %u timers took %f millisec\n", 
+  printf("Inserting %u timers took %f millisec\n",
         i, su_time_diff(inserted, started) * 1000);
 
   printf("Processing %u/%u timers took %f millisec (%f expected)\n",
index 6fa8b6450a4e4287d667401765a965cb006fc313..f35f1ecb1b07a690cf345ace344b3b0b422d1a6e 100644 (file)
@@ -1,6 +1,6 @@
 2006-10-19  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-       * tport.c (tport_is_shutdown, tport_is_closed): Added to 
+       * tport.c (tport_is_shutdown, tport_is_closed): Added to
        public API.
 
 2006-01-15  Martti Mela  <martti.mela@nokia.com>
 
        * tport.c (tport_bind_server): Avoid segfault
        if init for a NAT traversal mechanism has failed.
-       
+
 2005-10-18  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
        * Feature #1326002.
-       
+
   * Added stun_test(), but not running it.
 
     M ./libsofia-sip-ua/tport/tport_test.c +32
index 7606751acc710b00e4af7c85fbf369565cee363d..171ad882691ce6dcfc5c4049019651895554a01f 100644 (file)
@@ -21,7 +21,7 @@ INCLUDES =            -I$(srcdir)/../bnf -I../bnf \
 
 noinst_LTLIBRARIES =   libtport.la
 
-bin_PROGRAMS =                 
+bin_PROGRAMS =
 
 check_PROGRAMS =       test_tport
 
index f87191bc966e2a6d4ec21a4681802d5a8341287e..da957901fa077e0a7fcf97e94b0491514561de34 100644 (file)
@@ -213,7 +213,7 @@ TPORT_DLL int tport_tqueue(tport_t *, msg_t *, tag_type_t, tag_value_t, ...);
 TPORT_DLL isize_t tport_queuelen(tport_t const *self);
 
 /** Send a queued message (and queue another, if required). */
-TPORT_DLL int tport_tqsend(tport_t *, msg_t *, msg_t *, 
+TPORT_DLL int tport_tqsend(tport_t *, msg_t *, msg_t *,
                           tag_type_t, tag_value_t, ...);
 
 /** Stop reading from socket until tport_continue() is called. */
index 3cc2b7950c92c2887bfd06f275e0c8f69352f2d8..0c0252dabc66c4e583cea6a0b770ab7bc475aa1e 100644 (file)
@@ -91,7 +91,7 @@ struct tport_comp_vtable_s {
   int (*vsc_can_send_comp)(tport_compressor_t const *);
   int (*vsc_can_recv_comp)(tport_compressor_t const *);
 
-  int (*vsc_set_comp_name)(tport_t const *self, 
+  int (*vsc_set_comp_name)(tport_t const *self,
                           tport_compressor_t const *return_sc,
                           char const *comp);
 
@@ -104,7 +104,7 @@ struct tport_comp_vtable_s {
                             char const *name, int namelen,
                             int create_if_needed);
 
-  struct sigcomp_compartment * 
+  struct sigcomp_compartment *
   (*vsc_compartment_incref)(struct sigcomp_compartment *cc);
 
   void (*vsc_compartment_decref)(struct sigcomp_compartment **pointer_to_cc);
@@ -146,19 +146,19 @@ struct tport_comp_vtable_s {
   (*vsc_sigcomp_assign_if_needed)(tport_t *self,
                                  struct sigcomp_compartment *cc);
 
-  void (*vsc_accept_incomplete)(tport_t const *self, 
+  void (*vsc_accept_incomplete)(tport_t const *self,
                                tport_compressor_t *sc,
                                msg_t *msg);
 
-  int (*vsc_recv_comp)(tport_t const *self, 
+  int (*vsc_recv_comp)(tport_t const *self,
                       tport_compressor_t *sc,
                       msg_t **in_out_msg,
                       su_sockaddr_t *from,
                       socklen_t fromlen);
 
   ssize_t (*vsc_send_comp)(tport_t const *self,
-                      msg_t *msg, 
-                      msg_iovec_t iov[], 
+                      msg_t *msg,
+                      msg_iovec_t iov[],
                       size_t iovused,
                       struct sigcomp_compartment *cc,
                       tport_compressor_t *sc);
index 117e3af3dcd739e6344efb1e63dd40afcb0927de..5201083dec8e19629fb6c272a60372901d3bbaa2 100644 (file)
@@ -28,9 +28,9 @@
 
 /**@file sofia-sip/tport_tag.h
  * @brief Tags for tport module.
- * 
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Sat Oct 12 18:39:48 2002 ppessi
  */
 
@@ -74,7 +74,7 @@ TPORT_DLL extern tag_typedef_t tptag_server;
 TPORT_DLL extern tag_typedef_t tptag_server_ref;
 #define TPTAG_SERVER_REF(x) tptag_server_ref, tag_bool_vr(&(x))
 
-/** Define how the public transport connects to Internet. 
+/** Define how the public transport connects to Internet.
  *
  * @sa TPTAG_PUBLIC(), tport_is_public().
  */
index 02a3a3ddde676e94aed3c07161d7e7dce20fc902..4a11ab663c0e1049a0797371a9302702c5dc85b5 100644 (file)
@@ -49,7 +49,7 @@ typedef struct tp_test_s tp_test_t;
 
 #define TP_STACK_T tp_test_t
 #define TP_CLIENT_T struct called
+
 #include <sofia-sip/su_wait.h>
 #include <sofia-sip/su_md5.h>
 
@@ -158,7 +158,7 @@ int count_tports(tport_t *tp)
 
   for (tp = tport_primaries(tp); tp; tp = tport_next(tp))
     n++;
-  
+
   return n;
 }
 
@@ -169,7 +169,7 @@ static int check_msg(tp_test_t *tt, msg_t *msg, char const *ident)
   usize_t i, len;
 
   BEGIN();
-  
+
   TEST_1(tst = msg_test_public(msg));
   TEST_1(pl = tst->msg_payload);
 
@@ -197,7 +197,7 @@ static int test_create_md5(tp_test_t *tt, msg_t *msg)
   msg_test_t *tst;
   msg_payload_t *pl;
   su_md5_t md5[1];
-  
+
   BEGIN();
 
   TEST_1(tst = msg_test_public(msg));
@@ -255,7 +255,7 @@ static int test_msg_md5(tp_test_t *tt, msg_t *msg)
     if (strcmp(b64, tst->msg_content_md5->g_string)) {
       ;
     }
-    
+
     TEST_S(b64, tst->msg_content_md5->g_string);
   } else {
     TEST_1(tst->msg_content_md5);
@@ -266,7 +266,7 @@ static int test_msg_md5(tp_test_t *tt, msg_t *msg)
 
 #define TPORT_TEST_VERSION MSG_TEST_VERSION_CURRENT
 
-static int new_test_msg(tp_test_t *tt, msg_t **retval, 
+static int new_test_msg(tp_test_t *tt, msg_t **retval,
                        char const *ident,
                        int N, int len)
 {
@@ -336,7 +336,7 @@ static int new_test_msg(tp_test_t *tt, msg_t **retval,
 
   TEST_1(md5 = msg_content_md5_make(home, b64));
   TEST(msg_header_insert(msg, (void *)tst, (msg_header_t *)md5), 0);
-  
+
   TEST_1(sep = msg_separator_create(home));
   TEST(msg_header_insert(msg, (void *)tst, (msg_header_t *)sep), 0);
 
@@ -361,7 +361,7 @@ static void tp_test_recv(tp_test_t *tt,
 
   if (tport_delivered_from(tp, msg, frm) != -1 && frm->tpn_comp) {
     struct sigcomp_compartment *cc = test_sigcomp_compartment(tt, tp, frm);
-   
+
     tport_sigcomp_accept(tp, cc, msg);
   }
 
@@ -374,7 +374,7 @@ static void tp_test_recv(tp_test_t *tt,
   }
   else if (test_msg_md5(tt, msg))
     msg_destroy(msg);
-  else if (tt->tt_rmsg) 
+  else if (tt->tt_rmsg)
     msg_destroy(msg);
   else {
     tt->tt_rmsg = msg;
@@ -388,14 +388,14 @@ static void tp_test_error(tp_test_t *tt,
                          char const *remote)
 {
   tt->tt_status = -1;
-  fprintf(stderr, "tp_test_error(%p): error %d (%s) from %s\n", 
-         (void *)tp, errcode, su_strerror(errcode), 
+  fprintf(stderr, "tp_test_error(%p): error %d (%s) from %s\n",
+         (void *)tp, errcode, su_strerror(errcode),
          remote ? remote : "<unknown destination>");
 }
 
 msg_t *tp_test_msg(tp_test_t *tt, int flags,
                   char const data[], usize_t size,
-                  tport_t const *tp, 
+                  tport_t const *tp,
                   tp_client_t *tpc)
 {
   msg_t *msg = msg_create(tt->tt_mclass, flags);
@@ -408,15 +408,15 @@ msg_t *tp_test_msg(tp_test_t *tt, int flags,
 
 static
 struct sigcomp_compartment *
-test_sigcomp_compartment(tp_test_t *tt, 
-                        tport_t *tp, 
+test_sigcomp_compartment(tp_test_t *tt,
+                        tport_t *tp,
                         tp_name_t const *tpn)
 {
   struct sigcomp_compartment *cc = NULL;
 #if HAVE_SIGCOMP
   char name[256];
   int namesize;
-  
+
   namesize = snprintf(name, sizeof name, "TEST_%s/%s:%s",
                     tpn->tpn_proto,
                     tpn->tpn_host,
@@ -425,11 +425,11 @@ test_sigcomp_compartment(tp_test_t *tt,
   if (namesize <= 0 || namesize >= sizeof name)
     return NULL;
 
-  cc = sigcomp_compartment_access(tt->state_handler, 
+  cc = sigcomp_compartment_access(tt->state_handler,
                                  0, name, namesize, NULL, 0);
 
   if (cc == NULL) {
-    cc = sigcomp_compartment_create(tt->algorithm, tt->state_handler, 
+    cc = sigcomp_compartment_create(tt->algorithm, tt->state_handler,
                                    0, name, namesize, NULL, 0);
 
     sigcomp_compartment_option(cc, "dms=32768");
@@ -506,23 +506,23 @@ static int init_test(tp_test_t *tt)
 
 #if HAVE_SIGCOMP
   TEST_1(tt->state_handler = sigcomp_state_handler_create());
-  TEST_1(tt->algorithm = 
+  TEST_1(tt->algorithm =
         sigcomp_algorithm_by_name(getenv("SIGCOMP_ALGORITHM")));
-  TEST_1(tt->master_cc = 
-        sigcomp_compartment_create(tt->algorithm, tt->state_handler, 
+  TEST_1(tt->master_cc =
+        sigcomp_compartment_create(tt->algorithm, tt->state_handler,
                                    0, "", 0, NULL, 0));
   TEST(sigcomp_compartment_option(tt->master_cc, "stateless"), 1);
 #endif
 
   /* Create client transport */
-  TEST_1(tt->tt_tports = 
+  TEST_1(tt->tt_tports =
         tport_tcreate(tt, tp_test_class, tt->tt_root,
                       IF_SIGCOMP_TPTAG_COMPARTMENT(tt->master_cc)
                       TAG_END()));
 
   /* Bind client transports */
   TEST(tport_tbind(tt->tt_tports, myname, transports,
-                  TPTAG_SERVER(0), TAG_END()), 
+                  TPTAG_SERVER(0), TAG_END()),
        0);
 
   if (getenv("TPORT_TEST_HOST"))
@@ -536,15 +536,15 @@ static int init_test(tp_test_t *tt)
   myname->tpn_ident = "server";
 
   /* Create server transport */
-  TEST_1(tt->tt_srv_tports = 
+  TEST_1(tt->tt_srv_tports =
         tport_tcreate(tt, tp_test_class, tt->tt_root,
                       IF_SIGCOMP_TPTAG_COMPARTMENT(tt->master_cc)
                       TAG_END()));
 
   /* Bind server transports */
-  TEST(tport_tbind(tt->tt_srv_tports, myname, transports, 
+  TEST(tport_tbind(tt->tt_srv_tports, myname, transports,
                   TPTAG_SERVER(1),
-                  TAG_END()), 
+                  TAG_END()),
        0);
 
   /* Check that the master transport has idle parameter */
@@ -578,13 +578,13 @@ static int init_test(tp_test_t *tt)
 
     rname->tpn_port = port;
     rname->tpn_ident = "failure";
-    
+
     before = count_tports(tt->tt_srv_tports);
 
     /* Bind server transports to an reserved port - this should fail */
-    TEST(tport_tbind(tt->tt_srv_tports, rname, transports, 
+    TEST(tport_tbind(tt->tt_srv_tports, rname, transports,
                     TPTAG_SERVER(1),
-                    TAG_END()), 
+                    TAG_END()),
         -1);
 
     after = count_tports(tt->tt_srv_tports);
@@ -601,9 +601,9 @@ static int init_test(tp_test_t *tt)
     rname->tpn_ident = "server2";
 
     /* Bind server transports to another port */
-    TEST(tport_tbind(tt->tt_srv_tports, rname, transports, 
+    TEST(tport_tbind(tt->tt_srv_tports, rname, transports,
                     TPTAG_SERVER(1),
-                    TAG_END()), 
+                    TAG_END()),
         0);
 
     /* Check that new transports are after old ones. */
@@ -631,16 +631,16 @@ static int init_test(tp_test_t *tt)
 
     /* Bind client transports */
     TEST(tport_tbind(tt->tt_tports, tlsname, transports,
-                    TPTAG_SERVER(0), 
+                    TPTAG_SERVER(0),
                     TPTAG_CERTIFICATE(srcdir),
-                    TAG_END()), 
+                    TAG_END()),
         0);
 
     /* Bind tls server transport */
-    TEST(tport_tbind(tt->tt_srv_tports, tlsname, transports, 
+    TEST(tport_tbind(tt->tt_srv_tports, tlsname, transports,
                     TPTAG_SERVER(1),
                     TPTAG_CERTIFICATE(srcdir),
-                    TAG_END()), 
+                    TAG_END()),
         0);
   }
 #endif
@@ -651,9 +651,9 @@ static int init_test(tp_test_t *tt)
     if (tt->tt_flags & tst_verbatim) {
       char const *host = tpn->tpn_host != tpn->tpn_canon ? tpn->tpn_host : "";
       printf("bound transport to %s/%s:%s%s%s%s%s\n",
-            tpn->tpn_proto, tpn->tpn_canon, tpn->tpn_port, 
+            tpn->tpn_proto, tpn->tpn_canon, tpn->tpn_port,
             host[0] ? ";maddr=" : "", host,
-            tpn->tpn_comp ? ";comp=" : "", 
+            tpn->tpn_comp ? ";comp=" : "",
             tpn->tpn_comp ? tpn->tpn_comp : "");
     }
 
@@ -676,10 +676,10 @@ static int init_test(tp_test_t *tt)
       tt->tt_tcp_comp->tpn_ident = NULL;
 
       if (tt->tt_tcp_addr == NULL) {
-       tt->tt_tcp_addr = tport_get_address(tp); 
+       tt->tt_tcp_addr = tport_get_address(tp);
        tt->tt_tcp = tp;
       }
-    } 
+    }
     else if (strcmp(tpn->tpn_proto, "sctp") == 0) {
       *tt->tt_sctp_name = *tpn;
       tt->tt_sctp_name->tpn_ident = NULL;
@@ -693,13 +693,13 @@ static int init_test(tp_test_t *tt)
   END();
 }
 
-char const payload[] = 
+char const payload[] =
 "Some data\n"
 "More data\n";
 
 #include <time.h>
 
-int 
+int
 tport_test_run(tp_test_t *tt, unsigned timeout)
 {
   time_t now = time(NULL);
@@ -715,7 +715,7 @@ tport_test_run(tp_test_t *tt, unsigned timeout)
     }
     su_root_step(tt->tt_root, 500L);
 
-    if (!getenv("TPORT_TEST_DEBUG") && 
+    if (!getenv("TPORT_TEST_DEBUG") &&
        time(NULL) > (time_t)(now + timeout))
       return 0;
   }
@@ -838,7 +838,7 @@ static int tcp_test(tp_test_t *tt)
   msg_destroy(msg);
 
   tport_set_params(tp,
-                   TPTAG_KEEPALIVE(100), 
+                   TPTAG_KEEPALIVE(100),
                    TPTAG_PINGPONG(500),
                    TPTAG_IDLE(500),
                    TAG_END());
@@ -901,7 +901,7 @@ static int tcp_test(tp_test_t *tt)
 
   /* This uses a new connection */
   TEST_1(!new_test_msg(tt, &msg, "tcp-no-reuse", 1, 1024));
-  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name, 
+  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name,
                           TPTAG_REUSE(0), TAG_END()));
   N++;
   TEST_S(tport_name(tp)->tpn_ident, "client");
@@ -910,7 +910,7 @@ static int tcp_test(tp_test_t *tt)
 
   /* This uses the old connection */
   TEST_1(!new_test_msg(tt, &msg, "tcp-reuse", 1, 1024));
-  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name, 
+  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name,
                           TPTAG_REUSE(1), TAG_END()));
   N++;
   TEST_S(tport_name(tp)->tpn_ident, "client");
@@ -940,8 +940,8 @@ static int tcp_test(tp_test_t *tt)
   TEST_1(pending_server_close && pending_client_close);
   SU_DEBUG_3(("tport_test(%p): waiting for PONG timeout\n", (void *)tp0));
 
-  /* Wait until notifications - 
-     client closes when no pong is received and notifys pending, 
+  /* Wait until notifications -
+     client closes when no pong is received and notifys pending,
      then server closes and notifys pending */
   while (pending_server_close || pending_client_close)
     su_root_step(tt->tt_root, 50);
@@ -956,7 +956,7 @@ static int tcp_test(tp_test_t *tt)
   msg_destroy(msg);
 
   tport_set_params(tp0,
-                   TPTAG_KEEPALIVE(250), 
+                   TPTAG_KEEPALIVE(250),
                    TPTAG_PINGPONG(200),
                    TAG_END());
 
@@ -999,7 +999,7 @@ static int tcp_test(tp_test_t *tt)
 static int test_incomplete(tp_test_t *tt)
 {
   BEGIN();
-  
+
   su_addrinfo_t const *ai = tt->tt_tcp_addr;
   su_socket_t s;
   int connected;
@@ -1010,12 +1010,12 @@ static int test_incomplete(tp_test_t *tt)
 
   s = su_socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
   TEST_1(s != SOCKET_ERROR);
-  
+
   su_setblocking(s, 1);
   connected = connect(s, ai->ai_addr, (socklen_t)ai->ai_addrlen);
 
   su_root_step(tt->tt_root, 50);
-  
+
   TEST(su_send(s, "F", 1, 0), 1);
   su_root_step(tt->tt_root, 50);
   TEST(su_send(s, "O", 1, 0), 1);
@@ -1024,12 +1024,12 @@ static int test_incomplete(tp_test_t *tt)
   su_root_step(tt->tt_root, 50);
   TEST(su_send(s, " ", 1, 0), 1);
   su_root_step(tt->tt_root, 50);
-  
+
   tt->tt_received = 0;
   TEST(tport_test_run(tt, 5), -1);
   TEST(tt->tt_received, 1);
   TEST_P(tt->tt_rmsg, NULL);
-  
+
   su_close(s);
 
   END();
@@ -1050,7 +1050,7 @@ static int reuse_test(tp_test_t *tt)
   TEST_1(tp = tport_by_name(tt->tt_tports, tpn));
   TEST_1(tport_is_primary(tp));
   TEST(tport_flush(tp), 0);
-  
+
   for (i = 0; i < 10; i++)
     su_root_step(tt->tt_root, 10L);
 
@@ -1083,7 +1083,7 @@ static int reuse_test(tp_test_t *tt)
   /* Enable reuse on single connection */
   TEST(tport_set_params(tp1, TPTAG_REUSE(1), TAG_END()), 1);
   TEST(new_test_msg(tt, &msg, "reuse-3", 1, 1024), 0);
-  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name, 
+  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name,
                          TPTAG_REUSE(1),
                          TAG_END()));
   TEST_S(tport_name(tp)->tpn_ident, "client");
@@ -1101,7 +1101,7 @@ static int reuse_test(tp_test_t *tt)
 
   /* Send a single message with different connection */
   TEST_1(!new_test_msg(tt, &msg, "fresh-1", 1, 1024));
-  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name, 
+  TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name,
                          TPTAG_FRESH(1),
                          TPTAG_REUSE(1),
                          TAG_END()));
@@ -1135,7 +1135,7 @@ static int sctp_test(tp_test_t *tt)
   tport_t *tp, *tp0;
   char buffer[32];
 
-  if (!tt->tt_sctp_name->tpn_proto) 
+  if (!tt->tt_sctp_name->tpn_proto)
     return 0;
 
   /* Just a small and nice message first */
@@ -1148,7 +1148,7 @@ static int sctp_test(tp_test_t *tt)
   tport_set_params(tp, TPTAG_KEEPALIVE(100), TPTAG_IDLE(500), TAG_END());
 
   TEST(tport_test_run(tt, 5), 1);
-    
+
   TEST_1(!check_msg(tt, tt->tt_rmsg, NULL));
   test_check_md5(tt, tt->tt_rmsg);
   msg_destroy(tt->tt_rmsg), tt->tt_rmsg = NULL;
@@ -1177,7 +1177,7 @@ static int sctp_test(tp_test_t *tt)
     TEST_S(tport_name(tp)->tpn_ident, "client");
     msg_destroy(msg);
   }
-  
+
   /* Fill up the queue */
   for (i = 1; i < TPORT_QUEUESIZE; i++) {
     snprintf(buffer, sizeof buffer, "cid:sctp-%u", n + i);
@@ -1191,16 +1191,16 @@ static int sctp_test(tp_test_t *tt)
   TEST_1(!new_test_msg(tt, &msg, buffer, 1, 1024));
   TEST_1(!tport_tsend(tt->tt_tports, msg, tt->tt_sctp_name, TAG_END()));
   msg_destroy(msg);
-  
+
   TEST(tport_test_run(tt, 5), 1);
-    
+
   TEST_1(!check_msg(tt, tt->tt_rmsg, NULL));
   test_check_md5(tt, tt->tt_rmsg);
   msg_destroy(tt->tt_rmsg), tt->tt_rmsg = NULL;
 
   /* This uses a new connection */
   TEST_1(!new_test_msg(tt, &msg, "cid:sctp-new", 1, 1024));
-  TEST_1(tport_tsend(tt->tt_tports, msg, tt->tt_sctp_name, 
+  TEST_1(tport_tsend(tt->tt_tports, msg, tt->tt_sctp_name,
                     TPTAG_REUSE(0), TAG_END()));
   msg_destroy(msg);
 
@@ -1211,22 +1211,22 @@ static int sctp_test(tp_test_t *tt)
     TEST_1(!check_msg(tt, tt->tt_rmsg, NULL));
     msg_destroy(tt->tt_rmsg), tt->tt_rmsg = NULL;
   }
-  
+
   /* Try to send a single message */
   TEST_1(!new_test_msg(tt, &msg, "cid:sctp-final", 1, 512));
   TEST_1(tport_tsend(tt->tt_tports, msg, tt->tt_sctp_name, TAG_END()));
   msg_destroy(msg);
-  
+
   TEST(tport_test_run(tt, 10), 1);
-  
+
   TEST_1(!check_msg(tt, tt->tt_rmsg, NULL));
   msg_destroy(tt->tt_rmsg), tt->tt_rmsg = NULL;
   }
 
   tport_unref(tp0);
 
-  /* Wait until notifications - 
-     client closes when idle and notifys pending, 
+  /* Wait until notifications -
+     client closes when idle and notifys pending,
      then server closes and notifys pending */
   while (pending_server_close || pending_client_close)
     su_root_step(tt->tt_root, 50);
@@ -1256,7 +1256,7 @@ void tls_error_callback(tp_stack_t *tt, tp_client_t *client,
 
 static int tls_test(tp_test_t *tt)
 {
-  BEGIN(); 
+  BEGIN();
 
 #if HAVE_TLS
   tp_name_t const *dst = tt->tt_tls_name;
@@ -1319,7 +1319,7 @@ static int tls_test(tp_test_t *tt)
 
   /* This uses a new connection */
   TEST_1(!new_test_msg(tt, &msg, "tls-no-reuse", 1, 1024));
-  TEST_1(tp = tport_tsend(tt->tt_tports, msg, dst, 
+  TEST_1(tp = tport_tsend(tt->tt_tports, msg, dst,
                     TPTAG_REUSE(0), TAG_END()));
   TEST_1(tp != tp0);
   msg_destroy(msg);
@@ -1345,12 +1345,12 @@ static int tls_test(tp_test_t *tt)
 
   tport_decref(&tp0);
 
-  /* Wait until notifications - 
-     client closes when idle and notifys pending, 
+  /* Wait until notifications -
+     client closes when idle and notifys pending,
      then server closes and notifys pending */
   while (pending_server_close || pending_client_close)
     su_root_step(tt->tt_root, 50);
-  
+
 #endif
 
   END();
@@ -1364,7 +1364,7 @@ static int sigcomp_test(tp_test_t *tt)
   su_home_t *home;
   tp_name_t tpn[1] = {{ NULL }};
   struct sigcomp_compartment *cc;
-  
+
   if (tt->tt_udp_comp->tpn_comp) {
     msg_t *msg = NULL;
 
@@ -1372,8 +1372,8 @@ static int sigcomp_test(tp_test_t *tt)
 
     TEST_1(!new_test_msg(tt, &msg, "udp-sigcomp", 1, 1200));
     test_create_md5(tt, msg);
-    TEST_1(tport_tsend(tt->tt_tports, 
-                      msg, 
+    TEST_1(tport_tsend(tt->tt_tports,
+                      msg,
                       tt->tt_udp_comp,
                       TPTAG_COMPARTMENT(cc),
                       TAG_END()));
@@ -1386,25 +1386,25 @@ static int sigcomp_test(tp_test_t *tt)
     test_check_md5(tt, tt->tt_rmsg);
 
     TEST_1(msg = tt->tt_rmsg); tt->tt_rmsg = NULL;
-    
+
     TEST_1(home = msg_home(msg));
-    
+
     TEST_1(tport_convert_addr(home, tpn, "udp", NULL, msg_addr(msg)) == 0);
-    
+
     tpn->tpn_comp = tport_name(tt->tt_rtport)->tpn_comp;
-    
+
     /* reply */
     TEST_1(cc = test_sigcomp_compartment(tt, tt->tt_tports, tpn));
-    TEST_1(tport_tsend(tt->tt_rtport, msg, tpn, 
+    TEST_1(tport_tsend(tt->tt_rtport, msg, tpn,
                       TPTAG_COMPARTMENT(cc),
                       TAG_END()) != NULL);
-    
+
     msg_destroy(msg);
-    
+
     TEST(tport_test_run(tt, 5), 1);
 
-    TEST_1(!check_msg(tt, tt->tt_rmsg, NULL)); 
-    test_check_md5(tt, tt->tt_rmsg); 
+    TEST_1(!check_msg(tt, tt->tt_rmsg, NULL));
+    test_check_md5(tt, tt->tt_rmsg);
     msg_destroy(tt->tt_rmsg), tt->tt_rmsg = NULL;
   }
 
@@ -1420,9 +1420,9 @@ static int sigcomp_test(tp_test_t *tt)
     tport_log->log_level = 9;
 
     TEST_1(cc = test_sigcomp_compartment(tt, tt->tt_tports, tpn));
-    TEST_1(tp = tport_tsend(tt->tt_tports, 
-                           msg, 
-                           tpn, 
+    TEST_1(tp = tport_tsend(tt->tt_tports,
+                           msg,
+                           tpn,
                            TPTAG_COMPARTMENT(cc),
                            TAG_END()));
     TEST_1(tport_incref(tp)); tport_decref(&tp);
@@ -1436,9 +1436,9 @@ static int sigcomp_test(tp_test_t *tt)
 
     TEST_1(!new_test_msg(tt, &msg, "tcp-sigcomp-2", 1, 3000));
     test_create_md5(tt, msg);
-    TEST_1(tp = tport_tsend(tt->tt_tports, 
-                           msg, 
-                           tt->tt_tcp_comp, 
+    TEST_1(tp = tport_tsend(tt->tt_tports,
+                           msg,
+                           tt->tt_tcp_comp,
                            TPTAG_COMPARTMENT(cc),
                            TAG_END()));
     TEST_1(tport_incref(tp)); tport_decref(&tp);
@@ -1447,15 +1447,15 @@ static int sigcomp_test(tp_test_t *tt)
     TEST(tport_test_run(tt, 5), 1);
 
     TEST_1(!check_msg(tt, tt->tt_rmsg, "tcp-sigcomp-2"));
-    test_check_md5(tt, tt->tt_rmsg); 
+    test_check_md5(tt, tt->tt_rmsg);
 
     msg_destroy(tt->tt_rmsg), tt->tt_rmsg = NULL;
 
     TEST_1(!new_test_msg(tt, &msg, "tcp-sigcomp-3", 1, 45500));
     test_create_md5(tt, msg);
-    TEST_1(tp = tport_tsend(tt->tt_tports, 
-                           msg, 
-                           tt->tt_tcp_comp, 
+    TEST_1(tp = tport_tsend(tt->tt_tports,
+                           msg,
+                           tt->tt_tcp_comp,
                            TPTAG_COMPARTMENT(cc),
                            TAG_END()));
     TEST_1(tport_incref(tp));
@@ -1476,9 +1476,9 @@ static int sigcomp_test(tp_test_t *tt)
 
       TEST_1(!new_test_msg(tt, &msg, "tcp-sigcomp-4", 1, 1000));
       test_create_md5(tt, msg);
-      TEST_1(tp = tport_tsend(tt->tt_tports, 
-                             msg, 
-                             tpn, 
+      TEST_1(tp = tport_tsend(tt->tt_tports,
+                             msg,
+                             tpn,
                              TPTAG_COMPARTMENT(cc),
                              TPTAG_FRESH(1),
                              TAG_END()));
@@ -1486,7 +1486,7 @@ static int sigcomp_test(tp_test_t *tt)
       msg_destroy(msg);
 
       TEST(tport_test_run(tt, 5), 1);
-      
+
       TEST_1(!check_msg(tt, tt->tt_rmsg, "tcp-sigcomp-4"));
       test_check_md5(tt, tt->tt_rmsg);
       TEST_1((msg_addrinfo(tt->tt_rmsg)->ai_flags & TP_AI_COMPRESSED) == 0);
@@ -1496,14 +1496,14 @@ static int sigcomp_test(tp_test_t *tt)
       TEST_1(!new_test_msg(tt, &msg, "tcp-sigcomp-5", 1, 1000));
       test_create_md5(tt, msg);
       {
-       /* Mess with internal data structures in order to 
+       /* Mess with internal data structures in order to
           force tport to use SigComp on this connection */
        tp_name_t *tpn = (tp_name_t *)tport_name(rtp);
        tpn->tpn_comp = "sigcomp";
       }
-      TEST_1(tp = tport_tsend(rtp, 
-                             msg, 
-                             tt->tt_tcp_comp, 
+      TEST_1(tp = tport_tsend(rtp,
+                             msg,
+                             tt->tt_tcp_comp,
                              TPTAG_COMPARTMENT(cc),
                              TAG_END()));
       TEST_1(tport_incref(tp));
@@ -1544,8 +1544,8 @@ static int stun_test(tp_test_t *tt)
 #endif
 
   TEST_1(mr = tport_tcreate(tt, tp_test_class, tt->tt_root, TAG_END()));
-  
-  TEST(tport_tbind(tt->tt_tports, tpn, transports, TPTAG_SERVER(1), 
+
+  TEST(tport_tbind(tt->tt_tports, tpn, transports, TPTAG_SERVER(1),
                   STUNTAG_SERVER("999.999.999.999"),
                   TAG_END()), -1);
 
@@ -1587,7 +1587,7 @@ static int filter_test(tp_test_t *tt)
   BEGIN();
 
   lst = tl_list(TSTTAG_HEADER_STR("X: Y"),
-               TAG_SKIP(2), 
+               TAG_SKIP(2),
                TPTAG_IDENT("foo"),
                TSTTAG_HEADER_STR("X: Y"),
                TPTAG_IDENT("bar"),
index c24bd73fc846909cbbe1c439b411c020fd898d83..c8eb0b0b8eee32d6f4ee556d3b44cccaab529671 100644 (file)
@@ -40,7 +40,7 @@ int tls_setblocking(int s, int blocking)
   if (mode < 0)
      return -1;
 
-  if (blocking) 
+  if (blocking)
     mode &= ~(O_NDELAY | O_NONBLOCK);
   else
     mode |= O_NDELAY | O_NONBLOCK;
@@ -66,7 +66,7 @@ void tls_write_buffer(TLS_CONTEXT ctx, unsigned char *buf, int size)
       pos += ret;
       printf("%d bytes written\n", ret);
       break;
-    
+
     case SSL_ERROR_WANT_WRITE:
       printf("want write\n");
       break;
@@ -103,7 +103,7 @@ int main (int argc, char *argv[])
     perror("fopen");
     exit(1);
   }
-  
+
   if (fstat(fileno(fp), &stats) < 0) {
     perror("fstat");
     exit(1);
@@ -140,7 +140,7 @@ void write_file(FILE *fp, int size)
 
     while (posBuffer < sizeof(buf)) {
       int bytes;
-      
+
       bytes = read(fileno(fp), buf + posBuffer, sizeof(buf));
 
       if (bytes == 0)
@@ -149,7 +149,7 @@ void write_file(FILE *fp, int size)
       if (bytes < 0) {
         perror("read");
       }
-      
+
       else {
         printf("writing %d buffer\n", bytes);
         tls_write_buffer(ctx, buf, bytes);
index e5ee86e19250abc68da171e876cd8572a11b5255..dbf66bc3edb54e6ce2d62106fb84ac85afc7ac29 100644 (file)
@@ -60,7 +60,7 @@ int tls_setblocking(int s, int blocking)
   if (mode < 0)
      return -1;
 
-  if (blocking) 
+  if (blocking)
     mode &= ~(O_NDELAY | O_NONBLOCK);
   else
     mode |= O_NDELAY | O_NONBLOCK;
@@ -82,7 +82,7 @@ void regi_sock (int sock, TLS_CONTEXT ctx, IO_HANDLER handler)
 
   tls_setblocking(sock, 0);
 
-  printf("socket %d registered, ctx = %p, mngr_size = %d, width = %d\n", 
+  printf("socket %d registered, ctx = %p, mngr_size = %d, width = %d\n",
          sock, ctx, mngr_size, width);
 }
 
@@ -119,7 +119,7 @@ int tls_read_buffer(TLS_MNGR mngr, char *buf, int size)
       printf("ssl error want read\n");
       return bytes;
       break;
-      
+
     case SSL_ERROR_WANT_WRITE:
       break;
 
@@ -127,7 +127,7 @@ int tls_read_buffer(TLS_MNGR mngr, char *buf, int size)
       printf("shutdown\n");
       tls_shutdown(ctx);
       return bytes;
-      
+
     case SSL_ERROR_SYSCALL:
       perror("tls_syscall");
       tls_shutdown(ctx);
@@ -138,7 +138,7 @@ int tls_read_buffer(TLS_MNGR mngr, char *buf, int size)
       printf("TLS error code %d\n", err);
       return bytes;
     }
-    
+
     if (tls_pending(ctx)) {
       printf("read pending\n");
     }
@@ -162,7 +162,7 @@ int tls_slave_handler(int i)
   if (bytes > 0) {
     sprintf(fname, "%s%02d.txt", file_prefix, i);
     fp = fopen(fname, "a");
-  
+
     if (fp == NULL)
       perror("tls_slave_handler fopen");
 
@@ -175,7 +175,7 @@ int tls_slave_handler(int i)
       fclose(fp);
     }
   }
-  
+
   return 0;
 }
 
@@ -190,7 +190,7 @@ int tls_master_handler(int i)
   tls_issues.master_socket = master_socket;
 
   sock = init_tls_slave(tls_issues, tls_mngr[i].ctx, &ctx_slave);
-  
+
   if (sock < 0) {
     perror("init_tls_slave");
     return -1;
@@ -245,13 +245,13 @@ int main (int argc, char *argv[])
 
   init_event_mngr();
 
-  if (init_tls_master(&master_socket, 
+  if (init_tls_master(&master_socket,
                       tls_issues,
                       &ctx) < 0) {
     printf("init_tls_master failed\n");
     exit (1);
   }
-  
+
   regi_sock(master_socket, ctx, tls_master_handler);
 
   for (;;) {
index ac069abffb9e59eeab3cc6817215497411f6107f..2eae1ac730e0f53a7ddc89e2a1d1f9b4436e86d5 100644 (file)
@@ -108,7 +108,7 @@ su_inline int tp_cmp(tport_t const *a, tport_t const *b)
 {
   if (a == b)
     return 0;
-  
+
   if (a->tp_addrlen != b->tp_addrlen)
     return (int)(a->tp_addrlen - b->tp_addrlen);
 
@@ -122,7 +122,7 @@ su_inline int tprb_is_inserted(tport_t const *a)
 
 RBTREE_PROTOS(su_inline, tprb, tport_t);
 
-RBTREE_BODIES(su_inline, tprb, tport_t, 
+RBTREE_BODIES(su_inline, tprb, tport_t,
              TP_LEFT, TP_RIGHT, TP_PARENT,
              TP_IS_RED, TP_SET_RED, TP_IS_BLACK, TP_SET_BLACK, TP_COPY_COLOR,
              tp_cmp, TP_INSERT, TP_REMOVE);
@@ -171,25 +171,25 @@ struct tport_pending_s {
 /** Return true if transport is master. */
 int tport_is_master(tport_t const *self)
 {
-  return 
-    self && 
+  return
+    self &&
     self->tp_master->mr_master == self;
 }
 
 /** Return true if transport is primary. */
 int tport_is_primary(tport_t const *self)
 {
-  return 
-    self && 
+  return
+    self &&
     self->tp_pri->pri_primary == self;
 }
 
 /** Return true if transport is secondary. */
 int tport_is_secondary(tport_t const *self)
 {
-  return 
-    self && 
-    self->tp_master->mr_master != self && 
+  return
+    self &&
+    self->tp_master->mr_master != self &&
     self->tp_pri->pri_primary != self;
 }
 
@@ -204,33 +204,33 @@ int tport_is_stream(tport_t const *self)
 {
   return self && self->tp_addrinfo->ai_socktype == SOCK_STREAM;
 }
+
 /** Test if transport is dgram. */
 int tport_is_dgram(tport_t const *self)
 {
   return self && self->tp_addrinfo->ai_socktype == SOCK_DGRAM;
 }
+
 /** Test if transport is udp. */
 int tport_is_udp(tport_t const *self)
 {
   return self && self->tp_addrinfo->ai_protocol == IPPROTO_UDP;
 }
+
 /** Test if transport is tcp. */
 int tport_is_tcp(tport_t const *self)
 {
   return self && self->tp_addrinfo->ai_protocol == IPPROTO_TCP;
 }
+
 /** Return 1 if transport is reliable, 0 otherwise.
  *
  * (Note that this is part of external API).
  */
 int tport_is_reliable(tport_t const *self)
 {
-  return self != NULL && 
-    (self->tp_addrinfo->ai_socktype == SOCK_STREAM || 
+  return self != NULL &&
+    (self->tp_addrinfo->ai_socktype == SOCK_STREAM ||
      self->tp_addrinfo->ai_socktype == SOCK_SEQPACKET);
 }
 
@@ -248,8 +248,8 @@ int tport_is_public(tport_t const *self)
 /** Return true if transport supports IPv4 */
 int tport_has_ip4(tport_t const *self)
 {
-  return self && 
-    (self->tp_addrinfo->ai_family == 0 || 
+  return self &&
+    (self->tp_addrinfo->ai_family == 0 ||
      self->tp_addrinfo->ai_family == AF_INET);
 }
 
@@ -258,8 +258,8 @@ int tport_has_ip4(tport_t const *self)
 /** Return true if transport supports IPv6 */
 int tport_has_ip6(tport_t const *self)
 {
-  return self && 
-    (self->tp_addrinfo->ai_family == 0 || 
+  return self &&
+    (self->tp_addrinfo->ai_family == 0 ||
      self->tp_addrinfo->ai_family == AF_INET6);
 }
 #endif
@@ -277,7 +277,7 @@ int tport_is_updating(tport_t const *self)
   tport_primary_t *pri;
 
   if (tport_is_master(self)) {
-    for (pri = self->tp_master->mr_primaries; pri; pri = pri->pri_next) 
+    for (pri = self->tp_master->mr_primaries; pri; pri = pri->pri_next)
       if (pri->pri_updating)
        return 1;
   }
@@ -322,8 +322,8 @@ int tport_is_connected(tport_t const *self)
 int tport_is_clear_to_send(tport_t const *self)
 {
   return
-    tport_is_master(self) || 
-    tport_is_primary(self) || 
+    tport_is_master(self) ||
+    tport_is_primary(self) ||
     (tport_is_secondary(self) &&
      tport_is_registered(self) &&
      self->tp_reusable &&
@@ -352,16 +352,16 @@ int tport_has_sigcomp(tport_t const *self)
 /** Set IP TOS for socket */
 void tport_set_tos(su_socket_t socket, su_addrinfo_t *ai, int tos)
 {
-  if (tos >= 0 && 
-      ai->ai_family == AF_INET && 
+  if (tos >= 0 &&
+      ai->ai_family == AF_INET &&
       setsockopt(socket, IPPROTO_IP, IP_TOS, (const void*)&tos, sizeof(tos)) < 0) {
     SU_DEBUG_3(("tport: setsockopt(IP_TOS): %s\n",
                su_strerror(su_errno())));
   }
 }
 
-static 
-tport_t *tport_connect(tport_primary_t *pri, su_addrinfo_t *ai, 
+static
+tport_t *tport_connect(tport_primary_t *pri, su_addrinfo_t *ai,
                       tp_name_t const *tpn);
 
 static int bind6only_check(tport_master_t *mr);
@@ -370,13 +370,13 @@ static
 int tport_server_addrinfo(tport_master_t *mr,
                          char const *canon,
                          int family,
-                         char const *host, 
+                         char const *host,
                          char const *service,
                          char const *protocol,
                          char const * const transports[],
                          su_addrinfo_t **res);
 
-static int tport_get_local_addrinfo(tport_master_t *mr, 
+static int tport_get_local_addrinfo(tport_master_t *mr,
                                    char const *port,
                                    su_addrinfo_t const *hints,
                                    su_addrinfo_t **return_ai);
@@ -427,7 +427,7 @@ static void tport_parse(tport_t *self, int complete, su_time_t now);
 static tport_primary_t *tport_alloc_primary(tport_master_t *mr,
                                            tport_vtable_t const *vtable,
                                            tp_name_t tpn[1],
-                                           su_addrinfo_t *ai, 
+                                           su_addrinfo_t *ai,
                                            tagi_t const *tags,
                                            char const **return_culprit);
 
@@ -445,21 +445,21 @@ static int getprotohints(su_addrinfo_t *hints,
 
 /* Stack class used when transports are being destroyed */
 static
-void tport_destroy_recv(tp_stack_t *stack, tport_t *tp, 
-                       msg_t *msg, tp_magic_t *magic, 
+void tport_destroy_recv(tp_stack_t *stack, tport_t *tp,
+                       msg_t *msg, tp_magic_t *magic,
                        su_time_t received)
 {
   msg_destroy(msg);
 }
 
 static
-void tport_destroy_error(tp_stack_t *stack, tport_t *tp, 
+void tport_destroy_error(tp_stack_t *stack, tport_t *tp,
                         int errcode, char const *remote)
 {
 }
 
 static
-msg_t *tport_destroy_alloc(tp_stack_t *stack, int flags, 
+msg_t *tport_destroy_alloc(tp_stack_t *stack, int flags,
                           char const data[], usize_t len,
                           tport_t const *tp,
                           tp_client_t *tpc)
@@ -473,7 +473,7 @@ static char const tpn_any[] = "*";
 /** Create the master transport.
  *
  * Master transport object is used to bind the protocol using transport with
- * actual transport objects corresponding to TCP, UDP, etc. 
+ * actual transport objects corresponding to TCP, UDP, etc.
  *
  * @sa tport_tbind()
  *
@@ -483,7 +483,7 @@ static char const tpn_any[] = "*";
  */
 tport_t *tport_tcreate(tp_stack_t *stack,
                       tp_stack_class_t const *tpac,
-                      su_root_t *root, 
+                      su_root_t *root,
                       tag_type_t tag, tag_value_t value, ...)
 {
   tport_master_t *mr;
@@ -547,7 +547,7 @@ void tport_destroy(tport_t *self)
 {
   tport_master_t *mr;
 
-  static tp_stack_class_t tport_destroy_tpac[1] = 
+  static tp_stack_class_t tport_destroy_tpac[1] =
     {{
        sizeof tport_destroy_tpac,
        /* tpac_recv */ tport_destroy_recv,
@@ -560,7 +560,7 @@ void tport_destroy(tport_t *self)
 
   if (self == NULL)
     return;
-  
+
   assert(tport_is_master(self));
   if (!tport_is_master(self))
     return;
@@ -586,7 +586,7 @@ void tport_destroy(tport_t *self)
 
 
 /** Allocate a primary transport */
-static 
+static
 tport_primary_t *tport_alloc_primary(tport_master_t *mr,
                                     tport_vtable_t const *vtable,
                                     tp_name_t tpn[1],
@@ -600,7 +600,7 @@ tport_primary_t *tport_alloc_primary(tport_master_t *mr,
 
   for (next = &mr->mr_primaries; *next; next = &(*next)->pri_next)
     ;
-  
+
   assert(vtable->vtp_pri_size >= sizeof *pri);
 
   if ((pri = su_home_clone(mr->mr_home, vtable->vtp_pri_size))) {
@@ -625,9 +625,9 @@ tport_primary_t *tport_alloc_primary(tport_master_t *mr,
                (void *)pri));
   }
 
-  *next = pri; 
+  *next = pri;
   tp = pri->pri_primary;
-  
+
   if (!tp)
     *return_culprit = "alloc";
   else if (tport_set_params(tp, TAG_NEXT(tags)) < 0)
@@ -635,9 +635,9 @@ tport_primary_t *tport_alloc_primary(tport_master_t *mr,
   else if (vtable->vtp_init_primary &&
           vtable->vtp_init_primary(pri, tpn, ai, tags, return_culprit) < 0)
     ;
-  else if (tport_setname(tp, vtable->vtp_name, ai, tpn->tpn_canon) == -1) 
+  else if (tport_setname(tp, vtable->vtp_name, ai, tpn->tpn_canon) == -1)
     *return_culprit = "tport_setname";
-  else if (tpn->tpn_ident && 
+  else if (tpn->tpn_ident &&
           !(tp->tp_name->tpn_ident = su_strdup(tp->tp_home, tpn->tpn_ident)))
     *return_culprit = "alloc ident";
   else
@@ -652,7 +652,7 @@ tport_primary_t *tport_alloc_primary(tport_master_t *mr,
 
 
 /** Destroy a primary transport and its secondary transports. @internal */
-static 
+static
 void tport_zap_primary(tport_primary_t *pri)
 {
   tport_primary_t **prip;
@@ -695,7 +695,7 @@ static
 tport_primary_t *tport_listen(tport_master_t *mr,
                              tport_vtable_t const *vtable,
                              tp_name_t tpn[1],
-                             su_addrinfo_t *ai, 
+                             su_addrinfo_t *ai,
                              tagi_t *tags)
 {
   tport_primary_t *pri = NULL;
@@ -739,7 +739,7 @@ tport_primary_t *tport_listen(tport_master_t *mr,
       return TPORT_LISTEN_ERROR(su_errno(), "su_wait_create");
 
     /* Register receiving or accepting function with events specified above */
-    index = su_root_register(mr->mr_root, wait, tport_wakeup_pri, tp, 0); 
+    index = su_root_register(mr->mr_root, wait, tport_wakeup_pri, tp, 0);
     if (index == -1) {
       su_wait_destroy(wait);
       return TPORT_LISTEN_ERROR(su_errno(), "su_root_register");
@@ -750,7 +750,7 @@ tport_primary_t *tport_listen(tport_master_t *mr,
 
   pri->pri_primary->tp_has_connection = 0;
 
-  SU_DEBUG_5(("%s(%p): %s " TPN_FORMAT "\n", 
+  SU_DEBUG_5(("%s(%p): %s " TPN_FORMAT "\n",
              __func__, (void *)pri, "listening at",
              TPN_ARGS(pri->pri_primary->tp_name)));
 
@@ -780,13 +780,13 @@ int tport_bind_socket(int socket,
        (IN6_IS_ADDR_V4MAPPED(&su->su_sin6.sin6_addr) ||
         IN6_IS_ADDR_V4COMPAT(&su->su_sin6.sin6_addr))) {
       su_sockaddr_t su0[1];
-      
+
       memcpy(su0, su, sizeof su0);
-      
+
       memset(su, 0, ai->ai_addrlen = sizeof su->su_sin);
       su->su_family = ai->ai_family = AF_INET;
       su->su_port = su0->su_port;
-      
+
 #ifndef IN6_V4MAPPED_TO_INADDR
 #define IN6_V4MAPPED_TO_INADDR(in6, in4) \
       memcpy((in4), 12 + (uint8_t *)(in6), sizeof(struct in_addr))
@@ -823,17 +823,17 @@ int tport_set_events(tport_t *self, int set, int clear)
 
   if (self->tp_pri->pri_vtable->vtp_set_events)
     return self->tp_pri->pri_vtable->vtp_set_events(self);
-  
+
   SU_DEBUG_7(("tport_set_events(%p): events%s%s%s\n", (void *)self,
              (events & SU_WAIT_IN) ? " IN" : "",
              (events & SU_WAIT_OUT) ? " OUT" : "",
              SU_WAIT_CONNECT != SU_WAIT_OUT &&
              (events & SU_WAIT_CONNECT) ? " CONNECT" : ""));
-  
-  return 
-    su_root_eventmask(self->tp_master->mr_root, 
-                     self->tp_index, 
-                     self->tp_socket, 
+
+  return
+    su_root_eventmask(self->tp_master->mr_root,
+                     self->tp_index,
+                     self->tp_socket,
                      self->tp_events = events);
 }
 
@@ -851,7 +851,7 @@ int tport_set_events(tport_t *self, int set, int clear)
  *
  * @note The socket is always closed upon error.
  */
-tport_t *tport_alloc_secondary(tport_primary_t *pri, 
+tport_t *tport_alloc_secondary(tport_primary_t *pri,
                               int socket,
                               int accepted,
                               char const **return_reason)
@@ -862,7 +862,7 @@ tport_t *tport_alloc_secondary(tport_primary_t *pri,
   self = su_home_clone(mr->mr_home, pri->pri_vtable->vtp_secondary_size);
 
   if (self) {
-    SU_DEBUG_7(("%s(%p): new secondary tport %p\n", 
+    SU_DEBUG_7(("%s(%p): new secondary tport %p\n",
                __func__, (void *)pri, (void *)self));
 
     self->tp_refs = -1;                        /* Freshly allocated  */
@@ -915,7 +915,7 @@ tport_t *tport_alloc_secondary(tport_primary_t *pri,
  * @param tpn   canonical name of node
  */
 static
-tport_t *tport_connect(tport_primary_t *pri, 
+tport_t *tport_connect(tport_primary_t *pri,
                       su_addrinfo_t *ai,
                       tp_name_t const *tpn)
 {
@@ -996,20 +996,20 @@ tport_t *tport_base_connect(tport_primary_t *pri,
 
     /* Bind this socket to same IP address as the primary server socket */
     if (getsockname(server_socket, &susa.su_sa, &susalen) < 0) {
-      SU_DEBUG_3(("%s(%p): getsockname(): %s\n", 
+      SU_DEBUG_3(("%s(%p): getsockname(): %s\n",
                  __func__, (void *)self, su_strerror(su_errno())));
     }
     else {
       susa.su_port = 0;
       if (bind(s, &susa.su_sa, susalen) < 0) {
-       SU_DEBUG_3(("%s(%p): bind(local-ip): %s\n", 
+       SU_DEBUG_3(("%s(%p): bind(local-ip): %s\n",
                    __func__, (void *)self, su_strerror(su_errno())));
       }
     }
   }
 
   /* Set sockname for the tport */
-  if (tport_setname(self, tpn->tpn_proto, real_ai, tpn->tpn_canon) == -1) 
+  if (tport_setname(self, tpn->tpn_proto, real_ai, tpn->tpn_canon) == -1)
     TPORT_CONNECT_ERROR(su_errno(), tport_setname);
 
   /* Try to have a non-blocking connect().
@@ -1039,7 +1039,7 @@ tport_t *tport_base_connect(tport_primary_t *pri,
   self->tp_index = index;
 
   if (ai == real_ai) {
-    SU_DEBUG_5(("%s(%p): %s to " TPN_FORMAT "\n", 
+    SU_DEBUG_5(("%s(%p): %s to " TPN_FORMAT "\n",
                __func__, (void *)self, what, TPN_ARGS(self->tp_name)));
   }
   else {
@@ -1078,7 +1078,7 @@ void tport_zap_secondary(tport_t *self)
 
   if (self->tp_msg) {
     msg_destroy(self->tp_msg), self->tp_msg = NULL;
-    SU_DEBUG_3(("%s(%p): zapped partially received message\n", 
+    SU_DEBUG_3(("%s(%p): zapped partially received message\n",
                __func__, (void *)self));
   }
 
@@ -1088,7 +1088,7 @@ void tport_zap_secondary(tport_t *self)
       msg_destroy(self->tp_queue[i]), self->tp_queue[i] = NULL;
       n++;
     }
-    SU_DEBUG_3(("%s(%p): zapped %lu queued messages\n", 
+    SU_DEBUG_3(("%s(%p): zapped %lu queued messages\n",
                __func__, (void *)self, (LU)n));
   }
 
@@ -1132,7 +1132,7 @@ void tport_unref(tport_t *tp)
     return;
   if (--tp->tp_refs > 0)
     return;
-  
+
   if (!tport_is_secondary(tp))
     return;
 
@@ -1186,7 +1186,7 @@ int tport_get_params(tport_t const *self,
   tpp = self->tp_params;
   ta_start(ta, tag, value);
 
-  connect = tpp->tpp_conn_orient 
+  connect = tpp->tpp_conn_orient
     /* Only dgram primary is *not* connection-oriented */
     || !tport_is_primary(self) || !tport_is_dgram(self);
 
@@ -1235,7 +1235,7 @@ int tport_set_params(tport_t *self,
   ta_list ta;
   int n, m = 0;
   tport_params_t tpp[1], *tpp0;
-  
+
   usize_t mtu;
   int connect, sdwn_error, reusable, stun_server, pong2ping;
 
@@ -1296,8 +1296,8 @@ int tport_set_params(tport_t *self,
   if (mtu > UINT_MAX)
     mtu = UINT_MAX;
   tpp->tpp_mtu = (unsigned)mtu;
-  /* Currently only primary UDP transport can *not* be connection oriented */ 
-  tpp->tpp_conn_orient = connect; 
+  /* Currently only primary UDP transport can *not* be connection oriented */
+  tpp->tpp_conn_orient = connect;
   tpp->tpp_sdwn_error = sdwn_error;
   self->tp_reusable = reusable;
   tpp->tpp_stun_server = stun_server;
@@ -1306,7 +1306,7 @@ int tport_set_params(tport_t *self,
   if (memcmp(tpp0, tpp, sizeof tpp) == 0)
     return n;
 
-  if (tport_is_secondary(self) && 
+  if (tport_is_secondary(self) &&
       self->tp_params == self->tp_pri->pri_primary->tp_params) {
     tpp0 = su_zalloc(self->tp_home, sizeof *tpp0); if (!tpp0) return -1;
     self->tp_params = tpp0;
@@ -1376,7 +1376,7 @@ int tport_register_type(tport_vtable_t const *vtp)
 
 /**Get a vtable for given protocol */
 tport_vtable_t const *tport_vtable_by_name(char const *protoname,
-                                          enum tport_via public) 
+                                          enum tport_via public)
 {
   int i;
 
@@ -1392,7 +1392,7 @@ tport_vtable_t const *tport_vtable_by_name(char const *protoname,
 
     assert(vtable->vtp_pri_size >= sizeof (tport_primary_t));
     assert(vtable->vtp_secondary_size >= sizeof (tport_t));
-    
+
     return vtable;
   }
 
@@ -1400,7 +1400,7 @@ tport_vtable_t const *tport_vtable_by_name(char const *protoname,
 }
 
 #if 0
-tport_set_f const *tport_set_methods[TPORT_NUMBER_OF_TYPES + 1] = 
+tport_set_f const *tport_set_methods[TPORT_NUMBER_OF_TYPES + 1] =
   {
     tport_server_bind_set,
     tport_client_bind_set,
@@ -1414,7 +1414,7 @@ tport_set_f const *tport_set_methods[TPORT_NUMBER_OF_TYPES + 1] =
     NULL
   };
 
-int tport_bind_set(tport_master_t *mr, 
+int tport_bind_set(tport_master_t *mr,
                   tp_name_t const *tpn,
                   char const * const transports[],
                   tagi_t const *taglist,
@@ -1461,7 +1461,7 @@ int tport_tbind(tport_t *self,
   tp_name_t mytpn[1];
   tport_master_t *mr;
   char const *http_connect = NULL;
-  
+
   if (self == NULL || tport_is_secondary(self) ||
       tpn == NULL || transports == NULL) {
     su_seterrno(EINVAL);
@@ -1486,7 +1486,7 @@ int tport_tbind(tport_t *self,
 
   if (http_connect && public == 0)
     public = tport_type_connect;
-    
+
   if (public && public != tport_type_stun)
     server = 0;
 
@@ -1519,7 +1519,7 @@ int tport_bind_client(tport_master_t *mr,
 
   if (public == tport_type_local)
     public = tport_type_client;
-  
+
   SU_DEBUG_5(("%s(%p) to " TPN_FORMAT "\n",
              __func__, (void *)mr, TPN_ARGS(tpn)));
 
@@ -1531,8 +1531,8 @@ int tport_bind_client(tport_master_t *mr,
   for (i = 0; transports[i]; i++) {
     su_addrinfo_t hints[1];
     char const *proto = transports[i];
-    
-    if (strcmp(proto, tpn->tpn_proto) != 0 && 
+
+    if (strcmp(proto, tpn->tpn_proto) != 0 &&
         strcmp(tpn->tpn_proto, tpn_any) != 0)
       continue;
 
@@ -1582,7 +1582,7 @@ int tport_bind_server(tport_master_t *mr,
   bind6only_check(mr);
 
   (void)hostname;
-  
+
   SU_DEBUG_5(("%s(%p) to " TPN_FORMAT "\n",
              __func__, (void *)mr, TPN_ARGS(tpn)));
 
@@ -1603,7 +1603,7 @@ int tport_bind_server(tport_master_t *mr,
   if (tpn->tpn_port != NULL && strlen(tpn->tpn_port) > 0 &&
       strcmp(tpn->tpn_port, tpn_any) != 0)
     service = tpn->tpn_port;
-  else 
+  else
     service = "";
 
   if (host && (strcmp(host, "0.0.0.0") == 0 || strcmp(host, "0") == 0))
@@ -1617,7 +1617,7 @@ int tport_bind_server(tport_master_t *mr,
       (host || tpn->tpn_canon != tpn->tpn_host))
     canon = tpn->tpn_canon;
 
-  if (tport_server_addrinfo(mr, canon, family, 
+  if (tport_server_addrinfo(mr, canon, family,
                            host, service, tpn->tpn_proto,
                            transports, &res) < 0)
     return -1;
@@ -1628,9 +1628,9 @@ int tport_bind_server(tport_master_t *mr,
   port = port0 = port1 = ntohs(((su_sockaddr_t *)res->ai_addr)->su_port);
   error = EPROTONOSUPPORT;
 
-  /* 
-   * Loop until we can bind all the transports requested 
-   * by the transport user to the same port. 
+  /*
+   * Loop until we can bind all the transports requested
+   * by the transport user to the same port.
    */
   for (;;) {
     for (ai = res; ai; ai = ai->ai_next) {
@@ -1651,7 +1651,7 @@ int tport_bind_server(tport_master_t *mr,
       tpname->tpn_canon = canon;
       tpname->tpn_host = host;
 
-      SU_DEBUG_9(("%s(%p): calling tport_listen for %s\n", 
+      SU_DEBUG_9(("%s(%p): calling tport_listen for %s\n",
                  __func__, (void *)mr, ai->ai_canonname));
 
       pri = tport_listen(mr, vtable, tpname, ainfo, tags);
@@ -1698,7 +1698,7 @@ int tport_bind_server(tport_master_t *mr,
     if (port == port1)         /* All ports in use! */
       break;
 
-    SU_DEBUG_3(("%s(%p): cannot bind all transports to port %u, trying %u\n", 
+    SU_DEBUG_3(("%s(%p): cannot bind all transports to port %u, trying %u\n",
                __func__, (void *)mr, old, port));
   }
 
@@ -1728,20 +1728,20 @@ int bind6only_check(tport_master_t *mr)
 
   s4 = su_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
   s6 = su_socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
-  
+
   memset(su, 0, sizeof *su);
   su->su_len = sulen = (sizeof su->su_sin6);
   su->su_family = AF_INET6;
-  
+
   memset(su4, 0, sizeof *su4);
   su4->su_len = su4len = (sizeof su->su_sin);
   su4->su_family = AF_INET;
-  
+
   if (bind(s6, &su->su_sa, sulen) < 0)
     ;
   else if (getsockname(s6, &su->su_sa, &sulen) < 0)
     ;
-  else if ((su4->su_port = su->su_port) != 0 && 
+  else if ((su4->su_port = su->su_port) != 0 &&
           bind(s4, &su4->su_sa, su4len) == 0)
     retval = 1;
 
@@ -1757,14 +1757,14 @@ int bind6only_check(tport_master_t *mr)
 /* Number of supported transports */
 #define TPORT_N (8)
 
-/** Return list of addrinfo structures matching to 
+/** Return list of addrinfo structures matching to
  * canon/host/service/protocol
  */
 static
 int tport_server_addrinfo(tport_master_t *mr,
                          char const *canon,
                          int family,
-                         char const *host, 
+                         char const *host,
                          char const *service,
                          char const *protocol,
                          char const * const transports[],
@@ -1775,13 +1775,13 @@ int tport_server_addrinfo(tport_master_t *mr,
 
   *return_addrinfo = NULL;
 
-  /* 
+  /*
    * Resolve all the transports requested by the protocol
    */
   for (i = 0, N = 0; transports[i] && N < TPORT_N; i++) {
     su_addrinfo_t *ai = &hints[N];
 
-    if (strcasecmp(transports[i], protocol) != 0 && 
+    if (strcasecmp(transports[i], protocol) != 0 &&
        strcmp(protocol, tpn_any) != 0)
       continue;
 
@@ -1795,7 +1795,7 @@ int tport_server_addrinfo(tport_master_t *mr,
 
   if (N == 0)
     return su_seterrno(EPROTONOSUPPORT);
-  if (transports[i] /* Too many protocols */) 
+  if (transports[i] /* Too many protocols */)
     return su_seterrno(ENOMEM);
 
   hints[N - 1].ai_next = NULL;
@@ -1803,7 +1803,7 @@ int tport_server_addrinfo(tport_master_t *mr,
   if (host) {
     int error = tport_getaddrinfo(host, service, hints, return_addrinfo);
     if (error || !*return_addrinfo) {
-      SU_DEBUG_3(("%s(%p): su_getaddrinfo(%s, %s) for %s: %s\n", 
+      SU_DEBUG_3(("%s(%p): su_getaddrinfo(%s, %s) for %s: %s\n",
                  __func__, (void *)mr,
                  host ? host : "\"\"", service, protocol,
                  su_gai_strerror(error)));
@@ -1818,7 +1818,7 @@ int tport_server_addrinfo(tport_master_t *mr,
 /** Convert localinfo into addrinfo */
 static
 int
-tport_get_local_addrinfo(tport_master_t *mr, 
+tport_get_local_addrinfo(tport_master_t *mr,
                         char const *port,
                         su_addrinfo_t const *hints,
                         su_addrinfo_t **return_ai)
@@ -1855,14 +1855,14 @@ tport_get_local_addrinfo(tport_master_t *mr,
   error = su_getlocalinfo(lihints, &li_result);
   if (error) {
 #if SU_HAVE_IN6
-    SU_DEBUG_3(("%s(%p): su_getlocalinfo() for %s address: %s\n", 
-               __func__, (void *)mr, 
-               family == AF_INET6 ? "ip6" 
+    SU_DEBUG_3(("%s(%p): su_getlocalinfo() for %s address: %s\n",
+               __func__, (void *)mr,
+               family == AF_INET6 ? "ip6"
                : family == AF_INET ? "ip4" : "ip",
                su_gli_strerror(error)));
 #else
-    SU_DEBUG_3(("%s(%p): su_getlocalinfo() for %s address: %s\n", 
-               __func__, (void *)mr, 
+    SU_DEBUG_3(("%s(%p): su_getlocalinfo() for %s address: %s\n",
+               __func__, (void *)mr,
                family == AF_INET ? "ip4" : "ip",
                su_gli_strerror(error)));
 #endif
@@ -1878,7 +1878,7 @@ tport_get_local_addrinfo(tport_master_t *mr,
       ai = calloc(1, sizeof *ai + li->li_addrlen);
       if (ai == NULL)
        break;
-    
+
       *prev = ai, prev = &ai->ai_next;
 
       ai->ai_flags = AI_PASSIVE | TP_AI_ANY;
@@ -1886,7 +1886,7 @@ tport_get_local_addrinfo(tport_master_t *mr,
       ai->ai_socktype = h->ai_socktype;
       ai->ai_protocol = h->ai_protocol;
       ai->ai_canonname = h->ai_canonname;
-      ai->ai_addr = memcpy(ai + 1, li->li_addr, 
+      ai->ai_addr = memcpy(ai + 1, li->li_addr,
                           ai->ai_addrlen = li->li_addrlen);
       su = (void *)ai->ai_addr;
       su->su_port = htons(lport);
@@ -1924,7 +1924,7 @@ int tport_getaddrinfo(char const *node, char const *service,
   int error = EAI_SOCKTYPE;
   int i, N;
   su_addrinfo_t *all[TPORT_N + 1]; /* Lists for all supported transports */
-  su_addrinfo_t *results[TPORT_N + 1]; 
+  su_addrinfo_t *results[TPORT_N + 1];
   void *addr;
   int addrlen;
 
@@ -1938,7 +1938,7 @@ int tport_getaddrinfo(char const *node, char const *service,
     error = su_getaddrinfo(node, service, h, &all[N]);
     results[N] = all[N];
     if (error == EAI_SOCKTYPE) {
-      SU_DEBUG_7(("%s(): su_getaddrinfo(%s, %s) for %s: %s\n", 
+      SU_DEBUG_7(("%s(): su_getaddrinfo(%s, %s) for %s: %s\n",
                  __func__, node ? node : "\"\"", service,
                  h0->ai_canonname, su_gai_strerror(error)));
       continue;
@@ -1979,22 +1979,22 @@ int tport_getaddrinfo(char const *node, char const *service,
 
        if (memcmp(addr, a, addrlen)) /* Different address */
          break;
-       
+
        results[i] = ai0->ai_next;
 
        ai = calloc(1, sizeof *ai + ai0->ai_addrlen);
-       if (ai == NULL) 
+       if (ai == NULL)
          goto error;
        *prev = memcpy(ai, ai0, sizeof *ai); prev = &ai->ai_next; *prev = NULL;
        ai->ai_addr = memcpy(ai + 1, ai0->ai_addr, ai0->ai_addrlen);
        ai->ai_canonname = h0->ai_canonname;
       }
     }
-  }    
+  }
 
   for (i = 0; i < N; i++)
     su_freeaddrinfo(all[i]);
-  
+
   *res = tbf;
   return 0;
 
@@ -2052,8 +2052,8 @@ int tport_addrinfo_copy(su_addrinfo_t *dst, void *addr, socklen_t addrlen,
   return 0;
 }
 
-/** Close a transport. 
- * 
+/** Close a transport.
+ *
  * Close the socket associated with a transport object. Report an error to
  * all pending clients, if required. Set/reset timer, too.
  */
@@ -2097,7 +2097,7 @@ void tport_close(tport_t *self)
        msg_ref_destroy(self->tp_queue[i]), self->tp_queue[i] = NULL;
     }
   }
-  
+
   self->tp_index = 0;
   self->tp_events = 0;
 }
@@ -2181,7 +2181,7 @@ static void tport_secondary_timer(su_root_magic_t *magic,
     tport_base_timer(self, now);
 }
 
-/** Base timer for secondary transports.  
+/** Base timer for secondary transports.
  *
  * Closes and zaps unused transports.  Sets the timer again.
  */
@@ -2190,8 +2190,8 @@ void tport_base_timer(tport_t *self, su_time_t now)
   unsigned timeout = self->tp_params->tpp_idle;
 
   if (timeout != UINT_MAX) {
-    if (self->tp_refs == 0 && 
-       self->tp_msg == NULL && 
+    if (self->tp_refs == 0 &&
+       self->tp_msg == NULL &&
        !tport_has_queued(self) &&
        su_time_cmp(su_time_add(self->tp_rtime, timeout), now) < 0 &&
        su_time_cmp(su_time_add(self->tp_stime, timeout), now) < 0) {
@@ -2208,7 +2208,7 @@ void tport_base_timer(tport_t *self, su_time_t now)
   tport_set_secondary_timer(self);
 }
 
-/** Set timer for a secondary transport. 
+/** Set timer for a secondary transport.
  *
  * This function should be called after any network activity:
  * tport_base_connect(), tport_send_msg(), tport_send_queue(),
@@ -2239,7 +2239,7 @@ int tport_set_secondary_timer(tport_t *self)
   }
 
   if (self->tp_params->tpp_idle != UINT_MAX) {
-    if (self->tp_refs == 0 && 
+    if (self->tp_refs == 0 &&
        self->tp_msg == NULL && !tport_has_queued(self)) {
       if (su_time_cmp(self->tp_stime, self->tp_rtime) < 0) {
        target = su_time_add(self->tp_rtime, self->tp_params->tpp_idle);
@@ -2322,11 +2322,11 @@ int tport_convert_addr(su_home_t *home,
     host = "*";
   else if (!SU_SOCKADDR_INADDR_ANY(su))
     host = tport_hostport(buf, sizeof(buf), su, 0);
-  else if (canonlen && su->su_family == AF_INET && 
+  else if (canonlen && su->su_family == AF_INET &&
           strspn(canon, "0123456789.") == canonlen)
     host = canon;
 #if SU_HAVE_IN6
-  else if (canonlen && su->su_family == AF_INET6 && 
+  else if (canonlen && su->su_family == AF_INET6 &&
           strspn(canon, "0123456789abcdefABCDEF:.") == canonlen)
     host = canon;
 #endif
@@ -2340,7 +2340,7 @@ int tport_convert_addr(su_home_t *home,
     strcpy(port, "*");
   else
     snprintf(port, sizeof(port), "%u", ntohs(su->su_port));
-  
+
   name->tpn_proto = protoname;
   name->tpn_host = host;
   name->tpn_canon = canon ? canon : host;
@@ -2359,8 +2359,8 @@ int tport_setname(tport_t *self,
 {
   su_addrinfo_t *selfai = self->tp_addrinfo;
 
-  if (tport_convert_addr(self->tp_home, self->tp_name, 
-                        protoname, canon, 
+  if (tport_convert_addr(self->tp_home, self->tp_name,
+                        protoname, canon,
                         (su_sockaddr_t *)ai->ai_addr) < 0)
     return -1;
 
@@ -2369,9 +2369,9 @@ int tport_setname(tport_t *self,
 
   selfai->ai_flags = ai->ai_flags & TP_AI_MASK;
 
-  selfai->ai_family = ai->ai_family;     
-  selfai->ai_socktype = ai->ai_socktype; 
-  selfai->ai_protocol = ai->ai_protocol; 
+  selfai->ai_family = ai->ai_family;
+  selfai->ai_socktype = ai->ai_socktype;
+  selfai->ai_protocol = ai->ai_protocol;
   selfai->ai_canonname = (char *)self->tp_name->tpn_canon;
 
   if (ai->ai_addr) {
@@ -2389,10 +2389,10 @@ int tport_setname(tport_t *self,
  *
  * @param hints hints with the protocol number and socktype [OUT]
  * @param proto protocol name [IN]
- * @param flags hint flags      
+ * @param flags hint flags
  */
 static
-int getprotohints(su_addrinfo_t *hints, 
+int getprotohints(su_addrinfo_t *hints,
                  char const *proto,
                  int flags)
 {
@@ -2406,7 +2406,7 @@ int getprotohints(su_addrinfo_t *hints,
     proto = "tcp";
 #endif
 
-#if HAVE_SCTP  
+#if HAVE_SCTP
   if (strcasecmp(proto, "sctp") == 0) {
     hints->ai_protocol = IPPROTO_SCTP;
     hints->ai_socktype = SOCK_STREAM;
@@ -2419,7 +2419,7 @@ int getprotohints(su_addrinfo_t *hints,
     hints->ai_socktype = SOCK_DGRAM;
     return 0;
   }
-  
+
   if (strcasecmp(proto, "tcp") == 0) {
     hints->ai_protocol = IPPROTO_TCP;
     hints->ai_socktype = SOCK_STREAM;
@@ -2478,7 +2478,7 @@ char *localipname(int pf, char *buf, size_t bufsiz)
   if (li->li_family == AF_INET) {
     if (n >= bufsiz)
       return NULL;
-    
+
     memcpy(buf, li->li_canonname, n + 1);
   }
   else {
@@ -2488,14 +2488,14 @@ char *localipname(int pf, char *buf, size_t bufsiz)
     memcpy(buf + 1, li->li_canonname, n);
     buf[0] = '['; buf[++n] = ']'; buf[++n] = '\0';
   }
-      
+
   su_freelocalinfo(li);
-  
+
   return buf;
 }
 
 /** Process errors from transport. */
-void tport_error_report(tport_t *self, int errcode, 
+void tport_error_report(tport_t *self, int errcode,
                        su_sockaddr_t const *addr)
 {
   char const *errmsg;
@@ -2532,10 +2532,10 @@ void tport_error_report(tport_t *self, int errcode,
   }
   else {
     if (tport_is_primary(self))
-      SU_DEBUG_3(("%s(%p): %s (with %s)\n", __func__, (void *)self, 
+      SU_DEBUG_3(("%s(%p): %s (with %s)\n", __func__, (void *)self,
                  errmsg, self->tp_protoname));
     else
-      SU_DEBUG_3(("%s(%p): %s (with %s/%s:%s)\n", __func__, (void *)self, 
+      SU_DEBUG_3(("%s(%p): %s (with %s/%s:%s)\n", __func__, (void *)self,
                  errmsg, self->tp_protoname, self->tp_host, self->tp_port));
   }
 
@@ -2545,7 +2545,7 @@ void tport_error_report(tport_t *self, int errcode,
 }
 
 /** Accept a new connection.
- * 
+ *
  * The function tport_accept() accepts a new connection and creates a
  * secondary transport object for the new socket.
  */
@@ -2553,7 +2553,7 @@ int tport_accept(tport_primary_t *pri, int events)
 {
   tport_t *self;
   su_addrinfo_t ai[1];
-  su_sockaddr_t su[1]; 
+  su_sockaddr_t su[1];
   socklen_t sulen = sizeof su;
   su_socket_t s = INVALID_SOCKET, l = pri->pri_primary->tp_socket;
   char const *reason = "accept";
@@ -2576,7 +2576,7 @@ int tport_accept(tport_primary_t *pri, int events)
 
   ai->ai_addr = &su->su_sa, ai->ai_addrlen = sulen;
 
-  /* Alloc a new transport object, then register socket events with it */ 
+  /* Alloc a new transport object, then register socket events with it */
   self = tport_alloc_secondary(pri, s, 1, &reason);
 
   if (self) {
@@ -2589,7 +2589,7 @@ int tport_accept(tport_primary_t *pri, int events)
     SU_CANONIZE_SOCKADDR(su);
 
     if (/* Create wait object with appropriate events. */
-       su_wait_create(wait, s, events) != -1 
+       su_wait_create(wait, s, events) != -1
        /* Register socket to root */
        &&
        (i = su_root_register(root, wait, wakeup, self, 0)) != -1) {
@@ -2600,7 +2600,7 @@ int tport_accept(tport_primary_t *pri, int events)
       self->tp_events = events;
 
       if (tport_setname(self, pri->pri_protoname, ai, NULL) != -1) {
-       SU_DEBUG_5(("%s(%p): new connection from " TPN_FORMAT "\n", 
+       SU_DEBUG_5(("%s(%p): new connection from " TPN_FORMAT "\n",
                    __func__,  (void *)self, TPN_ARGS(self->tp_name)));
 
        tprb_append(&pri->pri_open, self);
@@ -2654,7 +2654,7 @@ static int tport_connected(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
   su_wait_t wait[1] =  { SU_WAIT_INIT };
 
   int error;
-  
+
   SU_DEBUG_7(("tport_connected(%p): events%s%s\n", (void *)self,
              events & SU_WAIT_CONNECT ? " CONNECTED" : "",
              events & SU_WAIT_ERR ? " ERR" : ""));
@@ -2683,7 +2683,7 @@ static int tport_connected(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
   self->tp_events = SU_WAIT_IN | SU_WAIT_ERR | SU_WAIT_HUP;
 
   if (su_wait_create(wait, self->tp_socket, self->tp_events) == -1 ||
-      (self->tp_index = su_root_register(mr->mr_root, 
+      (self->tp_index = su_root_register(mr->mr_root,
                                         wait, tport_wakeup, self, 0))
       == -1) {
     tport_close(self);
@@ -2709,10 +2709,10 @@ static int tport_wakeup_pri(su_root_magic_t *m, su_wait_t *w, tport_t *self)
   assert(w->fd == self->tp_socket);
 #endif
 
-  SU_DEBUG_7(("%s(%p): events%s%s%s%s%s%s\n", 
+  SU_DEBUG_7(("%s(%p): events%s%s%s%s%s%s\n",
              "tport_wakeup_pri", (void *)self,
              events & SU_WAIT_IN ? " IN" : "",
-             SU_WAIT_ACCEPT != SU_WAIT_IN && 
+             SU_WAIT_ACCEPT != SU_WAIT_IN &&
              (events & SU_WAIT_ACCEPT) ? " ACCEPT" : "",
              events & SU_WAIT_OUT ? " OUT" : "",
              events & SU_WAIT_HUP ? " HUP" : "",
@@ -2735,7 +2735,7 @@ static int tport_wakeup(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
   assert(w->fd == self->tp_socket);
 #endif
 
-  SU_DEBUG_7(("%s(%p): events%s%s%s%s%s\n", 
+  SU_DEBUG_7(("%s(%p): events%s%s%s%s%s\n",
              "tport_wakeup", (void *)self,
              events & SU_WAIT_IN ? " IN" : "",
              events & SU_WAIT_OUT ? " OUT" : "",
@@ -2761,7 +2761,7 @@ static int tport_base_wakeup(tport_t *self, int events)
 
   if ((events & SU_WAIT_IN) && !self->tp_closed)
     tport_recv_event(self);
-  
+
   if ((events & SU_WAIT_HUP) && !self->tp_closed)
     tport_hup_event(self);
 
@@ -2813,7 +2813,7 @@ void tport_hup_event(tport_t *self)
 /** Receive data available on the socket.
  *
  * @retval -1 error
- * @retval 0  end-of-stream  
+ * @retval 0  end-of-stream
  * @retval 1  normal receive
  * @retval 2  incomplete recv, recv again
  * @retval 3  STUN keepalive, ignore
@@ -2830,7 +2830,7 @@ int tport_recv_data(tport_t *self)
 void tport_recv_event(tport_t *self)
 {
   int again;
-  
+
   SU_DEBUG_7(("%s(%p)\n", "tport_recv_event", (void *)self));
 
   do {
@@ -2850,16 +2850,16 @@ void tport_recv_event(tport_t *self)
       if (!su_is_blocking(error)) {
        tport_error_report(self, error, NULL);
        return;
-      } 
+      }
       else {
-       SU_DEBUG_3(("%s: recvfrom(): %s (%d)\n", __func__, 
+       SU_DEBUG_3(("%s: recvfrom(): %s (%d)\n", __func__,
                    su_strerror(EAGAIN), EAGAIN));
       }
     }
 
     if (again >= 0)
       tport_parse(self, !again, self->tp_rtime);
-  } 
+  }
   while (again > 1);
 
   if (!tport_is_secondary(self))
@@ -2876,8 +2876,8 @@ void tport_recv_event(tport_t *self)
   tport_set_secondary_timer(self);
 }
 
-/* 
- * Parse the data and feed complete messages to the stack 
+/*
+ * Parse the data and feed complete messages to the stack
  */
 static void tport_parse(tport_t *self, int complete, su_time_t now)
 {
@@ -2896,17 +2896,17 @@ static void tport_parse(tport_t *self, int complete, su_time_t now)
        tport_sigcomp_accept_incomplete(self, msg);
        break;
       }
-    } 
+    }
 
     if (msg_get_flags(msg, MSG_FLG_TOOLARGE))
       SU_DEBUG_3(("%s(%p): too large message from " TPN_FORMAT "\n",
                  __func__, (void *)self, TPN_ARGS(self->tp_name)));
 
     /* Do not try to read anymore from this connection? */
-    if (tport_is_stream(self) && 
+    if (tport_is_stream(self) &&
        msg_get_flags(msg, MSG_FLG_TOOLARGE | MSG_FLG_ERROR))
       self->tp_recv_close = stall = 1;
-    
+
     if (n == -1)
       next = NULL;
     else if (streaming)
@@ -2927,7 +2927,7 @@ static void tport_parse(tport_t *self, int complete, su_time_t now)
 
   if (self->tp_rlogged != msg)
     self->tp_rlogged = NULL;
-  
+
   self->tp_msg = msg;
 }
 
@@ -2968,7 +2968,7 @@ void tport_deliver(tport_t *self,
 #endif
 
     d->d_from->tpn_canon = ipaddr;
-    d->d_from->tpn_host = ipaddr;    
+    d->d_from->tpn_host = ipaddr;
   }
 
   d->d_comp = sc;
@@ -2987,7 +2987,7 @@ void tport_deliver(tport_t *self,
   }
 
   SU_DEBUG_7(("%s(%p): %smsg %p ("MOD_ZU" bytes)"
-             " from " TPN_FORMAT " next=%p\n", 
+             " from " TPN_FORMAT " next=%p\n",
              __func__, (void *)self, error ? "bad " : "",
              (void *)msg, (size_t)msg_size(msg),
              TPN_ARGS(d->d_from), (void *)next));
@@ -3028,7 +3028,7 @@ int tport_delivered_from(tport_t *tp, msg_t const *msg, tp_name_t name[1])
 {
   if (name == NULL)
     return -1;
-  
+
   if (tp == NULL || msg == NULL || msg != tp->tp_master->mr_delivery->d_msg) {
     memset(name, 0, sizeof *name);
     return -1;
@@ -3054,12 +3054,12 @@ tport_delivered_with_comp(tport_t *tp, msg_t const *msg,
 }
 
 /** Allocate message for N bytes,
- *  return message buffer as a iovec 
+ *  return message buffer as a iovec
  */
-ssize_t tport_recv_iovec(tport_t const *self, 
+ssize_t tport_recv_iovec(tport_t const *self,
                         msg_t **in_out_msg,
                         msg_iovec_t iovec[msg_n_fragments],
-                        size_t N, 
+                        size_t N,
                         int exact)
 {
   msg_t *msg = *in_out_msg;
@@ -3072,13 +3072,13 @@ ssize_t tport_recv_iovec(tport_t const *self,
   fresh = !msg;
 
   /*
-   * Allocate a new message if needed 
+   * Allocate a new message if needed
    */
   if (!msg) {
     if (!(*in_out_msg = msg = tport_msg_alloc(self, N))) {
       SU_DEBUG_7(("%s(%p): cannot allocate msg for "MOD_ZU" bytes "
-                 "from (%s/%s:%s)\n", 
-                 __func__, (void *)self, N, 
+                 "from (%s/%s:%s)\n",
+                 __func__, (void *)self, N,
                  self->tp_protoname, self->tp_host, self->tp_port));
       return -1;
     }
@@ -3096,8 +3096,8 @@ ssize_t tport_recv_iovec(tport_t const *self,
   if (veclen < 0) {
     int err = su_errno();
     SU_DEBUG_7(("%s(%p): cannot get msg %p buffer for "MOD_ZU" bytes "
-               "from (%s/%s:%s): %s\n", 
-               __func__, (void *)self, (void *)msg, N, 
+               "from (%s/%s:%s): %s\n",
+               __func__, (void *)self, (void *)msg, N,
                self->tp_protoname, self->tp_host, self->tp_port,
                su_strerror(err)));
     su_seterrno(err);
@@ -3108,8 +3108,8 @@ ssize_t tport_recv_iovec(tport_t const *self,
 
   SU_DEBUG_7(("%s(%p) msg %p from (%s/%s:%s) has "MOD_ZU" bytes, "
              "veclen = "MOD_ZD"\n",
-              __func__, (void *)self, 
-             (void *)msg, self->tp_protoname, self->tp_host, self->tp_port, 
+              __func__, (void *)self,
+             (void *)msg, self->tp_protoname, self->tp_host, self->tp_port,
              N, veclen));
 
   for (i = 0; veclen > 1 && i < veclen; i++) {
@@ -3130,20 +3130,20 @@ int tport_recv_error_report(tport_t *self)
   return -1;
 }
 
-/** Send a message. 
+/** Send a message.
  *
  * The function tport_tsend() sends a message using the transport @a self.
  *
  * @TAGS
- * TPTAG_MTU(), TPTAG_REUSE(), TPTAG_CLOSE_AFTER(), TPTAG_SDWN_AFTER(), 
+ * TPTAG_MTU(), TPTAG_REUSE(), TPTAG_CLOSE_AFTER(), TPTAG_SDWN_AFTER(),
  * TPTAG_FRESH(), TPTAG_COMPARTMENT().
  */
-tport_t *tport_tsend(tport_t *self, 
-                    msg_t *msg, 
-                    tp_name_t const *_tpn, 
+tport_t *tport_tsend(tport_t *self,
+                    msg_t *msg,
+                    tp_name_t const *_tpn,
                     tag_type_t tag, tag_value_t value, ...)
 {
-  ta_list ta; 
+  ta_list ta;
   tagi_t const *t;
   int reuse, sdwn_after, close_after, resolved = 0, fresh;
   unsigned mtu;
@@ -3160,7 +3160,7 @@ tport_t *tport_tsend(tport_t *self,
   }
 
   *tpn = *_tpn;
-  
+
   SU_DEBUG_7(("tport_tsend(%p) tpn = " TPN_FORMAT "\n",
              (void *)self, TPN_ARGS(tpn)));
 
@@ -3186,8 +3186,8 @@ tport_t *tport_tsend(tport_t *self,
 
   /* tl_gets() is a bit too slow here... */
   for (t = ta_args(ta); t; t = tl_next(t)) {
-    tag_type_t tt = t->t_tag; 
-    
+    tag_type_t tt = t->t_tag;
+
     if (tptag_reuse == tt)
       reuse = t->t_value != 0;
     else if (tptag_mtu == tt)
@@ -3200,7 +3200,7 @@ tport_t *tport_tsend(tport_t *self,
       fresh = t->t_value != 0;
     else if (tptag_compartment == tt)
       cc = (struct sigcomp_compartment *)t->t_value;
-  }    
+  }
 
   ta_end(ta);
 
@@ -3213,9 +3213,9 @@ tport_t *tport_tsend(tport_t *self,
   tpn->tpn_comp = tport_canonize_comp(tpn->tpn_comp);
   if (tpn->tpn_comp) {
     ai->ai_flags |= TP_AI_COMPRESSED;
-    SU_DEBUG_9(("%s: compressed msg(%p) with %s\n", 
+    SU_DEBUG_9(("%s: compressed msg(%p) with %s\n",
                __func__, (void *)msg, tpn->tpn_comp));
-  } 
+  }
 
   if (!tpn->tpn_comp || cc == NONE)
     cc = NULL;
@@ -3233,8 +3233,8 @@ tport_t *tport_tsend(tport_t *self,
     self = self;
   }
   /*
-   * Try to find an already open connection to the destination, 
-   * or get a primary protocol 
+   * Try to find an already open connection to the destination,
+   * or get a primary protocol
    */
   else {
     /* If primary, resolve the destination address, store it in the msg */
@@ -3242,7 +3242,7 @@ tport_t *tport_tsend(tport_t *self,
       return NULL;
     }
     resolved = 1;
-    
+
     self = tport_by_addrinfo(primary, msg_addrinfo(msg), tpn);
 
     if (!self)
@@ -3258,7 +3258,7 @@ tport_t *tport_tsend(tport_t *self,
     if (tport_is_connection_oriented(self)
        || self->tp_params->tpp_conn_orient) {
 #if 0 && HAVE_UPNP /* We do not want to use UPnP with secondary transports! */
-      if (upnp_register_upnp_client(1) != 0) { 
+      if (upnp_register_upnp_client(1) != 0) {
        upnp_check_for_nat();
       }
 #endif
@@ -3300,15 +3300,15 @@ tport_t *tport_tsend(tport_t *self,
   }
 
   if (self->tp_pri->pri_vtable->vtp_prepare
-      ? self->tp_pri->pri_vtable->vtp_prepare(self, msg, tpn, cc, mtu) < 0 
+      ? self->tp_pri->pri_vtable->vtp_prepare(self, msg, tpn, cc, mtu) < 0
       : tport_prepare_and_send(self, msg, tpn, cc, mtu) < 0)
     return NULL;
   else
     return self;
 }
 
-int tport_prepare_and_send(tport_t *self, msg_t *msg, 
-                          tp_name_t const *tpn, 
+int tport_prepare_and_send(tport_t *self, msg_t *msg,
+                          tp_name_t const *tpn,
                           struct sigcomp_compartment *cc,
                           unsigned mtu)
 {
@@ -3326,7 +3326,7 @@ int tport_prepare_and_send(tport_t *self, msg_t *msg,
   }
 
   /*
-   * If there is already an queued message, 
+   * If there is already an queued message,
    * put this message straight in the queue
    */
   if ((self->tp_queue && self->tp_queue[self->tp_qhead]) ||
@@ -3338,7 +3338,7 @@ int tport_prepare_and_send(tport_t *self, msg_t *msg,
     }
     return 0;
   }
-  
+
   retval = tport_send_msg(self, msg, tpn, cc);
 
   tport_set_secondary_timer(self);
@@ -3352,8 +3352,8 @@ int tport_prepare_and_send(tport_t *self, msg_t *msg,
  * @retval 0 when succesful
  * @retval -1 upon an error
  */
-int tport_send_msg(tport_t *self, msg_t *msg, 
-                  tp_name_t const *tpn, 
+int tport_send_msg(tport_t *self, msg_t *msg,
+                  tp_name_t const *tpn,
                   struct sigcomp_compartment *cc)
 {
   msg_iovec_t *iov, auto_iov[40];
@@ -3364,7 +3364,7 @@ int tport_send_msg(tport_t *self, msg_t *msg,
   su_time_t now;
   su_addrinfo_t *ai;
 
-  assert(self->tp_queue == NULL || 
+  assert(self->tp_queue == NULL ||
         self->tp_queue[self->tp_qhead] == NULL ||
         self->tp_queue[self->tp_qhead] == msg);
 
@@ -3378,7 +3378,7 @@ int tport_send_msg(tport_t *self, msg_t *msg,
   /* Get a iovec for message contents */
   for (;;) {
     iovused = msg_iovec(msg, iov, iovlen);
-    if (iovused <= iovlen) 
+    if (iovused <= iovlen)
       break;
 
     iov = su_realloc(self->tp_home, self->tp_iov, sizeof(*iov) * iovused);
@@ -3387,7 +3387,7 @@ int tport_send_msg(tport_t *self, msg_t *msg,
       msg_set_errno(msg, errno);
       return -1;
     }
-    
+
     self->tp_iov = iov, self->tp_iovlen = iovlen = iovused;
   }
 
@@ -3404,7 +3404,7 @@ int tport_send_msg(tport_t *self, msg_t *msg,
   n = (size_t)nerror;
 
   self->tp_unsent = NULL, self->tp_unsentlen = 0;
-  
+
   if (n > 0 && self->tp_master->mr_log && self->tp_slogged != msg) {
     tport_log_msg(self, msg, "send", "to", now);
     self->tp_slogged = msg;
@@ -3422,8 +3422,8 @@ int tport_send_msg(tport_t *self, msg_t *msg,
       }
       else {
        char const *comp = tpn->tpn_comp;
-       
-       SU_DEBUG_1(("%s(%p): send truncated for %s/%s:%s%s%s\n", 
+
+       SU_DEBUG_1(("%s(%p): send truncated for %s/%s:%s%s%s\n",
                    "tport_vsend", (void *)self, tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port,
                    comp ? ";comp=" : "", comp ? comp : ""));
 
@@ -3448,18 +3448,18 @@ int tport_send_msg(tport_t *self, msg_t *msg,
 
   if (close_after || sdwn_after)
     tport_shutdown0(self, close_after ? 2 : 1);
-  
+
   return 0;
 }
 
-static 
-ssize_t tport_vsend(tport_t *self, 
-                   msg_t *msg, 
+static
+ssize_t tport_vsend(tport_t *self,
+                   msg_t *msg,
                    tp_name_t const *tpn,
-                   msg_iovec_t iov[], 
+                   msg_iovec_t iov[],
                    size_t iovused,
                    struct sigcomp_compartment *cc)
-{ 
+{
   ssize_t n;
   su_addrinfo_t *ai = msg_addrinfo(msg);
 
@@ -3474,14 +3474,14 @@ ssize_t tport_vsend(tport_t *self,
   if (n == 0)
     return 0;
 
-  if (n == -1) 
+  if (n == -1)
     return tport_send_error(self, msg, tpn, "tport_vsend");
 
   tport_sent_bytes(self, n, n);        /* Sigcomp will decrease on_line accodingly */
 
   if (n > 0 && self->tp_master->mr_dump_file)
     tport_dump_iovec(self, msg, n, iov, iovused, "sent", "to");
-    
+
   if (tport_log->log_level >= 7) {
     size_t i, m = 0;
 
@@ -3513,8 +3513,8 @@ int tport_send_error(tport_t *self, msg_t *msg, tp_name_t const *tpn,
   if (su_is_blocking(error)) {
     su_addrinfo_t *ai = msg_addrinfo(msg);
     char const *comp = (ai->ai_flags & TP_AI_COMPRESSED) ? ";comp=sigcomp" : "";
-    SU_DEBUG_5(("%s(%p): %s with (s=%d %s/%s:%s%s)\n", 
-               who, (void *)self, "EAGAIN", (int)self->tp_socket, 
+    SU_DEBUG_5(("%s(%p): %s with (s=%d %s/%s:%s%s)\n",
+               who, (void *)self, "EAGAIN", (int)self->tp_socket,
                tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port, comp));
     return 0;
   }
@@ -3532,10 +3532,10 @@ int tport_send_fatal(tport_t *self, msg_t *msg, tp_name_t const *tpn,
   char const *comp = (ai->ai_flags & TP_AI_COMPRESSED) ? ";comp=sigcomp" : "";
 
   int error = msg_errno(msg);
-  
+
   if (self->tp_addrinfo->ai_family == AF_INET) {
-    SU_DEBUG_3(("%s(%p): %s with (s=%d %s/%s:%s%s)\n", 
-               who, (void *)self, su_strerror(error), (int)self->tp_socket, 
+    SU_DEBUG_3(("%s(%p): %s with (s=%d %s/%s:%s%s)\n",
+               who, (void *)self, su_strerror(error), (int)self->tp_socket,
                tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port, comp));
   }
 #if SU_HAVE_IN6
@@ -3543,21 +3543,21 @@ int tport_send_fatal(tport_t *self, msg_t *msg, tp_name_t const *tpn,
     su_sockaddr_t const *su = (su_sockaddr_t const *)ai->ai_addr;
     SU_DEBUG_3(("%s(%p): %s with (s=%d, IP6=%s/%s:%s%s"
                " (scope=%i) addrlen=%u)\n",
-               who, (void *)self, su_strerror(error), (int)self->tp_socket, 
+               who, (void *)self, su_strerror(error), (int)self->tp_socket,
                tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port, comp,
                su->su_scope_id, (unsigned)ai->ai_addrlen));
   }
 #endif
   else {
-    SU_DEBUG_3(("%s(%p): %s with (s=%d, AF=%u addrlen=%u)%s\n", 
-               who, (void *)self, su_strerror(error), 
+    SU_DEBUG_3(("%s(%p): %s with (s=%d, AF=%u addrlen=%u)%s\n",
+               who, (void *)self, su_strerror(error),
                (int)self->tp_socket, ai->ai_family, (unsigned)ai->ai_addrlen, comp));
   }
 
 #if 0
   int i;
   for (i = 0; i < iovused; i++)
-    SU_DEBUG_7(("\t\tiov[%d] = { %d bytes @ %p }\n", 
+    SU_DEBUG_7(("\t\tiov[%d] = { %d bytes @ %p }\n",
                i, iov[i].siv_len, (void *)iov[i].siv_base));
 #endif
 
@@ -3572,16 +3572,16 @@ int tport_send_fatal(tport_t *self, msg_t *msg, tp_name_t const *tpn,
 
 
 static
-int tport_queue_rest(tport_t *self, 
-                    msg_t *msg, 
-                    msg_iovec_t iov[], 
+int tport_queue_rest(tport_t *self,
+                    msg_t *msg,
+                    msg_iovec_t iov[],
                     size_t iovused)
 {
   size_t iovlen = self->tp_iovlen;
 
   assert(tport_is_connection_oriented(self));
-  assert(self->tp_queue == NULL || 
-        self->tp_queue[self->tp_qhead] == NULL || 
+  assert(self->tp_queue == NULL ||
+        self->tp_queue[self->tp_qhead] == NULL ||
         self->tp_queue[self->tp_qhead] == msg);
 
   if (tport_queue(self, msg) < 0)
@@ -3618,19 +3618,19 @@ int tport_queue_rest(tport_t *self,
   return 0;
 }
 
-/** Queue a message to transport. 
+/** Queue a message to transport.
  *
  * The tport_tqueue() function queues a message in the send queue. It is
  * used by an (server) application that is required to send (response)
  * messages in certain order. For example, a HTTP server or proxy may
  * receive multiple requests from a single TCP connection. The server is
- * required to answer to the requests in same order as they are received. 
+ * required to answer to the requests in same order as they are received.
  * The responses are, however, sometimes generated asynchronously, that is,
  * a response to a later request may be ready earlier. For that purpose, the
  * HTTP protocol stack queues an empty response message immediately upon
  * receiving a request. Other messages cannot be sent before the queued one.
  *
- * The function tport_tqsend() is used to send the completed response message. 
+ * The function tport_tqsend() is used to send the completed response message.
  *
  * @param self pointer to transport object
  * @param msg  message to be inserted into queue
@@ -3651,7 +3651,7 @@ int tport_queue_rest(tport_t *self,
  *
  * @sa tport_tqsend()
  */
-int tport_tqueue(tport_t *self, msg_t *msg, 
+int tport_tqueue(tport_t *self, msg_t *msg,
                 tag_type_t tag, tag_value_t value, ...)
 {
   msg_unprepare(msg);
@@ -3679,8 +3679,8 @@ int tport_queue(tport_t *self, msg_t *msg)
 {
   unsigned short qhead = self->tp_qhead;
   unsigned short N = self->tp_params->tpp_qsize;
-  
-  SU_DEBUG_7(("tport_queue(%p): queueing %p for %s/%s:%s\n", 
+
+  SU_DEBUG_7(("tport_queue(%p): queueing %p for %s/%s:%s\n",
              (void *)self, (void *)msg,
              self->tp_protoname, self->tp_host, self->tp_port));
 
@@ -3711,8 +3711,8 @@ int tport_queue(tport_t *self, msg_t *msg)
 }
 
 /** Send a queued message (and queue another, if required).
- * 
- * The function tport_tqsend() sends a message to the transport. 
+ *
+ * The function tport_tqsend() sends a message to the transport.
  *
  * @deprecated Alternative interface will be provided in near future.
  */
@@ -3787,7 +3787,7 @@ int tport_tqsend(tport_t *self, msg_t *msg, msg_t *next,
       msg_destroy(self->tp_queue[qhead]);
       if ((self->tp_queue[qhead] = msg_ref_create(next)))
        msg_unprepare(next);
-      return 0; 
+      return 0;
     }
   }
 
@@ -3808,7 +3808,7 @@ int tport_tqsend(tport_t *self, msg_t *msg, msg_t *next,
     qhead = (qhead + 1) % N;
     next = self->tp_queue[qhead]; self->tp_queue[qhead] = msg; msg = next;
     /* Above we made sure that there is an empty slot */
-    assert(!next || qhead != self->tp_qhead); 
+    assert(!next || qhead != self->tp_qhead);
   } while (next);
 
   return 0;
@@ -3817,12 +3817,12 @@ int tport_tqsend(tport_t *self, msg_t *msg, msg_t *next,
 /** Send event.
  *
  * Process SU_WAIT_OUT event.
- */ 
+ */
 void tport_send_event(tport_t *self)
 {
   assert(tport_is_connection_oriented(self));
-  
-  SU_DEBUG_7(("tport_send_event(%p) - ready to send to (%s/%s:%s)\n", 
+
+  SU_DEBUG_7(("tport_send_event(%p) - ready to send to (%s/%s:%s)\n",
              (void *)self, self->tp_protoname, self->tp_host, self->tp_port));
   tport_send_queue(self);
   tport_set_secondary_timer(self);
@@ -3859,7 +3859,7 @@ void tport_send_queue(tport_t *self)
       tport_log_msg(self, msg, "send", "to", self->tp_stime);
       self->tp_slogged = msg;
     }
-    
+
     for (i = 0, total = 0; i < iovused; i++) {
       if (total + (size_t)iov[i].mv_len > n) {
        iov[i].mv_len -= (su_ioveclen_t)(n - total);
@@ -3875,7 +3875,7 @@ void tport_send_queue(tport_t *self)
     assert(total == n);
 
     /* We have sent a complete message */
-    
+
     self->tp_queue[qhead] = NULL;
     tport_sent_message(self, msg, 0);
     msg_destroy(msg);
@@ -3885,7 +3885,7 @@ void tport_send_queue(tport_t *self)
 
   while (msg_is_prepared(msg = self->tp_queue[self->tp_qhead = qhead])) {
     /* XXX - what about errors? */
-    tport_send_msg(self, msg, self->tp_name, NULL); 
+    tport_send_msg(self, msg, self->tp_name, NULL);
     if (self->tp_unsent)
       return;
 
@@ -3917,7 +3917,7 @@ tport_resolve(tport_t *self, msg_t *msg, tp_name_t const *tpn)
   if (host_is_ip_address(tpn->tpn_host))
     hints->ai_flags |= AI_NUMERICHOST;
 #endif
-  
+
   if (tpn->tpn_host[0] == '[') {
     /* Remove [] around IPv6 address */
     char *end;
@@ -3934,7 +3934,7 @@ tport_resolve(tport_t *self, msg_t *msg, tp_name_t const *tpn)
       return -1;
     }
   }
-  else 
+  else
     host = tpn->tpn_host;
 
   if ((error = su_getaddrinfo(host, tpn->tpn_port, hints, &res))) {
@@ -3950,13 +3950,13 @@ tport_resolve(tport_t *self, msg_t *msg, tp_name_t const *tpn)
   su = (su_sockaddr_t *) msg_addrinfo(msg)->ai_addr;
 
 #if SU_HAVE_IN6
-  SU_DEBUG_9(("tport_resolve addrinfo = %s%s%s:%d\n", 
+  SU_DEBUG_9(("tport_resolve addrinfo = %s%s%s:%d\n",
              su->su_family == AF_INET6 ? "[" : "",
               su_inet_ntop(su->su_family, SU_ADDR(su), ipaddr, sizeof(ipaddr)),
              su->su_family == AF_INET6 ? "]" : "",
               htons(su->su_port)));
 #else
-  SU_DEBUG_9(("tport_resolve addrinfo = %s%s%s:%d\n", 
+  SU_DEBUG_9(("tport_resolve addrinfo = %s%s%s:%d\n",
              "",
               su_inet_ntop(su->su_family, SU_ADDR(su), ipaddr, sizeof(ipaddr)),
              "",
@@ -4003,7 +4003,7 @@ msg_select_addrinfo(msg_t *msg, su_addrinfo_t *res)
   }
 
   msg_set_errno(msg, EAFNOSUPPORT);
-   
+
   return -1;
 }
 
@@ -4021,7 +4021,7 @@ tport_peer_address(tport_t *self, msg_t *msg)
   mai->ai_flags = flags;
 }
 
-/** Process error event. 
+/** Process error event.
  *
  * Return events that can be processed afterwards.
  */
@@ -4052,9 +4052,9 @@ int tport_error_event(tport_t *self)
  *
  * @return Positive integer, or -1 upon an error.
  */
-int tport_pend(tport_t *self, 
-              msg_t *msg, 
-              tport_pending_error_f *callback, 
+int tport_pend(tport_t *self,
+              msg_t *msg,
+              tport_pending_error_f *callback,
               tp_client_t *client)
 {
   tport_pending_t *pending;
@@ -4065,8 +4065,8 @@ int tport_pend(tport_t *self,
   if (msg == NULL && tport_is_primary(self))
     return -1;
 
-  SU_DEBUG_7(("tport_pend(%p): pending %p for %s/%s:%s (already %u)\n", 
-             (void *)self, (void *)msg, 
+  SU_DEBUG_7(("tport_pend(%p): pending %p for %s/%s:%s (already %u)\n",
+             (void *)self, (void *)msg,
              self->tp_protoname, self->tp_host, self->tp_port,
              self->tp_pused));
 
@@ -4074,7 +4074,7 @@ int tport_pend(tport_t *self,
     unsigned i, len = 8;
     if (self->tp_plen)
       len = 2 * self->tp_plen;
-    pending = su_realloc(self->tp_home, 
+    pending = su_realloc(self->tp_home,
                         self->tp_pending, len * sizeof(*pending));
     if (!pending) {
       msg_set_errno(msg, errno);
@@ -4085,7 +4085,7 @@ int tport_pend(tport_t *self,
 
     for (i = self->tp_plen; i + 1 < len; i++)
       pending[i].p_client = pending + i + 1;
-      
+
     self->tp_released = pending + self->tp_plen;
     self->tp_pending = pending;
     self->tp_plen = len;
@@ -4105,11 +4105,11 @@ int tport_pend(tport_t *self,
 }
 
 /** Mark message as no more pending */
-int tport_release(tport_t *self, 
+int tport_release(tport_t *self,
                  int pendd,
-                 msg_t *msg, 
-                 msg_t *reply, 
-                 tp_client_t *client, 
+                 msg_t *msg,
+                 msg_t *reply,
+                 tp_client_t *client,
                  int still_pending)
 {
   tport_pending_t *pending;
@@ -4119,14 +4119,14 @@ int tport_release(tport_t *self,
 
   pending = self->tp_pending + (pendd - 1);
 
-  if (pending->p_client != client || 
+  if (pending->p_client != client ||
       pending->p_msg != msg) {
          SU_DEBUG_1(("%s(%p): %u %p by %p not pending\n",
-                     __func__, (void *)self, 
+                     __func__, (void *)self,
                      pendd, (void *)msg, (void *)client));
     return su_seterrno(EINVAL), -1;
   }
-  
+
   SU_DEBUG_7(("%s(%p): %p by %p with %p%s\n",
              __func__, (void *)self,
              (void *)msg, (void *)client, (void *)reply,
@@ -4136,7 +4136,7 @@ int tport_release(tport_t *self,
 
   if (still_pending)
     return 0;
-           
+
   /* Just to make sure nobody uses stale data */
   memset(pending, 0, sizeof(*pending));
   pending->p_client = self->tp_released;
@@ -4213,11 +4213,11 @@ tport_pending_errmsg(tport_t *self, msg_t *msg, int error)
   for (i = 0; i < self->tp_plen; i++) {
     pending = self->tp_pending + i;
 
-    if (!pending->p_client || 
+    if (!pending->p_client ||
        pending->p_msg != msg ||
        pending->p_reported == reported)
       continue;
-    
+
     pending->p_reported = reported;
 
     pending->p_callback(self->TP_STACK, pending->p_client, self, msg, error);
@@ -4299,14 +4299,14 @@ tp_name_t const *tport_name(tport_t const *self)
   return self->tp_name;
 }
 
-/** Get transport identifier. */ 
+/** Get transport identifier. */
 char const *tport_ident(tport_t const *self)
 {
   return self ? self->tp_ident : NULL;
 }
 
 /** Get transport by protocol name. */
-tport_t *tport_by_protocol(tport_t const *self, char const *proto) 
+tport_t *tport_by_protocol(tport_t const *self, char const *proto)
 {
   if (proto && strcmp(proto, tpn_any) != 0) {
     for (; self; self = tport_next(self))
@@ -4340,7 +4340,7 @@ tport_t *tport_primary_by_name(tport_t const *tp, tp_name_t const *tpn)
 #endif
   else if (host_is_ip4_address(tpn->tpn_host))
     family = AF_INET;
-  else 
+  else
     family = 0;
 
   if (proto && strcmp(proto, tpn_any) == 0)
@@ -4366,7 +4366,7 @@ tport_t *tport_primary_by_name(tport_t const *tp, tp_name_t const *tpn)
     }
     if (proto && strcasecmp(proto, tp->tp_protoname))
       continue;
-    
+
     if (comp && comp != tp->tp_name->tpn_comp) {
       if (tp->tp_name->tpn_comp == NULL && nocomp == NULL)
        nocomp = self;
@@ -4436,7 +4436,7 @@ tport_t *tport_by_name(tport_t const *self, tp_name_t const *tpn)
     }
 
     su->su_port = htons(strtoul(port, NULL, 10));
-    
+
     if (su_inet_pton(su->su_family, host, SU_ADDR(su)) > 0) {
       resolved = 1;
       next = NULL;
@@ -4511,7 +4511,7 @@ tport_t *tport_by_name(tport_t const *self, tp_name_t const *tpn)
 }
 
 /** Get transport from primary by addrinfo. */
-tport_t *tport_by_addrinfo(tport_primary_t const *pri, 
+tport_t *tport_by_addrinfo(tport_primary_t const *pri,
                           su_addrinfo_t const *ai,
                           tp_name_t const *tpn)
 {
@@ -4530,7 +4530,7 @@ tport_t *tport_by_addrinfo(tport_primary_t const *pri,
 
   /* Find leftmost (prevmost) matching tport */
   while (sub) {
-    cmp = (int)(sub->tp_addrlen - ai->ai_addrlen); 
+    cmp = (int)(sub->tp_addrlen - ai->ai_addrlen);
     if (cmp == 0)
       cmp = memcmp(sub->tp_addr, sa, ai->ai_addrlen);
 
@@ -4566,8 +4566,8 @@ tport_t *tport_by_addrinfo(tport_primary_t const *pri,
 
     if (comp != sub->tp_name->tpn_comp)
       continue;
-    
-    if (sub->tp_addrlen != ai->ai_addrlen 
+
+    if (sub->tp_addrlen != ai->ai_addrlen
        || memcmp(sub->tp_addr, sa, ai->ai_addrlen)) {
       sub = NULL;
       break;
@@ -4587,7 +4587,7 @@ tport_t *tport_by_addrinfo(tport_primary_t const *pri,
 
 
 /** Get transport name from URL. */
-int tport_name_by_url(su_home_t *home, 
+int tport_name_by_url(su_home_t *home,
                      tp_name_t *tpn,
                      url_string_t const *us)
 {
@@ -4652,7 +4652,7 @@ int tport_name_is_resolved(tp_name_t const *tpn)
  * @retval 0 when successful
  * @retval -1 upon an error
  */
-int tport_name_dup(su_home_t *home, 
+int tport_name_dup(su_home_t *home,
                   tp_name_t *dst,
                   tp_name_t const *src)
 {
@@ -4662,7 +4662,7 @@ int tport_name_dup(su_home_t *home,
   if (!src->tpn_proto || !src->tpn_host || !src->tpn_port || !src->tpn_canon)
     return -1;
 
-  if (strcmp(src->tpn_proto, tpn_any)) 
+  if (strcmp(src->tpn_proto, tpn_any))
     n_proto = strlen(src->tpn_proto) + 1;
   else
     n_proto = 0;
@@ -4701,12 +4701,12 @@ int tport_name_dup(su_home_t *home,
     dst->tpn_comp = memcpy(s, src->tpn_comp, n_comp), s += n_comp;
   else
     dst->tpn_comp = NULL;
-  
+
   return 0;
 }
 
 /** Convert a sockaddr structure into printable form. */
-char *tport_hostport(char buf[], isize_t bufsize, 
+char *tport_hostport(char buf[], isize_t bufsize,
                     su_sockaddr_t const *su,
                     int with_port_and_brackets)
 {
@@ -4715,13 +4715,13 @@ char *tport_hostport(char buf[], isize_t bufsize,
 
 #if SU_HAVE_IN6
   if (with_port_and_brackets > 1 || su->su_family == AF_INET6) {
-    *b++ = '['; bufsize--; 
+    *b++ = '['; bufsize--;
   }
 #endif
 
   if (su_inet_ntop(su->su_family, SU_ADDR(su), b, bufsize) == NULL)
     return NULL;
-  n = strlen(b); 
+  n = strlen(b);
   if (bufsize < n + 2)
     return NULL;
 
@@ -4729,7 +4729,7 @@ char *tport_hostport(char buf[], isize_t bufsize,
 
 #if SU_HAVE_IN6
   if (with_port_and_brackets > 1 || su->su_family == AF_INET6) {
-    *b++ = ']'; bufsize--; 
+    *b++ = ']'; bufsize--;
   }
   if (with_port_and_brackets) {
     unsigned short port = ntohs(su->su_port);
@@ -4737,7 +4737,7 @@ char *tport_hostport(char buf[], isize_t bufsize,
       n = snprintf(b, bufsize, ":%u", port);
       if (n <= 0)
         return NULL;
-      b += n; 
+      b += n;
       if (bufsize > n)
         bufsize -= n;
       else
index 853731b362feaa711caec6814ae4f45a29878da7..4339c24ae695bf89b237b3ef14b9518bcaa0a280 100644 (file)
@@ -100,7 +100,7 @@ order, for instance, if a data chunk is lost by the network and then
 retransmitted, application can receive it later than a data chunk that
 was sent after lost one but did not need any retransmissions.
 
-@subsection tp_magic Transport Magic 
+@subsection tp_magic Transport Magic
 
 Transport magic is a cookie, a piece of data specified by stack that can
 be associated with a transport (e.g., a Via header). The protocol stack
@@ -142,7 +142,7 @@ the request.
 
 @note While the reference counting has been implemented in the tport
 module, the transport objects are not destroyed by timers by default as
-all the protocol stacks do @b not properly handle the reference counting. 
+all the protocol stacks do @b not properly handle the reference counting.
 Timers are activated when the tag TPTAG_IDLE() is used.
 
 @subsection tp_pend Pending Requests
@@ -183,11 +183,11 @@ debugging protocols. There are environment variables that are used to
 activate message logging within @b tport module.
 <dl compact>
 <dt>@b #TPORT_LOG
-   <dd>if set, tport module prints out the message contents 
+   <dd>if set, tport module prints out the message contents
        after parsing
 <dt>@b #TPORT_DUMP
    <dd>contains dump file name - incoming data is written
-       dump file @e before parsing 
+       dump file @e before parsing
 <dt>@b #TPORT_DEBUG
    <dd>integer in range -1..9 controlling amount of
        debugging printout from @b tport module. See also #tport_log.
index 388bebb33945eccbc30d695d44035b79096ac7fb..6aa79d5d0d1ac2987734fb125143cc4c8f4e1876 100644 (file)
@@ -136,21 +136,21 @@ struct tport_s {
   ssize_t             tp_refs;         /**< Number of references to tport */
 
   unsigned            tp_black:1;       /**< Used by red-black-tree */
-  
+
   unsigned            tp_accepted:1;    /**< Originally server? */
   unsigned            tp_conn_orient:1;        /**< Is connection-oriented */
   unsigned            tp_has_connection:1; /**< Has real connection */
   unsigned            tp_reusable:1;    /**< Can this connection be reused */
   unsigned            tp_closed : 1;
   /**< This transport is closed.
-   * 
+   *
    * A closed transport is inserted into pri_closed list.
    */
 
   /** Remote end has sent FIN (2) or we should not just read */
   unsigned            tp_recv_close:2;
   /** We will send FIN (1) or have sent FIN (2) */
-  unsigned            tp_send_close:2; 
+  unsigned            tp_send_close:2;
   unsigned            tp_has_keepalive:1;
   unsigned            tp_has_stun_server:1;
   unsigned            tp_trunc:1;
@@ -172,7 +172,7 @@ struct tport_s {
   su_time_t           tp_ptime;                /**< Ping sent */
 
   tp_name_t           tp_name[1];      /**< Transport name.
-                                        * 
+                                        *
                                         * This is either our name (if primary)
                                         * or peer name (if secondary).
                                         */
@@ -205,7 +205,7 @@ struct tport_s {
   unsigned            tp_pused;         /**< Used pends */
   tport_pending_t    *tp_pending;       /**< Pending requests */
   tport_pending_t    *tp_released;      /**< Released pends */
-  
+
   /* ==== Send queue ===================================================== */
 
   msg_t             **tp_queue;                /**< Messages being sent */
@@ -225,7 +225,7 @@ struct tport_s {
   tport_compressor_t *tp_comp;
 
   /* ==== Statistics  ===================================================== */
-  
+
   struct {
     uint64_t sent_msgs, sent_errors, sent_bytes, sent_on_line;
     uint64_t recv_msgs, recv_errors, recv_bytes, recv_on_line;
@@ -244,9 +244,9 @@ struct tport_primary {
 #endif
   tport_vtable_t const
                      *pri_vtable;
-  int                 pri_public;       /**< Type of primary transport; 
+  int                 pri_public;       /**< Type of primary transport;
                                         * tport_type_local,
-                                        * tport_type_stun, etc. 
+                                        * tport_type_stun, etc.
                                         */
 
   tport_primary_t    *pri_next;                /**< Next primary tport */
@@ -276,20 +276,20 @@ struct tport_master {
   int                 mr_stun_step_ready; /**< for stun's callback */
 
   tp_stack_t        *mr_stack;         /**< Transport consumer */
-  tp_stack_class_t 
+  tp_stack_class_t
                const *mr_tpac;         /**< Methods provided by stack */
   int                 mr_log;          /**< Do logging of parsed messages */
   su_root_t                 *mr_root;          /**< SU root pointer */
 
   /**< Timer reclaiming unused connections and compartment */
-  su_timer_t         *mr_timer;                
+  su_timer_t         *mr_timer;
   /** FILE to dump received and sent data */
-  FILE               *mr_dump_file;    
+  FILE               *mr_dump_file;
   char               *mr_dump; /**< Filename for dumping received/sent data */
   tport_primary_t    *mr_primaries;        /**< List of primary contacts */
 
   tport_params_t      mr_params[1];
-  
+
   unsigned            mr_boundserver:1; /**< Server has been bound */
   unsigned            mr_bindv6only:1; /**< We can bind separately to IPv6/4 */
   unsigned :0;
@@ -340,7 +340,7 @@ struct tport_vtable
                          char const **return_culprit);
   void (*vtp_deinit_primary)(tport_primary_t *pri);
   int (*vtp_wakeup_pri)(tport_primary_t *pri, int events);
-  tport_t *(*vtp_connect)(tport_primary_t *pri, su_addrinfo_t *ai, 
+  tport_t *(*vtp_connect)(tport_primary_t *pri, su_addrinfo_t *ai,
                          tp_name_t const *tpn);
 
   size_t vtp_secondary_size;   /* Size of secondary tport */
@@ -355,8 +355,8 @@ struct tport_vtable
   ssize_t (*vtp_send)(tport_t const *self, msg_t *msg,
                      msg_iovec_t iov[], size_t iovused);
   void (*vtp_deliver)(tport_t *self,  msg_t *msg, su_time_t now);
-  int (*vtp_prepare)(tport_t *self, msg_t *msg, 
-                    tp_name_t const *tpn, 
+  int (*vtp_prepare)(tport_t *self, msg_t *msg,
+                    tp_name_t const *tpn,
                     struct sigcomp_compartment *cc,
                     unsigned mtu);
   int (*vtp_keepalive)(tport_t *self, su_addrinfo_t const *ai,
@@ -364,7 +364,7 @@ struct tport_vtable
   int (*vtp_stun_response)(tport_t const *self,
                           void *msg, size_t msglen,
                           void *addr, socklen_t addrlen);
-  int (*vtp_next_secondary_timer)(tport_t *self, su_time_t *, 
+  int (*vtp_next_secondary_timer)(tport_t *self, su_time_t *,
                                  char const **return_why);
   void (*vtp_secondary_timer)(tport_t *self, su_time_t);
 };
@@ -391,12 +391,12 @@ int tport_primary_compression(tport_primary_t *pri,
 
 void tport_set_tos(su_socket_t socket, su_addrinfo_t *ai, int tos);
 
-tport_t *tport_base_connect(tport_primary_t *pri, 
+tport_t *tport_base_connect(tport_primary_t *pri,
                            su_addrinfo_t *ai,
                            su_addrinfo_t *name,
                            tp_name_t const *tpn);
 
-int tport_stream_init_primary(tport_primary_t *pri, 
+int tport_stream_init_primary(tport_primary_t *pri,
                              su_socket_t socket,
                              tp_name_t tpn[1],
                              su_addrinfo_t *ai,
@@ -427,36 +427,36 @@ void tport_recv_event(tport_t *self);
 void tport_send_event(tport_t *self);
 void tport_hup_event(tport_t *self);
 
-ssize_t tport_recv_iovec(tport_t const *self, 
+ssize_t tport_recv_iovec(tport_t const *self,
                         msg_t **mmsg,
-                        msg_iovec_t iovec[msg_n_fragments], size_t N, 
+                        msg_iovec_t iovec[msg_n_fragments], size_t N,
                         int exact);
 
 msg_t *tport_msg_alloc(tport_t const *self, usize_t size);
 
-int tport_prepare_and_send(tport_t *self, msg_t *msg, 
-                          tp_name_t const *tpn, 
+int tport_prepare_and_send(tport_t *self, msg_t *msg,
+                          tp_name_t const *tpn,
                           struct sigcomp_compartment *cc,
                           unsigned mtu);
-int tport_send_msg(tport_t *self, msg_t *msg, 
-                  tp_name_t const *tpn, 
+int tport_send_msg(tport_t *self, msg_t *msg,
+                  tp_name_t const *tpn,
                   struct sigcomp_compartment *cc);
 
 void tport_send_queue(tport_t *self);
 
-void tport_deliver(tport_t *self, msg_t *msg, msg_t *next, 
+void tport_deliver(tport_t *self, msg_t *msg, msg_t *next,
                   tport_compressor_t *comp,
                   su_time_t now);
 void tport_base_deliver(tport_t *self, msg_t *msg, su_time_t now);
 
 int tport_recv_error_report(tport_t *self);
-void tport_error_report(tport_t *self, int errcode, 
+void tport_error_report(tport_t *self, int errcode,
                        su_sockaddr_t const *addr);
 
 int tport_open_log(tport_master_t *mr, tagi_t *tags);
-void tport_log_msg(tport_t *tp, msg_t *msg, char const *what, 
+void tport_log_msg(tport_t *tp, msg_t *msg, char const *what,
                   char const *via, su_time_t now);
-void tport_dump_iovec(tport_t const *self, msg_t *msg, 
+void tport_dump_iovec(tport_t const *self, msg_t *msg,
                      size_t n, su_iovec_t const iov[], size_t iovused,
                      char const *what, char const *how);
 
@@ -466,9 +466,9 @@ int tport_tcp_pong(tport_t *self);
 extern tport_vtable_t const tport_udp_vtable;
 extern tport_vtable_t const tport_udp_client_vtable;
 
-int tport_udp_init_primary(tport_primary_t *, 
-                          tp_name_t tpn[1], 
-                          su_addrinfo_t *, 
+int tport_udp_init_primary(tport_primary_t *,
+                          tp_name_t tpn[1],
+                          su_addrinfo_t *,
                           tagi_t const *,
                           char const **return_culprit);
 void tport_udp_deinit_primary(tport_primary_t *);
@@ -480,12 +480,12 @@ int tport_udp_error(tport_t const *self, su_sockaddr_t name[1]);
 extern tport_vtable_t const tport_tcp_vtable;
 extern tport_vtable_t const tport_tcp_client_vtable;
 
-int tport_tcp_init_primary(tport_primary_t *, 
-                         tp_name_t  tpn[1], 
+int tport_tcp_init_primary(tport_primary_t *,
+                         tp_name_t  tpn[1],
                          su_addrinfo_t *, tagi_t const *,
                          char const **return_culprit);
-int tport_tcp_init_client(tport_primary_t *, 
-                        tp_name_t tpn[1], 
+int tport_tcp_init_client(tport_primary_t *,
+                        tp_name_t tpn[1],
                         su_addrinfo_t *, tagi_t const *,
                         char const **return_culprit);
 int tport_tcp_init_secondary(tport_t *self, int socket, int accepted,
@@ -518,7 +518,7 @@ typedef struct tport_descriptor_s {
   int tpd_is_client_only;
 } tport_descriptor_t;
 
-typedef int const *(tport_set_f)(tport_master_t *mr, 
+typedef int const *(tport_set_f)(tport_master_t *mr,
                                 tp_name_t const *tpn,
                                 tagi_t const *taglist,
                                 tport_descriptor_t **return_set,
@@ -566,8 +566,8 @@ int tport_recv_comp_dgram(tport_t const *self,
                          socklen_t fromlen);
 
 ssize_t tport_send_comp(tport_t const *self,
-                   msg_t *msg, 
-                   msg_iovec_t iov[], 
+                   msg_t *msg,
+                   msg_iovec_t iov[],
                    size_t iovused,
                    struct sigcomp_compartment *cc,
                    tport_compressor_t *sc);
index 9aace9f8bd9d0a9d052586119284a272da49c1b0..b523204ee1b4f64e6bac549ef86c6484e4616a6e 100644 (file)
@@ -49,7 +49,7 @@
  *
  * If the TPORT_LOG environment variable is set, the tport module logs the
  * contents of parsed messages. This eases debugging the signaling greatly.
- * 
+ *
  * @sa TPORT_DUMP, TPORT_DEBUG, tport_log
  */
 #ifdef DOXYGEN
@@ -63,7 +63,7 @@ extern char const TPORT_LOG[];        /* dummy declaration for Doxygen */
  * The received and sent data is dumped to the file specified by TPORT_DUMP
  * environment variable. This can be used to save message traces and help
  * hairy debugging tasks.
- * 
+ *
  * @sa TPORT_LOG, TPORT_DEBUG, tport_log
  */
 #ifdef DOXYGEN
@@ -76,19 +76,19 @@ extern char const TPORT_DUMP[];     /* dummy declaration for Doxygen */
  *
  * The TPORT_DEBUG environment variable is used to determine the debug logging
  * level for @b tport module. The default level is 3.
- * 
+ *
  * @sa <sofia-sip/su_debug.h>, tport_log, SOFIA_DEBUG
  */
 #ifdef DOXYGEN
 extern char const TPORT_DEBUG[]; /* dummy declaration for Doxygen */
 #endif
 
-/**Debug log for @b tport module. 
- * 
+/**Debug log for @b tport module.
+ *
  * The tport_log is the log object used by @b tport module. The level of
  * #tport_log is set using #TPORT_DEBUG environment variable.
  */
-su_log_t tport_log[] = { 
+su_log_t tport_log[] = {
   SU_LOG_INIT("tport", "TPORT_DEBUG", SU_DEBUG)
 };
 
@@ -99,9 +99,9 @@ int tport_open_log(tport_master_t *mr, tagi_t *tags)
   int log_msg = mr->mr_log != 0;
   char const *dump = NULL;
   int n;
-  
+
   n = tl_gets(tags,
-             TPTAG_LOG_REF(log_msg), 
+             TPTAG_LOG_REF(log_msg),
              TPTAG_DUMP_REF(dump),
              TAG_END());
 
@@ -129,7 +129,7 @@ int tport_open_log(tport_master_t *mr, tagi_t *tags)
     if (mr->mr_dump_file && mr->mr_dump_file != stdout)
       fclose(mr->mr_dump_file), mr->mr_dump_file = NULL;
 
-    if (strcmp(dumpname, "-")) 
+    if (strcmp(dumpname, "-"))
       mr->mr_dump_file = fopen(dumpname, "ab"); /* XXX */
     else
       mr->mr_dump_file = stdout;
@@ -144,8 +144,8 @@ int tport_open_log(tport_master_t *mr, tagi_t *tags)
 }
 
 /** Create log stamp */
-void tport_stamp(tport_t const *self, msg_t *msg, 
-                char stamp[128], char const *what, 
+void tport_stamp(tport_t const *self, msg_t *msg,
+                char stamp[128], char const *what,
                 size_t n, char const *via,
                 su_time_t now)
 {
@@ -183,7 +183,7 @@ void tport_stamp(tport_t const *self, msg_t *msg,
 }
 
 /** Dump the data from the iovec */
-void tport_dump_iovec(tport_t const *self, msg_t *msg, 
+void tport_dump_iovec(tport_t const *self, msg_t *msg,
                      size_t n, su_iovec_t const iov[], size_t iovused,
                      char const *what, char const *how)
 {
@@ -214,7 +214,7 @@ void tport_dump_iovec(tport_t const *self, msg_t *msg,
 }
 
 /** Log the message. */
-void tport_log_msg(tport_t *self, msg_t *msg, 
+void tport_log_msg(tport_t *self, msg_t *msg,
                   char const *what, char const *via,
                   su_time_t now)
 {
@@ -234,7 +234,7 @@ void tport_log_msg(tport_t *self, msg_t *msg,
   tport_stamp(self, msg, stamp, what, n, via, now);
   su_log(stamp);
   su_log("   " MSG_SEPARATOR);
+
   for (i = 0; truncated == 0 && i < iovlen && i < 80; i++) {
     char *s = iov[i].mv_base, *end = s + iov[i].mv_len;
 
index 5e1a79853dd3d476631f419f71a06d70631b3214..9eeed1311d1d48856233f90188e1f016e6b45068 100644 (file)
@@ -64,11 +64,11 @@ struct tport_comp {
   struct sigcomp_compartment   *sc_cc;
   struct sigcomp_compressor    *sc_compressor;
   struct sigcomp_buffer        *sc_output;
-  unsigned                      sc_compressed; 
+  unsigned                      sc_compressed;
 
   struct sigcomp_buffer        *sc_input;
   unsigned                      sc_copied;
-  
+
   enum {
     format_is_unknown,
     format_is_sigcomp,
@@ -95,7 +95,7 @@ tport_compressor_t *vsc_master_init_sigcomp(tport_t *mr,
   sh = sigcomp_state_handler_create();
 
   if (sh == NULL) {
-    SU_DEBUG_1(("tport: initializing SigComp state handler: %s\n", 
+    SU_DEBUG_1(("tport: initializing SigComp state handler: %s\n",
                strerror(errno)));
     vsc_master_deinit_sigcomp(mr, retval), retval = NULL;
     return retval;
@@ -106,7 +106,7 @@ tport_compressor_t *vsc_master_init_sigcomp(tport_t *mr,
   cc = sigcomp_compartment_create(a, sh, 0, "", 0, NULL, 0);
 
   if (cc == NULL) {
-    SU_DEBUG_1(("tport: initializing SigComp master compartment: %s\n", 
+    SU_DEBUG_1(("tport: initializing SigComp master compartment: %s\n",
                strerror(errno)));
     vsc_master_deinit_sigcomp(mr, retval), retval = NULL;
     return retval;
@@ -146,7 +146,7 @@ char const *vsc_comp_name(tport_sigcomp_t const *master_sc,
 {
   if (master_sc == NULL ||
       master_sc->sc_cc == NULL ||
-      compression == NULL || 
+      compression == NULL ||
       strcasecmp(compression, tport_sigcomp_name))
     return NULL;
 
@@ -166,7 +166,7 @@ int vsc_can_send_sigcomp(tport_sigcomp_t const *sc)
 }
 
 /** Set/reset compression */
-int vsc_set_compression(tport_t *self, 
+int vsc_set_compression(tport_t *self,
                        tport_sigcomp_t *sc,
                        char const *comp)
 {
@@ -186,7 +186,7 @@ int vsc_set_compression(tport_t *self,
       return 0;
     }
   }
-  
+
   return -1;
 }
 
@@ -194,7 +194,7 @@ int vsc_set_compression(tport_t *self,
 /** Assign a SigComp compartment (to a possibly connected tport). */
 int tport_sigcomp_assign(tport_t *self, struct sigcomp_compartment *cc)
 {
-  if (tport_is_connection_oriented(self) && 
+  if (tport_is_connection_oriented(self) &&
       tport_is_secondary(self) &&
       self->tp_socket != INVALID_SOCKET) {
 
@@ -205,7 +205,7 @@ int tport_sigcomp_assign(tport_t *self, struct sigcomp_compartment *cc)
       /* Remove old assignment */
       sigcomp_compartment_unref(self->tp_sigcomp->sc_cc);
     }
-    
+
     self->tp_sigcomp->sc_cc = sigcomp_compartment_ref(cc);
 
     return 0;
@@ -223,7 +223,7 @@ void vsc_sigcomp_shutdown(tport_t *self, int how)
   if (how >= 2 && self->tp_sigcomp->sc_cc) {
     sigcomp_compartment_unref(self->tp_sigcomp->sc_cc);
     self->tp_sigcomp->sc_cc = NULL;
-  }  
+  }
 }
 
 static int vsc_recv_sigcomp_r(tport_t*, msg_t**, struct sigcomp_udvm*, int);
@@ -369,50 +369,50 @@ static int tport_recv_sigcomp_r(tport_t *self,
 
     data = input->b_data + input->b_avail;
     dlen = input->b_size - input->b_avail;
-    
+
     if (tport_is_stream(self)) {
       n = recv(self->tp_socket, data, dlen, 0);
-    } 
+    }
     else if (dlen >= N) {
       n = recvfrom(self->tp_socket, data, dlen, 0, &su->su_sa, &su_size);
       SU_CANONIZE_SOCKADDR(su);
-    } 
+    }
     else {
       recvfrom(self->tp_socket, data, dlen, 0, &su->su_sa, &su_size);
       SU_CANONIZE_SOCKADDR(su);
       su_seterrno(EMSGSIZE);           /* Protocol error */
       return -1;
     }
-  
+
     if (n == (unsigned)-1) {
       char const *pn = self->tp_protoname;
       int err = su_errno();
-    
+
       if (su_is_blocking(err)) {
        SU_DEBUG_7(("%s(%p): recv from %s: EAGAIN\n", __func__, self, pn));
        return 1;
       }
-    
+
       SU_DEBUG_1(("%s(%p): recv from %s: %s (%d)\n", __func__, self, pn,
                  su_strerror(err), err));
       return -1;
     }
-  
+
     /* XXX - in case of stream, use message buffers for output? */
-    
+
     input->b_avail += n;
     input->b_complete = (n == 0) || !tport_is_stream(self);
   }
 
   for (complete = eos = 0; !complete;) {
     output = sigcomp_udvm_output_buffer(udvm, 16384);
-    
+
     if (sigcomp_udvm_decompress(udvm, output, input) < 0) {
       int error = sigcomp_udvm_errno(udvm);
-      
+
       SU_DEBUG_3(("%s: UDVM error %d: %s\n", __func__,
                  error, sigcomp_udvm_strerror(udvm)));
-      
+
       su_seterrno(EREMOTEIO);
 
       return -1;
@@ -424,7 +424,7 @@ static int tport_recv_sigcomp_r(tport_t *self,
     eos = complete && input->b_complete;
 
     veclen = tport_recv_iovec(self, mmsg, iovec, dlen, eos);
-    
+
     if (dlen ? veclen <= 0 : veclen < 0) {
       return -1;
     }
@@ -437,27 +437,27 @@ static int tport_recv_sigcomp_r(tport_t *self,
     assert(dlen == n);
 
     msg = *mmsg;
-    
+
     if (msg) {
       /* Message address */
       if (self->tp_addrinfo->ai_socktype == SOCK_STREAM)
        msg_set_address(msg, self->tp_addr, self->tp_addrlen);
       else
        msg_set_address(msg, su, su_size);
-      
-      SU_DEBUG_5(("%s(%p): sigcomp recv = %u => %u %s\n", __func__, self, 
+
+      SU_DEBUG_5(("%s(%p): sigcomp recv = %u => %u %s\n", __func__, self,
                  N, dlen, eos ? " (complete)" : ""));
 
       msg_mark_as_compressed(msg);
-      
+
       /* Write the received data to the message dump file */
       if (self->tp_master->mr_dump_file && !self->tp_pri->pri_threadpool)
        tport_dump_iovec(self, msg, n, iovec, veclen, "recv", "from");
-      
+
       msg_recv_commit(msg, dlen, eos);    /* Mark buffer as used */
     }
     else {
-      SU_DEBUG_5(("%s(%p): sigcomp recv = %u => %u %s\n", __func__, self, 
+      SU_DEBUG_5(("%s(%p): sigcomp recv = %u => %u %s\n", __func__, self,
                  N, dlen, eos ? " (complete)" : ""));
       if (complete || !tport_is_stream(self)) {
        sigcomp_udvm_reject(udvm); /* Reject empty message */
@@ -467,7 +467,7 @@ static int tport_recv_sigcomp_r(tport_t *self,
     if (self->tp_addrinfo->ai_socktype == SOCK_STREAM) {
       if (eos)
        return 0;
-    
+
       if (output->b_complete)
        return n < N || sigcomp_udvm_has_pending_data(udvm) ? 2 : 1;
 
@@ -481,8 +481,8 @@ static int tport_recv_sigcomp_r(tport_t *self,
 
 static
 int vsc_send_sigcomp(tport_t const *self,
-                    msg_t *msg, 
-                    msg_iovec_t iov[], 
+                    msg_t *msg,
+                    msg_iovec_t iov[],
                     int iovused,
                     struct sigcomp_compartment *cc,
                     tport_sigcomp_t *sc)
@@ -511,7 +511,7 @@ int vsc_send_sigcomp(tport_t const *self,
     sc->sc_outfmt = format_is_sigcomp;
 
   assert(cc);
-  
+
   if (c == NULL) {
     assert(input == NULL);
     if (stream)
@@ -519,7 +519,7 @@ int vsc_send_sigcomp(tport_t const *self,
     else
       c = sigcomp_compressor_create(cc);
     sc->sc_compressor = c;
-  } 
+  }
 
   ccname = sigcomp_compartment_name(cc, &ccnamelen);
 
@@ -539,7 +539,7 @@ int vsc_send_sigcomp(tport_t const *self,
     sc->sc_input = input = sigcomp_compressor_input_buffer(c, input_size);
 
     assert(input->b_avail == 0 && input->b_used == 0);
-  } 
+  }
   else if (!input->b_complete) {
     int input_size = 0;
 
@@ -552,15 +552,15 @@ int vsc_send_sigcomp(tport_t const *self,
 
   if (output == NULL)
     sc->sc_output = output = sigcomp_compressor_output_buffer(c, NULL);
-    
+
   if (!c || !input || !output) {
-    SU_DEBUG_3(("%s(%p): %s (%u)%s%s%s\n", 
+    SU_DEBUG_3(("%s(%p): %s (%u)%s%s%s\n",
                __func__, self, strerror(errno), errno,
                c ? "" : " (comp)",
                input ? "" : " (input)",
                output ? "" : " (output)"));
     sigcomp_compressor_free(c);
-    sc->sc_compressor = NULL; 
+    sc->sc_compressor = NULL;
     sc->sc_output = NULL; sc->sc_input = NULL;
     sc->sc_compressed = 0; sc->sc_copied = 0;
     return -1;
@@ -598,17 +598,17 @@ int vsc_send_sigcomp(tport_t const *self,
       input->b_complete = i == iovused;
       assert(stream || input->b_complete); (void)stream;
     }
-    
+
     m = output->b_avail - output->b_used;
 
     n = sigcomp_compressor_compress(c, output, input);
-    
+
     if (n < 0) {
       SU_DEBUG_3(("%s(%p): %s (%u)\n", __func__, self,
-                 sigcomp_compressor_strerror(c), 
+                 sigcomp_compressor_strerror(c),
                  sigcomp_compressor_errno(c)));
       sigcomp_compressor_free(c);
-      sc->sc_compressor = NULL; 
+      sc->sc_compressor = NULL;
       sc->sc_output = NULL; sc->sc_input = NULL;
       sc->sc_compressed = 0;
       return -1;
@@ -616,15 +616,15 @@ int vsc_send_sigcomp(tport_t const *self,
 
     assert(input->b_complete || sc->sc_copied - k > 0);
 
-    SU_DEBUG_5(("%s: input %u (%u new) compressed %u to %u with '%.*s'\n", 
-               __func__, sc->sc_copied, k, n, 
-               (output->b_avail - output->b_used) - m, 
+    SU_DEBUG_5(("%s: input %u (%u new) compressed %u to %u with '%.*s'\n",
+               __func__, sc->sc_copied, k, n,
+               (output->b_avail - output->b_used) - m,
                ccnamelen, ccname));
 
     sc->sc_compressed = n;
 
     assert(stream || output->b_complete);
-  } 
+  }
   else {
     assert(tport_is_connection_oriented(self));
     n = sc->sc_compressed;
@@ -636,7 +636,7 @@ int vsc_send_sigcomp(tport_t const *self,
   ciov->siv_len = output->b_avail - output->b_used;
 
   m = self->tp_pri->pri_vtable->vtp_send(self, msg, ciov, 1);
-  
+
   if (m == -1) {
     int error = su_errno();
 
@@ -650,9 +650,9 @@ int vsc_send_sigcomp(tport_t const *self,
 
     return -1;
   }
-  
+
   output->b_used += m;
-  
+
   if (output->b_used < output->b_avail)
     return 0;
 
@@ -668,7 +668,7 @@ int vsc_send_sigcomp(tport_t const *self,
     sc->sc_compressor = NULL;
   }
 
-  assert(sc->sc_compressed >= n); assert(sc->sc_copied >= n); 
+  assert(sc->sc_compressed >= n); assert(sc->sc_copied >= n);
 
   sc->sc_compressed -= n;
   sc->sc_copied -= n;
@@ -677,7 +677,7 @@ int vsc_send_sigcomp(tport_t const *self,
 }
 
 /** Initialize UDVM */
-static 
+static
 struct sigcomp_udvm *tport_init_udvm(tport_t *self)
 {
   struct sigcomp_compartment *cc;
@@ -701,7 +701,7 @@ struct sigcomp_udvm *tport_init_udvm(tport_t *self)
 
 
 /** Get primary compartment */
-static 
+static
 struct sigcomp_compartment *
 tport_primary_compartment(tport_master_t *mr)
 {
@@ -721,14 +721,14 @@ void vsc_try_accept_sigcomp(tport_t *self, msg_t *msg)
 
   udvm = self->tp_sigcomp->sc_udvm;
   if (udvm && sigcomp_udvm_is_complete(udvm)) {
-    if (self->tp_master->mr_tpac->tpac_sigcomp_accept && 
+    if (self->tp_master->mr_tpac->tpac_sigcomp_accept &&
        self->tp_sigcomp->sc_cc == NULL) {
       tport_t *ref;
       struct tport_delivery *d;
 
       d = self->tp_master->mr_delivery;
 
-      d->d_tport = self; 
+      d->d_tport = self;
       d->d_msg = msg;
       d->d_udvm = &self->tp_sigcomp->sc_udvm;
       *d->d_from = *self->tp_name;
@@ -744,11 +744,11 @@ void vsc_try_accept_sigcomp(tport_t *self, msg_t *msg)
     }
     else {
       if (tport_log->log_level >= 5) {
-       char const *name; 
+       char const *name;
        int namelen;
-      
+
        name = sigcomp_compartment_name(self->tp_sigcomp->sc_cc, &namelen);
-       SU_DEBUG_5(("tport(%p): msg %p SigComp implicit accept '%.*s'\n", 
+       SU_DEBUG_5(("tport(%p): msg %p SigComp implicit accept '%.*s'\n",
                    self, msg, namelen, name));
       }
       sigcomp_udvm_accept(udvm, self->tp_sigcomp->sc_cc);
@@ -758,9 +758,9 @@ void vsc_try_accept_sigcomp(tport_t *self, msg_t *msg)
 
 
 /** Accept a SigComp message */
-int 
-tport_sigcomp_accept(tport_t *self, 
-                    struct sigcomp_compartment *cc, 
+int
+tport_sigcomp_accept(tport_t *self,
+                    struct sigcomp_compartment *cc,
                     msg_t *msg)
 {
   struct sigcomp_udvm *udvm;
@@ -775,12 +775,12 @@ tport_sigcomp_accept(tport_t *self,
 
   if (udvm) {
     if (tport_log->log_level >= 5) {
-      char const *name; 
+      char const *name;
       int namelen;
-   
+
       if (cc) {
        name = sigcomp_compartment_name(cc, &namelen);
-       SU_DEBUG_5(("tport(%p): msg %p SigComp accept '%.*s'\n", 
+       SU_DEBUG_5(("tport(%p): msg %p SigComp accept '%.*s'\n",
                    self, msg, namelen, name));
       }
       else {
@@ -814,7 +814,7 @@ tport_sigcomp_deliver(tport_t *self, msg_t *msg, su_time_t now)
 su_inline
 int msg_is_compressed(msg_t *msg)
 {
-  return msg && 
+  return msg &&
     (msg_addrinfo(msg)->ai_flags & TP_AI_COMPRESSED) == TP_AI_COMPRESSED;
 }
 
@@ -852,11 +852,11 @@ tport_sigcomp_assign_if_needed(tport_t *self,
       /* Use default compartment */
       cc = self->tp_master->mr_compartment;
   }
-  else 
+  else
     cc = NULL;
-  
+
   return cc;
-}                         
+}
 
 /** Receive data from datagram using SigComp. */
 int tport_recv_sigcomp_dgram(tport_t *self, int N)
@@ -881,5 +881,5 @@ int tport_recv_sigcomp_dgram(tport_t *self, int N)
 #endif
   recv(self->tp_socket, dummy, 1, 0); /* remove msg from socket */
   /* XXX - send NACK ? */
-  return su_seterrno(error);     
+  return su_seterrno(error);
 }
index 791cd39ca7048dc27415f2224ade9b6a71ec37be..b8846a9abcbd8e53018504ca1054b2336d22e329 100644 (file)
@@ -140,7 +140,7 @@ int tport_can_send_sigcomp(tport_t const *self)
 int tport_has_compression(tport_t const *self, char const *comp)
 {
   return
-    self && comp && 
+    self && comp &&
     self->tp_name->tpn_comp == tport_canonize_comp(comp);
 }
 
@@ -169,7 +169,7 @@ int tport_sigcomp_option(tport_t const *self,
 }
 
 
-/** Assign a SigComp compartment (to a possibly connected tport). 
+/** Assign a SigComp compartment (to a possibly connected tport).
  *
  * @related tport_s
  */
@@ -180,7 +180,7 @@ int tport_sigcomp_assign(tport_t *self, struct sigcomp_compartment *cc)
   if (!vsc)
     return 0;
 
-  if (tport_is_connection_oriented(self) && 
+  if (tport_is_connection_oriented(self) &&
       tport_is_secondary(self) &&
       self->tp_socket != INVALID_SOCKET) {
     return vsc->vsc_set_compartment(self, self->tp_comp, cc);
@@ -207,7 +207,7 @@ tport_sigcomp_assign_if_needed(tport_t *self,
   }
 
   return vsc->vsc_get_compartment(self, self->tp_comp);
-}                         
+}
 
 
 /** Test if tport has a SigComp compartment assigned to it. */
@@ -217,13 +217,13 @@ int tport_has_sigcomp_assigned(tport_t const *self)
 
   if (vsc && self)
     return vsc->vsc_has_sigcomp_assigned(self->tp_comp);
-    
+
   return 0;
 }
 
-int 
-tport_sigcomp_accept(tport_t *self, 
-                    struct sigcomp_compartment *cc, 
+int
+tport_sigcomp_accept(tport_t *self,
+                    struct sigcomp_compartment *cc,
                     msg_t *msg)
 {
   tport_comp_vtable_t const *vsc = tport_comp_vtable;
@@ -260,7 +260,7 @@ struct sigcomp_udvm **tport_get_udvm_slot(tport_t *self)
 }
 
 /** Receive data from datagram using SigComp. */
-int tport_recv_comp_dgram(tport_t const *self, 
+int tport_recv_comp_dgram(tport_t const *self,
                          tport_compressor_t *sc,
                          msg_t **in_out_msg,
                          su_sockaddr_t *from,
@@ -273,13 +273,13 @@ int tport_recv_comp_dgram(tport_t const *self,
 
   msg_destroy(*in_out_msg), *in_out_msg = NULL;
 
-  return su_seterrno(EBADMSG);     
+  return su_seterrno(EBADMSG);
 }
 
 
 ssize_t tport_send_comp(tport_t const *self,
-                       msg_t *msg, 
-                       msg_iovec_t iov[], 
+                       msg_t *msg,
+                       msg_iovec_t iov[],
                        size_t iovused,
                        struct sigcomp_compartment *cc,
                        tport_compressor_t *comp)
index 86eb469a02bcad8b84936bd4b886b3bdff268c2d..d8e81151942dccf21b4326855be7b36a933e88b4 100644 (file)
@@ -55,13 +55,13 @@ tport_stun_server_t *vst_create(su_root_t *root, tagi_t const *tags)
 }
 
 static
-tport_stun_server_vtable_t const stun_mini_vtable = 
+tport_stun_server_vtable_t const stun_mini_vtable =
   {
     sizeof stun_mini_vtable,
-    vst_create, 
+    vst_create,
     stun_mini_destroy,
-    stun_mini_add_socket, 
-    stun_mini_remove_socket, 
+    stun_mini_add_socket,
+    stun_mini_remove_socket,
     stun_mini_request
   };
 
@@ -98,10 +98,10 @@ int tport_stun_server_add_socket(tport_t *tp)
 {
   tport_stun_server_t *stun_server = tp->tp_master->mr_stun_server;
 
-  if (tport_stun_server_vtable && 
+  if (tport_stun_server_vtable &&
       stun_server &&
       tp->tp_params->tpp_stun_server) {
-    if (tport_stun_server_vtable->vst_add_socket(stun_server, 
+    if (tport_stun_server_vtable->vst_add_socket(stun_server,
                                                 tp->tp_socket) == 0)
       tp->tp_has_stun_server = 1;
   }
@@ -124,7 +124,7 @@ int tport_stun_server_remove_socket(tport_t *tp)
 /**Process stun messagee.
  *
  * @retval -1 error
- * @retval 3  stun message received, ignore  
+ * @retval 3  stun message received, ignore
  */
 int tport_recv_stun_dgram(tport_t const *self,
                          msg_t **in_out_msg,
@@ -150,7 +150,7 @@ int tport_recv_stun_dgram(tport_t const *self,
   else if (request[0] == 1) {
     /* This is a response. */
     if (self->tp_pri->pri_vtable->vtp_stun_response) {
-      if (self->tp_pri->pri_vtable->vtp_stun_response(self, request, n, 
+      if (self->tp_pri->pri_vtable->vtp_stun_response(self, request, n,
                                                      from, fromlen) < 0)
        retval = -1;
     }
@@ -161,7 +161,7 @@ int tport_recv_stun_dgram(tport_t const *self,
   else if (request[0] == 0 && self->tp_master->mr_stun_server) {
     tport_stun_server_vtable_t const *vst = tport_stun_server_vtable;
     vst->vst_request(self->tp_master->mr_stun_server,
-                    self->tp_socket, request, n, 
+                    self->tp_socket, request, n,
                     (void *)from, fromlen);
   }
   else if (request[0] == 0) {
@@ -279,7 +279,7 @@ int tport_plug_in_stun_server(tport_stun_server_vtable_t const *vtable)
   if (vtable->vst_size <= (int)sizeof *vtable)
     return su_seterrno(EINVAL);
 
-  if (!vtable->vst_create || 
+  if (!vtable->vst_create ||
       !vtable->vst_destroy ||
       !vtable->vst_add_socket ||
       !vtable->vst_remove_socket ||
index 5bd06959d46c8a7e9be58c77fd4c7d1eaeb71347..8391015e265e8ac0b2cf528b92e74755eb4cc9af 100644 (file)
@@ -25,7 +25,7 @@
 /**@CFILE tport_tag.c
  * @brief Tags for transport module
  *
- * @note This file is used to automatically generate 
+ * @note This file is used to automatically generate
  * tport_tag_ref.c and tport_tag_dll.c
  *
  * Copyright (c) 2002 Nokia Research Center.  All rights reserved.
@@ -54,7 +54,7 @@ tag_typedef_t tptag_any = NSTAG_TYPEDEF(*);
 
 /**@def TPTAG_IDENT(cstr)
  *
- * Identify a transport interface. 
+ * Identify a transport interface.
  *
  * Use with tport_tbind(), tport_tsend(), nua_create(), nta_agent_create(),
  * nta_agent_add_tport(), nta_outgoing_tcreate(), nta_outgoing_mcreate(),
@@ -75,7 +75,7 @@ tag_typedef_t tptag_reuse = BOOLTAG_TYPEDEF(reuse);
 
 /**@def TPTAG_FRESH(boolean)
  *
- * Create new connection (but allow other messages to reuse the new one). 
+ * Create new connection (but allow other messages to reuse the new one).
  *
  * Use with tport_tsend(), nta_outgoing_tcreate(), nta_outgoing_mcreate(),
  * or nth_client_tcreate().
@@ -92,7 +92,7 @@ tag_typedef_t tptag_server = BOOLTAG_TYPEDEF(server);
 
 /**@def TPTAG_PUBLIC(tport_via)
  *
- * Define how the public transport connects to Internet. 
+ * Define how the public transport connects to Internet.
  *
  * Use with tport_tbind(), nua_create(), nta_agent_create(),
  * nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
@@ -146,7 +146,7 @@ tag_typedef_t tptag_sdwn_after = BOOLTAG_TYPEDEF(sdwn_after);
 /**@def TPTAG_CLOSE_AFTER(x)
  *
  * Close of a connection after sending the message.
- * 
+ *
  * Use with tport_tsend(), nta_outgoing_tcreate(), nta_outgoing_mcreate(),
  * or nth_client_tcreate().
  */
@@ -156,7 +156,7 @@ tag_typedef_t tptag_close_after = BOOLTAG_TYPEDEF(sdwn_after);
  *
  * How long transports may be idle (value in milliseconds).
  *
- * If 0, zap immediately, 
+ * If 0, zap immediately,
  * if UINT_MAX, leave them there (default value for now).
  *
  * @par Use With
@@ -201,7 +201,7 @@ tag_typedef_t tptag_keepalive = UINTTAG_TYPEDEF(keepalive);
  *
  * Ping-pong interval in milliseconds.
  *
- * If 0 or UINT_MAX, do not check for PONGs. Default value is 0. 
+ * If 0 or UINT_MAX, do not check for PONGs. Default value is 0.
  *
  * If set, the ping-pong protocol is used on TCP connections. If pinger
  * sends a ping and receives no data in the specified ping-pong interval, it
@@ -257,7 +257,7 @@ tag_typedef_t tptag_sigcomp_lifetime = UINTTAG_TYPEDEF(sigcomp_lifetime);
  *
  * Path to the public key certificate directory.
  *
- * Use with tport_tbind(), nua_create(), nta_agent_create(), 
+ * Use with tport_tbind(), nua_create(), nta_agent_create(),
  * nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
  */
 tag_typedef_t tptag_certificate = STRTAG_TYPEDEF(certificate);
@@ -275,7 +275,7 @@ tag_typedef_t tptag_compartment = PTRTAG_TYPEDEF(compartment);
  *
  * Sets the TLS version (version 0 implies SSL2/SSL3).
  *
- * Use with tport_tbind(), nua_create(), nta_agent_create(), 
+ * Use with tport_tbind(), nua_create(), nta_agent_create(),
  * nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
  */
 tag_typedef_t tptag_tls_version = UINTTAG_TYPEDEF(tls_version);
@@ -399,7 +399,7 @@ tag_typedef_t tptag_tos = INTTAG_TYPEDEF(tos);
  *
  * If set, print out parsed or sent messages at transport layer.
  *
- * Use with tport_tcreate(), nua_create(), nta_agent_create(), 
+ * Use with tport_tcreate(), nua_create(), nta_agent_create(),
  * nth_engine_create(), or initial nth_site_create().
  *
  * @sa #TPORT_LOG environment variable, TPTAG_DUMP()
@@ -410,7 +410,7 @@ tag_typedef_t tptag_log = INTTAG_TYPEDEF(log);
 
 /**@def TPTAG_DUMP(x)
  *
- * Filename for dumping unparsed messages from transport. 
+ * Filename for dumping unparsed messages from transport.
  *
  * Use with tport_tcreate(), nta_agent_create(), nua_create(),
  * nth_engine_create(), or initial nth_site_create().
@@ -421,7 +421,7 @@ tag_typedef_t tptag_log = INTTAG_TYPEDEF(log);
  */
 tag_typedef_t tptag_dump = STRTAG_TYPEDEF(dump);
 
-/** Mark transport as trusted. 
+/** Mark transport as trusted.
  *
  * @note Not implemented by tport module.
  *
index 2cfde195dbd90b204eec0b74b989d2b57d6967fa..43388434a70cd8fd05fd5494eb039c4d5c8b7ab0 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "config.h"
 
-#undef HAVE_SIGCOMP 
+#undef HAVE_SIGCOMP
 
 #define SU_ROOT_MAGIC_T         struct tport_threadpool
 #define SU_WAKEUP_ARG_T         struct tport_s
@@ -93,7 +93,7 @@ struct threadpool
   int        thrp_yield;
 };
 
-typedef struct 
+typedef struct
 {
   threadpool_t *tpd_thrp;
   int  tpd_errorcode;
@@ -114,16 +114,16 @@ union tport_su_msg_arg
   thrp_udp_deliver_t thrp_udp_deliver[1];
 };
 
-int tport_threadpool_init_primary(tport_primary_t *, 
-                                 tp_name_t tpn[1], 
-                                 su_addrinfo_t *, 
+int tport_threadpool_init_primary(tport_primary_t *,
+                                 tp_name_t tpn[1],
+                                 su_addrinfo_t *,
                                  tagi_t const *,
                                  char const **return_culprit);
 static void tport_threadpool_deinit_primary(tport_primary_t *pri);
 
 static int tport_thread_send(tport_t *tp,
                             msg_t *msg,
-                            tp_name_t const *tpn, 
+                            tp_name_t const *tpn,
                             struct sigcomp_compartment *cc,
                             unsigned mtu);
 
@@ -149,16 +149,16 @@ tport_vtable_t const tport_threadpool_vtable =
 
 static int thrp_udp_init(su_root_t *, threadpool_t *);
 static void thrp_udp_deinit(su_root_t *, threadpool_t *);
-static int thrp_udp_event(threadpool_t *thrp, 
-                           su_wait_t *w, 
+static int thrp_udp_event(threadpool_t *thrp,
+                           su_wait_t *w,
                            tport_t *_tp);
-static int thrp_udp_recv_deliver(threadpool_t *thrp, 
-                                tport_t const *tp, 
+static int thrp_udp_recv_deliver(threadpool_t *thrp,
+                                tport_t const *tp,
                                 thrp_udp_deliver_t *tpd,
                                 int events);
 static int thrp_udp_recv(threadpool_t *thrp, thrp_udp_deliver_t *tpd);
 #if HAVE_SIGCOMP
-static int thrp_udvm_decompress(threadpool_t *thrp, 
+static int thrp_udvm_decompress(threadpool_t *thrp,
                                thrp_udp_deliver_t *tpd);
 #endif
 static void thrp_udp_deliver(threadpool_t *thrp,
@@ -176,8 +176,8 @@ static void thrp_udp_send_report(threadpool_t *thrp,
 
 
 /** Launch threads in the tport pool. */
-int tport_threadpool_init_primary(tport_primary_t *pri, 
-                                 tp_name_t tpn[1], 
+int tport_threadpool_init_primary(tport_primary_t *pri,
+                                 tp_name_t tpn[1],
                                  su_addrinfo_t *ai,
                                  tagi_t const *tags,
                                  char const **return_culprit)
@@ -210,7 +210,7 @@ int tport_threadpool_init_primary(tport_primary_t *pri,
       thrp[i].thrp_compartment = tport_primary_compartment(tp->tp_master);
 #endif
     thrp[i].thrp_tport = tptp;
-    if (su_clone_start(pri->pri_master->mr_root, 
+    if (su_clone_start(pri->pri_master->mr_root,
                       thrp[i].thrp_clone,
                       thrp + i,
                       thrp_udp_init,
@@ -219,7 +219,7 @@ int tport_threadpool_init_primary(tport_primary_t *pri,
   }
 
   tp->tp_events = 0;
-  
+
   return 0;
 
  error:
@@ -231,7 +231,7 @@ int tport_threadpool_init_primary(tport_primary_t *pri,
  *
  * @note Executed by stack thread only.
  */
-static 
+static
 void tport_threadpool_deinit_primary(tport_primary_t *pri)
 {
   tport_threadpool_t *tptp = (tport_threadpool_t *)pri;
@@ -246,7 +246,7 @@ void tport_threadpool_deinit_primary(tport_primary_t *pri)
     thrp[i].thrp_killing = 1;
 
   /* Stop every task in the threadpool. */
-  for (i = 0; i < N; i++) 
+  for (i = 0; i < N; i++)
     su_clone_wait(pri->pri_master->mr_root, thrp[i].thrp_clone);
 
   su_free(pri->pri_home, tptp), tptp->tptp_pool = NULL;
@@ -299,8 +299,8 @@ thrp_gain(threadpool_t *thrp)
   thrp->thrp_yield = 0;
 }
 
-static int thrp_udp_event(threadpool_t *thrp, 
-                         su_wait_t *w, 
+static int thrp_udp_event(threadpool_t *thrp,
+                         su_wait_t *w,
                          tport_t *tp)
 {
 #if HAVE_POLL
@@ -317,7 +317,7 @@ static int thrp_udp_event(threadpool_t *thrp,
                        su_root_task(thrp->thrp_root),
                        thrp_udp_deliver,
                        sizeof (*tpd)) == -1) {
-       SU_DEBUG_1(("thrp_udp_event(%p): su_msg_create(): %s\n", thrp, 
+       SU_DEBUG_1(("thrp_udp_event(%p): su_msg_create(): %s\n", thrp,
                    strerror(errno)));
        return 0;
       }
@@ -337,7 +337,7 @@ static int thrp_udp_event(threadpool_t *thrp,
       tpd = su_msg_data(thrp->thrp_rmsg)->thrp_udp_deliver;
       memset(tpd, 0, sizeof *tpd);
       return 0;
-    } 
+    }
 
     if (thrp->thrp_yield || (thrp->thrp_s_sent - thrp->thrp_s_recv) > 0)
       return 0;
@@ -346,8 +346,8 @@ static int thrp_udp_event(threadpool_t *thrp,
   }
 }
 
-static int thrp_udp_recv_deliver(threadpool_t *thrp, 
-                                tport_t const *tp, 
+static int thrp_udp_recv_deliver(threadpool_t *thrp,
+                                tport_t const *tp,
                                 thrp_udp_deliver_t *tpd,
                                 int events)
 {
@@ -378,10 +378,10 @@ static int thrp_udp_recv_deliver(threadpool_t *thrp,
       assert(tpd->tpd_errorcode);
       if (su_is_blocking(tpd->tpd_errorcode))
        return 0;
-    } 
+    }
     else if (tpd->tpd_msg) {
       int n = msg_extract(tpd->tpd_msg); (void)n;
-      
+
       thrp->thrp_rcvd_msgs++;
       thrp->thrp_rcvd_bytes += msg_size(tpd->tpd_msg);
     }
@@ -395,7 +395,7 @@ static int thrp_udp_recv_deliver(threadpool_t *thrp,
 
     if (tpd->tpd_msg || tpd->tpd_errorcode) {
       if (qlen >= tp->tp_params->tpp_thrprqsize) {
-       SU_DEBUG_7(("tport recv queue %i: %u\n", 
+       SU_DEBUG_7(("tport recv queue %i: %u\n",
                    (int)(thrp - tp->tp_pri->tptp_pool), qlen));
        thrp_yield(thrp);
       }
@@ -429,7 +429,7 @@ int thrp_udp_recv(threadpool_t *thrp, thrp_udp_deliver_t *tpd)
   pthread_mutex_lock(mutex);
 
   /* Simulate packet loss */
-  if (tp->tp_params->tpp_drop && 
+  if (tp->tp_params->tpp_drop &&
       su_randint(0, 1000) < tp->tp_params->tpp_drop) {
     recv(s, sample, 1, 0);
     pthread_mutex_unlock(mutex);
@@ -462,7 +462,7 @@ int thrp_udp_recv(threadpool_t *thrp, thrp_udp_deliver_t *tpd)
       void *data;
       int dlen;
 
-      tpd->tpd_udvm = 
+      tpd->tpd_udvm =
        sigcomp_udvm_create_for_compartment(thrp->thrp_compartment);
       input = sigcomp_udvm_input_buffer(tpd->tpd_udvm, N); assert(input);
 
@@ -473,23 +473,23 @@ int thrp_udp_recv(threadpool_t *thrp, thrp_udp_deliver_t *tpd)
        dlen = 0;
 
       tpd->tpd_namelen = sizeof(tpd->tpd_name);
-    
-      dlen = recvfrom(tp->tp_socket, data, dlen, 0, 
+
+      dlen = recvfrom(tp->tp_socket, data, dlen, 0,
                      &tpd->tpd_name->su_sa, &tpd->tpd_namelen);
 
       SU_CANONIZE_SOCKADDR(tpd->tpd_name);
-      
+
       if (dlen < N) {
        su_seterrno(EMSGSIZE);          /* Protocol error */
        N = -1;
-      } else if (dlen == -1) 
+      } else if (dlen == -1)
        N = -1;
       else {
-       input->b_avail += dlen; 
+       input->b_avail += dlen;
        input->b_complete = 1;
-       
+
        pthread_mutex_unlock(mutex);
-      
+
        N = thrp_udvm_decompress(thrp, tpd);
 
        if (N == -1)
@@ -511,8 +511,8 @@ int thrp_udp_recv(threadpool_t *thrp, thrp_udp_deliver_t *tpd)
   else {
     /* receive as usual */
     N = tport_recv_dgram_r(tp, &tpd->tpd_msg, N);
-  } 
-  
+  }
+
   pthread_mutex_unlock(mutex);
 
   return N;
@@ -533,22 +533,22 @@ int thrp_udvm_decompress(threadpool_t *thrp, thrp_udp_deliver_t *tpd)
   ssize_t veclen;
 
   output = sigcomp_udvm_output_buffer(udvm, -1);
-  
+
   if (sigcomp_udvm_decompress(udvm, output, NULL) < 0) {
     int error = sigcomp_udvm_errno(udvm);
     SU_DEBUG_3(("%s: UDVM error %d: %s\n", __func__,
                error, sigcomp_udvm_strerror(udvm)));
     su_seterrno(EREMOTEIO);
     return -1;
-  } 
+  }
 
   data = output->b_data + output->b_used;
   dlen = output->b_avail - output->b_used;
   /* XXX - if a message is larger than default output size... */
   eos = output->b_complete; assert(output->b_complete);
-    
+
   veclen = tport_recv_iovec(tp, &tpd->tpd_msg, iovec, dlen, eos);
-    
+
   if (veclen <= 0) {
     n = -1;
   } else {
@@ -560,7 +560,7 @@ int thrp_udvm_decompress(threadpool_t *thrp, thrp_udp_deliver_t *tpd)
     assert(dlen == n);
 
     msg_recv_commit(tpd->tpd_msg, dlen, eos);    /* Mark buffer as used */
-    
+
     /* Message address */
     ai = msg_addrinfo(tpd->tpd_msg);
     ai->ai_flags |= TP_AI_COMPRESSED;
@@ -580,7 +580,7 @@ int thrp_udvm_decompress(threadpool_t *thrp, thrp_udp_deliver_t *tpd)
  *
  * @note Executed by stack thread only.
  */
-static 
+static
 void thrp_udp_deliver(su_root_magic_t *magic,
                      su_msg_r m,
                      union tport_su_msg_arg *arg)
@@ -602,7 +602,7 @@ void thrp_udp_deliver(su_root_magic_t *magic,
     return;
   }
 
-  SU_DEBUG_7(("thrp_udp_deliver(%p): got %p delay %f\n", 
+  SU_DEBUG_7(("thrp_udp_deliver(%p): got %p delay %f\n",
              thrp, tpd, 1000 * su_time_diff(now, tpd->tpd_when)));
 
   if (tpd->tpd_errorcode)
@@ -612,14 +612,14 @@ void thrp_udp_deliver(su_root_magic_t *magic,
     tp->tp_rlogged = NULL;
   }
 
-#if HAVE_SIGCOMP 
+#if HAVE_SIGCOMP
   if (tpd->tpd_udvm) {
     sigcomp_udvm_free(tpd->tpd_udvm), tpd->tpd_udvm = NULL;
   }
 #endif
 }
 
-static 
+static
 void thrp_udp_deliver_report(threadpool_t *thrp,
                             su_msg_r m,
                             union tport_su_msg_arg *arg)
@@ -639,11 +639,11 @@ void thrp_udp_deliver_report(threadpool_t *thrp,
 static
 int tport_thread_send(tport_t *tp,
                      msg_t *msg,
-                     tp_name_t const *tpn, 
+                     tp_name_t const *tpn,
                      struct sigcomp_compartment *cc,
                      unsigned mtu)
 {
-  
+
   threadpool_t *thrp = tp->tp_pri->tptp_pool;
   thrp_udp_deliver_t *tpd;
   int i, N = tp->tp_pri->tptp_poolsize;
@@ -661,12 +661,12 @@ int tport_thread_send(tport_t *tp,
 
   qlen = totalqlen = thrp->thrp_s_sent - thrp->thrp_s_recv;
 
-  /* Select thread with shortest queue */ 
+  /* Select thread with shortest queue */
   for (i = 1; i < N; i++) {
     threadpool_t *other = tp->tp_pri->tptp_pool + i;
     unsigned len = other->thrp_s_sent - other->thrp_s_recv;
 
-    if (len < qlen || 
+    if (len < qlen ||
        (len == qlen && (other->thrp_s_sent - thrp->thrp_s_sent) < 0))
       thrp = other, qlen = len;
 
@@ -681,7 +681,7 @@ int tport_thread_send(tport_t *tp,
                    su_root_task(tp->tp_master->mr_root),
                    thrp_udp_send,
                    sizeof (*tpd)) != su_success) {
-    SU_DEBUG_1(("thrp_udp_event(%p): su_msg_create(): %s\n", thrp, 
+    SU_DEBUG_1(("thrp_udp_event(%p): su_msg_create(): %s\n", thrp,
                strerror(errno)));
     return -1;
   }
@@ -708,7 +708,7 @@ int tport_thread_send(tport_t *tp,
 }
 
 /** thrp_udp_send() is run by threadpool to send the message. */
-static 
+static
 void thrp_udp_send(threadpool_t *thrp,
                   su_msg_r m,
                   union tport_su_msg_arg *arg)
@@ -723,7 +723,7 @@ void thrp_udp_send(threadpool_t *thrp,
 
   thrp->thrp_s_recv++;
 
-  { 
+  {
     double delay = 1000 * su_time_diff(su_now(), tpd->tpd_when);
     if (delay > 100)
       SU_DEBUG_3(("thrp_udp_deliver(%p): got %p delay %f\n", thrp, tpd, delay));
@@ -753,7 +753,7 @@ void thrp_udp_send(threadpool_t *thrp,
   /* Get a iovec for message contents */
   for (;;) {
     iovused = msg_iovec(msg, iov, iovlen);
-    if (iovused <= iovlen) 
+    if (iovused <= iovlen)
       break;
 
     iov = iov0 = realloc(iov0, sizeof(*iov) * iovused);
@@ -776,9 +776,9 @@ void thrp_udp_send(threadpool_t *thrp,
     tport_sigcomp_t sc[1] = {{ NULL }};
 
     n = tport_sigcomp_vsend(tp, msg, iov, iovused, tpd->tpd_cc, sc);
-  } 
+  }
 #endif
-  else 
+  else
     n = tport_send_dgram(tp, msg, iov, iovused);
 
   if (n == -1)
@@ -788,7 +788,7 @@ void thrp_udp_send(threadpool_t *thrp,
     free(iov0);
 }
 
-static 
+static
 void thrp_udp_send_report(su_root_magic_t *magic,
                          su_msg_r msg,
                          union tport_su_msg_arg *arg)
@@ -799,7 +799,7 @@ void thrp_udp_send_report(su_root_magic_t *magic,
 
   assert(magic != thrp);
 
-  SU_DEBUG_7(("thrp_udp_send_report(%p): got %p delay %f\n", 
+  SU_DEBUG_7(("thrp_udp_send_report(%p): got %p delay %f\n",
              thrp, tpd, 1000 * su_time_diff(su_now(), tpd->tpd_when)));
 
   if (tp->tp_master->mr_log)
index 664a7f17dbcc44764b7601841a91c8e7fd143856..9a9dfb18c8862f1df69d9b4cd952dee6dff345a6 100644 (file)
@@ -24,7 +24,7 @@
 
 /**@CFILE tport_tls.c
  * @brief TLS interface
- * 
+ *
  * @author Mikko Haataja <ext-Mikko.A.Haataja@nokia.com>
  * @author Pekka Pessi <ext-Pekka.Pessi@nokia.com>
  *
@@ -112,7 +112,7 @@ void tls_log_errors(unsigned level, char const *s, unsigned long e)
       const char *func = ERR_func_error_string(e);
       const char *reason = ERR_reason_error_string(e);
 
-      su_llog(tport_log, level, "%s: %08lx:%s:%s:%s\n", 
+      su_llog(tport_log, level, "%s: %08lx:%s:%s:%s\n",
              s, e, error, func, reason);
     }
   }
@@ -165,7 +165,7 @@ int tls_verify_cb(int ok, X509_STORE_CTX *store)
     SU_DEBUG_1(("  subject  = %s\n", data));
     SU_DEBUG_1(("  err %i:%s\n", err, X509_verify_cert_error_string(err)));
   }
+
   return 1;                    /* Always return "ok" */
 }
 
@@ -182,7 +182,7 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti)
     if (ti->randFile &&
        !RAND_load_file(ti->randFile, 1024 * 1024)) {
       if (ti->configured > 1) {
-       SU_DEBUG_3(("%s: cannot open randFile %s\n", 
+       SU_DEBUG_3(("%s: cannot open randFile %s\n",
                   "tls_init_context", ti->randFile));
        tls_log_errors(3, "tls_init_context", 0);
       }
@@ -216,7 +216,7 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti)
     return -1;
   }
 
-  if (!SSL_CTX_use_certificate_file(tls->ctx, 
+  if (!SSL_CTX_use_certificate_file(tls->ctx,
                                    ti->cert,
                                    SSL_FILETYPE_PEM)) {
     if (ti->configured > 0) {
@@ -230,8 +230,8 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti)
     }
   }
 
-  if (!SSL_CTX_use_PrivateKey_file(tls->ctx, 
-                                   ti->key, 
+  if (!SSL_CTX_use_PrivateKey_file(tls->ctx,
+                                   ti->key,
                                    SSL_FILETYPE_PEM)) {
     if (ti->configured > 0) {
       tls_log_errors(1, "tls_init_context", 0);
@@ -253,8 +253,8 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti)
 #endif
   }
 
-  if (!SSL_CTX_load_verify_locations(tls->ctx, 
-                                     ti->CAfile, 
+  if (!SSL_CTX_load_verify_locations(tls->ctx,
+                                     ti->CAfile,
                                      ti->CApath)) {
     if (ti->configured > 0)
       tls_log_errors(1, "tls_init_context", 0);
@@ -264,7 +264,7 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti)
 
   SSL_CTX_set_verify_depth(tls->ctx, ti->verify_depth);
 
-  SSL_CTX_set_verify(tls->ctx, 
+  SSL_CTX_set_verify(tls->ctx,
                     getenv("SSL_VERIFY_PEER") ? SSL_VERIFY_PEER : SSL_VERIFY_NONE
                     /* SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT */,
                      tls_verify_cb);
@@ -318,8 +318,8 @@ int tls_get_socket(tls_t *tls)
 
 tls_t *tls_init_master(tls_issues_t *ti)
 {
-  /* Default id in case RAND fails */ 
-  unsigned char sessionId[32] = "sofia/tls"; 
+  /* Default id in case RAND fails */
+  unsigned char sessionId[32] = "sofia/tls";
   tls_t *tls;
 
 #if HAVE_SIGPIPE
@@ -342,8 +342,8 @@ tls_t *tls_init_master(tls_issues_t *ti)
 
   SSL_CTX_set_session_id_context(tls->ctx,
                                  (void*) sessionId,
-                                sizeof(sessionId)); 
-  
+                                sizeof(sessionId));
+
   if (ti->CAfile != NULL)
     SSL_CTX_set_client_CA_list(tls->ctx,
                                SSL_load_client_CA_file(ti->CAfile));
@@ -379,7 +379,7 @@ tls_t *tls_clone(tls_t *master, int sock, int accept)
 
   assert(sock != -1);
 
-  tls->bio_con = BIO_new_socket(sock, BIO_NOCLOSE); 
+  tls->bio_con = BIO_new_socket(sock, BIO_NOCLOSE);
   tls->con = SSL_new(tls->ctx);
 
   if (tls->con == NULL) {
@@ -435,10 +435,10 @@ int tls_post_connection_check(tls_t *tls)
 
   if (!tls) return -1;
 
-  cert = SSL_get_peer_certificate(tls->con); 
+  cert = SSL_get_peer_certificate(tls->con);
   if (!cert)
     return X509_V_OK;
-  
+
   extcount = X509_get_ext_count(cert);
 
   for (k = 0; k < TLS_MAX_HOSTS && tls->hosts[k]; k++)
@@ -455,14 +455,14 @@ int tls_post_connection_check(tls_t *tls)
 
     ext = X509_get_ext(cert, i);
     name = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext)));
-    
+
     if (strcmp(name, "subjectAltName") != 0)
       continue;
-      
+
     vp = X509V3_EXT_get(ext); if (!vp) continue;
     d2i = X509V3_EXT_d2i(ext);
     values = vp->i2v(vp, d2i, NULL);
-    
+
     for (j = 0; j < sk_CONF_VALUE_num(values); j++) {
       value = sk_CONF_VALUE_value(values, j);
       if (strcmp(value->name, "DNS") == 0) {
@@ -480,18 +480,18 @@ int tls_post_connection_check(tls_t *tls)
       }
     }
   }
-   
+
   if (k < TLS_MAX_HOSTS) {
     X509_NAME *subject;
     char name[256];
 
     subject = X509_get_subject_name(cert);
     if (subject) {
-      if (X509_NAME_get_text_by_NID(subject, NID_commonName, 
+      if (X509_NAME_get_text_by_NID(subject, NID_commonName,
                                    name, sizeof name) > 0) {
        name[(sizeof name) - 1] = '\0';
 
-       for (i = 0; tls->hosts[i]; i++) 
+       for (i = 0; tls->hosts[i]; i++)
          if (strcasecmp(tls->hosts[i], name) == 0)
            break;
 
@@ -507,7 +507,7 @@ int tls_post_connection_check(tls_t *tls)
 
   if (error == X509_V_OK)
     tls->verified = 1;
-  
+
   return error;
 }
 
@@ -518,7 +518,7 @@ int tls_check_hosts(tls_t *tls, char const *hosts[TLS_MAX_HOSTS])
   if (tls == NULL) { errno = EINVAL; return -1; }
   if (!tls->verified) { errno = EAGAIN; return -1; }
 
-  if (!hosts) 
+  if (!hosts)
     return 0;
 
   for (i = 0; hosts[i]; i++) {
@@ -531,7 +531,7 @@ int tls_check_hosts(tls_t *tls, char const *hosts[TLS_MAX_HOSTS])
       return -1;
     }
   }
-  
+
   return 0;
 }
 
@@ -605,12 +605,12 @@ ssize_t tls_read(tls_t *tls)
   if (!tls->verified) {
     int err = tls_post_connection_check(tls);
 
-    if (err != X509_V_OK && 
+    if (err != X509_V_OK &&
        err != SSL_ERROR_SYSCALL &&
        err != SSL_ERROR_WANT_WRITE &&
        err != SSL_ERROR_WANT_READ) {
       SU_DEBUG_1((
-                "%s: server certificate doesn't verify\n", 
+                "%s: server certificate doesn't verify\n",
                 "tls_read"));
     }
   }
@@ -632,11 +632,11 @@ int tls_pending(tls_t const *tls)
 
 /** Check if data is available in TCP connection.
  *
- * 
+ *
  *
  * @retval -1 upon an error
  * @retval 0 end-of-stream
- * @retval 1 nothing to read 
+ * @retval 1 nothing to read
  * @retval 2 there is data to read
  */
 int tls_want_read(tls_t *tls, int events)
@@ -660,8 +660,8 @@ ssize_t tls_write(tls_t *tls, void *buf, size_t size)
 {
   ssize_t ret;
 
-  if (0) 
-    SU_DEBUG_1(("tls_write(%p, %p, "MOD_ZU") called on %s\n", 
+  if (0)
+    SU_DEBUG_1(("tls_write(%p, %p, "MOD_ZU") called on %s\n",
            (void *)tls, buf, size,
            tls && tls->type == tls_slave ? "server" : "client"));
 
@@ -676,9 +676,9 @@ ssize_t tls_write(tls_t *tls, void *buf, size_t size)
     assert(tls->write_events == 0);
 
     if (tls->write_events ||
-       buf != tls->write_buffer || 
+       buf != tls->write_buffer ||
        size < tls->write_buffer_len) {
-      errno = EIO;             
+      errno = EIO;
       return -1;
     }
 
@@ -743,9 +743,9 @@ int tls_events(tls_t const *tls, int mask)
 
   if (tls->type == tls_master)
     return mask;
-  
+
   return
     (mask & ~(SU_WAIT_IN|SU_WAIT_OUT)) |
-    ((mask & SU_WAIT_IN) ? tls->read_events : 0) | 
+    ((mask & SU_WAIT_IN) ? tls->read_events : 0) |
     ((mask & SU_WAIT_OUT) ? tls->write_events : 0);
 }
index 6ab6f781ceb6cb8e86a68a3a9eb5702dd600da18..ad9d086672fceb08d42dd656d35747145e47aebf 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef TPORT_TLS_H
 /** Defined when <tport_tls.h> has been included. */
 #define TPORT_TLS_H
-/**@internal 
+/**@internal
  * @file tport_tls.h
  * @brief Internal TLS interface
  *
@@ -58,7 +58,7 @@ typedef struct tls_issues_s {
   char *cipher;         /* Should be one of the above defined ciphers *
                         * or NULL (default: "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
                          */
-  int   version;       /* For tls1, version is 1. When ssl3/ssl2 is 
+  int   version;       /* For tls1, version is 1. When ssl3/ssl2 is
                         * used, it is 0. */
 } tls_issues_t;
 
index 93affa56a64f249174421959dd87473ca5703b46..7401ff37a5db7e6eb2210fa92a1def2dfbe4a6de 100644 (file)
 #include <sofia-sip/http_header.h>
 
 static int tport_http_connect_init_primary(tport_primary_t *,
-                                          tp_name_t tpn[1], 
-                                          su_addrinfo_t *, 
+                                          tp_name_t tpn[1],
+                                          su_addrinfo_t *,
                                           tagi_t const *,
                                           char const **return_culprit);
 
 static void tport_http_connect_deinit_primary(tport_primary_t *);
 
-static tport_t *tport_http_connect(tport_primary_t *pri, su_addrinfo_t *ai, 
+static tport_t *tport_http_connect(tport_primary_t *pri, su_addrinfo_t *ai,
                                   tp_name_t const *tpn);
 
 static void tport_http_deliver(tport_t *self, msg_t *msg, su_time_t now);
@@ -94,8 +94,8 @@ tport_vtable_t const tport_http_connect_vtable =
 };
 
 static int tport_http_connect_init_primary(tport_primary_t *pri,
-                                          tp_name_t tpn[1], 
-                                          su_addrinfo_t *ai, 
+                                          tp_name_t tpn[1],
+                                          su_addrinfo_t *ai,
                                           tagi_t const *tags,
                                           char const **return_culprit)
 {
@@ -122,13 +122,13 @@ static int tport_http_connect_init_primary(tport_primary_t *pri,
     port = "8080";
 
   memcpy(hints, ai, sizeof hints);
-  
+
   hints->ai_flags = 0;
   hints->ai_addr = NULL;
   hints->ai_addrlen = 0;
   hints->ai_next = NULL;
   hints->ai_canonname = NULL;
-  
+
   error = su_getaddrinfo(host, port, hints, &thc->thc_proxy);
   if (error)
     return *return_culprit = "su_getaddrinfo", -1;
@@ -139,24 +139,24 @@ static int tport_http_connect_init_primary(tport_primary_t *pri,
 static void tport_http_connect_deinit_primary(tport_primary_t *pri)
 {
   tport_http_connect_t *thc = (tport_http_connect_t *)pri;
-  
+
   su_freeaddrinfo(thc->thc_proxy), thc->thc_proxy = NULL;
 }
 
-static tport_t *tport_http_connect(tport_primary_t *pri, su_addrinfo_t *ai, 
+static tport_t *tport_http_connect(tport_primary_t *pri, su_addrinfo_t *ai,
                                   tp_name_t const *tpn)
 {
   tport_http_connect_t *thc = (tport_http_connect_t *)pri;
   tport_http_connect_instance_t *thci;
   tport_master_t *mr = pri->pri_master;
-  
+
   msg_t *msg, *response;
 
   char hostport[TPORT_HOSTPORTSIZE];
 
   tport_t *tport;
   http_request_t *rq;
-  
+
   msg = msg_create(http_default_mclass(), 0);
 
   if (!msg)
@@ -167,21 +167,21 @@ static tport_t *tport_http_connect(tport_primary_t *pri, su_addrinfo_t *ai,
   rq = http_request_format(msg_home(msg), "CONNECT %s HTTP/1.1", hostport);
 
   if (msg_header_insert(msg, NULL, (void *)rq) < 0
-      || msg_header_add_str(msg, NULL, 
+      || msg_header_add_str(msg, NULL,
                            "User-Agent: Sofia-SIP/" VERSION "\n") < 0
       || msg_header_add_str(msg, NULL, "Proxy-Connection: keepalive\n") < 0
       || msg_header_add_make(msg, NULL, http_host_class, hostport) < 0
-      || msg_header_add_make(msg, NULL, http_separator_class, "\r\n") < 0 
+      || msg_header_add_make(msg, NULL, http_separator_class, "\r\n") < 0
       || msg_serialize(msg, NULL) < 0
       || msg_prepare(msg) < 0)
     return (void)msg_destroy(msg), NULL;
 
-  /* 
-   * Create a response message that ignores the body 
-   * if there is no Content-Length 
+  /*
+   * Create a response message that ignores the body
+   * if there is no Content-Length
    */
   response = msg_create(http_default_mclass(), mr->mr_log | MSG_FLG_MAILBOX);
-  
+
   tport = tport_base_connect(pri, thc->thc_proxy, ai, tpn);
   if (!tport) {
     msg_destroy(msg); msg_destroy(response);
@@ -189,17 +189,17 @@ static tport_t *tport_http_connect(tport_primary_t *pri, su_addrinfo_t *ai,
   }
 
   thci = (tport_http_connect_instance_t*)tport;
-  
+
   thci->thci_response = response;
   tport->tp_msg = response;
   msg_set_next(response, thci->thci_stackmsg = tport_msg_alloc(tport, 512));
 
   if (tport_send_msg(tport, msg, tpn, NULL) < 0) {
     SU_DEBUG_9(("tport_send_msg failed in tpot_http_connect\n"));
-    msg_destroy(msg); 
+    msg_destroy(msg);
     tport_zap_secondary(tport);
     return NULL;
-  }  
+  }
 
   tport_set_secondary_timer(tport);
 
@@ -217,7 +217,7 @@ static void tport_http_deliver(tport_t *self, msg_t *msg, su_time_t now)
     http_t *http = http_object(msg);
 
     if (http && http->http_status) {
-      SU_DEBUG_0(("tport_http_connect: %u %s\n", 
+      SU_DEBUG_0(("tport_http_connect: %u %s\n",
                  http->http_status->st_status,
                  http->http_status->st_phrase));
       if (http->http_status->st_status < 300) {
index 8c435293556a1583f22a1877ecd8f6072831767d..014aa479fb999c6ad656eb10cdf643c12ad17e1e 100644 (file)
@@ -67,7 +67,7 @@ enum { MAX_STREAMS = 1 };
 typedef struct tport_sctp_t
 {
   tport_t sctp_base[1];
-  
+
   msg_t *sctp_recv[MAX_STREAMS];
   struct sctp_send {
     msg_t *ss_msg;
@@ -80,17 +80,17 @@ typedef struct tport_sctp_t
 
 #define TP_SCTP_MSG_MAX (65536)
 
-static int tport_sctp_init_primary(tport_primary_t *, 
-                                  tp_name_t tpn[1], 
+static int tport_sctp_init_primary(tport_primary_t *,
+                                  tp_name_t tpn[1],
                                   su_addrinfo_t *, tagi_t const *,
                                   char const **return_culprit);
-static int tport_sctp_init_client(tport_primary_t *, 
-                                 tp_name_t tpn[1], 
+static int tport_sctp_init_client(tport_primary_t *,
+                                 tp_name_t tpn[1],
                                  su_addrinfo_t *, tagi_t const *,
                                  char const **return_culprit);
 static int tport_sctp_init_secondary(tport_t *self, int socket, int accepted,
                                     char const **return_reason);
-static int tport_sctp_init_socket(tport_primary_t *pri, 
+static int tport_sctp_init_socket(tport_primary_t *pri,
                                  int socket,
                                  char const **return_reason);
 static int tport_recv_sctp(tport_t *self);
@@ -148,7 +148,7 @@ tport_vtable_t const tport_sctp_vtable =
   tport_sctp_timer,
 };
 
-static int tport_sctp_init_primary(tport_primary_t *pri, 
+static int tport_sctp_init_primary(tport_primary_t *pri,
                                   tp_name_t tpn[1],
                                   su_addrinfo_t *ai,
                                   tagi_t const *tags,
@@ -166,11 +166,11 @@ static int tport_sctp_init_primary(tport_primary_t *pri,
 
   if (tport_sctp_init_socket(pri, socket, return_culprit) < 0)
     return -1;
-  
+
   return tport_stream_init_primary(pri, socket, tpn, ai, tags, return_culprit);
 }
 
-static int tport_sctp_init_client(tport_primary_t *pri, 
+static int tport_sctp_init_client(tport_primary_t *pri,
                                  tp_name_t tpn[1],
                                  su_addrinfo_t *ai,
                                  tagi_t const *tags,
@@ -197,7 +197,7 @@ static int tport_sctp_init_secondary(tport_t *self, int socket, int accepted,
 }
 
 /** Initialize a SCTP socket */
-static int tport_sctp_init_socket(tport_primary_t *pri, 
+static int tport_sctp_init_socket(tport_primary_t *pri,
                                  int socket,
                                  char const **return_reason)
 {
@@ -215,11 +215,11 @@ static int tport_sctp_init_socket(tport_primary_t *pri,
 /** Receive data available on the socket.
  *
  * @retval -1 error
- * @retval 0  end-of-stream  
+ * @retval 0  end-of-stream
  * @retval 1  normal receive
  * @retval 2  incomplete recv, recv again
  */
-static 
+static
 int tport_recv_sctp(tport_t *self)
 {
   msg_t *msg;
@@ -266,14 +266,14 @@ int tport_recv_sctp(tport_t *self)
 static ssize_t tport_send_sctp(tport_t const *self, msg_t *msg,
                               msg_iovec_t iov[], size_t iovused)
 {
-  
+
 
   return su_vsend(self->tp_socket, iov, iovused, MSG_NOSIGNAL, NULL, 0);
 }
 
 /** Calculate tick timer if send is pending. */
 int tport_next_sctp_send_tick(tport_t *self,
-                           su_time_t *return_target, 
+                           su_time_t *return_target,
                            char const **return_why)
 {
   unsigned timeout = 100;  /* Retry 10 times a second... */
@@ -293,7 +293,7 @@ void tport_sctp_send_tick_timer(tport_t *self, su_time_t now)
   unsigned timeout = 100;
 
   /* Send timeout */
-  if (tport_has_queued(self) && 
+  if (tport_has_queued(self) &&
       su_time_cmp(su_time_add(self->tp_ktime, timeout), now) < 0) {
     uint64_t bytes = self->tp_stats.sent_bytes;
     su_time_t stime = self->tp_stime;
@@ -307,10 +307,10 @@ void tport_sctp_send_tick_timer(tport_t *self, su_time_t now)
 
 /** Calculate next timer for SCTP. */
 int tport_sctp_next_timer(tport_t *self,
-                        su_time_t *return_target, 
+                        su_time_t *return_target,
                         char const **return_why)
 {
-  return 
+  return
     tport_next_recv_timeout(self, return_target, return_why) |
     tport_next_sctp_send_tick(self, return_target, return_why);
 }
index 2cfd96448fb149605f0662f8353d7734e8147955..018c2b65087b6e45f638cdac209d4498ae1b7cd7 100644 (file)
@@ -50,8 +50,8 @@
 #include <sofia-sip/stun.h>
 
 static int tport_udp_init_stun(tport_primary_t *,
-                              tp_name_t tpn[1], 
-                              su_addrinfo_t *, 
+                              tp_name_t tpn[1],
+                              su_addrinfo_t *,
                               tagi_t const *,
                               char const **return_culprit);
 
@@ -98,8 +98,8 @@ tport_vtable_t const tport_stun_vtable =
 };
 
 static int tport_udp_init_stun(tport_primary_t *pri,
-                              tp_name_t tpn[1], 
-                              su_addrinfo_t *ai, 
+                              tp_name_t tpn[1],
+                              su_addrinfo_t *ai,
                               tagi_t const *tags,
                               char const **return_culprit)
 {
@@ -121,7 +121,7 @@ static int tport_udp_init_stun(tport_primary_t *pri,
     return -1;
 
 #if 0
-  if (stun_obtain_shared_secret(sh, tport_stun_tls_cb, pri, 
+  if (stun_obtain_shared_secret(sh, tport_stun_tls_cb, pri,
                                TAG_NEXT(tags)) < 0) {
     return *return_culprit = "stun_request_shared_secret()", -1;
   }
@@ -142,8 +142,8 @@ static int tport_udp_init_stun(tport_primary_t *pri,
 
 static void tport_udp_deinit_stun(tport_primary_t *pri)
 {
-  if (pri->pri_stun_handle) 
-    stun_handle_destroy(pri->pri_stun_handle); 
+  if (pri->pri_stun_handle)
+    stun_handle_destroy(pri->pri_stun_handle);
   pri->pri_stun_handle = NULL;
 }
 
@@ -195,18 +195,18 @@ void tport_stun_bind_done(tport_primary_t *pri,
     char ipname[SU_ADDRSIZE + 2] = { 0 };
     ai->ai_addr = (void *)su;
 
-    SU_DEBUG_5(("%s: stun_bind() ok: local address NATed as %s:%u\n", 
+    SU_DEBUG_5(("%s: stun_bind() ok: local address NATed as %s:%u\n",
                __func__,
                su_inet_ntop(su->su_family, SU_ADDR(su),
                             ipname, sizeof(ipname)),
                (unsigned) ntohs(su->su_port)));
   }
 
-  /* Send message to calling application indicating 
-   * there's a new public address available 
+  /* Send message to calling application indicating
+   * there's a new public address available
    */
   tport_has_been_updated(self);
-  
+
   return;
 }
 
@@ -221,12 +221,12 @@ int tport_stun_keepalive(tport_t *tp, su_addrinfo_t const *ai,
   tport_primary_t *pri = tp->tp_pri;
   int err;
 
-  err = stun_keepalive(pri->pri_stun_handle, 
+  err = stun_keepalive(pri->pri_stun_handle,
                       (su_sockaddr_t *)ai->ai_addr,
                       STUNTAG_SOCKET(tp->tp_socket),
                       STUNTAG_TIMEOUT(10000),
                       TAG_NEXT(taglist));
-  
+
   if (err < 0)
     return -1;
 
index 38b06aa6177e45047e83484cc17431d9b0e8aa73..ec87db586d9e2a772bee567acf68c5c430e4535e 100644 (file)
@@ -111,7 +111,7 @@ tport_vtable_t const tport_tcp_client_vtable =
 
 static int tport_tcp_setsndbuf(int socket, int atleast);
 
-int tport_tcp_init_primary(tport_primary_t *pri, 
+int tport_tcp_init_primary(tport_primary_t *pri,
                           tp_name_t tpn[1],
                           su_addrinfo_t *ai,
                           tagi_t const *tags,
@@ -129,7 +129,7 @@ int tport_tcp_init_primary(tport_primary_t *pri,
   return tport_stream_init_primary(pri, socket, tpn, ai, tags, return_culprit);
 }
 
-int tport_stream_init_primary(tport_primary_t *pri, 
+int tport_stream_init_primary(tport_primary_t *pri,
                              su_socket_t socket,
                              tp_name_t tpn[1],
                              su_addrinfo_t *ai,
@@ -168,7 +168,7 @@ int tport_stream_init_primary(tport_primary_t *pri,
   return 0;
 }
 
-int tport_tcp_init_client(tport_primary_t *pri, 
+int tport_tcp_init_client(tport_primary_t *pri,
                          tp_name_t tpn[1],
                          su_addrinfo_t *ai,
                          tagi_t const *tags,
@@ -223,7 +223,7 @@ static inline size_t ws_span(void *buffer, size_t len)
 {
   size_t i;
   char const *b = buffer;
-  
+
   for (i = 0; i < len; i++) {
     if (b[i] != '\r' && b[i] != '\n' && b[i] != ' ' && b[i] != '\t')
       break;
@@ -235,10 +235,10 @@ static inline size_t ws_span(void *buffer, size_t len)
 /** Receive from stream.
  *
  * @retval -1 error
- * @retval 0  end-of-stream  
+ * @retval 0  end-of-stream
  * @retval 1  normal receive
  * @retval 2  incomplete recv, recv again
- * 
+ *
  */
 int tport_recv_stream(tport_t *self)
 {
@@ -343,8 +343,8 @@ int tport_recv_stream(tport_t *self)
 }
 
 /** Send to stream */
-ssize_t tport_send_stream(tport_t const *self, msg_t *msg, 
-                         msg_iovec_t iov[], 
+ssize_t tport_send_stream(tport_t const *self, msg_t *msg,
+                         msg_iovec_t iov[],
                          size_t iovused)
 {
 #if __sun__                    /* XXX - there must be a better way... */
@@ -356,7 +356,7 @@ ssize_t tport_send_stream(tport_t const *self, msg_t *msg,
 
 /** Calculate timeout if receive is incomplete. */
 int tport_next_recv_timeout(tport_t *self,
-                           su_time_t *return_target, 
+                           su_time_t *return_target,
                            char const **return_why)
 {
   unsigned timeout = self->tp_params->tpp_timeout;
@@ -388,7 +388,7 @@ void tport_recv_timeout_timer(tport_t *self, su_time_t now)
   unsigned timeout = self->tp_params->tpp_timeout;
 
   if (timeout < INT_MAX) {
-    if (self->tp_msg && 
+    if (self->tp_msg &&
        su_time_cmp(su_time_add(self->tp_rtime, timeout), now) < 0) {
       msg_t *msg = self->tp_msg;
       msg_set_streaming(msg, 0);
@@ -399,7 +399,7 @@ void tport_recv_timeout_timer(tport_t *self, su_time_t now)
 
 #if 0
     /* Send timeout */
-    if (tport_has_queued(self) && 
+    if (tport_has_queued(self) &&
        su_time_cmp(su_time_add(self->tp_stime, timeout), now) < 0) {
       stime = su_time_add(self->tp_stime, self->tp_params->tpp_timeout);
       if (su_time_cmp(stime, target) < 0)
@@ -411,7 +411,7 @@ void tport_recv_timeout_timer(tport_t *self, su_time_t now)
 
 /** Calculate next timeout for keepalive */
 int tport_next_keepalive(tport_t *self,
-                        su_time_t *return_target, 
+                        su_time_t *return_target,
                         char const **return_why)
 {
   /* Keepalive timer */
@@ -446,9 +446,9 @@ void tport_keepalive_timer(tport_t *self, su_time_t now)
   if (timeout != 0) {
     if (self->tp_ptime.tv_sec && !self->tp_recv_close &&
        su_time_cmp(su_time_add(self->tp_ptime, timeout), now) < 0) {
-      SU_DEBUG_3(("%s(%p): %s to " TPN_FORMAT "%s\n", 
+      SU_DEBUG_3(("%s(%p): %s to " TPN_FORMAT "%s\n",
                  __func__, (void *)self,
-                 "closing connection", TPN_ARGS(self->tp_name), 
+                 "closing connection", TPN_ARGS(self->tp_name),
                  " because of PONG timeout"));
       tport_error_report(self, EPIPE, NULL);
       if (!self->tp_closed)
@@ -488,8 +488,8 @@ int tport_tcp_ping(tport_t *self, su_time_t now)
     int error = su_errno();
 
     why = " failed";
-    
-    if (!su_is_blocking(error)) 
+
+    if (!su_is_blocking(error))
       tport_error_report(self, error, NULL);
     else
       why = " blocking";
@@ -497,7 +497,7 @@ int tport_tcp_ping(tport_t *self, su_time_t now)
     return -1;
   }
 
-  SU_DEBUG_7(("%s(%p): %s to " TPN_FORMAT "%s\n", 
+  SU_DEBUG_7(("%s(%p): %s to " TPN_FORMAT "%s\n",
              __func__, (void *)self,
              "sending PING", TPN_ARGS(self->tp_name), why));
 
@@ -512,7 +512,7 @@ int tport_tcp_pong(tport_t *self)
   if (tport_has_queued(self) || !self->tp_params->tpp_pong2ping)
     return 0;
 
-  SU_DEBUG_7(("%s(%p): %s to " TPN_FORMAT "%s\n", 
+  SU_DEBUG_7(("%s(%p): %s to " TPN_FORMAT "%s\n",
              __func__, (void *)self,
              "sending PONG", TPN_ARGS(self->tp_name), ""));
 
@@ -521,10 +521,10 @@ int tport_tcp_pong(tport_t *self)
 
 /** Calculate next timer for TCP. */
 int tport_tcp_next_timer(tport_t *self,
-                        su_time_t *return_target, 
+                        su_time_t *return_target,
                         char const **return_why)
 {
-  return 
+  return
     tport_next_recv_timeout(self, return_target, return_why) |
     tport_next_keepalive(self, return_target, return_why);
 }
index 0a97f73ac61efcd5accf7aa42be016527bd93086..643e181bcd4c318cc9976992565fb1e2b4e3a36f 100644 (file)
 #include "tport_tls.h"
 
 static int tport_tls_init_primary(tport_primary_t *,
-                                 tp_name_t tpn[1], 
+                                 tp_name_t tpn[1],
                                  su_addrinfo_t *, tagi_t const *,
                                  char const **return_culprit);
 static int tport_tls_init_client(tport_primary_t *,
-                                tp_name_t tpn[1], 
+                                tp_name_t tpn[1],
                                 su_addrinfo_t *, tagi_t const *,
                                 char const **return_culprit);
 static int tport_tls_init_master(tport_primary_t *pri,
@@ -180,7 +180,7 @@ static int tport_tls_init_master(tport_primary_t *pri,
       homedir = "";
     path = tbf = su_sprintf(autohome, "%s/.sip/auth", homedir);
   }
-  
+
   if (path) {
     ti.verify_depth = 2;
     ti.configured = path != tbf;
@@ -248,7 +248,7 @@ static void tport_tls_deinit_secondary(tport_t *self)
   tport_tls_t *tlstp = (tport_tls_t *)self;
 
   /* XXX - PPe: does the tls_shutdown zap everything but socket? */
-  if (tlstp->tlstp_context != NULL) 
+  if (tlstp->tlstp_context != NULL)
     tls_free(tlstp->tlstp_context);
   tlstp->tlstp_context = NULL;
 
@@ -277,16 +277,16 @@ int tport_tls_set_events(tport_t const *self)
   int mask = tls_events(tlstp->tlstp_context, self->tp_events);
 
   SU_DEBUG_7(("%s(%p): logical events%s%s real%s%s\n",
-             "tport_tls_set_events", (void *)self, 
+             "tport_tls_set_events", (void *)self,
              (self->tp_events & SU_WAIT_IN) ? " IN" : "",
              (self->tp_events & SU_WAIT_OUT) ? " OUT" : "",
              (mask & SU_WAIT_IN) ? " IN" : "",
              (mask & SU_WAIT_OUT) ? " OUT" : ""));
 
   return
-    su_root_eventmask(self->tp_master->mr_root, 
-                     self->tp_index, 
-                     self->tp_socket, 
+    su_root_eventmask(self->tp_master->mr_root,
+                     self->tp_index,
+                     self->tp_socket,
                      mask);
 }
 
@@ -307,7 +307,7 @@ int tport_tls_events(tport_t *self, int events)
     else if (ret < 0)
       tport_error_report(self, errno, NULL);
   }
-  
+
   if ((self->tp_events & SU_WAIT_IN) && !self->tp_closed) {
     for (;;) {
       ret = tls_want_read(tlstp->tlstp_context, events);
@@ -344,15 +344,15 @@ int tport_tls_events(tport_t *self, int events)
     return 0;
 
   SU_DEBUG_7(("%s(%p): logical events%s%s real%s%s\n",
-             "tport_tls_events", (void *)self, 
+             "tport_tls_events", (void *)self,
              (events & SU_WAIT_IN) ? " IN" : "",
              (events & SU_WAIT_OUT) ? " OUT" : "",
              (mask & SU_WAIT_IN) ? " IN" : "",
              (mask & SU_WAIT_OUT) ? " OUT" : ""));
 
-  su_root_eventmask(self->tp_master->mr_root, 
-                   self->tp_index, 
-                   self->tp_socket, 
+  su_root_eventmask(self->tp_master->mr_root,
+                   self->tp_index,
+                   self->tp_socket,
                    mask);
 
   return 0;
@@ -361,12 +361,12 @@ int tport_tls_events(tport_t *self, int events)
 /** Receive data from TLS.
  *
  * @retval -1 error
- * @retval 0  end-of-stream  
+ * @retval 0  end-of-stream
  * @retval 1  normal receive
  * @retval 2  incomplete recv, recv again
- * 
+ *
  */
-static 
+static
 int tport_tls_recv(tport_t *self)
 {
   tport_tls_t *tlstp = (tport_tls_t *)self;
@@ -407,7 +407,7 @@ int tport_tls_recv(tport_t *self)
     memcpy(iovec[i].mv_base, tls_buf + n, m);
     n += m;
   }
-    
+
   assert(N == n);
 
   /* Write the received data to the message dump file */
@@ -449,7 +449,7 @@ ssize_t tport_tls_send(tport_t const *self,
 
   for (i = 0; i < iovlen; i = j) {
 #if 0
-    nerror = tls_write(tlstp->tlstp_context, 
+    nerror = tls_write(tlstp->tlstp_context,
                  iov[i].siv_base,
                  m = iov[i].siv_len);
     j = i + 1;
@@ -460,7 +460,7 @@ ssize_t tport_tls_send(tport_t const *self,
     if (i + 1 == iovlen)
       buf = NULL;              /* Don't bother copying single chunk */
 
-    if (buf && 
+    if (buf &&
        (char *)iov[i].siv_base - buf < TLSBUFSIZE &&
        (char *)iov[i].siv_base - buf >= 0) {
       tlsbufsize = buf + TLSBUFSIZE - (char *)iov[i].siv_base;
@@ -483,8 +483,8 @@ ssize_t tport_tls_send(tport_t const *self,
     nerror = tls_write(tlstp->tlstp_context, buf, m);
 #endif
 
-    SU_DEBUG_9(("tport_tls_writevec: vec %p %p %lu ("MOD_ZD")\n",  
-               (void *)tlstp->tlstp_context, (void *)iov[i].siv_base, (LU)iov[i].siv_len, 
+    SU_DEBUG_9(("tport_tls_writevec: vec %p %p %lu ("MOD_ZD")\n",
+               (void *)tlstp->tlstp_context, (void *)iov[i].siv_base, (LU)iov[i].siv_len,
                nerror));
 
     if (nerror == -1) {
index b3bde6e3f62033f0b0fdef74fddb41d816e398f3..bacc266806660deaf2a649a10535d700c3cf1ef1 100644 (file)
@@ -131,16 +131,16 @@ int tport_udp_init_primary(tport_primary_t *pri,
   tport_set_tos(s, ai, pri->pri_params->tpp_tos);
 
 #if HAVE_IP_ADD_MEMBERSHIP
-  if (ai->ai_family == AF_INET && 
+  if (ai->ai_family == AF_INET &&
       IN_MULTICAST(ntohl(su->su_sin.sin_addr.s_addr))) {
     /* Try to join to the multicast group */
-    /* Bind to the SIP address like 
+    /* Bind to the SIP address like
        <sip:88.77.66.55:5060;maddr=224.0.1.75;transport=udp> */
     struct ip_mreq imr[1];
     struct in_addr iface;
 
     memset(imr, 0, sizeof imr);
-      
+
     imr->imr_multiaddr = su->su_sin.sin_addr;
 
     if (host_is_ip4_address(tpn->tpn_canon) &&
@@ -153,7 +153,7 @@ int tport_udp_init_primary(tport_primary_t *pri,
                  "IP_ADD_MEMBERSHIP", su_strerror(su_errno())));
     }
 #if HAVE_IP_MULTICAST_LOOP
-    else 
+    else
       if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &one, sizeof one) < 0) {
        SU_DEBUG_3(("setsockopt(%s): %s\n",
                    "IP_MULTICAST_LOOP", su_strerror(su_errno())));
@@ -191,26 +191,26 @@ int tport_udp_init_primary(tport_primary_t *pri,
   }
 #endif
 
-  tl_gets(tags, 
+  tl_gets(tags,
          TPTAG_UDP_RMEM_REF(rmem),
          TPTAG_UDP_WMEM_REF(wmem),
          TAG_END());
 
-  if (rmem != 0 && 
+  if (rmem != 0 &&
 #if HAVE_SO_RCVBUFFORCE
       setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, (void *)&rmem, sizeof rmem) < 0 &&
 #endif
       setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void *)&rmem, sizeof rmem) < 0) {
-    SU_DEBUG_3(("setsockopt(SO_RCVBUF): %s\n", 
+    SU_DEBUG_3(("setsockopt(SO_RCVBUF): %s\n",
                su_strerror(su_errno())));
   }
 
-  if (wmem != 0 && 
+  if (wmem != 0 &&
 #if HAVE_SO_SNDBUFFORCE
       setsockopt(s, SOL_SOCKET, SO_SNDBUFFORCE, (void *)&wmem, sizeof wmem) < 0 &&
 #endif
       setsockopt(s, SOL_SOCKET, SO_SNDBUF, (void *)&wmem, sizeof wmem) < 0) {
-    SU_DEBUG_3(("setsockopt(SO_SNDBUF): %s\n", 
+    SU_DEBUG_3(("setsockopt(SO_SNDBUF): %s\n",
                su_strerror(su_errno())));
   }
 
@@ -255,7 +255,7 @@ static void tport_check_trunc(tport_t *tp, su_addrinfo_t *ai)
     return;
 
   for (;;) {
-    n = su_recvfrom(tp->tp_socket, buffer, sizeof buffer, MSG_TRUNC, 
+    n = su_recvfrom(tp->tp_socket, buffer, sizeof buffer, MSG_TRUNC,
                    (void *)&su, &sulen);
 
     if (n > (ssize_t)sizeof buffer) {
@@ -273,7 +273,7 @@ static void tport_check_trunc(tport_t *tp, su_addrinfo_t *ai)
 /** Receive datagram.
  *
  * @retval -1 error
- * @retval 0  end-of-stream  
+ * @retval 0  end-of-stream
  * @retval 1  normal receive (should never happen)
  * @retval 2  incomplete recv, call me again (should never happen)
  * @retval 3  STUN keepalive, ignore
@@ -289,7 +289,7 @@ int tport_recv_dgram(tport_t *self)
   uint8_t sample[1];
 
   /* Simulate packet loss */
-  if (self->tp_params->tpp_drop && 
+  if (self->tp_params->tpp_drop &&
       (unsigned)su_randint(0, 1000) < self->tp_params->tpp_drop) {
     su_recv(self->tp_socket, sample, 1, 0);
     SU_DEBUG_3(("tport(%p): simulated packet loss!\n", (void *)self));
@@ -326,9 +326,9 @@ int tport_recv_dgram(tport_t *self)
   from = (su_sockaddr_t *)ai->ai_addr, fromlen = (socklen_t)(ai->ai_addrlen);
 
   n = su_vrecv(self->tp_socket, iovec, veclen, 0, from, &fromlen);
-  
+
   ai->ai_addrlen = fromlen;
-  
+
   if (n == SOCKET_ERROR) {
     int error = su_errno();
     msg_destroy(msg); self->tp_msg = NULL;
@@ -360,7 +360,7 @@ int tport_recv_dgram(tport_t *self)
 
   if ((sample[0] & 0xf8) == 0xf8)
     /* SigComp */
-    return tport_recv_comp_dgram(self, self->tp_comp, &self->tp_msg, 
+    return tport_recv_comp_dgram(self, self->tp_comp, &self->tp_msg,
                                 from, fromlen);
 #if HAVE_SOFIA_STUN
   else if (sample[0] == 0 || sample[0] == 1)
@@ -372,8 +372,8 @@ int tport_recv_dgram(tport_t *self)
 }
 
 /** Send using su_vsend(). Map IPv4 addresses as IPv6 addresses, if needed. */
-ssize_t tport_send_dgram(tport_t const *self, msg_t *msg, 
-                        msg_iovec_t iov[], 
+ssize_t tport_send_dgram(tport_t const *self, msg_t *msg,
+                        msg_iovec_t iov[],
                         size_t iovused)
 {
   su_sockaddr_t su[1];
@@ -481,12 +481,12 @@ int tport_udp_error(tport_t const *self, su_sockaddr_t name[1])
        break;
       case SO_EE_ORIGIN_ICMP:
        origin = "icmp";
-       snprintf(info, sizeof(info), " type=%u code=%u", 
+       snprintf(info, sizeof(info), " type=%u code=%u",
                 ee->ee_type, ee->ee_code);
        break;
       case SO_EE_ORIGIN_ICMP6:
        origin = "icmp6";
-       snprintf(info, sizeof(info), " type=%u code=%u", 
+       snprintf(info, sizeof(info), " type=%u code=%u",
                ee->ee_type, ee->ee_code);
        break;
       case SO_EE_ORIGIN_NONE:
@@ -498,11 +498,11 @@ int tport_udp_error(tport_t const *self, su_sockaddr_t name[1])
       }
 
       if (ee->ee_info)
-       snprintf(info + strlen(info), sizeof(info) - strlen(info), 
+       snprintf(info + strlen(info), sizeof(info) - strlen(info),
                 " info=%08x", ee->ee_info);
 
       SU_DEBUG_3(("%s: %s (%d) [%s%s]\n",
-                 __func__, su_strerror(ee->ee_errno), ee->ee_errno, 
+                 __func__, su_strerror(ee->ee_errno), ee->ee_errno,
                  origin, info));
       if (from->su_family != AF_UNSPEC)
        SU_DEBUG_3(("\treported by [%s]:%u\n",
index ef4a339853711721c7018ce7e8b0fa29ab577c7e..68f1b5eb8bebfad721f2233ac48221a347b2b76b 100644 (file)
@@ -34,7 +34,7 @@
 #ifndef URL_H_TYPES
 #define URL_H_TYPES
 
-/** Recognized URL schemes (value of url_t.url_type). 
+/** Recognized URL schemes (value of url_t.url_type).
  *
  * @sa &lt;<a href="http://www.iana.org/assignments/uri-schemes.html">http://www.iana.org/assignments/uri-schemes.html</a>&gt;
  */
@@ -63,12 +63,12 @@ enum url_type_e {
   _url_none
 };
 
-/** URL structure. 
- * 
+/** URL structure.
+ *
  * This structure is used to present a parsed URL.
  */
 typedef struct {
-  char                url_pad[sizeof(void *) - 2];   
+  char                url_pad[sizeof(void *) - 2];
                                    /**< Zero pad for URL_STRING_P(). */
   signed char         url_type;            /**< URL type (url_type_e). */
   char                url_root;            /**< Nonzero if root "//" */
@@ -83,13 +83,13 @@ typedef struct {
   char const         *url_fragment; /**< Fragment (separated by #) */
 } url_t;
 
-enum { 
+enum {
   /** Maximum size of a URL. */
   URL_MAXLEN = 65536
 };
 
 /** Type to present either a parsed URL or string.
- * 
+ *
  * The union type url_string_t is used to pass a parsed URL or string as a
  * parameter. The URL_STRING_P() checks if a passed pointer points to a
  * string or a parsed URL. Testing requires that the first character of the
@@ -113,7 +113,7 @@ typedef union {
 
 SOFIA_BEGIN_DECLS
 
-/** Convert a string to a url struct. */ 
+/** Convert a string to a url struct. */
 SOFIAPUBFUN url_t *url_make(su_home_t *h, char const *str);
 
 /** Convert a string formatting result to a url struct. */
@@ -122,7 +122,7 @@ SOFIAPUBFUN url_t *url_format(su_home_t *h, char const *fmt, ...);
 /** Convert #url_t to a string allocated from @a home */
 SOFIAPUBFUN char *url_as_string(su_home_t *home, url_t const *url);
 
-/** Duplicate the url to memory allocated via home */ 
+/** Duplicate the url to memory allocated via home */
 SOFIAPUBFUN url_t *url_hdup(su_home_t *h, url_t const *src);
 
 /** Sanitize a URL. */
@@ -169,7 +169,7 @@ SOFIAPUBFUN int url_have_transport(url_t const *u);
 /* Query handling */
 
 /** Convert a URL query to a header string. */
-SOFIAPUBFUN char *url_query_as_header_string(su_home_t *home, 
+SOFIAPUBFUN char *url_query_as_header_string(su_home_t *home,
                                             char const *query);
 
 /* ---------------------------------------------------------------------- */
@@ -195,8 +195,8 @@ SOFIAPUBFUN char *url_unescape(char *d, char const *s);
 /* ---------------------------------------------------------------------- */
 /* Initializing */
 
-/** Initializer for an #url_t structure. @HI 
- * 
+/** Initializer for an #url_t structure. @HI
+ *
  * The macro URL_INIT_AS() is used to initialize a #url_t structure with a
  * known url type:
  * @code
@@ -229,11 +229,11 @@ SOFIAPUBFUN char const *url_port(url_t const *u);
 /* ---------------------------------------------------------------------- */
 /* url_string_t handling */
 
-/** Test if a pointer to #url_string_t is a string 
+/** Test if a pointer to #url_string_t is a string
  * (not a pointer to a #url_t structure). */
 #define URL_STRING_P(u) ((u) && *((url_string_t*)(u))->us_str != 0)
 
-/** Test if a pointer to #url_string_t is a string 
+/** Test if a pointer to #url_string_t is a string
  * (not a pointer to a #url_t structure). */
 #define URL_IS_STRING(u) ((u) && *((url_string_t*)(u))->us_str != 0)
 
@@ -306,10 +306,10 @@ SOFIAPUBFUN issize_t url_e(char buffer[], isize_t n, url_t const *url);
 /** Calculate the size of srings attached to the url. */
 SOFIAPUBFUN isize_t url_xtra(url_t const * url);
 
-/** Duplicate the url in the provided memory area. */ 
+/** Duplicate the url in the provided memory area. */
 SOFIAPUBFUN issize_t url_dup(char *, isize_t , url_t *dst, url_t const *src);
 
-/** Duplicate the url: use @a buf up to @a end. @HI */ 
+/** Duplicate the url: use @a buf up to @a end. @HI */
 #define URL_DUP(buf, end, dst, src) \
   (buf) += url_dup((buf), (isize_t)((buf) < (end) ? (end) - (buf) : 0), (dst), (src))
 
index 16deafd2b3eb4abaeb0605129e1b58167099929f..5b2cf0b76031241bc58a9941ea473b341084b33c 100644 (file)
@@ -59,9 +59,9 @@ SOFIAPUBVAR tag_typedef_t urltag_url_ref;
 #define URLTAG_URL_REF(u)  urltag_url_ref, urltag_url_vr(&(u))
 
 #if SU_HAVE_INLINE
-su_inline 
+su_inline
 tag_value_t urltag_url_v(void const *v) { return (tag_value_t)v; }
-su_inline 
+su_inline
 tag_value_t urltag_url_vr(url_string_t const **vp) { return(tag_value_t)vp; }
 #else
 #define urltag_url_v(v)   (tag_value_t)(v)
index e64e589a3ddeff20c4a24e710c354e9bf26c51e5..6a524b308b40808822057b3d2aef380d0b09bb45 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef URL_TAG_CLASS_H
 /**Defined when <sofia-sip/url_tag_class.h> has been included. */
-#define URL_TAG_CLASS_H 
+#define URL_TAG_CLASS_H
 /**@file  url_tag_class.h
  * @brief Tag classes for URLs
  *
index 9a05516127f1befd2beaf33a9fc0053bbf80c15e..c23f78eef4065ab787e11c9e97371d99f7dfd6cb 100644 (file)
@@ -71,9 +71,9 @@ int test_quote(void)
                       "abcdefghijklmnopqrstuvwxyz" \
                       "0123456789" \
                       "-_.!~*'()"
-  
+
   char unreserved[26 + 26 + 10 + 9 + 1];
-  
+
   BEGIN();
 
   d = url_as_string(home, (url_t *)"sip:joe@example.com");
@@ -86,9 +86,9 @@ int test_quote(void)
   TEST_1(!url_reserved_p(""));
   TEST_1(url_reserved_p("foobar:bar"));
 
-  TEST_SIZE(url_esclen("a" EXCLUDED, ""), 
+  TEST_SIZE(url_esclen("a" EXCLUDED, ""),
            1 + strlen(RESERVED) + 3 * strlen(DELIMS UNWISE));
-  TEST_SIZE(url_esclen("a" EXCLUDED, DELIMS UNWISE), 
+  TEST_SIZE(url_esclen("a" EXCLUDED, DELIMS UNWISE),
            1 + strlen(RESERVED) + 3 * strlen(DELIMS UNWISE));
   TEST_SIZE(url_esclen("a" EXCLUDED, EXCLUDED), 1 + 3 * strlen(EXCLUDED));
   TEST_SIZE(url_esclen("a" EXCLUDED, NULL), 1 + 3 * strlen(EXCLUDED));
@@ -184,14 +184,14 @@ int test_any(void)
   TEST_1(u = url_hdup(home, url));
   TEST(u->url_type, url_any);
   TEST(url_cmp(any, u), 0);
-  
+
   url_digest(hash1, sizeof(hash1), url, NULL);
   url_digest(hash2, sizeof(hash2), (url_t *)"*", NULL);
   TEST(memcmp(hash1, hash2, sizeof(hash1)), 0);
 
   {
     char buf[6];
-    
+
     TEST_1(u = url_hdup(home, (void *)"error"));
     TEST_SIZE(url_xtra(u), 6);
     TEST_SIZE(url_dup(buf, 6, url, u), 6);
@@ -227,7 +227,7 @@ int test_any(void)
   }
 
   su_home_deinit(home);
-  
+
   END();
 }
 
@@ -238,17 +238,17 @@ int test_sip(void)
   url_t sip[1] = { URL_INIT_AS(sip) };
   url_t *u, url[1];
   char *tst, *s;
-  char sipurl0[] = 
+  char sipurl0[] =
     "sip:pekka%2Epessi@nokia%2Ecom;method=%4D%45%53%53%41%47%45"
     "?body=CANNED%20MSG";
-  char sipurl[] = 
+  char sipurl[] =
     "sip:user:pass@host:32;param=1"
     "?From=foo@bar&To=bar@baz#unf";
-  char sip2url[] = 
+  char sip2url[] =
     "sip:user/path;tel-param:pass@host:32;param=1%3d%3d1"
     "?From=foo@bar&To=bar@baz#unf";
   char sip2[sizeof(sipurl) + 32];
-  char sipsurl[] = 
+  char sipsurl[] =
     "sips:user:pass@host:32;param=1"
     "?From=foo@bar&To=bar@baz#unf";
   size_t i, j;
@@ -277,7 +277,7 @@ int test_sip(void)
 
   TEST_S(url_query_as_header_string(home, url->url_headers),
         "\n\nCANNED MSG");
-  
+
   sip->url_user = "user";
   sip->url_password = "pass";
   sip->url_host = "host";
@@ -297,7 +297,7 @@ int test_sip(void)
   TEST_1(url_cmp(sip, u) == 0);
   TEST(url_e(sip2, sizeof(sip2), u), strlen(sipurl));
   TEST_1(strcmp(sip2, sipurl) == 0);
-  TEST_SIZE(snprintf(sip2, sizeof(sip2), URL_PRINT_FORMAT, 
+  TEST_SIZE(snprintf(sip2, sizeof(sip2), URL_PRINT_FORMAT,
                     URL_PRINT_ARGS(sip)), strlen(sipurl));
   TEST_1(strcmp(sip2, sipurl) == 0);
 
@@ -395,11 +395,11 @@ int test_sip(void)
 
   u = url_hdup(home, (void*)"sip:u:p@host:5060;user=phone;transport=tcp");
   TEST_1(u);
-  TEST_1(url_have_transport(u));  
+  TEST_1(url_have_transport(u));
   TEST_1(url_strip_transport(u));
   TEST_S(u->url_params, "user=phone");
   TEST_1(!url_have_transport(u));
-  
+
   u = url_hdup(home, (void*)"sip:u:p@host;user=phone;;");
   TEST_1(u);
   /* We don't have transport params */
@@ -470,14 +470,14 @@ int test_wv(void)
   char *tst;
   char wvurl[] = "wv:+12345678@imps.com";
   char wv2[sizeof(wvurl) + 32];
-  
+
   BEGIN();
 
   TEST_S(url_scheme(url_wv), "wv");
 
   wv->url_user = "+12345678";
   wv->url_host = "imps.com";
-  
+
   TEST_1(tst = su_strdup(home, wvurl));
   TEST_1(url_d(url, tst) == 0);
   TEST_1(url_cmp(wv, url) == 0);
@@ -488,7 +488,7 @@ int test_wv(void)
   TEST_1(url_cmp(wv, u) == 0);
   TEST_SIZE(url_e(wv2, sizeof(wv2), u), strlen(wvurl));
   TEST_1(strcmp(wv2, wvurl) == 0);
-  TEST_SIZE(snprintf(wv2, sizeof(wv2), URL_PRINT_FORMAT, 
+  TEST_SIZE(snprintf(wv2, sizeof(wv2), URL_PRINT_FORMAT,
                     URL_PRINT_ARGS(wv)), strlen(wvurl));
   TEST_1(strcmp(wv2, wvurl) == 0);
 
@@ -512,13 +512,13 @@ int test_tel(void)
   url_t tel[1] = { URL_INIT_AS(tel) };
   url_t *u, url[1];
   char *tst;
-  char telurl[] = 
+  char telurl[] =
     "tel:+12345678"
     ";param=1;param=2"
     "?From=foo@bar&To=bar@baz#unf";
   char tel2[sizeof(telurl) + 32];
   url_t *a, *b;
-  
+
   BEGIN();
 
   TEST_S(url_scheme(url_tel), "tel");
@@ -527,7 +527,7 @@ int test_tel(void)
   tel->url_params = "param=1;param=2";
   tel->url_headers = "From=foo@bar&To=bar@baz";
   tel->url_fragment = "unf";
-  
+
   TEST_1(tst = su_strdup(home, telurl));
   TEST_1(url_d(url, tst) == 0);
   TEST_1(url_cmp(tel, url) == 0);
@@ -540,7 +540,7 @@ int test_tel(void)
   TEST_1(url_cmp(tel, u) == 0);
   TEST_SIZE(url_e(tel2, sizeof(tel2), u), strlen(telurl));
   TEST_1(strcmp(tel2, telurl) == 0);
-  TEST_SIZE(snprintf(tel2, sizeof(tel2), URL_PRINT_FORMAT, 
+  TEST_SIZE(snprintf(tel2, sizeof(tel2), URL_PRINT_FORMAT,
                     URL_PRINT_ARGS(tel)), strlen(telurl));
   TEST_1(strcmp(tel2, telurl) == 0);
 
@@ -566,7 +566,7 @@ int test_fax(void)
   url_t fax[1] = { URL_INIT_AS(fax) };
   url_t *u, url[1];
   char *tst;
-  char faxurl[] = 
+  char faxurl[] =
     "fax:+12345678"
     ";param=1;param=2"
     "?From=foo@bar&To=bar@baz#unf";
@@ -590,7 +590,7 @@ int test_fax(void)
   TEST_1(url_cmp(fax, u) == 0);
   TEST_SIZE(url_e(fax2, sizeof(fax2), u), strlen(faxurl));
   TEST_1(strcmp(fax2, faxurl) == 0);
-  TEST_SIZE(snprintf(fax2, sizeof(fax2), URL_PRINT_FORMAT, 
+  TEST_SIZE(snprintf(fax2, sizeof(fax2), URL_PRINT_FORMAT,
                     URL_PRINT_ARGS(fax)), strlen(faxurl));
   TEST_1(strcmp(fax2, faxurl) == 0);
 
@@ -611,7 +611,7 @@ int test_modem(void)
   url_t modem[1] = { URL_INIT_AS(modem) };
   url_t *u, url[1];
   char *tst;
-  char modemurl[] = 
+  char modemurl[] =
     "modem:+12345678"
     ";param=1;param=2"
     "?From=foo@bar&To=bar@baz#unf";
@@ -635,7 +635,7 @@ int test_modem(void)
   TEST_1(url_cmp(modem, u) == 0);
   TEST_SIZE(url_e(modem2, sizeof(modem2), u), strlen(modemurl));
   TEST_1(strcmp(modem2, modemurl) == 0);
-  TEST_SIZE(snprintf(modem2, sizeof(modem2), URL_PRINT_FORMAT, 
+  TEST_SIZE(snprintf(modem2, sizeof(modem2), URL_PRINT_FORMAT,
                     URL_PRINT_ARGS(modem)), strlen(modemurl));
   TEST_1(strcmp(modem2, modemurl) == 0);
 
@@ -676,7 +676,7 @@ int test_file(void)
   TEST(url_cmp(file, u), 0);
   TEST_SIZE(url_e(buf1, sizeof(buf1), u), strlen(fileurl));
   TEST_S(buf1, fileurl);
-  TEST_SIZE(snprintf(buf2, sizeof(buf2), URL_PRINT_FORMAT, URL_PRINT_ARGS(u)), 
+  TEST_SIZE(snprintf(buf2, sizeof(buf2), URL_PRINT_FORMAT, URL_PRINT_ARGS(u)),
            strlen(fileurl));
   TEST_S(buf2, fileurl);
 
@@ -702,8 +702,8 @@ int test_ldap(void)
 
   BEGIN();
 
-  ldap->url_type = url_unknown; 
-  ldap->url_scheme = "ldap"; 
+  ldap->url_type = url_unknown;
+  ldap->url_scheme = "ldap";
 
   /* TEST_S(url_scheme(url_ldap), "ldap"); */
 
@@ -732,7 +732,7 @@ int test_ldap(void)
   TEST(url_cmp(ldap, u), 0);
   TEST_SIZE(url_e(buf1, sizeof(buf1), u), strlen(ldapurl));
   TEST_S(buf1, ldapurl);
-  TEST_SIZE(snprintf(buf2, sizeof(buf2), URL_PRINT_FORMAT, URL_PRINT_ARGS(u)), 
+  TEST_SIZE(snprintf(buf2, sizeof(buf2), URL_PRINT_FORMAT, URL_PRINT_ARGS(u)),
            strlen(ldapurl));
   TEST_S(buf2, ldapurl);
 
@@ -775,7 +775,7 @@ int test_rtsp(void)
   TEST_1(url_cmp(rtsp, u) == 0);
   TEST(url_e(rtsp2, sizeof(rtsp2), u), strlen(rtspurl));
   TEST_1(strcmp(rtsp2, rtspurl) == 0);
-  TEST_SIZE(snprintf(rtsp2, sizeof(rtsp2), URL_PRINT_FORMAT, 
+  TEST_SIZE(snprintf(rtsp2, sizeof(rtsp2), URL_PRINT_FORMAT,
                     URL_PRINT_ARGS(rtsp)), strlen(rtspurl));
   TEST_1(strcmp(rtsp2, rtspurl) == 0);
 
@@ -807,12 +807,12 @@ int test_http(void)
   url_t http[1] = { URL_INIT_AS(http) };
   url_t *u, url[1];
   char *tst;
-  char httpurl[] = 
+  char httpurl[] =
     "http://user:pass@host:32/foo;param=1/bar;param=3"
     "?From=foo@bar&To=bar@baz#unf";
   char http2[sizeof(httpurl) + 32];
 
-  char queryonly[] = 
+  char queryonly[] =
     "http://some.host?query";
 
   BEGIN();
@@ -838,7 +838,7 @@ int test_http(void)
   TEST_1(url_cmp(http, u) == 0);
   TEST_SIZE(url_e(http2, sizeof(http2), u), strlen(httpurl));
   TEST_1(strcmp(http2, httpurl) == 0);
-  TEST_SIZE(snprintf(http2, sizeof(http2), URL_PRINT_FORMAT, 
+  TEST_SIZE(snprintf(http2, sizeof(http2), URL_PRINT_FORMAT,
                     URL_PRINT_ARGS(http)), strlen(httpurl));
   TEST_1(strcmp(http2, httpurl) == 0);
 
@@ -859,10 +859,10 @@ int test_http(void)
   TEST_S(u->url_headers, "here");
 
   url_digest(hash1, sizeof(hash1), u, NULL);
-  url_digest(hash2, sizeof(hash2), (url_t *)"http://[::1]/test;ing?here", 
+  url_digest(hash2, sizeof(hash2), (url_t *)"http://[::1]/test;ing?here",
             NULL);
   TEST(memcmp(hash1, hash2, sizeof(hash1)), 0);
-    
+
   su_home_deinit(home);
 
   END();
@@ -920,7 +920,7 @@ int test_tags(void)
   url_string_t *us0 = NULL;
 
   tagi_t *lst, *dup;
-  
+
   tag_value_t value;
   char *s;
   su_home_t home[1] = { SU_HOME_INIT(home) };
@@ -977,7 +977,7 @@ int test_tag_filter(void)
   tagi_t *lst, *result;
 
   lst = tl_list(TAG_A("X"),
-               TAG_SKIP(2), 
+               TAG_SKIP(2),
                URLTAG_URL((void *)"urn:foo"),
                TAG_B("Y"),
                URLTAG_URL((void *)"urn:bar"),
@@ -997,8 +997,8 @@ int test_tag_filter(void)
   END();
 }
 
-#if 0 
-/* This is just a spike. How we can get 
+#if 0
+/* This is just a spike. How we can get
  *   register_printf_function('U', printf_url, printf_url_info)
  * run while initializing?
  */
@@ -1014,7 +1014,7 @@ int printf_url(FILE *fp,
 }
 
 /* This is the appropriate argument information function for `printf_url'.  */
-int printf_url_info(const struct printf_info *info, 
+int printf_url_info(const struct printf_info *info,
                    size_t n, int *argtypes)
 {
   if (n > 0) {
@@ -1027,7 +1027,7 @@ int printf_url_info(const struct printf_info *info,
 
 int test_print(void)
 {
-#if 0 
+#if 0
   url_t u0[1];
   url_t *u1 = NULL;
   url_t const *u2 = (void *)-1;
@@ -1080,7 +1080,7 @@ int main(int argc, char *argv[])
     else
       usage(1);
   }
-  
+
 #if HAVE_OPEN_C
   tstflags |= tst_verbatim;
 #endif
index 76b371b99960e60f5f4102af3338dbbc3ff86aba..4be736e1e9d634a0619767dcd29381bb60c7bd62 100644 (file)
@@ -53,7 +53,7 @@
  * The macro URL_PRINT_FORMAT is used in format string of printf() or
  * similar printing functions.  A URL can be printed like this:
  * @code
- *   printf("%s received URL " URL_PRINT_FORMAT "\n", 
+ *   printf("%s received URL " URL_PRINT_FORMAT "\n",
  *          my_name, URL_PRINT_ARGS(url));
  * @endcode
  */
@@ -65,7 +65,7 @@
  * or similar printing functions.  Using it, a URL can be printed like this:
  *
  * @code
- *   printf("%s received URL " URL_PRINT_FORMAT "\n", 
+ *   printf("%s received URL " URL_PRINT_FORMAT "\n",
  *          my_name, URL_PRINT_ARGS(url));
  * @endcode
  */
 static char *url_canonize(char *d, char const *s, size_t n,
                          unsigned syn33,
                          char const allowed[]);
-static char *url_canonize2(char *d, char const *s, size_t n, 
+static char *url_canonize2(char *d, char const *s, size_t n,
                           unsigned syn33,
                           unsigned m32, unsigned m64, unsigned m96);
 static int url_tel_cmp_numbers(char const *A, char const *B);
 
-/**Test if string contains excluded or url-reserved characters. 
+/**Test if string contains excluded or url-reserved characters.
+ *
  *
- * 
  *
  * @param s  string to be searched
  *
@@ -162,7 +162,7 @@ static int url_tel_cmp_numbers(char const *A, char const *B);
  */
 int url_reserved_p(char const *s)
 {
-  if (s) 
+  if (s)
     while (*s) {
       unsigned char u = *s++;
 
@@ -177,11 +177,11 @@ int url_reserved_p(char const *s)
  *
  * Calculate the length of string @a s when the excluded or reserved
  * characters in it have been escaped.
- * 
+ *
  * @param s         String with reserved URL characters. [IN
  * @param reserved  Optional array of reserved characters [IN]
  *
- * @return 
+ * @return
  * The number of characters in corresponding but escaped string.
  *
  * You can handle a part of URL with reserved characters like this:
@@ -230,7 +230,7 @@ char *url_escape(char *d, char const *s, char const reserved[])
 {
   char *retval = d;
   unsigned mask32, mask64, mask96;
+
   MASKS_WITH_RESERVED(reserved, mask32, mask64, mask96);
 
   while (s && *s) {
@@ -251,7 +251,7 @@ char *url_escape(char *d, char const *s, char const reserved[])
   }
 
   *d = '\0';
-  
+
   return retval;
 }
 
@@ -350,7 +350,7 @@ char *url_canonize2(char *d, char const * const s, size_t n,
   size_t i = 0;
 
   if (d == s)
-    for (;s[i] && i < n; d++, i++) 
+    for (;s[i] && i < n; d++, i++)
       if (s[i] == '%')
        break;
 
@@ -365,12 +365,12 @@ char *url_canonize2(char *d, char const * const s, size_t n,
     }
 
     h1 = s[i + 1], h2 = s[i + 2];
-    
+
     if (!IS_HEX(h1) || !IS_HEX(h2)) {
       *d = '\0';
       return NULL;
     }
-    
+
 #define UNHEX(a) (a - (a >= 'a' ? 'a' - 10 : (a >= 'A' ? 'A' - 10 : '0')))
     c = (UNHEX(h1) << 4) | UNHEX(h2);
 
@@ -391,7 +391,7 @@ char *url_canonize2(char *d, char const * const s, size_t n,
     d +=2, i += 2;
 #undef    UNHEX
   }
-  
+
   *d = '\0';
 
   return d;
@@ -400,7 +400,7 @@ char *url_canonize2(char *d, char const * const s, size_t n,
 
 /** Canonize a URL component (with precomputed mask).
  *
- * This version does not flag error if *s contains character that should 
+ * This version does not flag error if *s contains character that should
  * be escaped.
  */
 static
@@ -410,7 +410,7 @@ char *url_canonize3(char *d, char const * const s, size_t n,
   size_t i = 0;
 
   if (d == s)
-    for (;s[i] && i < n; d++, i++) 
+    for (;s[i] && i < n; d++, i++)
       if (s[i] == '%')
        break;
 
@@ -423,12 +423,12 @@ char *url_canonize3(char *d, char const * const s, size_t n,
     }
 
     h1 = s[i + 1], h2 = s[i + 2];
-    
+
     if (!IS_HEX(h1) || !IS_HEX(h2)) {
       *d = '\0';
       return NULL;
     }
-    
+
 #define UNHEX(a) (a - (a >= 'a' ? 'a' - 10 : (a >= 'A' ? 'A' - 10 : '0')))
     c = (UNHEX(h1) << 4) | UNHEX(h2);
 
@@ -448,7 +448,7 @@ char *url_canonize3(char *d, char const * const s, size_t n,
     d +=2, i += 2;
 #undef    UNHEX
   }
-  
+
   *d = '\0';
 
   return d;
@@ -478,7 +478,7 @@ char const* url_scheme(enum url_type_e url_type)
   case url_msrp:   return "msrp";
   case url_msrps:  return "msrps";
   case url_wv:     return "wv";
-  default:       
+  default:
     assert(url_type == url_unknown);
     return NULL;
   }
@@ -487,10 +487,10 @@ char const* url_scheme(enum url_type_e url_type)
 su_inline
 int url_type_is_opaque(enum url_type_e url_type)
 {
-  return 
+  return
     url_type == url_invalid ||
-    url_type == url_tel || 
-    url_type == url_modem || 
+    url_type == url_tel ||
+    url_type == url_modem ||
     url_type == url_fax ||
     url_type == url_cid;
 }
@@ -513,29 +513,29 @@ enum url_type_e url_get_type(char const *scheme, size_t len)
 {
 #define test_scheme(s) \
    if (len == strlen(#s) && !strncasecmp(scheme, #s, len)) return url_##s
-  
+
   switch (scheme[0]) {
   case '*': if (strcmp(scheme, "*") == 0) return url_any;
-  case 'c': case 'C': 
+  case 'c': case 'C':
     test_scheme(cid); break;
-  case 'f': case 'F': 
+  case 'f': case 'F':
     test_scheme(ftp); test_scheme(file); test_scheme(fax); break;
-  case 'h': case 'H': 
+  case 'h': case 'H':
     test_scheme(http); test_scheme(https); break;
-  case 'i': case 'I': 
+  case 'i': case 'I':
     test_scheme(im); break;
-  case 'm': case 'M': 
-    test_scheme(mailto); test_scheme(modem); 
+  case 'm': case 'M':
+    test_scheme(mailto); test_scheme(modem);
     test_scheme(msrp); test_scheme(msrps); break;
-  case 'p': case 'P': 
+  case 'p': case 'P':
     test_scheme(pres); break;
-  case 'r': case 'R': 
+  case 'r': case 'R':
     test_scheme(rtsp); test_scheme(rtspu); break;
-  case 's': case 'S': 
+  case 's': case 'S':
     test_scheme(sip); test_scheme(sips); break;
-  case 't': case 'T': 
+  case 't': case 'T':
     test_scheme(tel); break;
-  case 'w': case 'W': 
+  case 'w': case 'W':
     test_scheme(wv); break;
 
 
@@ -560,7 +560,7 @@ enum url_type_e url_get_type(char const *scheme, size_t len)
  *
  * @note The parsed string @a s will be modified when parsing it.
  *
- * @retval 0 if successful, 
+ * @retval 0 if successful,
  * @retval -1 otherwise.
  */
 static
@@ -571,7 +571,7 @@ int _url_d(url_t *url, char *s)
   int have_authority = 1;
 
   memset(url, 0, sizeof(*url));
-  
+
   if (strcmp(s, "*") == 0) {
     url->url_type = url_any;
     url->url_scheme = "*";
@@ -636,7 +636,7 @@ int _url_d(url_t *url, char *s)
        host += 2; s += 2, url->url_root = '/';
        n = strcspn(s, "/?#@[]");
       }
-      else 
+      else
        n = strcspn(s, "@;/?#");
 
       if (s[n] == '@')
@@ -691,7 +691,7 @@ int _url_d(url_t *url, char *s)
     default:
       break;
     }
-    
+
     if (host[n] == ':') {
       char *port = host + n + 1;
       url->url_port = port;
@@ -712,8 +712,8 @@ int _url_d(url_t *url, char *s)
        /* Port can be *digit, empty string or "*" */
        while (*port >= '0' && *port <= '9')
          port++;
-       
-       if (port != url->url_port ? port[0] != '\0' 
+
+       if (port != url->url_port ? port[0] != '\0'
            : (port[0] != '*' || port[1] != '\0'))
          return -1;
       }
@@ -755,7 +755,7 @@ int _url_d(url_t *url, char *s)
  *
  * @note The parsed string @a s will be modified when parsing it.
  *
- * @retval 0 if successful, 
+ * @retval 0 if successful,
  * @retval -1 otherwise.
  */
 int url_d(url_t *url, char *s)
@@ -799,7 +799,7 @@ int url_d(url_t *url, char *s)
 
   /* port is canonized by _url_d() */
   s = (char *)url->url_path;
-  if (s && !url_canonize(s, s, SIZE_MAX, 
+  if (s && !url_canonize(s, s, SIZE_MAX,
                         /* Allow all URI characters but ? */
                         /* Allow unescaped /;?@, - but do not convert */
                         SYN33('/') | SYN33(';') | SYN33('=') | SYN33('@') |
@@ -816,7 +816,7 @@ int url_d(url_t *url, char *s)
                         /* Convert escaped /:&+$ to unescaped */
                         "/:&+$"))
     return -1;
-  
+
   /* Unhex alphanumeric and unreserved URI characters */
   s = (char *)url->url_headers;
   if (s && !url_canonize3(s, s, SIZE_MAX, RESERVED_MASK))
@@ -830,8 +830,8 @@ int url_d(url_t *url, char *s)
   return 0;
 }
 
-/** Encode an URL. 
- * 
+/** Encode an URL.
+ *
  * The function url_e() combines a URL from substrings in url_t structure
  * according the @ref url_syntax "URL syntax" presented above.  The encoded
  * @a url is stored in a @a buffer of @a n bytes.
@@ -840,8 +840,8 @@ int url_d(url_t *url, char *s)
  * @param n      size of @a buffer.
  * @param url    URL to be encoded.
  *
- * @return 
- * Return the number of bytes in the encoding.  
+ * @return
+ * Return the number of bytes in the encoding.
  *
  * @note The function follows the convention set by C99 snprintf().  Even if
  * the result does not fit into the @a buffer and it is truncated, the
@@ -904,7 +904,7 @@ issize_t url_e(char buffer[], isize_t n, url_t const *url)
 
     if (url->url_password) {
       if (do_copy && (do_copy = 1 <= n))
-       *b = ':'; 
+       *b = ':';
       b++; n--;
       i = strlen(url->url_password);
       if (do_copy && (do_copy = i <= n))
@@ -914,7 +914,7 @@ issize_t url_e(char buffer[], isize_t n, url_t const *url)
 
     if (url->url_host) {
       if (do_copy && (do_copy = 1 <= n))
-       *b = '@'; 
+       *b = '@';
       b++; n--;
     }
   }
@@ -930,7 +930,7 @@ issize_t url_e(char buffer[], isize_t n, url_t const *url)
       if (do_copy && (do_copy = i <= n)) {
        b[0] = ':';
        memcpy(b + 1, url->url_port, i - 1);
-      } 
+      }
       b += i; n -= i;
     }
   }
@@ -946,7 +946,7 @@ issize_t url_e(char buffer[], isize_t n, url_t const *url)
       memcpy(b, url->url_path, i);
     b += i; n -= i;
   }
-  
+
   {
     static char const sep[] = ";?#";
     char const *pp[3];
@@ -974,15 +974,15 @@ issize_t url_e(char buffer[], isize_t n, url_t const *url)
     buffer[m - 1] = '\0';
 
   assert((size_t)(b - buffer) == (size_t)(m - n));
-  
-  /* This follows the snprintf(C99) return value, 
+
+  /* This follows the snprintf(C99) return value,
    * Number of characters written (excluding NUL)
    */
   return b - buffer;
 }
 
 
-/** Calculate the length of URL when encoded. 
+/** Calculate the length of URL when encoded.
  *
  */
 isize_t url_len(url_t const * url)
@@ -992,7 +992,7 @@ isize_t url_len(url_t const * url)
   if (url->url_scheme) rv += strlen(url->url_scheme) + 1; /* plus ':' */
   if (url->url_user) {
     rv += strlen(url->url_user);
-    if (url->url_password) 
+    if (url->url_password)
       rv += strlen(url->url_password) + 1;   /* plus ':' */
     rv += url->url_host != NULL;  /* plus '@' */
   }
@@ -1007,11 +1007,11 @@ isize_t url_len(url_t const * url)
 }
 
 /**@def URL_E(buf, end, url)
- * Encode an URL: use @a buf up to @a end. 
+ * Encode an URL: use @a buf up to @a end.
  * @hideinitializer
  */
 
-/** 
+/**
  * Calculate the size of strings associated with a #url_t sructure.
  *
  * @param url pointer to a #url_t structure or string
@@ -1026,7 +1026,7 @@ isize_t url_xtra(url_t const *url)
   }
   else {
     size_t len_scheme, len_user, len_password,
-      len_host, len_port, len_path, len_params, 
+      len_host, len_port, len_path, len_params,
       len_headers, len_fragment;
 
     len_scheme = (url->url_type <= url_unknown && url->url_scheme) ?
@@ -1061,7 +1061,7 @@ char *copy(char *buf, char *end, char const *src)
   for (; buf < end && (*buf = *src); buf++, src++)
     ;
 
-  if (buf >= end) 
+  if (buf >= end)
     while (*src++)
       buf++;
 
@@ -1069,12 +1069,12 @@ char *copy(char *buf, char *end, char const *src)
 #endif
 }
 
-/** 
+/**
  * Duplicate the url.
- * 
+ *
  * The function url_dup() copies the url structure @a src and the strings
  * attached to it to @a url.  The non-constant strings in @a src are copied
- * to @a buf.  If the size of duplicated strings exceed @a bufsize, the 
+ * to @a buf.  If the size of duplicated strings exceed @a bufsize, the
  * corresponding string fields in @a url are set to NULL.
  *
  * The calling function can calculate the size of buffer required by calling
@@ -1108,7 +1108,7 @@ issize_t url_dup(char *buf, isize_t bufsize, url_t *dst, url_t const *src)
   else {
     char *b = buf;
     char *end = b + bufsize;
-    char const **dstp; 
+    char const **dstp;
     char const * const *srcp;
     url_t dst0[1];
 
@@ -1154,7 +1154,7 @@ issize_t url_dup(char *buf, isize_t bufsize, url_t *dst, url_t const *src)
 }
 
 /**@def URL_DUP(buf, end, dst, src)
- *  Duplicate the url: use @a buf up to @a end. @HI 
+ *  Duplicate the url: use @a buf up to @a end. @HI
  *
  * The macro URL_DUP() duplicates the url.  The non-constant strings in @a
  * src are copied to @a buf.  However, no strings are copied past @a end.
@@ -1169,14 +1169,14 @@ issize_t url_dup(char *buf, isize_t bufsize, url_t *dst, url_t const *src)
  * @param dst     Destination URL structure.
  * @param src     Source URL structure.
  *
- * @return 
- * The macro URL_DUP() returns pointer to first unused byte in the 
+ * @return
+ * The macro URL_DUP() returns pointer to first unused byte in the
  * buffer @a buf.
  */
 
 /** Duplicate the url to memory allocated via home.
  *
- * The function url_hdup() duplicates (deep copies) an #url_t structure. 
+ * The function url_hdup() duplicates (deep copies) an #url_t structure.
  * Alternatively, it can be passed a string; string is then copied and
  * parsed to the #url_t structure.
  *
@@ -1190,7 +1190,7 @@ issize_t url_dup(char *buf, isize_t bufsize, url_t *dst, url_t const *src)
  * @return
  * The function url_hdup() returns a pointer to the newly allocated #url_t
  * structure, or NULL upon an error.
- */ 
+ */
 url_t *url_hdup(su_home_t *home, url_t const *src)
 {
   if (src) {
@@ -1211,13 +1211,13 @@ url_t *url_hdup(su_home_t *home, url_t const *src)
 }
 
 
-/** Convert an string to an url */ 
+/** Convert an string to an url */
 url_t *url_make(su_home_t *h, char const *str)
 {
   return url_hdup(h, URL_STRING_MAKE(str)->us_url);
 }
 
-/** Print an URL */ 
+/** Print an URL */
 url_t *url_format(su_home_t *h, char const *fmt, ...)
 {
   url_t *url;
@@ -1263,7 +1263,7 @@ char *url_as_string(su_home_t *home, url_t const *url)
 }
 
 
-/** Test if param @a tag matches to parameter string @a p. 
+/** Test if param @a tag matches to parameter string @a p.
  */
 #define URL_PARAM_MATCH(p, tag) \
  (strncasecmp(p, tag, strlen(tag)) == 0 && \
@@ -1274,8 +1274,8 @@ char *url_as_string(su_home_t *home, url_t const *url)
  *
  * This function searches for a parameter from a parameter list.
  *
- * If you want to test if there is parameter @b user=phone, 
- * call this function like 
+ * If you want to test if there is parameter @b user=phone,
+ * call this function like
  * @code if (url_param(url->url_param, "user=phone", NULL, 0))
  * @endcode
  *
@@ -1287,8 +1287,8 @@ char *url_as_string(su_home_t *home, url_t const *url)
  * @retval positive length of parameter value (including final NUL) if found
  * @retval zero     if not found.
  */
-isize_t url_param(char const *params, 
-                 char const *tag, 
+isize_t url_param(char const *params,
+                 char const *tag,
                  char value[], isize_t vlen)
 {
   size_t n, tlen, flen;
@@ -1309,7 +1309,7 @@ isize_t url_param(char const *params,
     if (strncasecmp(p, tag, tlen) == 0) {
       if (n == tlen) {
        if (vlen > 0)
-         value[0] = '\0';      
+         value[0] = '\0';
        return 1;
       }
       if (p[tlen] != '=')
@@ -1328,9 +1328,9 @@ isize_t url_param(char const *params,
   return 0;
 }
 
-/** Check for a parameter. 
+/** Check for a parameter.
  *
- * @deprecated 
+ * @deprecated
  * Bad grammar. Use url_has_param().
  */
 isize_t url_have_param(char const *params, char const *tag)
@@ -1354,7 +1354,7 @@ int url_param_add(su_home_t *h, url_t *url, char const *param)
 
   if (!s)
     return -1;
-  
+
   if (url->url_params)
     strcpy(s, url->url_params)[n - 1] = ';';
   strcpy(s + n, param);
@@ -1374,7 +1374,7 @@ char *url_strip_param_string(char *params, char const *name)
 {
   if (params && name) {
     size_t i, n = strlen(name), remove, rest;
-    
+
     for (i = 0; params[i];) {
       if (strncasecmp(params + i, name, n) ||
          (params[i + n] != '=' && params[i + n] != ';' && params[i + n])) {
@@ -1429,7 +1429,7 @@ int url_strip_transport2(url_t *url, int modify)
 
   if (url->url_type != url_sip && url->url_type != url_sips)
     return 0;
-  
+
   if (url->url_port != NULL) {
     if (!modify)
       return 1;
@@ -1475,13 +1475,13 @@ int url_strip_transport2(url_t *url, int modify)
 
   if (d != url->url_params)
     *d = '\0';
-  else 
+  else
     url->url_params = NULL;
 
   return 1;
 }
 
-/** Strip transport-specific stuff. 
+/** Strip transport-specific stuff.
  *
  * The function url_strip_transport() removes transport-specific parameters
  * from a SIP or SIPS URI.  These parameters include:
@@ -1497,7 +1497,7 @@ int url_strip_transport2(url_t *url, int modify)
  * @note
  * If the parameter string contains empty parameters, they are stripped, too.
  *
- * @return 
+ * @return
  * The function url_strip_transport() returns @e true, if the URL was
  * modified, @e false otherwise.
  */
@@ -1506,14 +1506,14 @@ int url_strip_transport(url_t *url)
   return url_strip_transport2(url, 1);
 }
 
-/** Check for transport-specific stuff. 
+/** Check for transport-specific stuff.
  *
  * The function url_have_transport() tests if there are transport-specific
  * parameters in a SIP or SIPS URI. These parameters include:
  * - the port number
  * - "maddr=" parameters
  * - "transport=" parameters
- * 
+ *
  * @note
  * The @a url must be a pointer to a URL structure.
  *
@@ -1538,7 +1538,7 @@ int url_have_transport(url_t const *url)
  *
  * @note Currently, the url parameters are not compared. This is because the
  * url_cmp() is used to sort URLs: taking parameters into account makes that
- * impossible. 
+ * impossible.
  */
 int url_cmp(url_t const *a, url_t const *b)
 {
@@ -1556,7 +1556,7 @@ int url_cmp(url_t const *a, url_t const *b)
     /* presence and instant messaging URLs match magically with SIP */
     enum url_type_e a_type = a->url_type;
     enum url_type_e b_type = b->url_type;
-    
+
     if (a_type == url_im || a_type == url_pres)
       a_type = url_sip;
 
@@ -1570,7 +1570,7 @@ int url_cmp(url_t const *a, url_t const *b)
 
   url_type = a->url_type;      /* Or b->url_type, they are equal! */
 
-  if (url_type <= url_unknown && 
+  if (url_type <= url_unknown &&
       ((rv = !a->url_scheme - !b->url_scheme) ||
        (a->url_scheme && b->url_scheme &&
        (rv = strcasecmp(a->url_scheme, b->url_scheme)))))
@@ -1589,7 +1589,7 @@ int url_cmp(url_t const *a, url_t const *b)
       a_port = b_port = url_port_default(url_type);
     else
       a_port = b_port = "";
-    
+
     if (a->url_port) a_port = a->url_port;
     if (b->url_port) b_port = b->url_port;
 
@@ -1635,7 +1635,7 @@ int url_tel_cmp_numbers(char const *A, char const *B)
     /* Skip visual-separators */
     do {
       a = *A++;
-      if (a == '%' && IS_HEX(A[0]) && IS_HEX(A[1])) 
+      if (a == '%' && IS_HEX(A[0]) && IS_HEX(A[1]))
        a = (UNHEX(A[0]) << 4) | UNHEX(A[1]), A +=2;
     } while (a == ' ' || a == '-' || a == '.' || a == '(' || a == ')');
 
@@ -1644,7 +1644,7 @@ int url_tel_cmp_numbers(char const *A, char const *B)
 
     do {
       b = *B++;
-      if (b == '%' && IS_HEX(B[0]) && IS_HEX(B[1])) 
+      if (b == '%' && IS_HEX(B[0]) && IS_HEX(B[1]))
        b = (UNHEX(B[0]) << 4) | UNHEX(B[1]), B +=2;
     } while (b == ' ' || b == '-' || b == '.' || b == '(' || b == ')');
 
@@ -1678,7 +1678,7 @@ int url_cmp_all(url_t const *a, url_t const *b)
 
   url_type = a->url_type;      /* Or b->url_type, they are equal! */
 
-  if (url_type <= url_unknown && 
+  if (url_type <= url_unknown &&
       ((rv = !a->url_scheme - !b->url_scheme) ||
        (a->url_scheme && b->url_scheme &&
        (rv = strcasecmp(a->url_scheme, b->url_scheme)))))
@@ -1700,7 +1700,7 @@ int url_cmp_all(url_t const *a, url_t const *b)
       a_port = b_port = url_port_default(url_type);
     else
       a_port = b_port = "";
-    
+
     if (a->url_port) a_port = a->url_port;
     if (b->url_port) b_port = b->url_port;
 
@@ -1790,10 +1790,10 @@ char const *url_port_default(enum url_type_e url_type)
   case url_msrps:
     return "9999";             /* XXXX */
 
-  case url_tel:        
-  case url_fax:        
+  case url_tel:
+  case url_fax:
   case url_modem:
-  case url_im: 
+  case url_im:
   case url_pres:
   case url_cid:
   case url_wv:
@@ -1909,7 +1909,7 @@ void canon_update(su_md5_t *md5, char const *s, size_t n, char const *allow)
 #define   UNHEX(a) (a - (a >= 'a' ? 'a' - 10 : (a >= 'A' ? 'A' - 10 : '0')))
       c = (UNHEX(s[i+1]) << 4) | UNHEX(s[i+2]);
 #undef    UNHEX
-      if (c != '%' && c > ' ' && c < '\177' && 
+      if (c != '%' && c > ' ' && c < '\177' &&
          (!strchr(EXCLUDED, c) || strchr(allow, c))) {
        if (i != j)
          su_md5_iupdate(md5, s + j, i - j);
@@ -1955,7 +1955,7 @@ void url_string_update(su_md5_t *md5, char const *s)
   else {
     su_md5_update(md5, "", 1);
   }
-  
+
   if (type == url_sip || type == url_sips) {
     /* SIP URL may have /;? in user part but no path */
     /* user-unreserved  =  "&" / "=" / "+" / "$" / "," / ";" / "?" / "/" */
@@ -1989,7 +1989,7 @@ void url_string_update(su_md5_t *md5, char const *s)
       s += 2;
       n = strcspn(s, "/?#@[]");
     }
-    else 
+    else
       n = strcspn(s, "@;/?#");
 
     if (s[n] == '@') {
@@ -2007,7 +2007,7 @@ void url_string_update(su_md5_t *md5, char const *s)
   }
   else /* if (!have_authority) */ {
     n = strcspn(s, ":/;?#");   /* Until pass, path, query or fragment */
-    
+
     canon_update(md5, s, n, ""); /* user */
     su_md5_update(md5, "\0", 1); /* host, no port */
     su_md5_striupdate(md5, url_port_default(type));
@@ -2019,7 +2019,7 @@ void url_string_update(su_md5_t *md5, char const *s)
     if (colon == NULL || ++colon == s + n || *colon != ':')
       colon = NULL;
   }
-  else 
+  else
     colon = memchr(s, ':', n);
 
   if (colon) {
@@ -2081,26 +2081,26 @@ void url_digest(void *hash, int hsize, url_t const *url, char const *key)
  * the resulting string will be truncated.
  *
  * @param home memory home used to alloate string (if NULL, malloc() it)
- * @param query query part from SIP URL 
- * 
+ * @param query query part from SIP URL
+ *
  * The result string is allocated from @a home, and it can be used as
  * argument to msg_header_parse_str(), msg_header_add_str() or
  * SIPTAG_HEADER_STR().
  *
  * @sa msg_header_add_str(), SIPTAG_HEADER_STR(),
- * sip_headers_as_url_query(), sip_url_query_as_taglist(), 
+ * sip_headers_as_url_query(), sip_url_query_as_taglist(),
  * @RFC3261 section 19.1.1 "Headers", #url_t, url_s#url_headers,
  * url_unescape(), url_unescape_to()
  *
  * @since New in @VERSION_1_12_4.
  */
-char *url_query_as_header_string(su_home_t *home, 
+char *url_query_as_header_string(su_home_t *home,
                                 char const *query)
 {
   size_t i, j, n, b_start = 0, b_len = 0;
   char *s = su_strdup(home, query);
 
-  if (!s) 
+  if (!s)
     return NULL;
 
   for (i = 0, j = 0; s[i];) {
index 7edcf9fc4c69afbd305134f0f93c4fbc885c312b..4a58f40d09ebd2bb918217be38dcfba52801673d 100644 (file)
@@ -3,7 +3,7 @@
 @section url_meta Module Meta Information
 
 The Sofia @b url module contains macros and functions for using URL
-datatype #url_t, parsing and printing URLs. 
+datatype #url_t, parsing and printing URLs.
 
 @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
 
@@ -13,11 +13,11 @@ datatype #url_t, parsing and printing URLs.
 
 @section url_syntax Using URL Library
 
-The URL library provides URL datatype and helper functions related to it. 
+The URL library provides URL datatype and helper functions related to it.
 There is URL parser, which separates the URL components to the #url_t
 structure.
 
-@note 
+@note
 Please note that we use terms URL and URI interchangeable.
 
 The formal URI syntax is defined in the @RFC3986.
@@ -39,14 +39,14 @@ as follows: <b> : @ / ; ? & = + </b>and<b> $</b>.
 The URL library understands two alternative URL syntaxes. First, the
 basic syntax used by, e.g., @b ftp:, @b http: and @b rtsp: URLs:
 
-<i>scheme</i> ":" ["//" [ <i>user</i> [":" <i>password</i> ] "@"] 
-<i>host</i> [":" <i>port</i> ] ] 
+<i>scheme</i> ":" ["//" [ <i>user</i> [":" <i>password</i> ] "@"]
+<i>host</i> [":" <i>port</i> ] ]
       ["/" <i>path</i> ] ["?" <i>query</i> ] ["#" <i>fragment</i> ]
 
 Alternatively, the syntax used by @b mailto:, @b sip:, @b im:, @b tel,
 and @b pres: URLs:
 
-<i>scheme</i> ":" [ [ <i>user</i> [":" <i>password</i> ] "@"] 
+<i>scheme</i> ":" [ [ <i>user</i> [":" <i>password</i> ] "@"]
 <i>host</i> [":" <i>port</i> ] ] [";" <i>params</i> ] ["?" <i>query</i> ]
 ["#" <i>fragment</i> ]
 
@@ -80,7 +80,7 @@ the components are NUL-terminated, canonized and assigned to the structure
 as follows:
 @code
  url_type = url_sip
- url_root = 0 
+ url_root = 0
  url_scheme = "sip"
  url_user = "joe.user"
  url_password = NULL
@@ -113,7 +113,7 @@ url_t *url_hdup(su_home_t *h, url_t const *src);
 int url_sanitize(url_t *u);
 char const *url_scheme(enum url_type_e type);
 
-#define URL_INIT_AS(type) 
+#define URL_INIT_AS(type)
 void url_init(url_t *url, enum url_type_e type);
 
 int url_cmp(url_t const *a, url_t const *b);
@@ -138,7 +138,7 @@ There are a few function and macros helping resolving URLs:
 char const *url_port_default(enum url_type_e url_type);
 char const *url_tport_default(enum url_type_e url_type);
 char const *url_port(url_t const *u);
-#define URL_PORT(u) 
+#define URL_PORT(u)
 @endcode
 
 In addition to the basic URL structure, #url_t, the library interface
@@ -149,13 +149,13 @@ of parsed URLs as function arguments:
 #define URL_IS_STRING(u) ((u) && *((url_string_t*)(u))->us_str != 0)
 int url_string_p(url_string_t const * url);
 int url_is_string(url_string_t const * url);
-#define URL_STRING_MAKE(s) 
+#define URL_STRING_MAKE(s)
 @endcode
 
 There are a macros for printf()-like formatting of URLs:
 @code
 #define URL_PRINT_FORMAT
-#define URL_PRINT_ARGS(u) 
+#define URL_PRINT_ARGS(u)
 @endcode
 
 These functions calculate MD5 digest of URL or contribute contents of the
@@ -165,7 +165,7 @@ void url_update(struct su_md5_t *md5, url_t const *url);
 void url_digest(void *hash, int hsize, url_t const *, char const *key);
 @endcode
 
-SIP or SIPS URIs have some parameters that control transport of the request. 
+SIP or SIPS URIs have some parameters that control transport of the request.
 In some cases, they should be detected and removed:
 @code
 int url_have_transport(url_t const *u);
@@ -181,7 +181,7 @@ issize_t url_e(char buffer[], isize_t n, url_t const *url);
 #define URL_E(buf, end, url)
 isize_t url_xtra(url_t const * url);
 issize_t url_dup(char *, isize_t , url_t *dst, url_t const *src);
-#define URL_DUP(buf, end, dst, src) 
+#define URL_DUP(buf, end, dst, src)
 @endcode
 
 */
index cad22c435166941c35edf5bb0a3f2bb7b2126af4..aa6c37e979451f3226c658b796c22970f5cf420d 100644 (file)
@@ -56,7 +56,7 @@ int urltag_snprintf(tagi_t const *t, char b[], size_t size)
   if (URL_STRING_P(us))
     return snprintf(b, size, "<%s>", us->us_str);
   else
-    return snprintf(b, size, "<" URL_PRINT_FORMAT ">", 
+    return snprintf(b, size, "<" URL_PRINT_FORMAT ">",
                    URL_PRINT_ARGS(us->us_url));
 }
 
@@ -95,7 +95,7 @@ tagi_t *urltag_dup(tagi_t *dst, tagi_t const *src, void **bb)
     dst->t_value = (tag_value_t)d;
     *bb = b + sizeof(*d) + xtra;
   }
-  
+
   return dst + 1;
 }
 
@@ -110,7 +110,7 @@ tagi_t *urltag_dup(tagi_t *dst, tagi_t const *src, void **bb)
  *
  * @param tt tag type
  * @param home memory home used to allocate new #url_t structure
- * @param str string to convert 
+ * @param str string to convert
  * @param return_value return-value parameter for converted url
  *
  * @retval 0 when successful
@@ -130,7 +130,7 @@ int urltag_scan(tag_type_t tt, su_home_t *home,
 
   for (len = 0; !IS_EXCLUDED(str[len]); len++)
     ;
-  
+
   url = su_alloc(home, (sizeof *url) + len + 1);
   if (!url)
     return -1;
@@ -145,7 +145,7 @@ int urltag_scan(tag_type_t tt, su_home_t *home,
   return 0;
 }
 
-tag_class_t url_tag_class[1] = 
+tag_class_t url_tag_class[1] =
   {{
     sizeof(url_tag_class),
     /* tc_next */     NULL,
index 3fa90fc4addf0ff7a0afb115522e608d915f9a6d..26fc79830298225c81386cdc87e7e18b7e0f315e 100644 (file)
@@ -172,7 +172,7 @@ void red_black_balance_insert(UrlMap **top, UrlMap *um)
   (*top)->um_black = 1;
 }
 
-static 
+static
 void red_black_balance_delete(UrlMap **top, UrlMap *um)
 {
   UrlMap *dad, *brother;
@@ -192,7 +192,7 @@ void red_black_balance_delete(UrlMap **top, UrlMap *um)
        brother->um_black = 0;
        um = dad;
        continue;
-      } 
+      }
 
       if (!brother->um_right || brother->um_right->um_black) {
        brother->um_left->um_black = 1;
@@ -208,7 +208,7 @@ void red_black_balance_delete(UrlMap **top, UrlMap *um)
       left_rotate(top, dad);
       um = *top;
       break;
-    } else { 
+    } else {
       assert(um == dad->um_right);
       brother = dad->um_left;
 
@@ -224,7 +224,7 @@ void red_black_balance_delete(UrlMap **top, UrlMap *um)
        brother->um_black = 0;
        um = dad;
        continue;
-      } 
+      }
 
       if (!brother->um_left || brother->um_left->um_black) {
        brother->um_right->um_black = 1;
@@ -424,12 +424,12 @@ void url_map_remove(UrlMap **top, UrlMap *um)
       dad->um_dad->um_right = dad;
 
     dad->um_black = um->um_black;
-    
+
     if ((dad->um_left = um->um_left))
-      dad->um_left->um_dad = dad;      
+      dad->um_left->um_dad = dad;
 
     if ((dad->um_right = um->um_right))
-      dad->um_right->um_dad = dad;      
+      dad->um_right->um_dad = dad;
   }
 
   um->um_left = NULL;
@@ -438,7 +438,7 @@ void url_map_remove(UrlMap **top, UrlMap *um)
   um->um_black = 0;
   um->um_inserted = 0;
 
-  if (need_to_balance) 
+  if (need_to_balance)
     red_black_balance_delete(top, kid);
 }
 
@@ -600,7 +600,7 @@ int test_insert(void)
   six = url_map_new(home, (void*)"/6", sizeof (UrlMap));
   seven = url_map_new(home, (void*)"/7", sizeof (UrlMap));
 
-  TEST_1(one); 
+  TEST_1(one);
   TEST_1(three);
   TEST_1(five);
   TEST_1(six);
@@ -612,16 +612,16 @@ int test_insert(void)
   TEST_P(five->um_left, NULL); TEST_P(five->um_right, NULL);
   TEST_P(five->um_dad, NULL); TEST(five->um_black, 1);
 
-  /* Check after another node: 
+  /* Check after another node:
    *
    *         5b
-   *        / 
+   *        /
    *       3r
    */
   TEST(url_map_insert(&tree, three, &o), 0); TEST_P(o, NULL);
   TEST_P(tree->um_left, three); TEST(tree->um_black, 1);
   TEST_P(three->um_left, NULL); TEST_P(three->um_right, NULL);
-  TEST_P(three->um_dad, tree); TEST(three->um_black, 0); 
+  TEST_P(three->um_dad, tree); TEST(three->um_black, 0);
 
   /* Check third node
    *         5b
@@ -631,21 +631,21 @@ int test_insert(void)
   TEST(url_map_insert(&tree, seven, &o), 0); TEST_P(o, NULL);
   TEST_P(tree->um_right, seven); TEST(tree->um_black, 1);
   TEST_P(seven->um_left, NULL); TEST_P(seven->um_right, NULL);
-  TEST_P(seven->um_dad, tree); TEST(seven->um_black, 0); 
+  TEST_P(seven->um_dad, tree); TEST(seven->um_black, 0);
 
   /* Check after fourth node:
    *         5b
    *        / \
    *       3b  7b
    *      /
-   *     1r  
+   *     1r
    */
   TEST(url_map_insert(&tree, one, &o), 0); TEST_P(o, NULL);
-  TEST_P(tree->um_left->um_left, one); 
-  TEST(tree->um_black, 1); 
+  TEST_P(tree->um_left->um_left, one);
+  TEST(tree->um_black, 1);
   TEST(tree->um_left->um_black, 1); TEST(tree->um_right->um_black, 1);
   TEST_P(one->um_left, NULL); TEST_P(one->um_right, NULL);
-  TEST_P(one->um_dad, tree->um_left); TEST(one->um_black, 0); 
+  TEST_P(one->um_dad, tree->um_left); TEST(one->um_black, 0);
 
   /* Checks that we got after fifth node:
    *         5b
@@ -693,7 +693,7 @@ int test_rotate(void)
   y = url_map_new(home, (void*)"/y", sizeof *y);
 
   TEST_1(x);
-  TEST_1(y); 
+  TEST_1(y);
 
   /*
    *              x                   y               x
@@ -725,9 +725,9 @@ unsigned log2ceil(unsigned k)
   if (k > (1 << 32))
     result += 32, k = (k >> 32) + ((k & ((1 << 32) - 1)) != 0);
 #endif
-  if (k > (1 << 16)) 
+  if (k > (1 << 16))
     result += 16, k = (k >> 16) + ((k & ((1 << 16) - 1)) != 0);
-  if (k > (1 << 8)) 
+  if (k > (1 << 8))
     result += 8, k = (k >> 8) + ((k & ((1 << 8) - 1)) != 0);
   if (k > (1 << 4))
     result += 4, k = (k >> 4) + ((k & 15) != 0);
@@ -737,7 +737,7 @@ unsigned log2ceil(unsigned k)
     result += 1, k = (k >> 1) + (k & 1);
   if (k > 1)
     result += 1;
-  
+
   return result;
 }
 
@@ -803,9 +803,9 @@ int test_balance(void)
     te = (TEntry *)url_map_find(tree, (void*)u, 1);
     TEST_1(te); TEST(te->te_value, i);
     url_map_remove(&tree, te->te_urlmap);
-    TEST_1(te->te_urlmap->um_dad == NULL && 
-          te->te_urlmap->um_left == NULL && 
-          te->te_urlmap->um_right == NULL); 
+    TEST_1(te->te_urlmap->um_dad == NULL &&
+          te->te_urlmap->um_left == NULL &&
+          te->te_urlmap->um_right == NULL);
     TEST_1(url_map_height(tree) <= 2 * log2ceil(N - i + 1));
     TEST_1(redblack_check(tree));
   }
@@ -814,7 +814,7 @@ int test_balance(void)
 
   for (i = N - 1; i >= 0; i--) {
     o = (void *)-1;
-    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0);
     TEST_P(o, NULL);
     TEST_1(url_map_height(tree) <= 2 * log2ceil(N - i + 1));
     TEST_1(redblack_check(tree));
@@ -837,7 +837,7 @@ int test_balance(void)
     int sn = (i * 57) % N;
     o = (void *)-1;
     TEST(nodes[sn]->te_inserted, 0);
-    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0);
     nodes[sn]->te_inserted = 1;
     TEST_P(o, NULL);
     TEST_1(url_map_height(tree) <= 2 * log2ceil(i + 1 + 1));
@@ -865,7 +865,7 @@ int test_balance(void)
     int sn = (i * 517) % N;    /* relative prime to N */
     o = (void *)-1;
     TEST(nodes[sn]->te_inserted, 0);
-    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0);
     nodes[sn]->te_inserted = 1;
     TEST_P(o, NULL);
     TEST_1(url_map_height(tree) <= 2 * log2ceil(i + 1 + 1));
@@ -893,7 +893,7 @@ int test_balance(void)
     int sn = (i * 1957) % N;   /* relative prime to N */
     o = (void *)-1;
     TEST(nodes[sn]->te_inserted, 0);
-    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0);
     nodes[sn]->te_inserted = 1;
     TEST_P(o, NULL);
     TEST_1(url_map_height(tree) <= 2 * log2ceil(i + 1 + 1));
@@ -923,13 +923,13 @@ int test_balance(void)
     int sn = N - i - 1;
     TEST(nodes[i]->te_inserted, 0);
     o = (void *)-1;
-    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0);
     TEST_P(o, NULL);
     nodes[i]->te_inserted = 1;
 
     TEST(nodes[sn]->te_inserted, 0);
     o = (void *)-1;
-    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0);
     TEST_P(o, NULL);
     nodes[sn]->te_inserted = 1;
   }
@@ -959,13 +959,13 @@ int test_balance(void)
     int sn = N - i - 1;
     TEST(nodes[i]->te_inserted, 0);
     o = (void *)-1;
-    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0);
     TEST_P(o, NULL);
     nodes[i]->te_inserted = 1;
 
     TEST(nodes[sn]->te_inserted, 0);
     o = (void *)-1;
-    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0);
     TEST_P(o, NULL);
     nodes[sn]->te_inserted = 1;
   }
@@ -995,13 +995,13 @@ int test_balance(void)
     int sn = N / 2 + i;
     TEST(nodes[i]->te_inserted, 0);
     o = (void *)-1;
-    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0);
     TEST_P(o, NULL);
     nodes[i]->te_inserted = 1;
 
     TEST(nodes[sn]->te_inserted, 0);
     o = (void *)-1;
-    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0); 
+    TEST(url_map_insert(&tree, nodes[sn]->te_urlmap, &o), 0);
     TEST_P(o, NULL);
     nodes[sn]->te_inserted = 1;
   }
@@ -1026,13 +1026,13 @@ int test_balance(void)
   TEST_P(tree, NULL);
 
   /* Insert in perfect order ... */
-  
+
   for (j = N / 2; j > 0; j /= 2) {
     for (i = N - j; i >= 0; i -= j) {
       if (nodes[i]->te_inserted)
        continue;
       o = (void *)-1;
-      TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0); 
+      TEST(url_map_insert(&tree, nodes[i]->te_urlmap, &o), 0);
       TEST_P(o, NULL);
       nodes[i]->te_inserted = 1;
     }
index 6f0edb68ab93ee55ee88c5de2bad77df3ecf32db..1831447330d51307694a4792fa234c45a0b5b1c3 100644 (file)
 
 /**
  * @file urlmap.h
- * @brief 
- * 
+ * @brief
+ *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
- *  
+ *
  * @date Created: Wed Mar 10 17:06:20 2004 ppessi
  */
 
index 58724f3224c197fc08e94cb0bc6d9104660b83e8..812092f530362cea769b833eb6e24a5cc1113a9a 100644 (file)
@@ -1,8 +1,8 @@
 dnl =====================================================================
 dnl This file contains autoconf macros shared by Sofia modules.
-dnl 
+dnl
 dnl Author: Pekka Pessi <Pekka.Pessi@nokia.com>
-dnl 
+dnl
 dnl License:
 dnl
 dnl Copyright (c) 2001,2004 Nokia and others. All Rights Reserved.
@@ -12,19 +12,19 @@ dnl its respective author, unless the macro source explicitely says
 dnl otherwise. Permission has been granted, though, to use and distribute
 dnl all macros under the following license, which is a modified version of
 dnl the GNU General Public License version 2:
-dnl 
+dnl
 dnl Each Autoconf macro in this file is free software; you can redistribute it
 dnl and/or modify it under the terms of the GNU General Public License as
 dnl published by the Free Software Foundation; either version 2, or (at your
 dnl option) any later version.
-dnl 
+dnl
 dnl They are distributed in the hope that they will be useful, but WITHOUT ANY
 dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 dnl FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 dnl details. (You should have received a copy of the GNU General Public License
 dnl along with this program; if not, write to the Free Software Foundation,
 dnl Inc., 59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA.)
-dnl 
+dnl
 dnl As a special exception, the Free Software Foundation gives unlimited
 dnl permission to copy, distribute and modify the configure scripts that are
 dnl the output of Autoconf. You need not follow the terms of the GNU General
@@ -32,21 +32,21 @@ dnl Public License when using or distributing such scripts, even though
 dnl portions of the text of Autoconf appear in them. The GNU General Public
 dnl License (GPL) does govern all other use of the material that constitutes
 dnl the Autoconf program.
-dnl 
+dnl
 dnl Certain portions of the Autoconf source text are designed to be copied
-dnl (in certain cases, depending on the input) into the output of Autoconf. 
+dnl (in certain cases, depending on the input) into the output of Autoconf.
 dnl We call these the "data" portions. The rest of the Autoconf source text
 dnl consists of comments plus executable code that decides which of the data
 dnl portions to output in any given case. We call these comments and
 dnl executable code the "non-data" portions. Autoconf never copies any of
 dnl the non-data portions into its output.
-dnl 
+dnl
 dnl This special exception to the GPL applies to versions of Autoconf
 dnl released by the Free Software Foundation. When you make and distribute a
 dnl modified version of Autoconf, you may extend this special exception to
 dnl the GPL to apply to your modified version as well, *unless* your
 dnl modified version has the potential to copy into its output some of the
-dnl text that was the non-data portion of the version that you started with. 
+dnl text that was the non-data portion of the version that you started with.
 dnl (In other words, unless your change moves or copies text from the
 dnl non-data portions to the data portions.) If your modification has such
 dnl potential, you must delete any notice of this special exception to the
index 6326f6617ed81905a588f918e3973c0ddef21f4a..4abe40a04296b5d516419c18d4ba54687393f7fe 100644 (file)
@@ -1,8 +1,8 @@
 dnl =====================================================================
 dnl This file contains autoconf macros shared by Sofia modules.
-dnl 
+dnl
 dnl Author: Pekka Pessi <Pekka.Pessi@nokia.com>
-dnl 
+dnl
 dnl License:
 dnl
 dnl Copyright (c) 2001,2004 Nokia and others. All Rights Reserved.
@@ -12,19 +12,19 @@ dnl its respective author, unless the macro source explicitely says
 dnl otherwise. Permission has been granted, though, to use and distribute
 dnl all macros under the following license, which is a modified version of
 dnl the GNU General Public License version 2:
-dnl 
+dnl
 dnl Each Autoconf macro in this file is free software; you can redistribute it
 dnl and/or modify it under the terms of the GNU General Public License as
 dnl published by the Free Software Foundation; either version 2, or (at your
 dnl option) any later version.
-dnl 
+dnl
 dnl They are distributed in the hope that they will be useful, but WITHOUT ANY
 dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 dnl FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 dnl details. (You should have received a copy of the GNU General Public License
 dnl along with this program; if not, write to the Free Software Foundation,
 dnl Inc., 59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA.)
-dnl 
+dnl
 dnl As a special exception, the Free Software Foundation gives unlimited
 dnl permission to copy, distribute and modify the configure scripts that are
 dnl the output of Autoconf. You need not follow the terms of the GNU General
@@ -32,21 +32,21 @@ dnl Public License when using or distributing such scripts, even though
 dnl portions of the text of Autoconf appear in them. The GNU General Public
 dnl License (GPL) does govern all other use of the material that constitutes
 dnl the Autoconf program.
-dnl 
+dnl
 dnl Certain portions of the Autoconf source text are designed to be copied
-dnl (in certain cases, depending on the input) into the output of Autoconf. 
+dnl (in certain cases, depending on the input) into the output of Autoconf.
 dnl We call these the "data" portions. The rest of the Autoconf source text
 dnl consists of comments plus executable code that decides which of the data
 dnl portions to output in any given case. We call these comments and
 dnl executable code the "non-data" portions. Autoconf never copies any of
 dnl the non-data portions into its output.
-dnl 
+dnl
 dnl This special exception to the GPL applies to versions of Autoconf
 dnl released by the Free Software Foundation. When you make and distribute a
 dnl modified version of Autoconf, you may extend this special exception to
 dnl the GPL to apply to your modified version as well, *unless* your
 dnl modified version has the potential to copy into its output some of the
-dnl text that was the non-data portion of the version that you started with. 
+dnl text that was the non-data portion of the version that you started with.
 dnl (In other words, unless your change moves or copies text from the
 dnl non-data portions to the data portions.) If your modification has such
 dnl potential, you must delete any notice of this special exception to the
@@ -56,7 +56,7 @@ dnl =====================================================================
 
 dnl ===================================================================
 dnl Get host, target and build variables filled with appropriate info,
-dnl and check the validity of the cache 
+dnl and check the validity of the cache
 dnl ===================================================================
 
 AC_DEFUN([SAC_CANONICAL_SYSTEM_CACHE_CHECK], [
@@ -73,7 +73,7 @@ AC_CACHE_VAL(ac_cv_hostcheck, [ ac_cv_hostcheck="$hostcheck" ])
 if test "$ac_cv_hostcheck" != "$hostcheck"; then
   AC_MSG_RESULT(changed)
   AC_MSG_WARN(config.cache exists!)
-  AC_MSG_ERROR([you must do 'make distclean' first to compile 
+  AC_MSG_ERROR([you must do 'make distclean' first to compile
  for different host or different parameters.])
 else
   AC_MSG_RESULT(ok)
@@ -116,7 +116,7 @@ AC_CACHE_CHECK([for maximum warnings compiler flag],
     *solaris*)  ac_cv_cwflag="-erroff=%none,E_END_OF_LOOP_CODE_NOT_REACHED,E_BAD_PTR_INT_COMBINATION -errtags"
                ;;
     *)         ac_cv_cwflag=;;
-               esac 
+               esac
   ;;
 esac])
 AC_SUBST([CWFLAG], [$ac_cv_cwflag])
@@ -132,10 +132,10 @@ dnl ======================================================================
 AC_DEFUN([AC_STRUCT_SIN6], [
 AC_CACHE_CHECK([for sockaddr_in6],
   ac_cv_sin6,
-[AC_EGREP_HEADER(struct sockaddr_in6, netinet/in.h, 
+[AC_EGREP_HEADER(struct sockaddr_in6, netinet/in.h,
   ac_cv_sin6=yes, ac_cv_sin6=no)])
 if test $ac_cv_sin6 = yes ;then
-       AC_DEFINE([HAVE_SIN6], 1, 
+       AC_DEFINE([HAVE_SIN6], 1,
                [Define to 1 if you have IPv6 structures and constants])
 fi
 ])
@@ -150,7 +150,7 @@ AC_CACHE_CHECK([for sa_len],
 #include <sys/socket.h>]], [[
  struct sockaddr t;t.sa_len = 0;]])],[ac_cv_sa_len=yes],[ac_cv_sa_len=no])])
 if test "$ac_cv_sa_len" = yes ;then
-       AC_DEFINE([HAVE_SA_LEN], 1, 
+       AC_DEFINE([HAVE_SA_LEN], 1,
                [Define to 1 if you have sa_len in struct sockaddr])
 fi
 ])
@@ -160,7 +160,7 @@ dnl Check for MSG_NOSIGNAL flag
 dnl ======================================================================
 AC_DEFUN([AC_FLAG_MSG_NOSIGNAL], [
 AC_REQUIRE([AC_PROG_CC])
-AC_CACHE_CHECK([for MSG_NOSIGNAL], 
+AC_CACHE_CHECK([for MSG_NOSIGNAL],
   ac_cv_flag_msg_nosignal, [
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
@@ -169,7 +169,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 ]])],[ac_cv_flag_msg_nosignal=yes],[ac_cv_flag_msg_nosignal=no])])
 if test "$ac_cv_flag_msg_nosignal" = yes ; then
        AC_DEFINE([HAVE_MSG_NOSIGNAL], 1,
-               [Define to 1 if you have MSG_NOSIGNAL flag for send()]) 
+               [Define to 1 if you have MSG_NOSIGNAL flag for send()])
 fi
 ])dnl
 
@@ -178,7 +178,7 @@ dnl Check for MSG_ERRQUEUE flag
 dnl ======================================================================
 AC_DEFUN([AC_SYS_MSG_ERRQUEUE], [
 AC_REQUIRE([AC_PROG_CC])
-AC_CACHE_CHECK([for MSG_ERRQUEUE], 
+AC_CACHE_CHECK([for MSG_ERRQUEUE],
   ac_cv_flag_msg_errqueue, [
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
@@ -187,7 +187,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 ]])],[ac_cv_flag_msg_errqueue=yes],[ac_cv_flag_msg_errqueue=no])])
 if test "$ac_cv_flag_msg_errqueue" = yes; then
        AC_DEFINE([HAVE_MSG_ERRQUEUE], 1,
-               [Define to 1 if you have MSG_ERRQUEUE flag for send()]) 
+               [Define to 1 if you have MSG_ERRQUEUE flag for send()])
 fi
 ])dnl
 
@@ -196,7 +196,7 @@ dnl Check for IP_RECVERR option
 dnl ======================================================================
 AC_DEFUN([AC_SYS_IP_RECVERR], [
 AC_REQUIRE([AC_PROG_CC])
-AC_CACHE_CHECK([for IP_RECVERR], 
+AC_CACHE_CHECK([for IP_RECVERR],
   ac_cv_sys_ip_recverr, [
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
@@ -208,7 +208,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
   setsockopt(s, SOL_IP, IP_RECVERR, &one, sizeof(one));
 ]])],[ac_cv_sys_ip_recverr=yes],[ac_cv_sys_ip_recverr=no])])
 if test "$ac_cv_sys_ip_recverr" = yes ; then
-       AC_DEFINE([HAVE_IP_RECVERR], 1, 
+       AC_DEFINE([HAVE_IP_RECVERR], 1,
                [Define to 1 if you have IP_RECVERR in <netinet/in.h>])
 fi
 ])dnl
@@ -218,7 +218,7 @@ dnl Check for IPV6_RECVERR option
 dnl ======================================================================
 AC_DEFUN([AC_SYS_IPV6_RECVERR], [
 AC_REQUIRE([AC_PROG_CC])
-AC_CACHE_CHECK([for IPV6_RECVERR], 
+AC_CACHE_CHECK([for IPV6_RECVERR],
   ac_cv_sys_ipv6_recverr, [
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
@@ -261,7 +261,7 @@ AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func,
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[char *s = __func__;
 ]])],[ac_cv_c_var_func=yes],[ac_cv_c_var_func=no]))
 if test $ac_cv_c_var_func = "yes"; then
-AC_DEFINE([HAVE_FUNC], 1, [Define to 1 if the C compiler supports __func__]) 
+AC_DEFINE([HAVE_FUNC], 1, [Define to 1 if the C compiler supports __func__])
 fi
 ])dnl
 
@@ -272,7 +272,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
 char *s = __FUNCTION__;
 ]])],[ac_cv_c_macro_function=yes],[ac_cv_c_macro_function=no]))
 if test $ac_cv_c_macro_function = "yes"; then
-AC_DEFINE([HAVE_FUNCTION], 1, [Define to 1 if the C compiler supports __FUNCTION__]) 
+AC_DEFINE([HAVE_FUNCTION], 1, [Define to 1 if the C compiler supports __FUNCTION__])
 fi
 ])dnl
 
@@ -281,8 +281,8 @@ dnl AC_C_INLINE_DEFINE
 dnl ======================================================================
 AC_DEFUN([AC_C_INLINE_DEFINE], [
 AC_C_INLINE
-case "$ac_cv_c_inline" in *inline* | yes) 
-       AC_DEFINE([HAVE_INLINE], 1, [Define to 1 if you have inlining compiler]) ;; 
+case "$ac_cv_c_inline" in *inline* | yes)
+       AC_DEFINE([HAVE_INLINE], 1, [Define to 1 if you have inlining compiler]) ;;
 esac
 ])
 
@@ -298,7 +298,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
 ]])],[ac_cv_c_keyword_struct=yes],[ac_cv_c_keyword_struct=no]))
 if test $ac_cv_c_keyword_struct = "yes"; then
 AC_DEFINE([HAVE_STRUCT_KEYWORDS], 1, [
-Define to 1 if your CC supports C99 struct initialization]) 
+Define to 1 if your CC supports C99 struct initialization])
 fi
 ])
 
@@ -307,7 +307,7 @@ dnl autoconf-version
 dnl should be removed after automake conversion is finished
 dnl ======================================================================
 
-AC_DEFUN([AC_AUTOCONF_PARAM], 
+AC_DEFUN([AC_AUTOCONF_PARAM],
 [
 if autoconf --version | fgrep '2.13' > /dev/null ; then
     AUTOCONF_PARAM="-l"
@@ -349,7 +349,7 @@ dnl ======================================================================
 
 AC_DEFUN([AC_CHECK_COMPILATION_ENVIRONMENT], [
 AC_REQUIRE([AC_PROG_CC])
-AC_CACHE_CHECK([for compilation environment], 
+AC_CACHE_CHECK([for compilation environment],
   ac_cc_environment, [
 machine=`$CC -dumpmachine`
 if test "$machine" = mingw32 ; then
@@ -392,7 +392,7 @@ AC_CACHE_CHECK([/dev/urandom], [ac_cv_dev_urandom],
   [ac_cv_dev_urandom=no
    if test -r /dev/urandom; then ac_cv_dev_urandom=yes; fi])
 if test $ac_cv_dev_urandom = yes; then
-  AC_DEFINE([HAVE_DEV_URANDOM], 1, 
+  AC_DEFINE([HAVE_DEV_URANDOM], 1,
     [Define to 1 if you have /dev/urandom.])
   AC_DEFINE([DEV_URANDOM], 1,
     [Define to the random number source name.])
index 3abbe7880454f0ca759af624e121646639a7724b..49738c7d89fe06e264a3b164695bf775dba04a05 100644 (file)
@@ -13,7 +13,7 @@ if test "$with_openssl" = no  ;then
   : # No openssl
 else
 
-  if test "$with_openssl" = "pkg-config" ; then 
+  if test "$with_openssl" = "pkg-config" ; then
     PKG_CHECK_MODULES(openssl, openssl,
        [HAVE_TLS=1 HAVE_OPENSSL=1 LIBS="$openssl_LIBS $LIBS"],
        [HAVE_OPENSSL=0])
@@ -26,16 +26,16 @@ else
     AC_CHECK_HEADERS([openssl/tls1.h], [
       HAVE_OPENSSL=1 HAVE_TLS=1
 
-      AC_CHECK_LIB(crypto, BIO_new,, 
+      AC_CHECK_LIB(crypto, BIO_new,,
        HAVE_OPENSSL=0
        AC_MSG_WARN(OpenSSL crypto library was not found))
 
-      AC_CHECK_LIB(ssl, TLSv1_method,, 
+      AC_CHECK_LIB(ssl, TLSv1_method,,
        HAVE_TLS=0
        AC_MSG_WARN(OpenSSL protocol library was not found))
      ],[AC_MSG_WARN(OpenSSL include files were not found)])
   fi
-  
+
   if test x$HAVE_OPENSSL = x1; then
      AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have OpenSSL])
   fi
index 5203293d534f212bf3ba6e453abe8b4a55a1d726..6f016df124ad2912e5787dc14213c7314e9dc5ad 100644 (file)
@@ -12,33 +12,33 @@ AC_DEFUN([SAC_SOFIA_SU], [
 
 dnl Define compilation options for su_configure.h
 
-case "$target" in 
+case "$target" in
 *-*-solaris?.* )
   SAC_SU_DEFINE(__EXTENSIONS__, 1, [Define to 1 in Solaris in order to get POSIX extensions.])
 ;;
 esac
 
 # Check includes used by su includes
-AC_CHECK_HEADER(sys/types.h, 
-       SAC_SU_DEFINE([SU_HAVE_SYS_TYPES], 1, 
+AC_CHECK_HEADER(sys/types.h,
+       SAC_SU_DEFINE([SU_HAVE_SYS_TYPES], 1,
                     [Define to 1 if Sofia uses sys/types.h]))
 
 ax_inttypes=false
 AC_CHECK_HEADER(stdint.h, [
        ax_inttypes=true
-       SAC_SU_DEFINE([SU_HAVE_STDINT], 1, 
+       SAC_SU_DEFINE([SU_HAVE_STDINT], 1,
                     [Define to 1 if Sofia uses stdint.h])])
 AC_CHECK_HEADER(inttypes.h,[
        ax_inttypes=true
-       SAC_SU_DEFINE([SU_HAVE_INTTYPES], 1, 
+       SAC_SU_DEFINE([SU_HAVE_INTTYPES], 1,
                     [Define to 1 if Sofia uses inttypes.h])])
 
-if $ax_inttypes; then : ; else 
+if $ax_inttypes; then : ; else
        AC_MSG_ERROR("No <stdint.h> or <inttypes.h> found.")
 fi
 
 if test "x$MINGW_ENVIRONMENT" != x1 ; then
-  AC_CHECK_HEADER(pthread.h, 
+  AC_CHECK_HEADER(pthread.h,
         HAVE_PTHREADS=1;
        SAC_SU_DEFINE([SU_HAVE_PTHREADS], 1, [Sofia SU uses pthreads]))
 else
@@ -128,7 +128,7 @@ dnl ======================================================================
 dnl SAC_ENABLE_COREFOUNDATION
 dnl ======================================================================
 AC_ARG_ENABLE(corefoundation,
-[  --enable-corefoundation 
+[  --enable-corefoundation
                           compile with OSX COREFOUNDATION [[disabled]]],
  , enable_corefoundation=no)
 AM_CONDITIONAL(COREFOUNDATION, test $enable_corefoundation = yes)
@@ -191,7 +191,7 @@ int main(int avc, char **av)
               (tv)6, (tv)7, (tv)8, (tv)9, (tv)10);
 }
 ]])],[ac_cv_tagstack=yes],[ac_cv_tagstack=no],[
-case "$target" in 
+case "$target" in
 i?86-*-* ) ac_cv_tagstack=yes ;;
 * ) ac_cv_tagstack=no ;;
 esac
@@ -229,7 +229,7 @@ dnl Socket features
 
 AC_REQUIRE([AC_SYS_SA_LEN])
 if test "$ac_cv_sa_len" = yes ;then
-  SAC_SU_DEFINE([SU_HAVE_SOCKADDR_SA_LEN], 1, 
+  SAC_SU_DEFINE([SU_HAVE_SOCKADDR_SA_LEN], 1,
                [Define to 1 if you have sa_len in struct sockaddr])
 fi
 
@@ -238,7 +238,7 @@ AC_ARG_ENABLE([ip6],
 
 if ! test no$enable_ip6 = nono ; then
 AC_STRUCT_SIN6
-case $ac_cv_sin6 in 
+case $ac_cv_sin6 in
 yes) SAC_SU_DEFINE(SU_HAVE_IN6, 1, [
        Define to 1 if you have struct sockaddr_in6]) ;;
  no) ;;
@@ -254,7 +254,7 @@ AC_CHECK_HEADERS([winsock2.h], [
   AC_DEFINE([HAVE_WIN32], 1, [Define to 1 you have WIN32])
   SAC_SU_DEFINE([SU_HAVE_WINSOCK], 1, [Define to 1 you have WinSock])
   SAC_SU_DEFINE([SU_HAVE_WINSOCK2], 1, [Define to 1 you have WinSock2])
-  SAC_SU_DEFINE([SU_HAVE_SOCKADDR_STORAGE], 1, 
+  SAC_SU_DEFINE([SU_HAVE_SOCKADDR_STORAGE], 1,
       [Define to 1 if you have struct sockaddr_storage])
   AC_DEFINE([HAVE_ADDRINFO], 1,
       [Define to 1 if you have addrinfo structure.])
@@ -276,7 +276,7 @@ AC_CHECK_HEADERS([winsock2.h], [
 #endif
   ])
   AC_DEFINE([HAVE_FILETIME], 1, [
-     Define to 1 if you have WIN32 FILETIME type and 
+     Define to 1 if you have WIN32 FILETIME type and
      GetSystemTimeAsFileTime().])
 ],[
 dnl no winsock2
@@ -335,7 +335,7 @@ else
 fi])
 
 if test "$ac_cv_struct_addrinfo" = yes; then
-  SAC_SU_DEFINE([SU_HAVE_ADDRINFO], 1, 
+  SAC_SU_DEFINE([SU_HAVE_ADDRINFO], 1,
     [Define to 1 if you have struct addrinfo.])
 fi
 
@@ -349,7 +349,7 @@ else
   ac_cv_struct_sockaddr_storage='sys/socket.h missing'
 fi])
 if test "$ac_cv_struct_sockaddr_storage" = yes; then
-  SAC_SU_DEFINE(SU_HAVE_SOCKADDR_STORAGE, 1, 
+  SAC_SU_DEFINE(SU_HAVE_SOCKADDR_STORAGE, 1,
     [Define to 1 if you have struct sockaddr_storage])
 fi
 
@@ -437,7 +437,7 @@ fi
 AC_CHECK_LIB(pthread, pthread_create)
 AC_CHECK_LIB(socket, socketpair,,,-lnsl)
 
-AC_ARG_WITH(rt,  
+AC_ARG_WITH(rt,
 [  --with-rt               use POSIX realtime library [[used by default]]])
 if test "${with_rt}" != no; then
        AC_SEARCH_LIBS(clock_gettime, rt)
@@ -451,30 +451,30 @@ fi
 # No GLib path explicitly defined, use pkg-config
 AC_ARG_WITH(glib,
 [  --with-glib=version     use GLib (default=2.0)], [
-case "$with_glib" in 
+case "$with_glib" in
 yes | "" ) with_glib=2.0 ;;
 esac
 ], [with_glib=2.0])
 
 AC_ARG_WITH(glib-dir,
-[  --with-glib-dir=PREFIX  explicitly define GLib path],, 
+[  --with-glib-dir=PREFIX  explicitly define GLib path],,
  with_glib_dir="pkg-config")
 
 if test "$with_glib" = no || test "$with_glib_dir" = "no" ; then
 
   : # No glib
 
-elif test "$with_glib_dir" = "pkg-config" ; then 
+elif test "$with_glib_dir" = "pkg-config" ; then
 
   PKG_CHECK_MODULES(GLIB, glib-$with_glib, [HAVE_GLIB=yes], [HAVE_GLIB=no])
 
-else # GLib path is explicitly defined 
+else # GLib path is explicitly defined
 
   gprefix=$with_glib_dir
   GLIB_VERSION="$with_glib"
   GLIBXXX=glib-$with_glib
 
-  if test "$gprefix" = "yes" ; then 
+  if test "$gprefix" = "yes" ; then
     for gprefix in /usr /usr/local /opt/$GLIBXXX
     do
        test -d $gprefix/include/$GLIBXXX && break
@@ -492,7 +492,7 @@ else # GLib path is explicitly defined
     # glib_mkenums=glib-mkenums
 
     HAVE_GLIB=yes
-    
+
     if test "x$MINGW_ENVIRONMENT" = x1 ; then
       GLIB_LIBS="${glibdir}/lib$GLIBXXX.dll.a ${glibdir}/libintl.a ${glibdir}/libiconv.a"
     else
@@ -501,7 +501,7 @@ else # GLib path is explicitly defined
     GLIB_CFLAGS="-I${gincludedir}/$GLIBXXX -I${glibdir}/$GLIBXXX/include"
   fi
 
-fi # GLib path is explicitly defined 
+fi # GLib path is explicitly defined
 
 if test "x$HAVE_GLIB" = xyes ; then
   SAC_COMMA_APPEND([SOFIA_GLIB_PKG_REQUIRES],[glib-2.0])
@@ -544,7 +544,7 @@ then
 fi
 
 if test $ac_cv_func_if_nameindex = yes ; then
-  SAC_SU_DEFINE([SU_HAVE_IF_NAMEINDEX], 1, 
+  SAC_SU_DEFINE([SU_HAVE_IF_NAMEINDEX], 1,
     [Define to 1 if you have if_nameindex().])
 fi
 
@@ -619,7 +619,7 @@ fi
 # Check IPv6 addresss configuration
 # ===========================================================================
 case "$target" in
- *-*-linux*) AC_DEFINE([HAVE_PROC_NET_IF_INET6], 1, 
+ *-*-linux*) AC_DEFINE([HAVE_PROC_NET_IF_INET6], 1,
        [Define to 1 if you have /proc/net/if_inet6 control file]) ;;
 esac
 
index ef1f3b328df4786d4502b505f569f97d510190d4..cb717f9b64505f8a3df81b87a8bba9fcd744b285 100644 (file)
@@ -19,7 +19,7 @@ if test -n "${with_sigcomp}" && test "${with_sigcomp}" != no ; then
 
        AC_CHECK_FUNC(sigcomp_library_2_5,
             [AC_DEFINE([HAVE_SIGCOMP], 1, [Define to 1 if you have Sofia sigcomp >= 2.5])
-             AC_DEFINE([HAVE_SOFIA_SIGCOMP], 1, [Define to 1 if you have Sofia sigcomp >= 2.5])], 
+             AC_DEFINE([HAVE_SOFIA_SIGCOMP], 1, [Define to 1 if you have Sofia sigcomp >= 2.5])],
              AC_MSG_ERROR(Sofia SigComp API >= 2.5 was not found))
 fi
 
index f627550447192bdc65274ce2d08f110ce3e92c13..ddf8774f640b0543ccb37f38b3fe716124430f27 100644 (file)
@@ -67,7 +67,7 @@
    TEMPLATE1=%PR2%.in ^
    TEMPLATE2=%PR3%.in ^
    TEMPLATE3=%PR4%.in ^
-   TEMPLATE=%PR5%.in %SIPEXTRA% < NUL 
+   TEMPLATE=%PR5%.in %SIPEXTRA% < NUL
 %CHECK%
 
 %AWK_SIP_AWK% PT=%PT% TEMPLATE=%PT%.in ^
index bf5dd7cf56b6a9bee6f729227746b8b2da337755..c610015f3d84c58896c471a5ca3bcee02163fc7b 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/gawk
 #
 # This script extracts the version information from configure.ac
-# and re-generates win32/config.h and 
+# and re-generates win32/config.h and
 # libsofia-sip-ua/features/sofia_sip_features.h
 #
 # --------------------------------------------------------------------
@@ -38,7 +38,7 @@ BEGIN { IN=1; OUT=0; }
 
 IN && /^AC_INIT/ { version=$2; gsub(/[\]\[)]/, "", version); }
 
-OUT && /@[A-Z_]+@/ { 
+OUT && /@[A-Z_]+@/ {
   gsub(/@PACKAGE_VERSION@/, version);
   gsub(/@PACKAGE_BUGREPORT@/, "sofia-sip-devel@lists.sourceforge.net");
   gsub(/@PACKAGE_NAME@/, "sofia-sip");
index 8dd26db4ebebb55fe7152268aa499176364f968b..6cea8f56c66906adbec979eb7a020e157b2d6542 100644 (file)
@@ -1,7 +1,7 @@
 2005-11-15  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-       * sofia-sip.spec.in: Removed the --includedir parameter. 
-       The public headers are now installed under 
+       * sofia-sip.spec.in: Removed the --includedir parameter.
+       The public headers are now installed under
        includedir/sofia-sip-MAJOR.MINOR/
 
 2005-10-06  Pekka Pessi  <Pekka.Pessi@nokia.com>
index 335ad3cbafdbc46d1f4f1767f0d46c4afa66da22..63db31baeff2871cedce9fc3b50cf9b79913e877 100644 (file)
@@ -10,7 +10,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = sofia-sip-ua.pc
 
 if HAVE_GLIB
-# We should probably have something here telling 
+# We should probably have something here telling
 # if we have gobject support or not
 pkgconfig_DATA += sofia-sip-ua-glib.pc
 endif
index 01c14c023576d1e53be75b87f8ffa011de4b3e3d..ae4f20a2925ae6074c769470f9b15e97116bbe49 100644 (file)
@@ -1,6 +1,6 @@
 # Sofia SIP UA Library
 
-Summary: Sofia SIP User-Agent library 
+Summary: Sofia SIP User-Agent library
 Name: sofia-sip
 Version: @VERSION@
 Release: 1%{?dist}
@@ -15,7 +15,7 @@ BuildRequires: pkgconfig
 %define opt_with() %{expand:%%global with_%{1} %%{?_with_%{1}:1}%%{?!_with_%{1}:0}}
 %define opt_without() %{expand:%%global with_%{1} %%{!?_without_%{1}:1}%%{?_without_%{1}:0}}
 
-# Options: 
+# Options:
 %opt_with doxygen      - Generate documents using doxygen and dot
 %opt_with check                - Run tests
 %opt_with openssl      - Always use OpenSSL (TLS)
@@ -94,7 +94,7 @@ rm -rf $RPM_BUILD_ROOT
 # note: soname in pkgname allows install of multiple library versions
 # The glib interface is still a bit unstable
 %package       glib@LIBVER_SOFIA_SIP_UA_GLIB_SOVER@
-Summary:       GLIB bindings for Sofia-SIP 
+Summary:       GLIB bindings for Sofia-SIP
 Group:         System Environment/Libraries
 Requires:      sofia-sip
 Obsoletes:     sofia-sip-glib < %{version}-%{release}
@@ -123,11 +123,11 @@ Provides: sofia-devel = %{version}-%{release}
 Requires:      pkgconfig
 
 %description   devel
-Development package for Sofia SIP UA library. This package includes 
+Development package for Sofia SIP UA library. This package includes
 static libraries and include files.
 
 %if !%{with_doxygen}
-The reference documentation for Sofia SIP UA library is available at 
+The reference documentation for Sofia SIP UA library is available at
 <http://sofia-sip.sourceforge.net/development.html>
 %endif
 
@@ -209,7 +209,7 @@ Command line utilities for Sofia SIP UA library.
 - Bumped version. rpmlinted.
 
 * Tue Dec  5 2006 Kai Vehmanen <first.lastname at nokia.com>
-- The 'nua-glib' module, and the related dependency to gobject, has been 
+- The 'nua-glib' module, and the related dependency to gobject, has been
   removed from the sofia-sip package
 
 * Fri Oct  6 2006 Pekka Pessi <ppessi at gmail.com> - 1.12.3
index eb887afe1a4cfdf89cda977e15fb6d0ff2f66519..b62dbd094ca111b8ba884fdf4d6b593c92c71d17 100644 (file)
@@ -1,4 +1,4 @@
-# 
+#
 # Generate lcov output
 #
 
@@ -37,7 +37,7 @@ lcov-report:
        rm -rf $$odir ; mkdir -p $$odir && \
        ${LCOV_REPORT} ${GENHTML_OPTIONS} \
           --title "${PACKAGE_NAME}-${PACKAGE_VERSION}$$sub" \
-         --srcdir=${srcdir} -o $$odir 
+         --srcdir=${srcdir} -o $$odir
 
 # Rerun checks before generating report
 lcov-rerun: clean-lcov
index b277d6de4371969e5437b2ca1c58b1eebf7186f3..f59e386b76a8a8d7ebe05230108a7e8ac93ee84b 100644 (file)
@@ -2,7 +2,7 @@
 # --------------------------
 
 all-recursive: built-sources-recursive
-built-sources: built-sources-recursive 
+built-sources: built-sources-recursive
 clean-built-sources: clean-built-sources-recursive
 valcheck: valcheck-recursive
 
index f9c6900f8a57ef97cffb51cbe3860647efe50222..5f5f9b47543d2151bef40b51ec2a61e1d08c0492 100644 (file)
@@ -1,4 +1,4 @@
-# 
+#
 # run tests with valgrind
 #
 
@@ -23,7 +23,7 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-VALGRIND = valgrind 
+VALGRIND = valgrind
 
 VALGRINDFLAGS = --tool=memcheck
 
@@ -34,7 +34,7 @@ valcheck-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
        $(MAKE) $(AM_MAKEFLAGS) valcheck-TESTS
 
-# Run tests with valgrind in 
+# Run tests with valgrind in
 valcheck-TESTS:        $(TESTS)
        @failed=0; all=0; xfail=0; xpass=0; skip=0; \
        srcdir=$(srcdir); export srcdir; \
index 22d07f8715843c35cbb371df7db742c4c6b96c7e..935bd0fe03c87d7497dab4f2fe3c73ae458eb26e 100644 (file)
@@ -28,14 +28,14 @@ done
 
 {
 for f in *.bb
-do 
+do
     test "$f" = "*.bb" && { echo "run 'make check' first"; exit 1; }
     gcov $gcovflags "$f" 2>/dev/null
-done 
+done
 for f in $@
-do 
+do
     gcov $gcovflags "$f" 2>/dev/null
-done 
+done
 } |
 awk '
 BEGIN {
@@ -51,10 +51,10 @@ BEGIN {
     else
        file = "";
 }
-file ~ /\.[hc]$/ && /Lines executed/ { 
-       sub(/Lines executed:/, ""); 
+file ~ /\.[hc]$/ && /Lines executed/ {
+       sub(/Lines executed:/, "");
        covered = int($3*$1/100 + 0.5);
-       
+
 #      printf "%-5u %-5u %-5u %-7s %s\n", $3, covered, $3 - covered, $1, file;
        if ($3 == 0) {
                /* skip */
@@ -69,11 +69,11 @@ file ~ /\.[hc]$/ && /Lines executed/ {
         }
 }
 
-/torture/ { next; } 
+/torture/ { next; }
 /test/ { next; }
 /\/usr\/include/ { next; }
 
-/(source )?lines executed in file (.*\/)?[-A-Za-z_0-9]+\.[ch]/ { 
+/(source )?lines executed in file (.*\/)?[-A-Za-z_0-9]+\.[ch]/ {
         file = $0;
        sub(/.* in file /, "", file);
        sub(/.*\//, "", file);
@@ -98,7 +98,7 @@ END {
        l = lines[file]; c = coverage[file];
        covered = int(c + 0.5);
         total += l; total_coverage += c;
-       printf "%-5u %-5u %-5u %6.2f%%  %s\n", 
+       printf "%-5u %-5u %-5u %6.2f%%  %s\n",
                l, covered, l - covered, 100.0 * c / l, file;
     }
     if (total) {
index f1cf74ed9a467b59a68d272519e48068cd81e731..1128bf657de42b7f81c1711dc5285e1d7738f38a 100644 (file)
@@ -1,12 +1,12 @@
 #! /bin/sed -f
-# 
+#
 # Run this script like
 #
 # fix-include-sofia-sip -i.bak source.h source.c
 #
 # or
 #
-# find . -name '*.[hc]' -print0 | xargs -0 fix-include-sofia-sip -i.bak 
+# find . -name '*.[hc]' -print0 | xargs -0 fix-include-sofia-sip -i.bak
 #
 /^ *# *include/ {
 # Not using features.h...
index 3060e0c05945e2580f64fe76fce098650410ff93..64e38c2e245b8a3fec45fc7dd0db359e162cc254 100644 (file)
@@ -31,7 +31,7 @@
 
 echo "Postprocessing HTML in ${1:-.}: hiding email addresses, fixing links"
 
-find ${1:-.} -name '*.html' -print0 | 
+find ${1:-.} -name '*.html' -print0 |
 xargs -0 \
 sed -r -i '
 # Hide e-mail addresses
index 14c9da8b369f05a36d197f025f0260a720bff2a1..364f7981287709e0cfb990023a17b01fcdeabadd 100644 (file)
@@ -30,7 +30,7 @@ GENHTML_OPTIONS= o=
 
 while test $# -gt 0;
 do
-  case $1 in 
+  case $1 in
   --srcdir | -s )
     test -z "$2" && usage 1; shift; srcdir=$1; shift; ;;
   --srcdir=* )
@@ -41,7 +41,7 @@ do
     o=${1#--output?directory=}; shift ;;
   --prefix=* | --title=* | --show-details | --legend | --frames )
     GENHTML_OPTIONS="${GENHTML_OPTIONS} $1" ; shift ;;
-  --prefix | --title ) 
+  --prefix | --title )
     test -z "$2" && usage 1; GENHTML_OPTIONS="${GENHTML_OPTIONS} $1 $2" ; shift ; shift ;;
   --help | '-?' | -h ) usage 0 ;;
   - ) shift; break ;;
@@ -53,7 +53,7 @@ done
 info=${o:=.}/lcov.info geninfo=${o}/genhtml.info
 rm -f ${info} ${info}
 
-case ${GENHTML_OPTIONS} in *--prefix* ) ;; *) 
+case ${GENHTML_OPTIONS} in *--prefix* ) ;; *)
   GENHTML_OPTIONS="${GENHTML_OPTIONS} --prefix=`cd ${srcdir:=.} && pwd`"
 esac
 
@@ -64,7 +64,7 @@ lcov --compat-libtool --directory . --capture --output-file ${info} &&
     # remove source files in builddir
     test ${srcdir:-.} = . || lcov -l ${info} | grep "`pwd`"
     # remove test programs
-    lcov -l ${info} | grep "/test\|/torture\|_test[.][ch][+xp]*$" 
+    lcov -l ${info} | grep "/test\|/torture\|_test[.][ch][+xp]*$"
 } |
 cut -d: -f1 |
 xargs lcov -r ${info} > ${geninfo}
index 70b11091714583dc1021a56d8e978b832a191ef9..cddb705aab502a3bcd0bdbde513f750a64317890 100644 (file)
@@ -27,7 +27,7 @@
 
 function usage
 {
-  echo "usage: snapshot.sh [-bc|-bb] [-c|--configure] [rpmbuild options]" 
+  echo "usage: snapshot.sh [-bc|-bb] [-c|--configure] [rpmbuild options]"
   exit $@
 }
 
@@ -36,10 +36,10 @@ configure=0
 
 case "$1" in -b? ) bb=$1 ; shift ;; esac
 
-while true ; do 
-  case "$1" in 
+while true ; do
+  case "$1" in
   -c | --configure | --co ) configure=1; shift; ;;
-  '-?' | --help | -h ) usage 0 ;; 
+  '-?' | --help | -h ) usage 0 ;;
   *) break ;;
   esac
 done
@@ -89,24 +89,24 @@ awk '
 /@VERSION@/ { sub(/@VERSION@/, version); }
 /@PACKAGE@/ { sub(/@PACKAGE@/, package); }
 /@PACKAGE_NAME@/ { sub(/@PACKAGE_NAME@/, package_name); }
-/@LIBVER_SOFIA_SIP_UA_GLIB_SOVER@/ { 
+/@LIBVER_SOFIA_SIP_UA_GLIB_SOVER@/ {
   sub(/@LIBVER_SOFIA_SIP_UA_GLIB_SOVER@/, glib_sover);
 }
-/^Release:/ { 
+/^Release:/ {
   print "Release: " release "%{?dist}\n";
   print "Prefix: " prefix "\n";
   next;
 }
 /^Source0:/ { print "Source0:" dummy "\n"; next; }
-/disable-dependency-tracking/ { 
+/disable-dependency-tracking/ {
   sub(/--disable-dependency-tracking/, "");
 }
-/^%configure/ { 
+/^%configure/ {
  print "cd " "\"" pwd "\"";
  if (!configure) { $1="echo skipping configure"; }
  $1=$1 "-C --enable-maintainer-mode";
- print $0; 
- next; 
+ print $0;
+ next;
 }
 # Do not make documentation
 /^make doc/ { print "echo skipping " $0; next; }
index 754925601a3ec6c59df6a14c91d17989d517034f..80f14ffad4365a574edb485ea58d1734be47694f 100644 (file)
@@ -25,7 +25,7 @@ GENHTML_OPTIONS= o= ldir=
 
 while test $# -gt 0;
 do
-  case $1 in 
+  case $1 in
   --lcov-dir | -l ) test -z "$2" && usage 1; shift; ldir=$1; shift; ;;
   --lcov-dir=* ) ldir=${1#--ldir=}; shift ;;
   --srcdir | -s )
@@ -41,21 +41,21 @@ done
 
 cwd=`pwd`
 
-tdir=${TMPDIR:-/tmp}/$USER.uncovered.$$ 
+tdir=${TMPDIR:-/tmp}/$USER.uncovered.$$
 info=${tdir}/lcov.info geninfo=${tdir}/genhtml.info
 
 test -d ${tdir} && { echo ${tdir}: already exists ; exit 2 ; }
 
 mkdir -p ${tdir} &&
 {
-    # Find all lcov.info0 under -t DIR 
+    # Find all lcov.info0 under -t DIR
     test -d ${ldir} &&
     find ${ldir} -name lcov.info |
     while read s
     do
-      find $cwd -type f -not -newer $s | xargs lcov -q -e $s 
+      find $cwd -type f -not -newer $s | xargs lcov -q -e $s
     done
-    
+
     lcov -q -c -d . --compat-libtool
 } > ${info}
 
@@ -65,8 +65,8 @@ test -e ${info} || exit 1
   # remove system includes with with inlined functions
   lcov -q -l ${info} | grep -v "`cd ${srcdir:-.} && pwd`"
   # remove test programs
-  lcov -q -l ${info} | grep "/test\|/torture\|_test[.]c$" 
-} | 
+  lcov -q -l ${info} | grep "/test\|/torture\|_test[.]c$"
+} |
 cut -d: -f1 |
 xargs lcov -q -r ${info} > ${geninfo} &&
 cd ${tdir} &&
@@ -107,7 +107,7 @@ while (<>) {
         for ($f = $ARGV) {
           s:^[.]'$cwd/'::o;
           s:[.]gcov[.]html$::;
-        } 
+        }
         s/^ +(\d+)[^:]+:/$1:/;
         $uncovered = $f . ":" . $_;
       }
index c2c528e27d60ac781fb576902d9627e301dc770a..c32739c7c64ddc8a380f9ce461e1f5831f0596b5 100644 (file)
@@ -38,7 +38,7 @@
 #include <stdlib.h>
 
 /* Globals used by <sofia-sip/tstdef.h> */
-int tstflags;                  
+int tstflags;
 char const name[] = "check_sofia";
 
 int main(int argc, char *argv[])
index 99991b8fbc2026d7d013db4b2a5f08375864c9b6..ba7572c7ab9b41d5cc5d7a91964625c13a75e907 100644 (file)
@@ -106,7 +106,7 @@ int accept_pracked2(CONDITION_PARAMS)
     RESPOND(ep, call, nh, SIP_180_RINGING,
            TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
            TAG_END());
-    RESPOND(ep, call, nh, SIP_200_OK, 
+    RESPOND(ep, call, nh, SIP_200_OK,
            NUTAG_INCLUDE_EXTRA_SDP(1),
            TAG_END());
     return 0;
@@ -283,7 +283,7 @@ int test_180rel(struct context *ctx)
 
   if (print_headings)
     printf("TEST NUA-10.1.2: PASSED\n");
-  
+
   END();
 }
 
@@ -395,7 +395,7 @@ int test_prack_auth(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 407);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_1(au = sip->sip_proxy_authenticate); 
+  TEST_1(au = sip->sip_proxy_authenticate);
 
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
@@ -499,7 +499,7 @@ int test_prack_auth(struct context *ctx)
 
   if (print_headings)
     printf("TEST NUA-10.1.4: PASSED\n");
-  
+
   END();
 }
 
@@ -607,12 +607,12 @@ int test_183rel(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
   TEST_1(!is_offer_answer_done(e->data->e_tags));
-  
+
   if (!ep) {
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
     TEST(e->data->e_status, 200);
   }
-    
+
   ei = event_by_type(e->next, nua_r_invite);
   ep = event_by_type(e->next, nua_r_prack);
   if (!ep) {
@@ -696,7 +696,7 @@ int test_183rel(struct context *ctx)
 
   /* Client transitions:
      INIT -(C1)-> CALLING: nua_invite(), nua_i_state
-     CALLING -(C2)-> TERMINATING: nua_r_invite, nua_i_state, 
+     CALLING -(C2)-> TERMINATING: nua_r_invite, nua_i_state,
                                   nua_r_prack, nua_i_state
      TERMINATING -(T1)-> TERMINATED: nua_r_invite, nua_i_state
   */
@@ -722,7 +722,7 @@ int test_183rel(struct context *ctx)
     int bye = 1, cancel = 1, invite = 1, state = 1;
 
     while (bye || cancel || invite || state) {
-      TEST_1(e = e->next); 
+      TEST_1(e = e->next);
       if (e->data->e_event == nua_r_bye) {
        TEST_E(e->data->e_event, nua_r_bye);
        TEST(e->data->e_status, 200);
@@ -778,9 +778,9 @@ int test_183rel(struct context *ctx)
   /* 183 is PRACKed, PRACK is responded with 483 */
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_prack);
 
-  /* Client terminates the call 
-     - we may (it is received before BYE) or may not (received after BYE) 
-       get CANCEL request 
+  /* Client terminates the call
+     - we may (it is received before BYE) or may not (received after BYE)
+       get CANCEL request
   */
   TEST_1(e = e->next);
   if (e->data->e_event == nua_i_cancel) {
@@ -1116,7 +1116,7 @@ int test_preconditions(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_update);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
-  TEST_1(!is_offer_sent(e->data->e_tags)); 
+  TEST_1(!is_offer_sent(e->data->e_tags));
   TEST_1(is_offer_recv(e->data->e_tags));
   TEST_1(is_answer_sent(e->data->e_tags));
   TEST_1(!is_answer_recv(e->data->e_tags));
@@ -1281,9 +1281,9 @@ int test_preconditions2(struct context *ctx)
    |-------200 OK-------|
    |                   |
 
-   Note that the boxed responses above can be re-ordered 
+   Note that the boxed responses above can be re-ordered
    (180 or 200 OK to INVITE is received before 200 OK to UPDATE).
-   ACK, however, is sent only after 200 OK to both UPDATE and INVITE. 
+   ACK, however, is sent only after 200 OK to both UPDATE and INVITE.
 */
 
   a_call->sdp = "m=audio 5008 RTP/AVP 8";
@@ -1513,7 +1513,7 @@ int ringing_updated2(CONDITION_PARAMS)
     return 0;
   case nua_r_update:
     if (200 <= status && status < 300) {
-      RESPOND(ep, call, nh, SIP_180_RINGING, 
+      RESPOND(ep, call, nh, SIP_180_RINGING,
              SIPTAG_REQUIRE_STR("100rel"),
              TAG_END());
       ep->next_condition = accept_pracked;
@@ -1741,7 +1741,7 @@ int test_update_by_uas(struct context *ctx)
   do {
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
     TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
-    TEST_1(is_offer_sent(e->data->e_tags)); 
+    TEST_1(is_offer_sent(e->data->e_tags));
     TEST_1(!is_offer_recv(e->data->e_tags));
     TEST_1(!is_answer_sent(e->data->e_tags));
     TEST_1(!is_answer_recv(e->data->e_tags));
@@ -2035,7 +2035,7 @@ int test_update_failure(struct context *ctx)
 #endif
   END();
 }
+
 int cancel_when_pracked(CONDITION_PARAMS);
 int alert_call(CONDITION_PARAMS);
 
@@ -2129,7 +2129,7 @@ int test_180rel_cancel1(struct context *ctx)
    Option B:
    EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state
    COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
-   READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state   
+   READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
   */
   TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
   TEST(e->data->e_status, 100);
@@ -2157,7 +2157,7 @@ int test_180rel_cancel1(struct context *ctx)
 
   if (print_headings)
     printf("TEST NUA-10.6: PASSED\n");
-  
+
   END();
 }
 
@@ -2298,7 +2298,7 @@ int test_180rel_cancel2(struct context *ctx)
    Option B:
    EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state
    COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
-   READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state   
+   READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
   */
   TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
   TEST(e->data->e_status, 100);
@@ -2343,7 +2343,7 @@ int test_180rel_cancel2(struct context *ctx)
 
   if (print_headings)
     printf("TEST NUA-10.7: PASSED\n");
-  
+
   END();
 }
 
@@ -2561,7 +2561,7 @@ int test_180rel_redirected(struct context *ctx)
 
   if (print_headings)
     printf("TEST NUA-10.8.2: PASSED\n");
-  
+
   END();
 }
 
@@ -2575,7 +2575,7 @@ int redirect_pracked(CONDITION_PARAMS)
   if (event == nua_i_prack) {
     if (!ep->flags.bit0) {
       sip_contact_t m[1];
-      
+
       ep->flags.bit0 = 1;
 
       *m = *ep->contact;
index 38b3246ef0df77894e393d61f67e9b07a0e9563a..16cf3025b93e99d0f4ef6458b6a7e3bdd34230b7 100644 (file)
@@ -75,7 +75,7 @@ int accept_call(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            TAG_END());
     return 0;
   case nua_callstate_early:
@@ -115,7 +115,7 @@ int accept_call_with_early_sdp(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
            NUTAG_M_DISPLAY("Bob"),
            NUTAG_M_USERNAME("b+b"),
@@ -212,8 +212,8 @@ int test_basic_call_1(struct context *ctx)
     printf("TEST NUA-3.1: Basic call\n");
 
   /* Disable session timer from proxy */
-  test_proxy_get_session_timer(ctx->p, &se, &min_se); 
-  test_proxy_set_session_timer(ctx->p, 0, 0); 
+  test_proxy_get_session_timer(ctx->p, &se, &min_se);
+  test_proxy_set_session_timer(ctx->p, 0, 0);
 
   a_call->sdp = "m=audio 5008 RTP/AVP 8";
   b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
@@ -357,7 +357,7 @@ int test_basic_call_1(struct context *ctx)
   nua_handle_destroy(a_call->nh), a_call->nh = NULL;
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
 
-  test_proxy_set_session_timer(ctx->p, se, min_se); 
+  test_proxy_set_session_timer(ctx->p, se, min_se);
 
   if (print_headings)
     printf("TEST NUA-3.1: PASSED\n");
@@ -422,7 +422,7 @@ int test_basic_call_2(struct context *ctx)
   a_call->sdp = "m=audio 5008 RTP/AVP 8";
   b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
 
-  TEST_1(a_call->nh = nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call,
                                 SIPTAG_TO_STR("<sip:b@x.org>"),
                                 TAG_END()));
 
@@ -453,7 +453,7 @@ int test_basic_call_2(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_1(sip->sip_content_type); 
+  TEST_1(sip->sip_content_type);
   TEST_S(sip->sip_content_type->c_type, "application/sdp");
   TEST_1(sip->sip_payload);    /* there is sdp in 200 OK */
   TEST_1(sip->sip_contact);
@@ -533,7 +533,7 @@ int test_basic_call_2(struct context *ctx)
   TEST_1(sip->sip_subscription_state);
   TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
   TEST_1(tl_find(e->data->e_tags, nutag_substate));
-  TEST(tl_find(e->data->e_tags, nutag_substate)->t_value, 
+  TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
        nua_substate_terminated);
   TEST_1(!e->next);
 
@@ -615,7 +615,7 @@ int accept_call_no_media(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            NUTAG_MEDIA_ENABLE(0),
            TAG_END());
     return 0;
@@ -655,7 +655,7 @@ int test_basic_call_3(struct context *ctx)
     "t=0 0\r\n"
     "m=audio 5008 RTP/AVP 8\r\n";
 
-  b_call->sdp = 
+  b_call->sdp =
     "v=0\r\n"
     "o=- 2 1 IN IP4 127.0.0.1\r\n"
     "s=-\r\n"
@@ -663,7 +663,7 @@ int test_basic_call_3(struct context *ctx)
     "t=0 0\r\n"
     "m=audio 5010 RTP/AVP 0 8\r\n";
 
-  TEST_1(a_call->nh = nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call,
                                 SIPTAG_TO_STR("<sip:b@x.org>"),
                                 TAG_END()));
 
@@ -695,7 +695,7 @@ int test_basic_call_3(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_1(sip->sip_content_type); 
+  TEST_1(sip->sip_content_type);
   TEST_S(sip->sip_content_type->c_type, "application/sdp");
   TEST_1(sip->sip_payload);    /* there is sdp in 200 OK */
   TEST_1(sip->sip_contact);
@@ -780,7 +780,7 @@ int ack_when_completing_no_media(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_completing:
-    ACK(ep, call, nh, 
+    ACK(ep, call, nh,
        TAG_IF(call->sdp, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
        TAG_IF(call->sdp, SIPTAG_PAYLOAD_STR(call->sdp)),
        TAG_END());
@@ -805,7 +805,7 @@ int accept_call_no_media2(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            NUTAG_MEDIA_ENABLE(0),
            TAG_IF(call->sdp, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
            TAG_IF(call->sdp, SIPTAG_PAYLOAD_STR(call->sdp)),
@@ -848,7 +848,7 @@ int test_basic_call_4(struct context *ctx)
     "t=0 0\r\n"
     "m=audio 5008 RTP/AVP 8\r\n";
 
-  b_call->sdp = 
+  b_call->sdp =
     "v=0\r\n"
     "o=- 2 1 IN IP4 127.0.0.1\r\n"
     "s=-\r\n"
@@ -856,7 +856,7 @@ int test_basic_call_4(struct context *ctx)
     "t=0 0\r\n"
     "m=audio 5010 RTP/AVP 0 8\r\n";
 
-  TEST_1(a_call->nh = nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call,
                                 SIPTAG_TO_STR("<sip:b@x.org>"),
                                 TAG_END()));
 
@@ -889,7 +889,7 @@ int test_basic_call_4(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_1(sip->sip_content_type); 
+  TEST_1(sip->sip_content_type);
   TEST_S(sip->sip_content_type->c_type, "application/sdp");
   TEST_1(sip->sip_payload);    /* there is sdp in 200 OK */
   TEST_1(sip->sip_contact);
@@ -996,8 +996,8 @@ int change_uri_in_ack(CONDITION_PARAMS)
 }
 
 /* Test changing from/to within dialog */
-/* Test that a proper Contact gets selected in response 
- * regardless of the To URI. 
+/* Test that a proper Contact gets selected in response
+ * regardless of the To URI.
  */
 int test_basic_call_5(struct context *ctx)
 {
@@ -1014,7 +1014,7 @@ int test_basic_call_5(struct context *ctx)
   a_call->sdp = "m=audio 5008 RTP/AVP 8";
   b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
 
-  TEST_1(a_call->nh = nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call,
                                 SIPTAG_TO_STR("<sips:b@x.org>"),
                                 TAG_END()));
 
@@ -1073,8 +1073,8 @@ int test_basic_call_5(struct context *ctx)
   TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_ack);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_S(sip->sip_to->a_url->url_user, "anonymous"); 
-  TEST_S(sip->sip_from->a_url->url_user, "anonymous"); 
+  TEST_S(sip->sip_to->a_url->url_user, "anonymous");
+  TEST_S(sip->sip_from->a_url->url_user, "anonymous");
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!e->next);
@@ -1177,8 +1177,8 @@ int test_video_call_1(struct context *ctx)
     printf("TEST NUA-3.6: Basic call\n");
 
   /* Disable session timer from proxy */
-  test_proxy_get_session_timer(ctx->p, &se, &min_se); 
-  test_proxy_set_session_timer(ctx->p, 0, 0); 
+  test_proxy_get_session_timer(ctx->p, &se, &min_se);
+  test_proxy_set_session_timer(ctx->p, 0, 0);
 
   a_call->sdp = "m=audio 5008 RTP/AVP 8";
   b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
@@ -1256,8 +1256,8 @@ int test_video_call_1(struct context *ctx)
   a_call->sdp =
     "m=audio 5008 RTP/AVP 8\n"
     "m=video 5014 RTP/AVP 34 31\n";
-  
-  m = memset(b_video, 0, sizeof b_video);    
+
+  m = memset(b_video, 0, sizeof b_video);
   m->m_size = sizeof *m;
   m->m_session = b_sdp;
   m->m_type = sdp_media_video, m->m_type_name = "video";
@@ -1265,7 +1265,7 @@ int test_video_call_1(struct context *ctx)
   m->m_proto = sdp_proto_rtp; m->m_proto_name = "RTP/AVP";
   m->m_rtpmaps = memset(rm = b_h261, 0, sizeof b_h261);
   rm->rm_size = sizeof *rm;
-  rm->rm_pt = 31; rm->rm_encoding = "h261"; rm->rm_rate = 90000; 
+  rm->rm_pt = 31; rm->rm_encoding = "h261"; rm->rm_rate = 90000;
 
   b_sdp->sdp_media->m_next = m;
 
@@ -1336,7 +1336,7 @@ int test_video_call_1(struct context *ctx)
   nua_handle_destroy(a_call->nh), a_call->nh = NULL;
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
 
-  test_proxy_set_session_timer(ctx->p, se, min_se); 
+  test_proxy_set_session_timer(ctx->p, se, min_se);
 
   if (print_headings)
     printf("TEST NUA-3.6: PASSED\n");
@@ -1421,7 +1421,7 @@ int accept_call_with_contact(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
            SIPTAG_CONTACT(contact_for_b),
            TAG_END());
@@ -1475,11 +1475,11 @@ int test_basic_call_6(struct context *ctx)
   mb->m_url->url_user = "b++b";
 
   contact_for_b = mb;
-  
+
   sip_route_init(rb)->r_url[0] = b->contact->m_url[0];
   rb->r_url->url_user = "bob+0";
   url_param_add(nua_handle_home(a_call->nh), rb->r_url, "lr");
-  
+
   INVITE(a, a_call, a_call->nh,
         NUTAG_URL("sip:bob@example.org"), /* Expanded by proxy */
         SIPTAG_ROUTE_STR("B2 <sip:bob+2@example.org>;bar=foo"), /* Last in list */
@@ -1582,7 +1582,7 @@ int test_basic_call_6(struct context *ctx)
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!e->next);
   free_events_in_list(ctx, a->events);
-  
+
   TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
@@ -1773,7 +1773,7 @@ int test_basic_call_7(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   /* Make B to process HUMPPA at application level */
-  nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("HUMPPA"), 
+  nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("HUMPPA"),
                  NUTAG_ALLOW("HUMPPA"),
                  TAG_END());
   run_b_until(ctx, nua_r_set_params, until_final_response);
@@ -1898,7 +1898,7 @@ int test_basic_call_7(struct context *ctx)
   /* Let A allow INFO  */
   nua_set_params(a->nua, NUTAG_ALLOW("INFO"), TAG_END());
   /* Make B to process INFO at application level */
-  nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("INFO"), 
+  nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("INFO"),
                  NUTAG_ALLOW("INFO"),
                  TAG_END());
   run_ab_until(ctx, nua_r_set_params, NULL, nua_r_set_params, NULL);
@@ -1955,7 +1955,7 @@ int reject_method(CONDITION_PARAMS)
   save_event_in_list(ctx, event, ep, call);
 
   if (event == nua_i_method) {
-    RESPOND(ep, call, nh, 
+    RESPOND(ep, call, nh,
            SIP_604_DOES_NOT_EXIST_ANYWHERE,
            NUTAG_WITH(current),
            TAG_END());
@@ -1974,7 +1974,7 @@ int reject_info(CONDITION_PARAMS)
   save_event_in_list(ctx, event, ep, call);
 
   if (event == nua_i_info) {
-    RESPOND(ep, call, nh, 
+    RESPOND(ep, call, nh,
            SIP_480_TEMPORARILY_UNAVAILABLE,
            NUTAG_WITH(current),
            TAG_END());
index 9f1a87e341c29b2943cb8f218ccd2696c97aeccd..11d3ae0831369f04a5af3f7eca4e4862deb9cbac 100644 (file)
@@ -524,7 +524,7 @@ int test_call_hold(struct context *ctx)
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!e->next);
   free_events_in_list(ctx, b->events);
-  
+
   TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_ack);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
@@ -618,7 +618,7 @@ int test_call_hold(struct context *ctx)
   TEST_1(!e->next);
 #endif
   free_events_in_list(ctx, b->events);
-  
+
   TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_ack);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
@@ -632,7 +632,7 @@ int test_call_hold(struct context *ctx)
   if (print_headings)
     printf("TEST NUA-7.6.2: PASSED\n");
   }
-  
+
 
   /* ---------------------------------------------------------------------- */
   /*
@@ -742,7 +742,7 @@ int until_complete(CONDITION_PARAMS)
 static size_t remove_first_ack(void *_once, void *message, size_t len)
 {
   int *once = _once;
-  
+
   if (*once)
     return len;
 
@@ -792,8 +792,8 @@ int test_reinvite(struct context *ctx)
   a_call->sdp = "m=audio 5008 RTP/AVP 0 8\n";
   b_call->sdp = "m=audio 5010 RTP/AVP 8\n";
 
-  TEST_1(a_call->nh = 
-        nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh =
+        nua_handle(a->nua, a_call,
                    SIPTAG_FROM_STR("Alice <sip:alice@example.com>"),
                    SIPTAG_TO(b->to),
                    NUTAG_AUTOANSWER(0),
@@ -823,12 +823,12 @@ int test_reinvite(struct context *ctx)
 */
 
   /* re-INVITE A, send BYE after receiving 180 */
-  INVITE(b, b_call, b_call->nh, 
+  INVITE(b, b_call, b_call->nh,
         SIPTAG_SUBJECT_STR("re-INVITE"),
         TAG_END());
   /* Run until both a and b has terminated their call */
   run_ab_until(ctx, -1, ringing_until_terminated, -1, bye_when_ringing);
-  
+
 #if notyet
   struct event *e;
 
@@ -849,8 +849,8 @@ int test_reinvite(struct context *ctx)
   TEST(callstate(e->data->e_tags), nua_callstate_terminating); /* READY */
   /* Now we can receive events, in any possible order */
   /* XXX */
-  TEST_1(e = e->next); 
-  
+  TEST_1(e = e->next);
+
   TEST_1(!nua_handle_has_active_call(a_call->nh));
 
   /*
@@ -890,7 +890,7 @@ int test_reinvite(struct context *ctx)
 }
 
 /*
- Accept INVITE 
+ Accept INVITE
  X
  |                    |
  |-------INVITE------>|
@@ -998,8 +998,8 @@ int test_reinvite2(struct context *ctx)
   a_call->sdp = "m=audio 5008 RTP/AVP 0 8\n";
   b_call->sdp = "m=audio 5010 RTP/AVP 8\n";
 
-  TEST_1(a_call->nh = 
-        nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh =
+        nua_handle(a->nua, a_call,
                    SIPTAG_FROM_STR("Alice <sip:alice@example.com>"),
                    SIPTAG_TO(b->to),
                    TAG_END()));
@@ -1098,7 +1098,7 @@ int accept_and_attempt_reinvite(CONDITION_PARAMS)
   }
   else switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            SIPTAG_REQUIRE_STR("100rel"),
            TAG_END());
     return 0;
@@ -1166,7 +1166,7 @@ int test_reinvites(struct context *ctx)
     printf("TEST NUA-7: Test call hold and re-INVITEs\n");
 
   retval = test_call_hold(ctx);
-  
+
   if (retval == 0)
     retval = test_reinvite(ctx);
 
index c3be7ad0dd7dea75d04d97666d0984ef79542145..7e10c6e090b8a3cd9763f08aee1f9e25150aed50 100644 (file)
@@ -128,7 +128,7 @@ int test_reject_a(struct context *ctx)
   TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
   TEST(e->data->e_status, 100);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_1(sip->sip_contact); TEST_1(!sip->sip_contact->m_next); 
+  TEST_1(sip->sip_contact); TEST_1(!sip->sip_contact->m_next);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
   TEST_1(is_offer_recv(e->data->e_tags));
@@ -1042,7 +1042,7 @@ int test_reject_401_bad(struct context *ctx)
   TEST(e->data->e_status, 904);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
-  TEST_1(!e->next); 
+  TEST_1(!e->next);
 
   free_events_in_list(ctx, a->events);
 
@@ -1263,7 +1263,7 @@ size_t filter_ACK(void *arg, void *message, size_t len)
 {
   (void)arg;
 
-  if (len >= 7 && strncasecmp(message, "ACK sip", 7) == 0) 
+  if (len >= 7 && strncasecmp(message, "ACK sip", 7) == 0)
     return 0;
   return len;
 }
@@ -1297,7 +1297,7 @@ int test_call_timeouts(struct context *ctx)
   TEST_1(f = test_nat_add_filter(ctx->nat, filter_200_OK, NULL, nat_inbound));
   TEST_1(f2 = test_nat_add_filter(ctx->nat, filter_200_OK,
                                  NULL, nat_outbound));
-  
+
   INVITE(a, a_call, a_call->nh,
         TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
         SIPTAG_SUBJECT_STR("NUA-4.7.1"),
@@ -1383,7 +1383,7 @@ int test_call_timeouts(struct context *ctx)
   TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
 
   TEST_1(f = test_nat_add_filter(ctx->nat, filter_ACK, NULL, nat_outbound));
-  
+
   INVITE(a, a_call, a_call->nh,
         TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
         SIPTAG_SUBJECT_STR("NUA-4.7.2"),
@@ -1421,14 +1421,14 @@ int test_call_timeouts(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_proceeding); 
+  TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_terminated); 
+  TEST(callstate(e->data->e_tags), nua_callstate_terminated);
   TEST_1(!e->next);
 
   /*
@@ -1503,7 +1503,7 @@ int test_call_timeouts(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_proceeding); 
+  TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
@@ -1513,7 +1513,7 @@ int test_call_timeouts(struct context *ctx)
   TEST(callstate(e->data->e_tags), nua_callstate_terminating);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_terminated); 
+  TEST(callstate(e->data->e_tags), nua_callstate_terminated);
   TEST_1(!e->next);
 
   /*
@@ -1559,7 +1559,7 @@ int test_call_timeouts(struct context *ctx)
   TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
 
   TEST_1(f = test_nat_add_filter(ctx->nat, filter_ACK, NULL, nat_outbound));
-  
+
   INVITE(a, a_call, a_call->nh,
         TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
         SIPTAG_SUBJECT_STR("NUA-4.7.4"),
@@ -1599,14 +1599,14 @@ int test_call_timeouts(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_proceeding); 
+  TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_terminated); 
+  TEST(callstate(e->data->e_tags), nua_callstate_terminated);
   TEST_1(!e->next);
 
   /*
@@ -1626,7 +1626,7 @@ int test_call_timeouts(struct context *ctx)
   TEST_1(is_answer_sent(e->data->e_tags));
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_error);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_terminating); 
+  TEST(callstate(e->data->e_tags), nua_callstate_terminating);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
index 88c2ae61b128599029758fe1e60b4b3ddcc966ed..7ba63cad105e484972d84f02fa58000d34e055aa 100644 (file)
@@ -288,7 +288,7 @@ int test_call_cancel(struct context *ctx)
     printf("TEST NUA-5.1.2: PASSED\n");
 
  /* ----------------------------------------------------------------------- */
+
   if (print_headings)
     printf("TEST NUA-5.2.1: cancel call when ringing\n");
 
@@ -687,7 +687,7 @@ int test_call_destroy_3(struct context *ctx)
   TEST_1(is_offer_recv(e->data->e_tags));
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
-  TEST_1(!e->next);  
+  TEST_1(!e->next);
 
   free_events_in_list(ctx, b->events);
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
@@ -757,7 +757,7 @@ int test_call_destroy_4(struct context *ctx)
     TEST(e->data->e_status, 180);
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
     TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
-    TEST_1(e = e->next); 
+    TEST_1(e = e->next);
   }
   if (e->data->e_event == nua_r_invite) {
     TEST_E(e->data->e_event, nua_r_invite);
@@ -765,7 +765,7 @@ int test_call_destroy_4(struct context *ctx)
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
     TEST(callstate(e->data->e_tags), nua_callstate_completing); /* COMPLETING */
     TEST_1(is_answer_recv(e->data->e_tags));
-    TEST_1(e = e->next); 
+    TEST_1(e = e->next);
   }
   TEST_E(e->data->e_event, nua_i_bye);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
@@ -790,7 +790,7 @@ int test_call_destroy_4(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
   TEST_1(is_answer_sent(e->data->e_tags));
-  TEST_1(!e->next);  
+  TEST_1(!e->next);
 
   free_events_in_list(ctx, b->events);
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
@@ -866,7 +866,7 @@ int test_call_destroy_5(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
   TEST_1(is_answer_sent(e->data->e_tags));
-  TEST_1(!e->next);  
+  TEST_1(!e->next);
 
   free_events_in_list(ctx, b->events);
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
@@ -885,7 +885,7 @@ int test_call_destroy(struct context *ctx)
   a_call->sdp = "m=audio 5008 RTP/AVP 8";
   b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
 
-  return 
+  return
     test_call_destroy_1(ctx) ||
     test_call_destroy_2(ctx) ||
     test_call_destroy_3(ctx) ||
@@ -1108,12 +1108,12 @@ int test_bye_before_ack(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_proceeding); 
+  TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
 
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_completing); 
+  TEST(callstate(e->data->e_tags), nua_callstate_completing);
   TEST_1(e = e->next);
 
   TEST_E(e->data->e_event, nua_r_bye); TEST(e->data->e_status, 200);
@@ -1212,7 +1212,7 @@ int test_bye_after_receiving_401(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   /* re-INVITE A. */
-  INVITE(b, b_call, b_call->nh, 
+  INVITE(b, b_call, b_call->nh,
         SIPTAG_SUBJECT_STR("NUA-6.3 re-INVITE"),
         TAG_END());
   run_ab_until(ctx, -1, reject_reinvite_401, -1, save_until_final_response);
@@ -1224,7 +1224,7 @@ int test_bye_after_receiving_401(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   BYE(b, b_call, b_call->nh, TAG_END());
-  
+
   run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
 
   free_events_in_list(ctx, a->events);
@@ -1287,7 +1287,7 @@ int test_bye_after_sending_401(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   /* re-INVITE A. */
-  INVITE(b, b_call, b_call->nh, 
+  INVITE(b, b_call, b_call->nh,
         SIPTAG_SUBJECT_STR("NUA-6.4.1 re-INVITE"),
         TAG_END());
   run_ab_until(ctx, -1, reject_reinvite_401, -1, save_until_final_response);
@@ -1299,7 +1299,7 @@ int test_bye_after_sending_401(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   BYE(a, a_call, a_call->nh, TAG_END());
-  
+
   run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
 
   free_events_in_list(ctx, a->events);
@@ -1362,7 +1362,7 @@ int test_bye_after_receiving_401_to_update(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   /* UPDATE A. */
-  UPDATE(b, b_call, b_call->nh, 
+  UPDATE(b, b_call, b_call->nh,
         SIPTAG_SUBJECT_STR("NUA-6.4.2 UPDATE"),
         TAG_END());
   BYE(b, b_call, b_call->nh, TAG_END()); /* Queued until nua_authenticate */
@@ -1375,7 +1375,7 @@ int test_bye_after_receiving_401_to_update(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   AUTHENTICATE(b, b_call, b_call->nh, TAG_END());
-  
+
   run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
 
   free_events_in_list(ctx, a->events);
@@ -1472,7 +1472,7 @@ int test_bye_with_407(struct context *ctx)
   TEST_1(e = c->events->head); TEST_E(e->data->e_event, nua_i_invite);
   free_events_in_list(ctx, c->events);
 
-  BYE(c, c_call, c_call->nh, 
+  BYE(c, c_call, c_call->nh,
       TAG_END());
   run_c_until(ctx, -1, save_until_final_response);
 
@@ -1482,9 +1482,9 @@ int test_bye_with_407(struct context *ctx)
   free_events_in_list(ctx, a->events);
   free_events_in_list(ctx, c->events);
 
-  AUTHENTICATE(c, c_call, c_call->nh, 
+  AUTHENTICATE(c, c_call, c_call->nh,
               NUTAG_AUTH("Digest:\"test-proxy\":charlie:secret"), TAG_END());
-  
+
   run_abc_until(ctx, -1, until_terminated, -1, NULL, -1, until_terminated);
 
   free_events_in_list(ctx, a->events);
@@ -1556,12 +1556,12 @@ int test_bye_to_invalid_contact(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_proceeding); 
+  TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
 
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_ready); 
+  TEST(callstate(e->data->e_tags), nua_callstate_ready);
   TEST_1(!e->next);
 
   /*
@@ -1588,7 +1588,7 @@ int test_bye_to_invalid_contact(struct context *ctx)
   free_events_in_list(ctx, b->events);
 
   BYE(b, b_call, b_call->nh, TAG_END());
-  
+
   run_b_until(ctx, -1, until_terminated);
 
   /* B transitions:
@@ -1651,7 +1651,7 @@ int test_bye_to_invalid_contact(struct context *ctx)
 
 int test_early_bye(struct context *ctx)
 {
-  return 
+  return
     test_bye_with_407(ctx) ||
     test_bye_before_200(ctx) ||
     test_bye_before_ack(ctx) ||
index 79aac676cbc5a247792db626f95d0bdc6054917f..f5f34021b36197ef2d4586c14f8f69670a64630e 100644 (file)
@@ -75,7 +75,7 @@ int test_extension(struct context *ctx)
   sip_t const *sip;
 
 
-/* Test for EXTENSION 
+/* Test for EXTENSION
 
    A                   B
    |------EXTENSION---->|
index 9a8838012fef3fcdffaaa6064d5e8c1d73ce4935..e81d94bda3c17c5bce6abb024c11920344769aee 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**@CFILE test_init.c
- * @brief Init nua test context 
+ * @brief Init nua test context
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  * @author Martti Mela <Martti Mela@nokia.com>
@@ -114,7 +114,7 @@ int test_nua_init(struct context *ctx,
                               TAG_END());
 
     if (ctx->p) {
-      ctx->a.domain = 
+      ctx->a.domain =
        test_proxy_add_domain(ctx->p,
                              URL_STRING_MAKE("sip:example.com")->us_url,
                              AUTHTAG_METHOD("Digest"),
@@ -126,7 +126,7 @@ int test_nua_init(struct context *ctx,
                              AUTHTAG_NEXT_EXPIRES(60),
                              TAG_END());
 
-      ctx->b.domain = 
+      ctx->b.domain =
        test_proxy_add_domain(ctx->p,
                              URL_STRING_MAKE("sip:example.org")->us_url,
                              AUTHTAG_METHOD("Digest"),
@@ -140,7 +140,7 @@ int test_nua_init(struct context *ctx,
 
       test_proxy_domain_set_outbound(ctx->b.domain, 1);
 
-      ctx->c.domain = 
+      ctx->c.domain =
        test_proxy_add_domain(ctx->p,
                              URL_STRING_MAKE("sip:example.net")->us_url,
                              AUTHTAG_METHOD("Digest"),
@@ -379,7 +379,7 @@ int test_nua_init(struct context *ctx,
                    NUTAG_APPL_METHOD_REF(appl_method),
                    SIPTAG_SUPPORTED_REF(supported),
                    TAG_END());
-  
+
   TEST(err, 4); TEST_1(m);
   TEST_1(ctx->c.contact = sip_contact_dup(ctx->home, m));
   TEST_1(ctx->c.allow = sip_allow_dup(ctx->home, allow));
index 50f188cc979643cd98fe43c9218c10982b2c4901..8410e1bd960a3190ed4a0d5b1dc57ba73440f735 100644 (file)
@@ -128,7 +128,7 @@ struct binding
 
 static struct binding *nat_binding_new(struct nat *nat,
                                       char const *protoname,
-                                      int socktype, int protocol, 
+                                      int socktype, int protocol,
                                       int connected,
                                       su_socket_t in_socket,
                                       su_sockaddr_t *from,
@@ -178,7 +178,7 @@ test_nat_init(su_root_t *root, struct nat *nat)
   nat->root = root;
   nat->udp_socket = INVALID_SOCKET, nat->tcp_socket = INVALID_SOCKET;
 
-  tl_gets(nat->tags, 
+  tl_gets(nat->tags,
          TESTNATTAG_SYMMETRIC_REF(nat->symmetric),
          TESTNATTAG_LOGGING_REF(nat->logging),
          TAG_END());
@@ -427,7 +427,7 @@ int test_nat_flush(struct nat *nat)
   if (nat == NULL)
     return su_seterrno(EFAULT);
 
-  return su_task_execute(su_clone_task(nat->clone), 
+  return su_task_execute(su_clone_task(nat->clone),
                         invalidate_bindings, nat, NULL);
 }
 
@@ -485,10 +485,10 @@ static int binding_init(struct binding *b,
   su_wakeup_f in_to_out, out_to_in;
 
   if (b->socktype == SOCK_STREAM)
-    in_to_out = tcp_in_to_out, out_to_in = tcp_out_to_in;    
+    in_to_out = tcp_in_to_out, out_to_in = tcp_out_to_in;
   else
-    in_to_out = udp_in_to_out, out_to_in = udp_out_to_in;    
-  
+    in_to_out = udp_in_to_out, out_to_in = udp_out_to_in;
+
   if (b->in_socket == INVALID_SOCKET) {
     int in_socket;
 
@@ -549,7 +549,7 @@ static int binding_init(struct binding *b,
   b->in_register = su_root_register(nat->root, wait, in_to_out, b, 0);
   if (b->in_register < 0) {
     su_perror("nat_binding_new: su_root_register");
-    su_wait_destroy(wait); 
+    su_wait_destroy(wait);
     return -1;
   }
 
@@ -610,13 +610,13 @@ static int invalidate_bindings(void *arg)
 
 #if 0
 static struct binding *nat_binding_find(struct nat *nat,
-                                       su_sockaddr_t *from, 
+                                       su_sockaddr_t *from,
                                        int fromlen)
 {
   char name[64], ipname[64];
   size_t namelen;
   struct binding *b;
-                                      
+
   su_inet_ntop(from->su_family, SU_ADDR(from), ipname, sizeof ipname);
   snprintf(name, sizeof name,
           from->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
@@ -629,7 +629,7 @@ static struct binding *nat_binding_find(struct nat *nat,
   }
 
   if (b == NULL)
-    b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric, 
+    b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric,
                        INVALID_SOCKET, from, fromlen);
 
   return b;
@@ -659,7 +659,7 @@ static int new_udp(struct nat *nat, su_wait_t *wait, struct binding *dummy)
     return 0;
   }
 
-  b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric, 
+  b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric,
                      INVALID_SOCKET, from, fromlen);
   if (b == NULL)
     return 0;
@@ -667,7 +667,7 @@ static int new_udp(struct nat *nat, su_wait_t *wait, struct binding *dummy)
   if (nat->symmetric)
     m = su_send(b->out_socket, nat->buffer, n, 0);
   else
-    m = su_sendto(b->out_socket, nat->buffer, n, 0, 
+    m = su_sendto(b->out_socket, nat->buffer, n, 0,
                  nat->out_address, nat->out_addrlen);
 
   if (nat->logging)
@@ -989,7 +989,7 @@ int test_nat_remove_filter(struct nat *nat,
 
   a->nat = nat;
   a->f = filter;
-  
+
   if (su_task_execute(su_clone_task(nat->clone),
                      execute_nat_filter_remove, a, NULL) < 0)
     return -1;
index 3cc3c855b78d2a3da256b87f09922e5c54b5b77a..9caed9d97a51f299da56d604f949338d3801d050 100644 (file)
@@ -33,7 +33,7 @@ SOFIA_BEGIN_DECLS
 struct nat;
 struct nat_filter;
 
-struct nat *test_nat_create(su_root_t *, int family, 
+struct nat *test_nat_create(su_root_t *, int family,
                            tag_type_t, tag_value_t, ...);
 
 void test_nat_destroy(struct nat *);
index 283e19100ccc4e860752354ff0829ea266a02291..4848551b0e10848263a1e0cae1fc23a36a25ca18 100644 (file)
@@ -74,7 +74,7 @@ static RETSIGTYPE sig_alarm(int s)
 static char const options_usage[] =
   "   -v | --verbose    be verbose\n"
   "   -q | --quiet      be quiet\n"
-  "   -a | --abort      abort on error\n" 
+  "   -a | --abort      abort on error\n"
   "   -s                use only single thread\n"
   "   -l level          set logging level (0 by default)\n"
   "   -e | --events     print nua events\n"
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
 #if HAVE_OPEN_C
   dup2(1, 2);
 #endif
-  
+
   if (getenv("EXPENSIVE_CHECKS"))
     o_expensive = 1;
 
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
   ctx->a.printer = o_events_init ? print_event : NULL;
 
   retval |= test_nua_api_errors(ctx); SINGLE_FAILURE_CHECK();
-  
+
   retval |= test_tag_filter(); SINGLE_FAILURE_CHECK();
 
   retval |= test_nua_params(ctx); SINGLE_FAILURE_CHECK();
index 5c67d014d33ced286ddbfd59661b5ad04ff41fc9..940db657eb039c3da748bbf626b92baf9da13408 100644 (file)
@@ -111,7 +111,7 @@ struct eventlist
   struct event *head, **tail;
 };
 
-struct event 
+struct event
 {
   struct event *next, **prev;
   struct call *call;
@@ -267,7 +267,7 @@ int run_a_until(struct context *, nua_event_t, condition_function *);
 int run_b_until(struct context *, nua_event_t, condition_function *);
 int run_c_until(struct context *, nua_event_t, condition_function *);
 
-typedef int operation_f(struct endpoint *ep, struct call *call, 
+typedef int operation_f(struct endpoint *ep, struct call *call,
                        nua_handle_t *nh, tag_type_t tag, tag_value_t value,
                        ...);
 
index 545ea004b5cf44bc751bf9b0ee86d6527be223c2..fa56dd22629660bcc089fc70db7584ad2028bd59 100644 (file)
@@ -160,7 +160,7 @@ void destroy_callback(nua_event_t event,
 int test_nua_destroy(struct context *ctx)
 {
   BEGIN();
-  
+
   struct endpoint *a = &ctx->a;
 
   TEST_1(ctx->root = su_root_create(NULL));
@@ -307,7 +307,7 @@ int test_unregister_without_register(struct context *ctx)
 
   if (print_headings)
     printf("TEST NUA-1.2.4: PASSED\n");
-  
+
   END();
 }
 
@@ -384,7 +384,7 @@ int test_register_503(struct context *ctx)
    A
    |------REGISTER--\
    |<-------503-----/
-   |                   
+   |
 
 */
 
@@ -393,7 +393,7 @@ int test_register_503(struct context *ctx)
 
   TEST_1(a_reg->nh = nua_handle(a->nua, a_reg, TAG_END()));
 
-  REGISTER(a, a_reg, a_reg->nh, 
+  REGISTER(a, a_reg, a_reg->nh,
           NUTAG_REGISTRAR(URL_STRING_MAKE("sip:bad.domain")),
           SIPTAG_TO_STR("sip:lissu@bad.domain"),
           TAG_END());
@@ -407,7 +407,7 @@ int test_register_503(struct context *ctx)
 
   TEST_1(a_reg->nh = nua_handle(a->nua, a_reg, TAG_END()));
 
-  REGISTER(a, a_reg, a_reg->nh, 
+  REGISTER(a, a_reg, a_reg->nh,
           NUTAG_REGISTRAR(URL_STRING_MAKE("sip:bad.domain")),
           SIPTAG_TO_STR("sip:lissu@bad.domain"),
           TAG_END());
@@ -447,13 +447,13 @@ int test_stack_errors(struct context *ctx)
   nua_shutdown(a->nua);
 
   run_a_until(ctx, -1, until_final_response);
-  
+
   TEST_VOID(nua_destroy(a->nua));
 
   a->nua = NULL;
 
   su_root_destroy(ctx->root), ctx->root = NULL;
-        
+
   if (print_headings)
     printf("TEST NUA-1.2: PASSED\n");
 
index 354d0f0f5cf93b112d956aceb289a3240431c205..2d9543310af921042d6fd7840e385fdc04bd920a 100644 (file)
@@ -155,7 +155,7 @@ int test_nua_params(struct context *ctx)
                 SIPTAG_USER_AGENT_STR("test_nua/1.0"),
 
                 SIPTAG_ORGANIZATION_STR("Open Laboratory"),
-                
+
                 NUTAG_M_DISPLAY("XXX"),
                 NUTAG_M_USERNAME("xxx"),
                 NUTAG_M_PARAMS("user=ip"),
@@ -310,7 +310,7 @@ int test_nua_params(struct context *ctx)
     char const *m_params = "NONE";
     char const *m_features = "NONE";
     char const *instance = "NONE";
-    
+
     url_string_t const *registrar = NONE;
     unsigned keepalive = (unsigned)-1, keepalive_stream = (unsigned)-1;
 
@@ -424,10 +424,10 @@ int test_nua_params(struct context *ctx)
     TEST_S(sip_header_as_string(tmphome, (void *)allow), "OPTIONS, INFO, ACK");
     TEST_S(allow_str, "OPTIONS, INFO, ACK");
     TEST_S(appl_method, "INVITE, REGISTER, PUBLISH, SUBSCRIBE, NOTIFY");
-    TEST_S(sip_header_as_string(tmphome, (void *)allow_events), 
+    TEST_S(sip_header_as_string(tmphome, (void *)allow_events),
           "reg, presence, presence.winfo");
     TEST_S(allow_events_str, "reg, presence, presence.winfo");
-    TEST_S(sip_header_as_string(tmphome, (void *)supported), 
+    TEST_S(sip_header_as_string(tmphome, (void *)supported),
           "foo, bar, baz");
     TEST_S(supported_str, "foo, bar, baz");
     TEST_S(sip_header_as_string(tmphome, (void *)user_agent), "test_nua");
index 3fa5afe13e1c1f405250d1d000c83bfad226f65a..6b91ed3116e3fb3b5d735b33fe72949b8ecdab14 100644 (file)
@@ -66,7 +66,7 @@
           <--nua_i_state---|                    |
 
    Client transitions:
-   INIT -(C1)-> CALLING -(C2a)-> PROCEEDING -(C3+C4)-> 
+   INIT -(C1)-> CALLING -(C2a)-> PROCEEDING -(C3+C4)->
    TERMINATING -> TERMINATED
    Server transitions:
    INIT -(S1)-> RECEIVED -(S2a)-> EARLY -(S3b)-> COMPLETED -(S4)-> READY
@@ -113,8 +113,8 @@ int test_no_answer_1(struct context *ctx)
 
   /* Client transitions:
      INIT -(C1)-> CALLING: nua_invite(), nua_i_state
-     CALLING -(C3)-> PROCEEDING: nua_r_invite, nua_i_state 
-     PROCEEDING -(C3a+C5)-> TERMINATING: nua_r_invite, nua_i_state 
+     CALLING -(C3)-> PROCEEDING: nua_r_invite, nua_i_state
+     PROCEEDING -(C3a+C5)-> TERMINATING: nua_r_invite, nua_i_state
      TERMINATING -(C12)-> TERMINATED: nua_r_bye, nua_i_state
   */
   TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
@@ -198,7 +198,7 @@ int no_media_terminated(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            NUTAG_MEDIA_ENABLE(0),
            TAG_END());
     return 0;
@@ -238,7 +238,7 @@ int test_no_answer_2(struct context *ctx)
     "t=0 0\r\n"
     "m=audio 5008 RTP/AVP 8\r\n";
 
-  b_call->sdp = 
+  b_call->sdp =
     "v=0\r\n"
     "o=- 2 1 IN IP4 127.0.0.1\r\n"
     "s=-\r\n"
@@ -246,7 +246,7 @@ int test_no_answer_2(struct context *ctx)
     "t=0 0\r\n"
     "m=audio 5010 RTP/AVP 0 8\r\n";
 
-  TEST_1(a_call->nh = nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call,
                                 SIPTAG_TO_STR("<sip:b@x.org>"),
                                 TAG_END()));
 
@@ -279,7 +279,7 @@ int test_no_answer_2(struct context *ctx)
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_1(sip->sip_content_type); 
+  TEST_1(sip->sip_content_type);
   TEST_S(sip->sip_content_type->c_type, "application/sdp");
   TEST_1(sip->sip_payload);    /* there is sdp in 200 OK */
   TEST_1(sip->sip_contact);
@@ -344,7 +344,7 @@ int accept_call_until_terminated(CONDITION_PARAMS)
 
   switch (callstate(tags)) {
   case nua_callstate_received:
-    RESPOND(ep, call, nh, SIP_180_RINGING, 
+    RESPOND(ep, call, nh, SIP_180_RINGING,
            TAG_END());
     return 0;
   case nua_callstate_early:
@@ -387,7 +387,7 @@ int test_missing_user_sdp(struct context *ctx)
   nua_set_params(b->nua, NUTAG_MEDIA_ENABLE(0), TAG_END());
   run_b_until(ctx, nua_r_set_params, until_final_response);
 
-  TEST_1(a_call->nh = nua_handle(a->nua, a_call, 
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call,
                                 SIPTAG_TO_STR("<sip:b@x.org>"),
                                 TAG_END()));
 
@@ -456,7 +456,7 @@ int test_missing_user_sdp(struct context *ctx)
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
 
   nua_set_params(b->nua,
-                NUTAG_MEDIA_ENABLE(1), 
+                NUTAG_MEDIA_ENABLE(1),
                 SOATAG_USER_SDP_STR("m=audio 5006 RTP/AVP 8 0"),
                 TAG_END());
   run_b_until(ctx, nua_r_set_params, until_final_response);
index 0c43d9bf4035f2f6e1c5bae44dd96fadc58c9cee..d88c9d337efd05968a333d3226de84a89d52d5bb 100644 (file)
@@ -48,7 +48,7 @@ int save_events(CONDITION_PARAMS)
 }
 
 int until_final_response(CONDITION_PARAMS)
-{ 
+{
   return status >= 200;
 }
 
@@ -115,7 +115,7 @@ int is_offer_answer_done(tagi_t const *tags)
 {
   tagi_t const *ti;
 
-  return 
+  return
     ((ti = tl_find(tags, nutag_answer_recv)) && ti->t_value) ||
     ((ti = tl_find(tags, nutag_offer_sent)) && ti->t_value) ||
     ((ti = tl_find(tags, nutag_offer_recv)) && ti->t_value) ||
@@ -182,7 +182,7 @@ void print_event(nua_event_t event,
            ep->name, (void *)nh, nua_event_name(event), phrase,
            nua_substate_name(t ? t->t_value : 0));
   }
-  else if ((int)event >= nua_i_bye || 
+  else if ((int)event >= nua_i_bye ||
           event == nua_i_invite || event == nua_i_cancel ||
           event == nua_i_ack) {
     fprintf(stderr, "%s %s.nua(%p): event %s %03d %s\n", timestamp,
@@ -208,7 +208,7 @@ void print_event(nua_event_t event,
              ep->name, (void *)nh, operation);
   }
 
-  if (tags && 
+  if (tags &&
       ((tstflags & tst_verbatim) || ctx->print_tags || ep->print_tags))
     tl_print(stderr, "", tags);
 }
@@ -516,7 +516,7 @@ void free_event_in_list(struct context *ctx,
     if (list->head == NULL)
       list->tail = &list->head;
   }
-}                            
+}
 
 struct event *event_by_type(struct event *e, nua_event_t etype)
 {
index 3d27627434456b8c5742406d8f65f2c08ca3914b..4647bffa9f1cd276caf293e6eb1c42bdaa548328 100644 (file)
@@ -98,7 +98,7 @@ struct proxy {
   tagi_t      *tags;
 
   su_root_t   *root;
+
   nta_agent_t *agent;
   url_t const *uri;
   sip_route_t *lr;
@@ -119,7 +119,7 @@ struct proxy {
     unsigned t1x64;
     sip_time_t session_expires, min_se;
   } prefs;
-}; 
+};
 
 struct domain {
   su_home_t home[1];
@@ -139,7 +139,7 @@ struct domain {
     int outbound_tcp;          /**< Use inbound TCP connection as outbound */
     char const *authorize;     /**< Authorization realm to use */
     int record_route;
-  } prefs;  
+  } prefs;
 
   tagi_t *tags;
 };
@@ -175,18 +175,18 @@ struct binding
   tport_t *tport;              /**< Reference to tport */
 };
 
-static struct binding *binding_new(su_home_t *home, 
+static struct binding *binding_new(su_home_t *home,
                                   sip_contact_t *contact,
                                   tport_t *tport,
                                   sip_call_id_t const *call_id,
                                   uint32_t cseq,
-                                  sip_time_t registered, 
+                                  sip_time_t registered,
                                   sip_time_t expires);
 static void binding_destroy(su_home_t *home, struct binding *b);
 static int binding_is_active(struct binding const *b)
 {
   return
-    b->expires > sip_now() && 
+    b->expires > sip_now() &&
     (b->tport == NULL || tport_is_clear_to_send(b->tport));
 }
 
@@ -270,21 +270,21 @@ static auth_challenger_t registrar_challenger[1];
 static auth_challenger_t proxy_challenger[1];
 
 /* Proxy entry point */
-static int 
+static int
 test_proxy_init(su_root_t *root, struct proxy *proxy)
 {
   struct proxy_tr *t;
   struct client_tr *c;
 
-  auth_challenger_t _proxy_challenger[1] = 
-  {{ 
+  auth_challenger_t _proxy_challenger[1] =
+  {{
       SIP_407_PROXY_AUTH_REQUIRED,
       sip_proxy_authenticate_class,
       sip_proxy_authentication_info_class
     }};
 
-  auth_challenger_t _registrar_challenger[1] = 
-  {{ 
+  auth_challenger_t _registrar_challenger[1] =
+  {{
       SIP_401_UNAUTHORIZED,
       sip_www_authenticate_class,
       sip_authentication_info_class
@@ -323,14 +323,14 @@ test_proxy_init(su_root_t *root, struct proxy *proxy)
                       NTATAG_SIP_T1X64_REF(proxy->prefs.t1x64),
                       TAG_END());
 
-  if (!proxy->defleg) 
+  if (!proxy->defleg)
     return -1;
   /* if (!proxy->example_net || !proxy->example_org || !proxy->example_com)
      return -1; */
 
   /* Create stateless client */
   t = su_zalloc(proxy->home, sizeof *t);
-  c = su_zalloc(proxy->home, sizeof *c); 
+  c = su_zalloc(proxy->home, sizeof *c);
 
   if (!t || !c)
     return -1;
@@ -350,7 +350,7 @@ test_proxy_init(su_root_t *root, struct proxy *proxy)
 
   if (!proxy->lr)
     return -1;
-                                 
+
   return 0;
 }
 
@@ -391,7 +391,7 @@ struct proxy *test_proxy_create(su_root_t *root,
     ta_start(ta, tag, value);
     p->tags = tl_llist(ta_tags(ta));
     ta_end(ta);
-    
+
     if (su_clone_start(root,
                       p->clone,
                       p,
@@ -435,7 +435,7 @@ struct _set_logging {
   struct proxy *p;
   int logging;
 };
+
 static int _set_logging(void *_a)
 {
   struct _set_logging *a = _a;
@@ -451,8 +451,8 @@ void test_proxy_set_logging(struct proxy *p, int logging)
 }
 
 void test_proxy_domain_set_expiration(struct domain *d,
-                                     sip_time_t min_expires, 
-                                     sip_time_t expires, 
+                                     sip_time_t min_expires,
+                                     sip_time_t expires,
                                      sip_time_t max_expires)
 {
   if (d) {
@@ -475,7 +475,7 @@ void test_proxy_domain_get_expiration(struct domain *d,
 }
 
 void test_proxy_set_session_timer(struct proxy *p,
-                                 sip_time_t session_expires, 
+                                 sip_time_t session_expires,
                                  sip_time_t min_se)
 {
   if (p) {
@@ -529,7 +529,7 @@ void test_proxy_domain_get_record_route(struct domain *d,
   }
 }
 
-int test_proxy_domain_set_authorize(struct domain *d, 
+int test_proxy_domain_set_authorize(struct domain *d,
                                     char const *realm)
 {
   if (d) {
@@ -604,14 +604,14 @@ struct domain *test_proxy_add_domain(struct proxy *p,
     d->prefs.outbound_tcp = 0;
     d->prefs.authorize = NULL;
 
-    if (d->uri && d->tags && 
+    if (d->uri && d->tags &&
        !su_task_execute(su_clone_task(p->clone), _domain_init, d, &init)) {
       if (init == 0)
        /* OK */;
       else
        d = NULL;
     }
-    else 
+    else
       su_home_unref(d->home);
   }
 
@@ -687,7 +687,7 @@ static sip_contact_t *create_transport_contacts(struct proxy *p)
   for (v = nta_agent_via(p->agent); v; v = v->v_next) {
     char const *proto = v->v_protocol;
 
-    if (v->v_next && 
+    if (v->v_next &&
        strcasecmp(v->v_host, v->v_next->v_host) == 0 &&
        str0cmp(v->v_port, v->v_next->v_port) == 0 &&
        ((proto == sip_transport_udp &&
@@ -753,14 +753,14 @@ static int domain_request(union proxy_or_domain *pod,
 {
   int (*process)(struct proxy_tr *) = NULL;
   sip_method_t method = sip->sip_request->rq_method;
-  
+
   assert(pod->domain->magic = domain_init);
 
   if (leg == pod->domain->uleg)
     process = proxy_transaction;
   else if (method == sip_method_register)
     process = process_register;
-  else if (method == sip_method_options) 
+  else if (method == sip_method_options)
     process = process_options;
 
   if (process == NULL)
@@ -839,15 +839,15 @@ static int respond_transaction(struct proxy_tr *t,
 
   if (t->as)
     info = t->as->as_info, response = t->as->as_response;
-  
-  if (nta_incoming_treply(t->server, t->status = status, phrase, 
+
+  if (nta_incoming_treply(t->server, t->status = status, phrase,
                          SIPTAG_HEADER(info),
                          SIPTAG_HEADER(response),
                          ta_tags(ta)) < 0)
     t->status = status = 500;
 
   ta_end(ta);
-  
+
   return status;
 }
 
@@ -892,8 +892,8 @@ static int validate_transaction(struct proxy_tr *t)
   }
 
   /* Remove our routes */
-  while (t->sip->sip_route && 
-        url_has_param(t->sip->sip_route->r_url, "lr") && 
+  while (t->sip->sip_route &&
+        url_has_param(t->sip->sip_route->r_url, "lr") &&
         (url_cmp(t->proxy->lr->r_url, t->sip->sip_route->r_url) == 0 ||
          url_cmp(t->proxy->rr_uri, t->sip->sip_route->r_url) == 0)) {
     sip_route_remove(t->msg, t->sip);
@@ -902,7 +902,7 @@ static int validate_transaction(struct proxy_tr *t)
 
   if (t->use_auth)
     return challenge_transaction(t);
-  
+
   return 0;
 }
 
@@ -915,7 +915,7 @@ static int session_timers(struct proxy_tr *t)
 
   if (t->method == sip_method_invite) {
     if (t->proxy->prefs.min_se) {
-      if (!sip->sip_min_se || 
+      if (!sip->sip_min_se ||
          sip->sip_min_se->min_delta < t->proxy->prefs.min_se) {
        min_se = sip_min_se_init(min_se0);
        min_se->min_delta = t->proxy->prefs.min_se;
@@ -959,7 +959,7 @@ static int incoming_transaction(struct proxy_tr *t)
   struct binding *b;
 
 #if 0
-  if (sip->sip_request->rq_method == sip_method_register) 
+  if (sip->sip_request->rq_method == sip_method_register)
     return process_register(proxy, irq, sip);
 #endif
 
@@ -968,7 +968,7 @@ static int incoming_transaction(struct proxy_tr *t)
     return respond_transaction(t, SIP_404_NOT_FOUND, TAG_END());
 
   for (b = e->bindings; b; b = b->next) {
-    if (binding_is_active(b)) 
+    if (binding_is_active(b))
       target_transaction(t, b->contact->m_url, b->tport);
 
     if (t->clients)            /* XXX - enable forking */
@@ -1073,7 +1073,7 @@ static int challenge_transaction(struct proxy_tr *t)
     msg_header_remove(t->msg, (msg_pub_t *)sip, as->as_match);
 
   return 0;
-}                    
+}
 
 int proxy_ack_cancel(struct proxy_tr *t,
                     nta_incoming_t *irq,
@@ -1083,7 +1083,7 @@ int proxy_ack_cancel(struct proxy_tr *t,
   int status;
 
   if (sip == NULL) {           /* timeout */
-    proxy_tr_destroy(t);       
+    proxy_tr_destroy(t);
     return 0;
   }
 
@@ -1096,7 +1096,7 @@ int proxy_ack_cancel(struct proxy_tr *t,
     if (c->client && c->status < 200)
       /*
        * We don't care about response to CANCEL (or ACK)
-       * so we give NULL as callback pointer (and nta immediately 
+       * so we give NULL as callback pointer (and nta immediately
        * destroys transaction object or marks it disposable)
        */
       if (nta_outgoing_tcancel(c->client, NULL, NULL, TAG_END()) == NULL)
@@ -1117,7 +1117,7 @@ int proxy_response(struct client_tr *c,
   if (sip) {
     msg_t *response = nta_outgoing_getresponse(client);
     if (c->t->method == sip_method_invite)
-      final = sip->sip_status->st_status >= 300, 
+      final = sip->sip_status->st_status >= 300,
        timeout = sip->sip_status->st_status >= 200;
     else
       final = sip->sip_status->st_status >= 200;
@@ -1150,7 +1150,7 @@ int proxy_late_response(struct client_tr *c,
   assert(c->t);
 
   if (sip &&
-      sip->sip_status->st_status >= 200 && 
+      sip->sip_status->st_status >= 200 &&
       sip->sip_status->st_status < 300) {
     msg_t *response = nta_outgoing_getresponse(client);
     sip_via_remove(response, sip_object(response));
@@ -1168,7 +1168,7 @@ static void proxy_tr_remove_late(su_root_magic_t *magic,
 }
 
 
-/** Proxy only late responses 
+/** Proxy only late responses
  *
  * Keeping the invite transactions live
  */
@@ -1219,7 +1219,7 @@ void proxy_tr_destroy(struct proxy_tr *t)
 
   if (t->as)
     su_home_unref(t->as->as_home), t->as = NULL;
-  
+
   while (t->clients) {
     client_tr_remove(c = t->clients);
     nta_outgoing_destroy(c->client), c->client = NULL;
@@ -1275,7 +1275,7 @@ int process_register(struct proxy_tr *t)
 
   if (check_out_of_order(t))
     return t->status;
-  
+
   return update_bindings(t);
 }
 
@@ -1286,7 +1286,7 @@ static int check_received_contact(struct proxy_tr *t)
   sip_via_t *v = sip->sip_via;
 
   if (m && v && v->v_received && m->m_url->url_host
-      && strcasecmp(v->v_received, m->m_url->url_host) 
+      && strcasecmp(v->v_received, m->m_url->url_host)
       && host_is_ip_address(m->m_url->url_host))
     return respond_transaction(t, 406, "Unacceptable Contact", TAG_END());
 
@@ -1309,7 +1309,7 @@ static int validate_contacts(struct proxy_tr *t)
 
   for (; m; m = m->m_next) {
     expires = sip_contact_expires(m, ex, date, t->domain->prefs.expires, t->now);
-    
+
     if (expires > 0 && expires < t->domain->prefs.min_expires) {
       sip_min_expires_t me[1];
 
@@ -1375,8 +1375,8 @@ registration_entry_new(struct domain *d, url_t const *aor)
   if (d == NULL)
     return NULL;
 
-  e = su_zalloc(d->home, sizeof *e); 
-  if (!e) 
+  e = su_zalloc(d->home, sizeof *e);
+  if (!e)
     return NULL;
 
   e->domain = d;
@@ -1415,16 +1415,16 @@ LIST_BODIES(static, registration_entry, struct registration_entry, next, prev);
 /* Bindings */
 
 static
-struct binding *binding_new(su_home_t *home, 
+struct binding *binding_new(su_home_t *home,
                            sip_contact_t *contact,
                            tport_t *tport,
                            sip_call_id_t const *call_id,
                            uint32_t cseq,
-                           sip_time_t registered, 
+                           sip_time_t registered,
                            sip_time_t expires)
 {
   struct binding *b;
-  
+
   b = su_zalloc(home, sizeof *b);
 
   if (b) {
@@ -1444,7 +1444,7 @@ struct binding *binding_new(su_home_t *home,
     if (b)
       msg_header_remove_param(b->contact->m_common, "expires");
   }
-  
+
   return b;
 }
 
@@ -1472,7 +1472,7 @@ static int update_bindings(struct proxy_tr *t)
   sip_date_t *date = t->sip->sip_date;
   sip_time_t expires;
   tport_t *tport = NULL;
-  sip_contact_t *contacts = NULL, **mm = &contacts; 
+  sip_contact_t *contacts = NULL, **mm = &contacts;
   void *tbf;
 
   if (t->sip->sip_contact == NULL) {
@@ -1486,7 +1486,7 @@ static int update_bindings(struct proxy_tr *t)
   if (t->entry == NULL)
     return respond_transaction(t, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
 
-  if (d->prefs.outbound_tcp && 
+  if (d->prefs.outbound_tcp &&
       str0casecmp(t->sip->sip_via->v_protocol, sip_transport_tcp) == 0)
     tport = nta_incoming_transport(t->proxy->agent, t->server, NULL);
 
@@ -1494,7 +1494,7 @@ static int update_bindings(struct proxy_tr *t)
   for (m = t->sip->sip_contact; m; m = m->m_next) {
     if (m->m_url->url_type == url_any)
       break;
-    
+
     expires = sip_contact_expires(m, ex, date, d->prefs.expires, t->now);
 
     if (expires > d->prefs.max_expires)
@@ -1519,7 +1519,7 @@ static int update_bindings(struct proxy_tr *t)
       next = old->next;
 
       for (b = bindings; b != last; b = b->next) {
-       if (url_cmp_all(old->contact->m_url, b->contact->m_url) != 0) 
+       if (url_cmp_all(old->contact->m_url, b->contact->m_url) != 0)
          continue;
 
        if (strcmp(old->call_id->i_id, b->call_id->i_id) == 0) {
@@ -1561,7 +1561,7 @@ static int update_bindings(struct proxy_tr *t)
 
     *mm = sip_contact_copy(d->home, b->contact);
     if (*mm) {
-      expires = su_sprintf(d->home, "expires=%u", 
+      expires = su_sprintf(d->home, "expires=%u",
                           (unsigned)(b->expires - t->now));
       msg_header_add_param(d->home, (*mm)->m_common, expires);
       mm = &(*mm)->m_next;
@@ -1586,7 +1586,7 @@ static int close_tports(void *_proxy)
   struct domain *d;
   struct registration_entry *e;
   struct binding *b;
-  
+
   /* Close all outbound transports */
   for (d = p->domains; d; d = d->next) {
     for (e = d->entries; e; e = e->next) {
@@ -1599,6 +1599,6 @@ static int close_tports(void *_proxy)
       }
     }
   }
-  
+
   return 0;
 }
index 7174cc1bd27e52caa39f4e64861cd04cf785f0d1..b93bcf948d430dbaafccd360e7478ae62da1c247 100644 (file)
@@ -49,17 +49,17 @@ struct domain *test_proxy_add_domain(struct proxy *,
 void test_proxy_set_logging(struct proxy *, int logging);
 
 void test_proxy_domain_set_expiration(struct domain *,
-                                     sip_time_t min_expires, 
-                                     sip_time_t expires, 
+                                     sip_time_t min_expires,
+                                     sip_time_t expires,
                                      sip_time_t max_expires);
 
 void test_proxy_domain_get_expiration(struct domain *,
-                                     sip_time_t *return_min_expires, 
-                                     sip_time_t *return_expires, 
+                                     sip_time_t *return_min_expires,
+                                     sip_time_t *return_expires,
                                      sip_time_t *return_max_expires);
 
 void test_proxy_set_session_timer(struct proxy *p,
-                                 sip_time_t session_expires, 
+                                 sip_time_t session_expires,
                                  sip_time_t min_se);
 
 void test_proxy_get_session_timer(struct proxy *p,
index bb029c5fd66c05cca4dbe57c054edbb0c942defc..f2815d73ed124fbf9574e0c4b2740113e5bb1066 100644 (file)
@@ -239,7 +239,7 @@ int test_refer0(struct context *ctx, char const *tests,
     printf("TEST %s.2: B refers A to C\n", tests);
 
   if (b_refer != b_call)
-    TEST_1(b_refer->nh = 
+    TEST_1(b_refer->nh =
           nua_handle(b->nua, b_refer, SIPTAG_TO(a->to), TAG_END()));
 
   *sip_refer_to_init(r0)->r_url = *c->contact->m_url;
@@ -356,7 +356,7 @@ int test_refer0(struct context *ctx, char const *tests,
     Events in A:
     nua_i_subscribe, nua_r_notify
   */
-  TEST_1(e = a->events->head); 
+  TEST_1(e = a->events->head);
   if (e->data->e_event == nua_r_notify)
     TEST_1(e = e->next);
   TEST_E(e->data->e_event, nua_i_subscribe);
@@ -371,7 +371,7 @@ int test_refer0(struct context *ctx, char const *tests,
      Events in B after nua_subscribe():
      nua_r_subscribe, nua_i_notify
   */
-  TEST_1(e = b->events->head); 
+  TEST_1(e = b->events->head);
   if (e->data->e_event == nua_i_notify) {
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
@@ -575,7 +575,7 @@ int test_refer0(struct context *ctx, char const *tests,
   TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
   TEST_1(!e->next);
   free_events_in_list(ctx, a->events);
-  
+
   /* Transitions of B:
      READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
   */
@@ -685,7 +685,7 @@ int notify_until_terminated(CONDITION_PARAMS)
 
     assert(nua_handle_has_events(r_call->nh));
 
-    pl = sip_payload_format(NULL, "SIP/2.0 %u %s\r\n", 
+    pl = sip_payload_format(NULL, "SIP/2.0 %u %s\r\n",
                            st->st_status, st->st_phrase);
 
     NOTIFY(ep, r_call, r_call->nh,
@@ -761,7 +761,7 @@ int test_challenge_refer(struct context *ctx)
   TEST_1(sip->sip_refer_to);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
   TEST(e->data->e_status, 200);
-  TEST_1(!e->next); 
+  TEST_1(!e->next);
   /*
      Events in C after nua_refer():
      nua_r_refer
@@ -780,7 +780,7 @@ int test_challenge_refer(struct context *ctx)
   TEST(e->data->e_status, 480);
 
   TEST_1(!e->next);
-  
+
   free_events_in_list(ctx, a->events);
   free_events_in_list(ctx, c->events);
 
index cb79b12d2b0c4a53aa4a421e0ce09b77839b9e42..657f5d4fae5f96f2cd82966d352d2cb18773fbdc 100644 (file)
@@ -75,10 +75,10 @@ int test_clear_registrations(struct context *ctx)
     printf("TEST NUA-2.3.0.1: un-REGISTER a\n");
 
   TEST_1(a_reg->nh = nua_handle(a->nua, a_reg, TAG_END()));
-  UNREGISTER(a, a_reg, a_reg->nh, SIPTAG_TO(a->to), 
+  UNREGISTER(a, a_reg, a_reg->nh, SIPTAG_TO(a->to),
             SIPTAG_CONTACT_STR("*"),
             TAG_END());
-  run_a_until(ctx, -1, until_final_response);  
+  run_a_until(ctx, -1, until_final_response);
   AUTHENTICATE(a, a_reg, a_reg->nh,
               NUTAG_AUTH("Digest:\"test-proxy\":alice:secret"), TAG_END());
   run_a_until(ctx, -1, until_final_response);
@@ -91,10 +91,10 @@ int test_clear_registrations(struct context *ctx)
     printf("TEST NUA-2.3.0.2: un-REGISTER b\n");
 
   TEST_1(b_reg->nh = nua_handle(b->nua, b_reg, TAG_END()));
-  UNREGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to), 
+  UNREGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to),
             SIPTAG_CONTACT_STR("*"),
             TAG_END());
-  run_b_until(ctx, -1, until_final_response);  
+  run_b_until(ctx, -1, until_final_response);
   AUTHENTICATE(b, b_reg, b_reg->nh,
               NUTAG_AUTH("Digest:\"test-proxy\":bob:secret"), TAG_END());
   run_b_until(ctx, -1, until_final_response);
@@ -111,7 +111,7 @@ int test_clear_registrations(struct context *ctx)
             SIPTAG_FROM(c->to), SIPTAG_TO(c->to),
             SIPTAG_CONTACT_STR("*"),
             TAG_END());
-  run_c_until(ctx, -1, until_final_response);  
+  run_c_until(ctx, -1, until_final_response);
   AUTHENTICATE(c, c_reg, c_reg->nh,
               NUTAG_AUTH("Digest:\"test-proxy\":charlie:secret"), TAG_END());
   run_c_until(ctx, -1, until_final_response);
@@ -227,7 +227,7 @@ int test_outbound_cases(struct context *ctx)
   }
 
   run_a_until(ctx, -1, a->next_condition);
-  
+
   for (e = a->events->head; e; e = e->next) {
     TEST_E(e->data->e_event, nua_r_register);
     TEST(e->data->e_status, 200);
@@ -375,7 +375,7 @@ int test_register_b(struct context *ctx)
     if (ctx->p)
       m->m_url->url_params = "transport=tcp";
 
-    REGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to), 
+    REGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to),
             SIPTAG_CONTACT(m),
             /* Do not include credentials unless challenged */
             NUTAG_AUTH_CACHE(nua_auth_cache_challenged),
@@ -440,7 +440,7 @@ int test_register_c(struct context *ctx)
           NUTAG_CALLEE_CAPS(1),
           SIPTAG_EXPIRES_STR("5"), /* Test 423 negotiation */
           TAG_END());
-  run_abc_until(ctx, -1, save_events, -1, save_events, 
+  run_abc_until(ctx, -1, save_events, -1, save_events,
                -1, save_until_final_response);
 
   TEST_1(e = c->events->head);
@@ -454,7 +454,7 @@ int test_register_c(struct context *ctx)
 
   AUTHENTICATE(c, c_reg, c_reg->nh,
               NUTAG_AUTH("Digest:\"test-proxy-0\":charlie:secret"), TAG_END());
-  run_abc_until(ctx, -1, save_events, -1, save_events, 
+  run_abc_until(ctx, -1, save_events, -1, save_events,
                -1, save_until_final_response);
 
   TEST_1(e = c->events->head);
@@ -527,7 +527,7 @@ int test_register_refresh(struct context *ctx)
   }
 
   run_ab_until(ctx, -1, a->next_condition, -1, b->next_condition);
-  
+
   for (e = a->events->head; e; e = e->next) {
     TEST_E(e->data->e_event, nua_r_register);
     TEST(e->data->e_status, 200);
@@ -628,7 +628,7 @@ int test_register_to_c(struct context *ctx)
 
   TEST_1(b_call->nh = nua_handle(b->nua, b_call, TAG_END()));
 
-  REGISTER(b, b_call, b_call->nh, 
+  REGISTER(b, b_call, b_call->nh,
           NUTAG_REGISTRAR((url_string_t *)c->contact->m_url),
           SIPTAG_TO(b->to),
           NUTAG_OUTBOUND(NULL),
@@ -778,7 +778,7 @@ int test_connectivity(struct context *ctx)
 
     free_events_in_list(ctx, c->events);
 
-    /* Sneakily change the realm */  
+    /* Sneakily change the realm */
 
     TEST(test_proxy_domain_set_authorize(ctx->c.domain, "test-proxy"), 0);
 
@@ -871,7 +871,7 @@ int test_nat_timeout(struct context *ctx)
 
   if (print_headings)
     printf("TEST NUA-2.5.1: PASSED\n");
-  
+
   if (print_headings)
     printf("TEST NUA-2.5.2: OPTIONS from B to A\n");
 
index d18069206b2b79c9927f99a33011c3bceb6355ef..397818f2a3c8e0ebd30c8dab7eace49a276cda6a 100644 (file)
@@ -82,7 +82,7 @@ int test_session_timer(struct context *ctx)
 
   /* We negotiate session timer of 6 second */
   /* Disable session timer from proxy */
-  test_proxy_set_session_timer(ctx->p, 0, 0); 
+  test_proxy_set_session_timer(ctx->p, 0, 0);
 
   nua_set_params(ctx->b.nua,
                 NUTAG_SESSION_REFRESHER(nua_any_refresher),
@@ -199,7 +199,7 @@ int test_session_timer(struct context *ctx)
       TEST_1(f);
 
       run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
-      
+
       TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_bye);
 
       free_events_in_list(ctx, a->events);
index d396415d5eada6593638ed22b30ea1f5090f26b7..6f70a2fd471f6f0e6032aa5889faf338364b97be 100644 (file)
@@ -148,7 +148,7 @@ int test_message(struct context *ctx)
   TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_message);
   TEST(e->data->e_status, 202);
   TEST_1(sip = sip_object(e->data->e_msg));
-  TEST_1(sip_user_agent(sip)); 
+  TEST_1(sip_user_agent(sip));
   TEST_S(sip_user_agent(sip)->g_value, "007");
   TEST_1(!e->next);
 
@@ -229,7 +229,7 @@ int test_message(struct context *ctx)
 int accept_request(CONDITION_PARAMS)
 {
   msg_t *with = nua_current_request(nua);
-  
+
   if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
     return 0;
 
@@ -265,7 +265,7 @@ int respond_with_etag(CONDITION_PARAMS)
       RESPOND(ep, call, nh, SIP_412_PRECONDITION_FAILED,
              NUTAG_WITH(with),
              TAG_END());
-    } 
+    }
     else {
       RESPOND(ep, call, nh, SIP_200_OK,
              NUTAG_WITH(with),
@@ -433,7 +433,7 @@ int test_publish(struct context *ctx)
   if (!ctx->expensive && 0)
     goto skip_republish;
 
-  run_ab_until(ctx, -1, save_until_final_response, -1, respond_with_etag); 
+  run_ab_until(ctx, -1, save_until_final_response, -1, respond_with_etag);
 
   /* Client events: nua_r_publish
   */
@@ -445,7 +445,7 @@ int test_publish(struct context *ctx)
   TEST_1(!e->next);
 
   free_events_in_list(ctx, a->events);
+
   /*
    Server events:
    nua_i_publish
@@ -492,7 +492,7 @@ int test_publish(struct context *ctx)
 
   TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
 
-  /* Let server close handle without responding to PUBLISH */ 
+  /* Let server close handle without responding to PUBLISH */
   PUBLISH(a, a_call, a_call->nh,
          TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
          SIPTAG_EVENT_STR("presence"),
@@ -579,7 +579,7 @@ int accept_and_notify_twice(CONDITION_PARAMS)
   switch (event) {
   case nua_i_subscribe:
     if (status < 200) {
-      NOTIFY(ep, call, nh, 
+      NOTIFY(ep, call, nh,
             SIPTAG_EVENT(sip->sip_event),
             SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
             SIPTAG_PAYLOAD_STR(presence_closed),
@@ -647,7 +647,7 @@ int accept_and_notify(CONDITION_PARAMS)
              SIPTAG_EXPIRES(sip->sip_expires),
              TAG_END());
 
-      NOTIFY(ep, call, nh, 
+      NOTIFY(ep, call, nh,
             SIPTAG_EVENT(sip->sip_event),
             SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
             SIPTAG_PAYLOAD_STR(presence_closed),
@@ -673,7 +673,7 @@ int save_and_notify(CONDITION_PARAMS)
 
   switch (event) {
   case nua_i_subscribe:
-    NOTIFY(ep, call, nh, 
+    NOTIFY(ep, call, nh,
           SIPTAG_EVENT(sip->sip_event),
           SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
           SIPTAG_PAYLOAD_STR(presence_closed),
@@ -970,7 +970,7 @@ int test_subscribe_notify(struct context *ctx)
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
   TEST_1(tl_find(e->data->e_tags, nutag_substate));
-  TEST(tl_find(e->data->e_tags, nutag_substate)->t_value, 
+  TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
        nua_substate_terminated);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
   TEST_1(e->data->e_status >= 200);
@@ -1089,7 +1089,7 @@ int test_subscribe_notify_graceful(struct context *ctx)
 
   SUBSCRIBE(a, a_call, a_call->nh, TAG_END());
 
-  run_ab_until(ctx, -1, save_until_notified_and_responded_twice, 
+  run_ab_until(ctx, -1, save_until_notified_and_responded_twice,
               -1, accept_subscription_until_terminated);
 
 #if 0
@@ -1128,7 +1128,7 @@ int test_subscribe_notify_graceful(struct context *ctx)
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
   TEST_1(tl_find(e->data->e_tags, nutag_substate));
-  TEST(tl_find(e->data->e_tags, nutag_substate)->t_value, 
+  TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
        nua_substate_terminated);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
   TEST_1(e->data->e_status >= 200);
@@ -1500,7 +1500,7 @@ int test_newsub_notify(struct context *ctx)
   TEST_1(!e->next);
 
   free_events_in_list(ctx, a->events);
-  
+
   /* 2nd NOTIFY using same dialog */
   /* Check that server really discards the dialog */
 
@@ -1633,7 +1633,7 @@ int test_newsub_notify(struct context *ctx)
   a->state.n = 4;
   b->state.n = 4;
 
-  run_ab_until(ctx, -1, save_until_nth_final_response, 
+  run_ab_until(ctx, -1, save_until_nth_final_response,
               -1, accept_n_notifys);
 
   /* Notifier events: nua_r_notify nua_r_notify */
@@ -1743,7 +1743,7 @@ int test_newsub_notify(struct context *ctx)
   a->state.n = 3;
   b->state.n = 3;
 
-  run_ab_until(ctx, -1, save_until_nth_final_response, 
+  run_ab_until(ctx, -1, save_until_nth_final_response,
               -1, accept_n_notifys);
 
   /* Notifier events: nua_r_notify nua_r_notify */
@@ -1876,14 +1876,14 @@ int test_newsub_notify(struct context *ctx)
   END();
 }
 
-/**Terminate when received notify. 
+/**Terminate when received notify.
  * Respond to NOTIFY with 200 OK if it has not been responded.
  * Save events (except nua_i_active or terminated).
  */
 int accept_notify(CONDITION_PARAMS)
 {
   if (event == nua_i_notify && status < 200)
-    RESPOND(ep, call, nh, SIP_200_OK, 
+    RESPOND(ep, call, nh, SIP_200_OK,
            NUTAG_WITH_THIS(ep->nua),
            TAG_END());
 
@@ -1898,7 +1898,7 @@ int save_until_nth_final_response(CONDITION_PARAMS)
 
   if (nua_r_set_params <= event && event < nua_i_network_changed
       && status >= 200) {
-    if (ep->state.n > 0) 
+    if (ep->state.n > 0)
       ep->state.n--;
     return ep->state.n == 0;
   }
@@ -1911,7 +1911,7 @@ int accept_n_notifys(CONDITION_PARAMS)
   tagi_t const *substate = tl_find(tags, nutag_substate);
 
   if (event == nua_i_notify && status < 200)
-    RESPOND(ep, call, nh, SIP_200_OK, 
+    RESPOND(ep, call, nh, SIP_200_OK,
            NUTAG_WITH_THIS(ep->nua),
            TAG_END());
 
@@ -1920,10 +1920,10 @@ int accept_n_notifys(CONDITION_PARAMS)
   if (event != nua_i_notify)
     return 0;
 
-  if (ep->state.n > 0) 
+  if (ep->state.n > 0)
     ep->state.n--;
 
-  if (ep->state.n == 0) 
+  if (ep->state.n == 0)
     return 1;
 
   if (substate && substate->t_value == nua_substate_terminated) {
@@ -2068,7 +2068,7 @@ int accept_subscription_until_terminated(CONDITION_PARAMS)
            NUTAG_WITH(with),
            SIPTAG_EXPIRES_STR("360"),
            TAG_END());
-    NOTIFY(ep, call, nh, 
+    NOTIFY(ep, call, nh,
           SIPTAG_EVENT(sip->sip_event),
           SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
           SIPTAG_PAYLOAD_STR(presence_closed),
index 2023bdfdf42b451536fabc4d7f81a6f6e106678a..18285e71b51520b31f25259c50e5e37341a38ac4 100644 (file)
@@ -72,7 +72,7 @@ int save_until_notified_and_responded(CONDITION_PARAMS)
                   NUTAG_AUTH("Digest:\"test-proxy\":charlie:secret"),
                   TAG_END());
     }
-    else if (status >= 300) 
+    else if (status >= 300)
       return 1;
     else if (status >= 200)
       ep->flags.bit1 = 1;
index c5f5a39ad7623ef076982efaa7913f43be6e0e92..d2f82188c4b0597bc4439cd40cc5c4e1d8521c79 100644 (file)
@@ -1,6 +1,6 @@
 2006-02-08  Kai Vehmanen  <kai.vehmanen@nokia.com>
 
-       * Makefile.am, nua_cli.c: nua_cli example add removed from the 
+       * Makefile.am, nua_cli.c: nua_cli example add removed from the
        distribution package.
 
 2005-09-29  Pekka Pessi  <Pekka.Pessi@nokia.com>
@@ -14,8 +14,8 @@
     M ./utils/nua_cli.c +2
 
 2005-09-28  Pekka Pessi  <Pekka.Pessi@nokia.com>
-       
-       * Not using soa directly anymore. 
+
+       * Not using soa directly anymore.
 
            M ./utils/nua_cli.c -5 +3
 
index b8539c0726deff32f80c85902d7a0589c404cfcc..268881bdb6906fea9b8a954c171a00f8c24018c3 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Template for Doxyfile. 
+# Template for Doxyfile.
 # @configure_input@
 #
 # Copyright (C) 2006 Nokia Corporation
@@ -27,13 +27,13 @@ GENERATE_TAGFILE     = ../libsofia-sip-ua/docs/utils.doxytags
 @INCLUDE = ../libsofia-sip-ua/docs/Doxyfile.aliases
 @INCLUDE = ../libsofia-sip-ua/docs/Doxyfile.rfc
 
-FILE_PATTERNS        = *.h *.c 
+FILE_PATTERNS        = *.h *.c
 
 EXCLUDE_PATTERNS     = acconfig.h config.h confdefs.h \
                        test*.h test*.c torture*.c *test.c *torture.c \
                        *_tag_dll.c *_tag_ref.c
 
-TAGFILES             = 
+TAGFILES             =
 
 OUTPUT_LANGUAGE      = English
 
index 8fde4ef82105d8026085ea3ff1ad981b2cdeda77..7871345736b9ff7124f5b36eea214c082d40f6e8 100644 (file)
@@ -3,8 +3,8 @@
 
 /**
  * @nofile apps_utils.h
- * @brief 
- * 
+ * @brief
+ *
  * Copyright (C) 2005 Nokia Corporation.
  *
  * Written by Pekka Pessi <pekka -dot pessi -at- nokia -dot- com>
@@ -25,7 +25,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA
  * @ENDLGPL@
- * 
+ *
  * @date Created: Thu Apr  8 15:55:15 2004 ppessi
  *
  */
@@ -38,20 +38,20 @@ int proxy_authenticate(context_t *c,
                       sip_t const *sip,
                       nta_response_f response_function)
 {
-  if (sip && sip->sip_status->st_status == 407 && 
+  if (sip && sip->sip_status->st_status == 407 &&
       sip->sip_proxy_authenticate &&
-      c->c_proxy_auth_retries++ < 3 && 
+      c->c_proxy_auth_retries++ < 3 &&
       c->c_proxy && c->c_proxy->url_user && c->c_proxy->url_password) {
     url_t *u = c->c_proxy;
     msg_t *rmsg = nta_outgoing_getrequest(oreq);
     sip_t *rsip = sip_object(rmsg);
 
     if (auc_challenge(&c->c_proxy_auth, c->c_home, sip->sip_proxy_authenticate,
-                     sip_proxy_authorization_class) >= 0 
+                     sip_proxy_authorization_class) >= 0
        &&
-       auc_all_credentials(&c->c_proxy_auth, NULL, NULL, 
+       auc_all_credentials(&c->c_proxy_auth, NULL, NULL,
                            u->url_user, u->url_password) > 0
-       && 
+       &&
        auc_authorization(&c->c_proxy_auth, rmsg, (msg_pub_t *)rsip,
                          rsip->sip_request->rq_method_name,
                          rsip->sip_request->rq_url,
@@ -59,14 +59,14 @@ int proxy_authenticate(context_t *c,
       nta_outgoing_destroy(c->c_orq);
       sip_header_remove(rmsg, rsip, (sip_header_t *)rsip->sip_via);
       nta_msg_request_complete(rmsg, c->c_leg, 0, NULL, NULL);
-      c->c_orq = nta_outgoing_tmcreate(c->c_agent, response_function, c, NULL, 
+      c->c_orq = nta_outgoing_tmcreate(c->c_agent, response_function, c, NULL,
                                       rmsg, TAG_END());
       return 1;
     }
   }
 
   return 0;
-}                                 
+}
 
 static inline
 int server_authenticate(context_t *c,
@@ -74,18 +74,18 @@ int server_authenticate(context_t *c,
                        sip_t const *sip,
                        nta_response_f response_function)
 {
-  if (sip && sip->sip_status->st_status == 401 && 
+  if (sip && sip->sip_status->st_status == 401 &&
       sip->sip_www_authenticate &&
-      c->c_auth_retries++ < 3 && 
+      c->c_auth_retries++ < 3 &&
       c->c_password && c->c_username) {
     msg_t *rmsg = nta_outgoing_getrequest(oreq);
     sip_t *rsip = sip_object(rmsg);
 
     if (auc_challenge(&c->c_auth, c->c_home, sip->sip_www_authenticate,
-                     sip_authorization_class) >= 0 
+                     sip_authorization_class) >= 0
        &&
        auc_all_credentials(&c->c_auth, NULL, NULL, c->c_username, c->c_password) > 0
-       && 
+       &&
        auc_authorization(&c->c_auth, rmsg, (msg_pub_t *)rsip,
                          rsip->sip_request->rq_method_name,
                          rsip->sip_request->rq_url,
@@ -93,14 +93,14 @@ int server_authenticate(context_t *c,
       nta_outgoing_destroy(c->c_orq);
       sip_header_remove(rmsg, rsip, (sip_header_t *)rsip->sip_via);
       nta_msg_request_complete(rmsg, c->c_leg, 0, NULL, NULL);
-      c->c_orq = nta_outgoing_tmcreate(c->c_agent, response_function, c, NULL, 
+      c->c_orq = nta_outgoing_tmcreate(c->c_agent, response_function, c, NULL,
                                       rmsg, TAG_END());
       return 1;
     }
   }
 
   return 0;
-}                                 
+}
 
 static inline
 int tag_from_header(nta_agent_t *nta,
index f3f99dd4ddb8e175c887cf924f13b8c182e7c81e..41405c1128d16f9725fdec4ae43deed2711630f2 100644 (file)
  */
 
 /**@page sip-date Print or parse SIP date
- * 
+ *
  * @section synopsis Synopsis
  *
  * <tt>sip-date [-n] [SIP-date | [YYYYy] [DDd] [HHh] [MMm] [SS[s]]]</tt>
  *
  * @section description Description
- * 
+ *
  * @em sip-date is an utility for printing a SIP date (in the format
  * specified by RFC 1123, but the timezone must always be GMT) or parsing a
  * given SIP date. The date can be given as a SIP date or by giving year,
  * day, hour, minutes and seconds separately.
- * 
+ *
  * @section options Options
  *
  * The @em sip-date utility takes options as follows:
 
 void usage(void)
 {
-  fprintf(stderr, 
+  fprintf(stderr,
          "usage: sip-date [-n] "
           "[SIP-date | [YYYYy] [DDd] [HHh] [MMm] [SS[s]]]\n");
   exit(1);
 }
 
 /* Epoch year. */
-#define EPOCH 1900             
+#define EPOCH 1900
 /* Day number of New Year Day of given year */
 #define YEAR_DAYS(y) \
   (((y)-1) * 365 + ((y)-1) / 4 - ((y)-1) / 100 + ((y)-1) / 400)
@@ -123,7 +123,7 @@ int main(int ac, char *av[])
     buf[n] = '\0';
 
     s = buf;
-      
+
     if (s[0] < '0' || s[0] > '9') {
       if (msg_date_d(&s, &t) < 0) {
        fprintf(stderr, "sip-date: %s is not valid time\n", s);
@@ -136,17 +136,17 @@ int main(int ac, char *av[])
 
        if (msg_delta_d(&s, &t2) < 0)
          usage();
-      
+
        switch (*s) {
-       case 'y': t2 = YEAR_DAYS(t2) - YEAR_DAYS(EPOCH); 
+       case 'y': t2 = YEAR_DAYS(t2) - YEAR_DAYS(EPOCH);
          /*FALLTHROUGH*/
        case 'd': t += t2 * 24 * 60 * 60; s++; break;
        case 'h': t += t2 * 60 * 60; s++; break;
        case 'm': t += t2 * 60; s++; break;
-       case 's': 
+       case 's':
          s++;
        default:
-         t += t2; 
+         t += t2;
          break;
        }
 
index 92d6bce64488d0a3fc0187fc216ecf92810ef350..6843a8986be8e26b89d49f03a702c753db905df1 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 /**@page sip-dig Resolve SIP URIs.
- * 
+ *
  * @section sip_dig_synopsis Synopsis
  * <tt>sip-dig [OPTIONS] uri...</tt>
  *
@@ -45,7 +45,7 @@
  * otherwise indicated by NAPTR or SRV records, the sip-dig uses UDP and TCP
  * as transports for SIP and TLS for SIPS URIs.
  *
- * The results are printed intended, with a preference followed by weight, 
+ * The results are printed intended, with a preference followed by weight,
  * then protocol name, port number and IP address in numeric format.
  *
  * @section sip_dig_options Command Line Options
@@ -73,7 +73,7 @@
  * <dd>Use TLS over SCTP transport protocol.
  * </dd>
  * <dt>--no-sctp</dt>
- * <dd>Ignore SCTP or TLS-SCTP records in the list of default transports. 
+ * <dd>Ignore SCTP or TLS-SCTP records in the list of default transports.
  * This option has no effect if transport protocols has been explicitly
  * listed.
  * </dd>
  *
  * @section sip_dig_environment Environment
  * #SRESOLV_DEBUG, SRESOLV_CONF
- * 
+ *
  * @section sip_dig_bugs Reporting Bugs
  * Report bugs to <sofia-sip-devel@lists.sourceforge.net>.
  *
@@ -171,11 +171,11 @@ int dig_srv(struct dig *dig, char const *tport, char const *host,
            double weight);
 
 int dig_srv_at(struct dig *dig,
-              char const *tport, sres_record_t **answers, 
+              char const *tport, sres_record_t **answers,
               double weight, int pweight,
               int priority);
 
-int dig_addr(struct dig *dig, 
+int dig_addr(struct dig *dig,
             char const *tport, char const *host, char const *port,
             double weight);
 
@@ -192,7 +192,7 @@ void print_result(char const *addr, char const *port, char const *tport,
 int prepare_transport(struct dig *dig, char const *tport);
 
 int count_transports(struct dig *dig,
-                    char const *tp1, 
+                    char const *tp1,
                     char const *tp2);
 
 void usage(int exitcode)
@@ -216,7 +216,7 @@ int main(int argc, char *argv[])
 
   struct dig dig[1] = {{ NULL }};
 
-  if (su_init() != 0) 
+  if (su_init() != 0)
     return -1;
 
   while (argv[1] && argv[1][0] == '-') {
@@ -444,7 +444,7 @@ count_transports(struct dig *dig,
                 char const *tport,
                 char const *tport2)
 {
-  
+
   int i, tcount = 0;
   struct transport const *tports = dig->tports;
 
@@ -545,7 +545,7 @@ int dig_naptr(struct dig *dig,
     else if (strcasecmp(na->na_flags, "a") == 0) {
       scount = dig_addr(dig, tp->name, na->na_replace, NULL, weight / nacount);
     }
-    else 
+    else
       scount = 0;
 
     count += scount;
@@ -604,7 +604,7 @@ int dig_all_srvs(struct dig *dig,
        continue;
       if (srv->srv_record->r_status != 0)
        continue;
-      
+
       if (srv->srv_priority != priority && pweight != 0) {
        scount = dig_srv_at(dig, tport, answers, weight / n, pweight,
                            priority);
index bc0b70cac815e7ab4cfd50c3a0e51fcb443d565e..d7eef497dd1c590c7eec0292aaa2bab7a09397a8 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /**@page sip-options Query SIP OPTIONS
- * 
+ *
  * @section synopsis Synopsis
  * <tt>sip-options [OPTIONS] target-uri </tt>
  *
@@ -46,7 +46,7 @@
  *     preliminary responses are silently discarded.
  * </dd>
  * <dt>--all | -a</dt>
- * <dd>All SIP headers will be printed. If the --all option is given, 
+ * <dd>All SIP headers will be printed. If the --all option is given,
  *     the @em options utility also prints @b From, @b Via, @b Call-ID or
  *     @b CSeq headers.
  * </dd>
@@ -82,7 +82,7 @@
  *
  * @section environment Environment
  * #SIPADDRESS, #sip_proxy, #NTA_DEBUG, #TPORT_DEBUG, #TPORT_LOG.
- * 
+ *
  * @section bugs Reporting Bugs
  * Report bugs to <sofia-sip-devel@lists.sourceforge.net>.
  *
@@ -117,13 +117,13 @@ typedef struct context_s context_t;
 #include <sofia-sip/tport_tag.h>
 
 struct context_s {
-  su_home_t      c_home[1];
-  su_root_t     *c_root;
-  nta_agent_t   *c_agent;
+  su_home_t      c_home[1];
+  su_root_t     *c_root;
+  nta_agent_t   *c_agent;
   url_t          *c_proxy;
   char const     *c_username;
   char const     *c_password;
-  nta_leg_t     *c_leg;
+  nta_leg_t     *c_leg;
   nta_outgoing_t *c_orq;
   auth_client_t  *c_proxy_auth;
   auth_client_t  *c_auth;
@@ -139,7 +139,7 @@ char const name[] = "sip-options";
 static
 void usage(int rc)
 {
-  fprintf(rc ? stderr : stdout, 
+  fprintf(rc ? stderr : stdout,
          "usage: %s OPTIONS url [extra-file]\n"
          "where OPTIONS are\n"
          "    --mf=count | --max-forwards=count\n"
@@ -164,15 +164,15 @@ int main(int argc, char *argv[])
 {
   su_home_t *home;
   context_t context[1] = {{{SU_HOME_INIT(context)}}};
-  char 
+  char
     *extra = NULL,
-    *o_bind = "sip:*:*", 
+    *o_bind = "sip:*:*",
     *o_from = getenv("SIPADDRESS"),
     *o_http_proxy = NULL,
     *o_max_forwards = NULL,
     *o_method = NULL,
     *o_to = NULL;
-   
+
   char *s, *v;
 
   sip_method_t method = sip_method_options;
@@ -190,11 +190,11 @@ int main(int argc, char *argv[])
   while ((s = argv++[1])) {
     if (!MATCH(s, "-"))             { o_to = s;           break; }
     else if (strcmp(s, "") == 0)    { o_to = argv++[1];   break; }
-    else if (MATCH(s, "-a") || MATCH(s, "--all")) 
+    else if (MATCH(s, "-a") || MATCH(s, "--all"))
                                     { context->c_all = 1; }
-    else if (MATCH(s, "-x") || MATCH(s, "--extra")) 
+    else if (MATCH(s, "-x") || MATCH(s, "--extra"))
                                     { extra = "-"; }
-    else if (MATCH(s, "-1") || MATCH(s, "--1XX")) 
+    else if (MATCH(s, "-1") || MATCH(s, "--1XX"))
                                     { context->c_pre = 1; }
     else if (MATCH2(s, "--mf"))     { o_max_forwards = v; }
     else if (MATCH2(s, "--http-proxy"))     { o_http_proxy = v; }
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
     else if (MATCH2(s, "--from"))   { o_from = v; }
     else if (MATCH2(s, "--method")) { o_method = v; }
     else if (MATCH(s, "--help"))    { usage(0); }
-    else 
+    else
       usage(2);
   }
 
@@ -216,7 +216,7 @@ int main(int argc, char *argv[])
     extra = argv++[1];
 
   su_init();
-  
+
   su_home_init(home = context->c_home);
 
   context->c_root = su_root_create(context);
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
   if (context->c_root) {
     url_string_t *r_uri;
 
-    context->c_agent = 
+    context->c_agent =
       nta_agent_create(context->c_root,
                       URL_STRING_MAKE(o_bind),
                       NULL, NULL, /* Ignore incoming messages */
@@ -251,7 +251,7 @@ int main(int argc, char *argv[])
       tag_from_header(context->c_agent, context->c_home, from);
 
       if (o_method) {
-       method = sip_method_code(o_method); 
+       method = sip_method_code(o_method);
       } else {
        isize_t len;
        char const *params = to->a_url->url_params;
@@ -262,7 +262,7 @@ int main(int argc, char *argv[])
          o_method = su_alloc(home, len + 1);
          if (o_method == 0 ||
              url_param(params, "method", o_method, len + 1) != len) {
-           fprintf(stderr, "%s: %s\n", name, 
+           fprintf(stderr, "%s: %s\n", name,
                    o_method ? "internal error" : strerror(errno));
            exit(2);
          }
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
 
       if (extra) {
        FILE *hf;
-       
+
        if (strcmp(extra, "-"))
          hf = fopen(extra, "rb");
        else
@@ -290,7 +290,7 @@ int main(int argc, char *argv[])
        extra = readfile(hf);
       }
 
-      context->c_proxy = url_hdup(context->c_home, 
+      context->c_proxy = url_hdup(context->c_home,
                                  (url_t *)getenv("sip_proxy"));
 
       nta_agent_set_params(context->c_agent,
@@ -298,17 +298,17 @@ int main(int argc, char *argv[])
                           NTATAG_DEFAULT_PROXY(context->c_proxy),
                           TAG_END());
 
-      context->c_leg = 
+      context->c_leg =
        nta_leg_tcreate(context->c_agent,
                        NULL, NULL,      /* ignore incoming requests */
                        SIPTAG_FROM(from), /* who is sending OPTIONS? */
                        SIPTAG_TO(to), /* whom we are sending OPTIONS? */
                        TAG_END());
-                                     
+
       if (context->c_leg) {
-       context->c_orq = 
+       context->c_orq =
          nta_outgoing_tcreate(context->c_leg,
-                              response_to_options, context, 
+                              response_to_options, context,
                               NULL,
                               method, o_method, r_uri,
                               SIPTAG_USER_AGENT_STR("options"),
@@ -317,7 +317,7 @@ int main(int argc, char *argv[])
                               TAG_END());
 
        if (context->c_orq) {
-         su_root_run(context->c_root); 
+         su_root_run(context->c_root);
          nta_outgoing_destroy(context->c_orq), context->c_orq = NULL;
        }
 
@@ -326,7 +326,7 @@ int main(int argc, char *argv[])
 
       nta_agent_destroy(context->c_agent), context->c_agent = NULL;
     }
-    
+
     su_root_destroy(context->c_root);
   }
 
@@ -345,7 +345,7 @@ int response_to_options(context_t *context,
     return 0;
   if (server_authenticate(context, oreq, sip, response_to_options))
     return 0;
-                                  
+
   if (sip->sip_status->st_status >= 200 || context->c_pre) {
     sip_header_t *h = (sip_header_t *)sip->sip_status;
     char hname[64];
@@ -362,17 +362,17 @@ int response_to_options(context_t *context,
 
       if (h->sh_class->hc_name == NULL) {
        sl_header_print(stdout, NULL, h);
-      } 
+      }
       else if (h->sh_class->hc_name[0] == '\0') {
-       sl_header_print(stdout, "%s\n", h); 
+       sl_header_print(stdout, "%s\n", h);
       }
       else {
        snprintf(hname, sizeof hname, "%s: %%s\n", h->sh_class->hc_name);
-       sl_header_print(stdout, hname, h); 
+       sl_header_print(stdout, hname, h);
       }
     }
   }
-  
+
   if (sip->sip_status->st_status >= 200) {
     context->c_retval = sip->sip_status->st_status >= 300;
     su_root_break(context->c_root);
index 5df65767ad8639837c72adb5b991a8cdcb39054a..e7210db9e24fea6e8b023e38d79d12475ea572d3 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- c -*- */
 
 /**@MODULEPAGE "utils" - Sofia-SIP Command Line Utilities
- * 
+ *
  * @section utils_meta Module Meta Information
  *
  * Command line utilities for <a href="../index.html">Sofia-SIP</a>.
@@ -14,8 +14,8 @@
  *
  * @section utuils_overview Overview
  *
- * The Sofia-SIP provides a few command line utilities: 
- * - @ref sip-date "sip-date" - print or parse SIP date 
+ * The Sofia-SIP provides a few command line utilities:
+ * - @ref sip-date "sip-date" - print or parse SIP date
  * - @ref sip-dig "sip-dig" - resolve SIP URIs
  * - @ref sip-options "sip-options" - query SIP OPTIONS
  * - @ref localinfo "localinfo" - list local network addresses
index 8856b629d589dbb46dc8dde48e072de461c5e702..65f96c3d842d28f39fbe9d2a679b2773070beb2f 100644 (file)
@@ -1,20 +1,20 @@
 2006-05-11  Pekka Pessi  <Pekka.Pessi@nokia.com>
 
        * Now building libsofia_sip_ua.dll on win32.
-  
+
        We define both IN_LIBSOFIA_SIP_UA and IN_LIBSOFIA_SRES in
        libsofia_sip_ua.dsp.
-  
+
        Because of DLL linkage, we compile tags typedefs as C++
        (see win32/tests/test_nua/test_nat_tags.cpp).
-  
+
        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
-       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.
-  
+
        Using multithreaded DLL runtime for all projects.
 
 2006-05-03  Kai Vehmanen  <kai.vehmanen@nokia.com>
   * Added test_tport.dsp to SofiaSIP.dsw
 
   * Added source files:
-  
+
   sres.c sres_blocking.c sres_cache.c stun.c stun_common.c stun_dns.c
   stun_internal.h stun_mini.c nua_params.c nua_params.h tport_internal.h
   tport_logging.c tport_stub_sigcomp.c tport_stub_stun.c
   tport_threadpool.c tport_type_connect.c tport_type_tcp.c
   tport_type_udp.c
-  
+
   and
-  
+
   sofia-resolv/sres.h sofia-resolv/sres_async.h
   sofia-resolv/sres_cache.h sofia-resolv/sres_record.h
   sofia-sip/tport_plugins.h
-  
+
   to libsofia_sip_ua.dsp.
 
   * Added stat() as well as struct stat to compatibity win32/unistd.h.
index b31409cb1cad78ea4e65a9773974c15f697f082d..0073fe1bea6f308be31fa02d1aacdcf2507f1c28 100644 (file)
@@ -2,11 +2,11 @@
 win32/README.txt / Sofia-SIP for win32
 ======================================
 
-The win32 subdirectory contains the build environment for Win32 
+The win32 subdirectory contains the build environment for Win32
 environment using MSVC.
 
 Currently, the provided workspace/solution files will create both
-shared and static libraries for libsofia-sip-ua, and a few test 
+shared and static libraries for libsofia-sip-ua, and a few test
 programs. The test programs can be run with the script check.cmd.
 
 
@@ -18,7 +18,7 @@ compiling Sofia SIP. Note that it uses AWK, so an AWK interpreter
 is needed. You can for example use gawk (3.1.5 or newer) or mawk (tested
 with 1.3.3) implementations. Precompiled binaries are available
 for instance at:
+
   - http://gnuwin32.sourceforge.net/packages/mawk.htm
   - http://ftp.uni-kl.de/pub/windows/cygwin/release/gawk/
   - plus many sites, a web search for "win32 awk" will
index 6ebfded3c76bd8b79c19f2ceeac35135cd8b2662..0f740537a0c84612f5410e34d19ca03cf7281d8f 100644 (file)
@@ -67,7 +67,7 @@
    TEMPLATE1=%PR2%.in ^
    TEMPLATE2=%PR3%.in ^
    TEMPLATE3=%PR4%.in ^
-   TEMPLATE=%PR5%.in %SIPEXTRA% < NUL 
+   TEMPLATE=%PR5%.in %SIPEXTRA% < NUL
 %CHECK%
 
 %AWK_SIP_AWK% PT=%PT% TEMPLATE=%PT%.in ^
index 5bbca9de8406a2a9ce7e01dcb2184c55f280f1a2..363d33b301f6787b5dbc29788ad8fc208e27238e 100644 (file)
@@ -25,7 +25,7 @@
 /**@file win32/config.h.in
  * @brief <config.h> used by Windows.
  *
- * Use this on WIN32. 
+ * Use this on WIN32.
  *
  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  *
 #undef HAVE_INTTYPES_H
 
 /* Define to 1 if you have the <iphlpapi.h> header file. */
-#if _MSC_VER > 1200 
+#if _MSC_VER > 1200
 #define HAVE_IPHLPAPI_H 1
 #else
 // XXX: vehmanek-win32-fix for VC6
 
 #define snprintf _snprintf
 
-#ifndef _MSC_VER 
+#ifndef _MSC_VER
 #define vsnprintf _vsnprintf
 #endif
 #if _MSC_VER < 1500
 #define HAVE_SIO_ADDRESS_LIST_QUERY 1
 
 /* Define to 1 if you have INTERFACE_INFO ioctl */
-#define HAVE_INTERFACE_INFO       (1) 
+#define HAVE_INTERFACE_INFO       (1)
 
 /* Ignore certain warnings */
 #ifdef _MSC_VER
 #pragma warning( disable : 4090 4204 4244 4018 4514 4706 4761)
 /* VC does not grok const */
 #pragma warning( disable : 4022 4028 )
-/* Temporarily disable high frequency, low value warnings.  
+/* Temporarily disable high frequency, low value warnings.
    We may still want to re-enable and fix these */
 #pragma warning( disable : 4132 4100 4127 4152)
 #if (_MSC_VER >= 1400) // VC8+
 #endif // VC8+
 #endif
 
-/* size_t/ssize_t modifiers 
+/* size_t/ssize_t modifiers
  * ref: http://msdn2.microsoft.com/en-us/library/tcxf1dw6.aspx */
 #define MOD_ZD "%ld"
 #define MOD_ZU "%lu"
index 494bd64080445da96bc7b0d26f561885675a1094..c36ed959addaf71e4c6d3f2ce4b368979d36184f 100644 (file)
@@ -121,7 +121,7 @@ msg_set_flags
 msg_token_d
 msg_unquote_dup
 msghdrtag_dup
-msghdrtag_snprintf 
+msghdrtag_snprintf
 msghdrtag_xtra
 msgobjtag_dup
 msgobjtag_snprintf
@@ -311,7 +311,7 @@ sip_separator_create
 sip_serialize
 sip_status_create
 sip_status_phrase
-sip_to_add_param   
+sip_to_add_param
 sip_to_create
 sip_to_tag
 sip_version_d
index 8d01703a1e0600d030b38a0ba9c222d7d6439fc9..c0217ebaa0d1483708ff3273aa07e36d554d4b9f 100644 (file)
@@ -46,7 +46,7 @@
 #define SU_HAVE_STDINT          (0)
 #define SU_HAVE_NT              0
 
-/* note: on Windows 2000 and older (WINVER<=500), IPv6-tech-preview 
+/* note: on Windows 2000 and older (WINVER<=500), IPv6-tech-preview
  * is needed for IPv4 support as well, so SU_HAVE_IN6 must be set */
 #define SU_HAVE_IN6             1
 
 #define snprintf    _snprintf
 #endif
 #ifndef vsnprintf
-#ifndef _MSC_VER 
+#ifndef _MSC_VER
 #define vsnprintf _vsnprintf
 #endif
 #if _MSC_VER < 1500
index bf5dd7cf56b6a9bee6f729227746b8b2da337755..c610015f3d84c58896c471a5ca3bcee02163fc7b 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/gawk
 #
 # This script extracts the version information from configure.ac
-# and re-generates win32/config.h and 
+# and re-generates win32/config.h and
 # libsofia-sip-ua/features/sofia_sip_features.h
 #
 # --------------------------------------------------------------------
@@ -38,7 +38,7 @@ BEGIN { IN=1; OUT=0; }
 
 IN && /^AC_INIT/ { version=$2; gsub(/[\]\[)]/, "", version); }
 
-OUT && /@[A-Z_]+@/ { 
+OUT && /@[A-Z_]+@/ {
   gsub(/@PACKAGE_VERSION@/, version);
   gsub(/@PACKAGE_BUGREPORT@/, "sofia-sip-devel@lists.sourceforge.net");
   gsub(/@PACKAGE_NAME@/, "sofia-sip");