From d5bf9156c0c6367fea834b305a5bcd72a5066fe9 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 16 Dec 2008 18:05:22 +0000 Subject: [PATCH] merge whitespace fixes from sofia-sip tree git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10802 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- AUTHORS | 3 +- COPYING | 2 +- COPYRIGHTS | 38 +- ChangeLog | 6 +- ChangeLog.ext-trees | 188 ++-- Makefile.am | 4 +- README | 16 +- README.developers | 36 +- RELEASE | 16 +- RELEASE.template | 16 +- TODO | 4 +- autogen.sh | 2 +- configure.ac | 12 +- docs/build_system.txt | 10 +- docs/devel_platform_notes.txt | 14 +- docs/release_management.txt | 24 +- libsofia-sip-ua-glib/Makefile.am | 4 +- .../su-glib/sofia-sip/su_glib.h | 2 +- .../su-glib/sofia-sip/su_source.h | 10 +- libsofia-sip-ua-glib/su-glib/su_glib.docs | 12 +- libsofia-sip-ua-glib/su-glib/su_source.c | 198 ++--- libsofia-sip-ua-glib/su-glib/su_source_test.c | 44 +- .../su-glib/torture_su_glib_timer.c | 4 +- libsofia-sip-ua/ChangeLog | 32 +- libsofia-sip-ua/Makefile.am | 12 +- libsofia-sip-ua/bnf/bnf.c | 32 +- libsofia-sip-ua/bnf/bnf.docs | 4 +- libsofia-sip-ua/bnf/sofia-sip/bnf.h | 72 +- libsofia-sip-ua/bnf/sofia-sip/hostdomain.h | 8 +- libsofia-sip-ua/bnf/torture_bnf.c | 6 +- libsofia-sip-ua/docs/ChangeLog | 2 +- libsofia-sip-ua/docs/Doxyfile.conf | 4 +- libsofia-sip-ua/docs/Doxyfile.in | 2 +- libsofia-sip-ua/docs/Makefile.am | 2 +- libsofia-sip-ua/docs/conformance.docs | 12 +- libsofia-sip-ua/docs/docguide.docs | 60 +- libsofia-sip-ua/docs/mainpage.docs | 132 +-- libsofia-sip-ua/features/features.c | 36 +- libsofia-sip-ua/features/features.docs | 4 +- libsofia-sip-ua/http/Doxyfile.in | 2 +- libsofia-sip-ua/http/Makefile.am | 6 +- libsofia-sip-ua/http/http.docs | 8 +- libsofia-sip-ua/http/http_basic.c | 20 +- libsofia-sip-ua/http/http_extra.c | 10 +- libsofia-sip-ua/http/http_header.c | 12 +- libsofia-sip-ua/http/http_parser.c | 54 +- libsofia-sip-ua/http/http_parser_table.c.in | 2 +- libsofia-sip-ua/http/http_status.c | 2 +- libsofia-sip-ua/http/http_tag.c.in | 6 +- libsofia-sip-ua/http/http_tag_class.c | 16 +- libsofia-sip-ua/http/sofia-sip/http.h | 22 +- .../http/sofia-sip/http_hclasses.h | 4 +- libsofia-sip-ua/http/sofia-sip/http_header.h | 26 +- libsofia-sip-ua/http/sofia-sip/http_parser.h | 4 +- .../http/sofia-sip/http_protos.h.in | 102 +-- libsofia-sip-ua/http/sofia-sip/http_status.h | 6 +- libsofia-sip-ua/http/sofia-sip/http_tag.h.in | 8 +- .../http/sofia-sip/http_tag_class.h | 6 +- libsofia-sip-ua/http/test_http.c | 4 +- libsofia-sip-ua/ipt/base64.c | 46 +- libsofia-sip-ua/ipt/ipt.docs | 4 +- libsofia-sip-ua/ipt/rc4.c | 242 +++--- libsofia-sip-ua/ipt/sofia-sip/base64.h | 4 +- libsofia-sip-ua/ipt/sofia-sip/rc4.h | 16 +- libsofia-sip-ua/ipt/sofia-sip/uniqueid.h | 4 +- libsofia-sip-ua/ipt/sofia-sip/utf8.h | 6 +- libsofia-sip-ua/ipt/token64.c | 10 +- libsofia-sip-ua/ipt/ucs2.c | 14 +- libsofia-sip-ua/ipt/ucs4.c | 12 +- libsofia-sip-ua/ipt/utf8.c | 2 +- libsofia-sip-ua/ipt/utf8internal.h | 4 +- libsofia-sip-ua/ipt/utf8test.c | 16 +- libsofia-sip-ua/iptsec/Doxyfile.in | 2 +- libsofia-sip-ua/iptsec/auth_client.c | 158 ++-- libsofia-sip-ua/iptsec/auth_client_ntlm.c | 36 +- libsofia-sip-ua/iptsec/auth_common.c | 2 +- libsofia-sip-ua/iptsec/auth_digest.c | 52 +- libsofia-sip-ua/iptsec/auth_module.c | 2 +- libsofia-sip-ua/iptsec/auth_module_http.c | 14 +- libsofia-sip-ua/iptsec/auth_module_sip.c | 12 +- libsofia-sip-ua/iptsec/auth_ntlm.c | 50 +- libsofia-sip-ua/iptsec/auth_plugin.c | 18 +- libsofia-sip-ua/iptsec/auth_plugin_delayed.c | 20 +- libsofia-sip-ua/iptsec/auth_plugin_ntlm.c | 66 +- libsofia-sip-ua/iptsec/auth_tag.c | 44 +- libsofia-sip-ua/iptsec/iptsec.docs | 16 +- libsofia-sip-ua/iptsec/iptsec_debug.c | 8 +- libsofia-sip-ua/iptsec/iptsec_debug.h | 4 +- .../iptsec/sofia-sip/auth_client.h | 22 +- .../iptsec/sofia-sip/auth_client_plugin.h | 18 +- .../iptsec/sofia-sip/auth_common.h | 4 +- .../iptsec/sofia-sip/auth_digest.h | 6 +- .../iptsec/sofia-sip/auth_module.h | 16 +- libsofia-sip-ua/iptsec/sofia-sip/auth_ntlm.h | 32 +- .../iptsec/sofia-sip/auth_plugin.h | 34 +- libsofia-sip-ua/iptsec/test_auth_digest.c | 258 +++--- libsofia-sip-ua/msg/ChangeLog | 6 +- libsofia-sip-ua/msg/Makefile.am | 4 +- libsofia-sip-ua/msg/msg.c | 40 +- libsofia-sip-ua/msg/msg.docs | 36 +- libsofia-sip-ua/msg/msg_auth.c | 16 +- libsofia-sip-ua/msg/msg_basic.c | 20 +- libsofia-sip-ua/msg/msg_date.c | 94 +- libsofia-sip-ua/msg/msg_generic.c | 36 +- libsofia-sip-ua/msg/msg_header_copy.c | 44 +- libsofia-sip-ua/msg/msg_header_make.c | 24 +- libsofia-sip-ua/msg/msg_internal.h | 8 +- libsofia-sip-ua/msg/msg_mclass.c | 58 +- libsofia-sip-ua/msg/msg_mime.c | 112 +-- libsofia-sip-ua/msg/msg_mime_table.c.in | 4 +- libsofia-sip-ua/msg/msg_name_hash.c | 6 +- libsofia-sip-ua/msg/msg_parser.awk | 76 +- libsofia-sip-ua/msg/msg_parser.c | 68 +- libsofia-sip-ua/msg/msg_parser_util.c | 278 +++--- libsofia-sip-ua/msg/msg_tag.c | 28 +- libsofia-sip-ua/msg/sofia-sip/msg.h | 6 +- libsofia-sip-ua/msg/sofia-sip/msg_addr.h | 12 +- libsofia-sip-ua/msg/sofia-sip/msg_buffer.h | 6 +- libsofia-sip-ua/msg/sofia-sip/msg_date.h | 6 +- libsofia-sip-ua/msg/sofia-sip/msg_header.h | 6 +- libsofia-sip-ua/msg/sofia-sip/msg_mclass.h | 20 +- .../msg/sofia-sip/msg_mclass_hash.h | 6 +- libsofia-sip-ua/msg/sofia-sip/msg_mime.h | 14 +- .../msg/sofia-sip/msg_mime_protos.h.in | 104 +-- libsofia-sip-ua/msg/sofia-sip/msg_parser.h | 20 +- libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in | 104 +-- libsofia-sip-ua/msg/sofia-sip/msg_tag_class.h | 12 +- libsofia-sip-ua/msg/sofia-sip/msg_types.h | 36 +- libsofia-sip-ua/msg/test_class.c | 38 +- libsofia-sip-ua/msg/test_class.h | 12 +- libsofia-sip-ua/msg/test_msg.c | 202 ++--- libsofia-sip-ua/msg/test_protos.h.in | 92 +- libsofia-sip-ua/msg/test_table.c.in | 4 +- libsofia-sip-ua/nea/Doxyfile.in | 2 +- libsofia-sip-ua/nea/Makefile.am | 4 +- libsofia-sip-ua/nea/nea.c | 84 +- libsofia-sip-ua/nea/nea.docs | 16 +- libsofia-sip-ua/nea/nea_debug.c | 6 +- libsofia-sip-ua/nea/nea_event.c | 2 +- libsofia-sip-ua/nea/nea_server.c | 358 ++++---- libsofia-sip-ua/nea/sofia-sip/nea.h | 38 +- libsofia-sip-ua/nta/Doxyfile.in | 2 +- libsofia-sip-ua/nta/Makefile.am | 6 +- libsofia-sip-ua/nta/invite.msc | 4 +- libsofia-sip-ua/nta/nta.c | 802 +++++++++--------- libsofia-sip-ua/nta/nta.docs | 220 ++--- libsofia-sip-ua/nta/nta_internal.h | 8 +- libsofia-sip-ua/nta/nta_tag.c | 156 ++-- libsofia-sip-ua/nta/portbind.c | 14 +- libsofia-sip-ua/nta/run_test_nta | 8 +- libsofia-sip-ua/nta/sl_read_payload.c | 10 +- libsofia-sip-ua/nta/sl_utils.docs | 2 +- libsofia-sip-ua/nta/sl_utils_log.c | 64 +- libsofia-sip-ua/nta/sl_utils_print.c | 86 +- libsofia-sip-ua/nta/sofia-sip/nta.h | 72 +- libsofia-sip-ua/nta/sofia-sip/nta_stateless.h | 14 +- libsofia-sip-ua/nta/sofia-sip/nta_tag.h | 8 +- libsofia-sip-ua/nta/sofia-sip/nta_tport.h | 6 +- libsofia-sip-ua/nta/sofia-sip/sl_utils.h | 10 +- libsofia-sip-ua/nta/test_nta.c | 500 +++++------ libsofia-sip-ua/nta/test_nta_api.c | 186 ++-- libsofia-sip-ua/nth/Doxyfile.in | 2 +- libsofia-sip-ua/nth/http-client.c | 48 +- libsofia-sip-ua/nth/nth.docs | 2 +- libsofia-sip-ua/nth/nth_client.c | 14 +- libsofia-sip-ua/nth/nth_server.c | 142 ++-- libsofia-sip-ua/nth/nth_tag.c | 2 +- libsofia-sip-ua/nth/sofia-sip/nth.h | 30 +- libsofia-sip-ua/nth/sofia-sip/nth_tag.h | 4 +- libsofia-sip-ua/nth/test_nth.c | 136 +-- libsofia-sip-ua/nua/ChangeLog | 22 +- libsofia-sip-ua/nua/nua.c | 8 +- libsofia-sip-ua/nua/nua.docs | 12 +- libsofia-sip-ua/nua/nua_common.c | 30 +- libsofia-sip-ua/nua/nua_dialog.c | 54 +- libsofia-sip-ua/nua/nua_dialog.h | 52 +- libsofia-sip-ua/nua/nua_event_server.c | 58 +- libsofia-sip-ua/nua/nua_extension.c | 14 +- libsofia-sip-ua/nua/nua_message.c | 18 +- libsofia-sip-ua/nua/nua_notifier.c | 82 +- libsofia-sip-ua/nua/nua_options.c | 6 +- libsofia-sip-ua/nua/nua_params.c | 106 +-- libsofia-sip-ua/nua/nua_publish.c | 22 +- libsofia-sip-ua/nua/nua_register.c | 148 ++-- libsofia-sip-ua/nua/nua_registrar.c | 4 +- libsofia-sip-ua/nua/nua_stack.c | 150 ++-- libsofia-sip-ua/nua/nua_stack.h | 32 +- libsofia-sip-ua/nua/nua_subnotref.c | 120 +-- libsofia-sip-ua/nua/nua_tag.c | 8 +- libsofia-sip-ua/nua/nua_types.h | 6 +- libsofia-sip-ua/nua/outbound.c | 62 +- libsofia-sip-ua/nua/outbound.h | 8 +- libsofia-sip-ua/nua/sofia-sip/nua.h | 28 +- libsofia-sip-ua/nua/test_s2.c | 82 +- libsofia-sip-ua/nua/test_s2.h | 2 +- libsofia-sip-ua/sdp/ChangeLog | 2 +- libsofia-sip-ua/sdp/errata | 2 +- libsofia-sip-ua/sdp/run_test_sdp | 4 +- libsofia-sip-ua/sdp/sdp.c | 226 ++--- libsofia-sip-ua/sdp/sdp.docs | 12 +- libsofia-sip-ua/sdp/sdp_parse.c | 114 +-- libsofia-sip-ua/sdp/sdp_print.c | 68 +- libsofia-sip-ua/sdp/sdp_tag.c | 8 +- libsofia-sip-ua/sdp/sofia-sip/sdp.h | 40 +- libsofia-sip-ua/sdp/sofia-sip/sdp_tag.h | 10 +- libsofia-sip-ua/sdp/test_sdp.c | 4 +- libsofia-sip-ua/sdp/torture_sdp.c | 76 +- libsofia-sip-ua/sip/ADD-A-HEADER | 24 +- libsofia-sip-ua/sip/ChangeLog | 6 +- libsofia-sip-ua/sip/Doxyfile.in | 2 +- libsofia-sip-ua/sip/GRAMMAR | 134 +-- libsofia-sip-ua/sip/run-tests | 4 +- libsofia-sip-ua/sip/run_test_sip_msg | 26 +- libsofia-sip-ua/sip/sip.docs | 122 +-- libsofia-sip-ua/sip/sip.doxyaliases | 6 +- libsofia-sip-ua/sip/sip_bad_mask | 4 +- libsofia-sip-ua/sip/sip_basic.c | 296 +++---- libsofia-sip-ua/sip/sip_caller_prefs.c | 4 +- libsofia-sip-ua/sip/sip_event.c | 88 +- libsofia-sip-ua/sip/sip_extra.c | 164 ++-- libsofia-sip-ua/sip/sip_extra_headers.txt | 2 +- libsofia-sip-ua/sip/sip_feature.c | 86 +- libsofia-sip-ua/sip/sip_header.c | 4 +- libsofia-sip-ua/sip/sip_mime.c | 78 +- libsofia-sip-ua/sip/sip_parser.c | 74 +- libsofia-sip-ua/sip/sip_parser.docs | 18 +- libsofia-sip-ua/sip/sip_parser_table.c.in | 2 +- libsofia-sip-ua/sip/sip_prack.c | 14 +- libsofia-sip-ua/sip/sip_pref_util.c | 60 +- libsofia-sip-ua/sip/sip_reason.c | 26 +- libsofia-sip-ua/sip/sip_refer.c | 20 +- libsofia-sip-ua/sip/sip_security.c | 86 +- libsofia-sip-ua/sip/sip_session.c | 26 +- libsofia-sip-ua/sip/sip_status.c | 16 +- libsofia-sip-ua/sip/sip_tag.c.in | 2 +- libsofia-sip-ua/sip/sip_tag_class.c | 36 +- libsofia-sip-ua/sip/sip_time.c | 10 +- libsofia-sip-ua/sip/sip_util.c | 196 ++--- libsofia-sip-ua/sip/sofia-sip/sip.h | 56 +- .../sip/sofia-sip/sip_hclasses.h.in | 16 +- libsofia-sip-ua/sip/sofia-sip/sip_header.h | 68 +- libsofia-sip-ua/sip/sofia-sip/sip_parser.h | 22 +- libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in | 102 +-- libsofia-sip-ua/sip/sofia-sip/sip_status.h | 4 +- libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in | 16 +- libsofia-sip-ua/sip/sofia-sip/sip_tag_class.h | 6 +- libsofia-sip-ua/sip/sofia-sip/sip_util.h | 28 +- libsofia-sip-ua/sip/test_date.c | 8 +- libsofia-sip-ua/sip/test_sip_msg.c | 18 +- libsofia-sip-ua/sip/torture_sip.c | 492 +++++------ libsofia-sip-ua/sip/validator.c | 80 +- libsofia-sip-ua/soa/ChangeLog | 6 +- libsofia-sip-ua/soa/Doxyfile.in | 2 +- libsofia-sip-ua/soa/Makefile.am | 2 +- libsofia-sip-ua/soa/soa.c | 118 +-- libsofia-sip-ua/soa/soa.docs | 82 +- libsofia-sip-ua/soa/soa_static.c | 116 +-- libsofia-sip-ua/soa/soa_tag.c | 64 +- libsofia-sip-ua/soa/sofia-sip/soa.h | 10 +- libsofia-sip-ua/soa/sofia-sip/soa_session.h | 22 +- libsofia-sip-ua/soa/sofia-sip/soa_tag.h | 6 +- libsofia-sip-ua/soa/test_soa.c | 142 ++-- libsofia-sip-ua/sresolv/127.zone | 2 +- libsofia-sip-ua/sresolv/194.2.188 | 2 +- .../sresolv/3.f.f.e.1.2.0.0.3.0.1.2.c.0.0.0 | 2 +- .../3.f.f.e.1.2.0.0.3.0.1.2.c.0.0.0.arpa | 2 +- libsofia-sip-ua/sresolv/Makefile.am | 4 +- libsofia-sip-ua/sresolv/example.com | 2 +- libsofia-sip-ua/sresolv/resolve_sip.c | 34 +- libsofia-sip-ua/sresolv/root.zone | 2 - libsofia-sip-ua/sresolv/run_test_sresolv | 12 +- libsofia-sip-ua/sresolv/sofia-resolv/sres.h | 34 +- .../sresolv/sofia-resolv/sres_async.h | 10 +- .../sresolv/sofia-resolv/sres_cache.h | 4 +- .../sresolv/sofia-resolv/sres_config.h | 2 +- .../sresolv/sofia-resolv/sres_record.h | 8 +- libsofia-sip-ua/sresolv/sofia-sip/sresolv.h | 4 +- libsofia-sip-ua/sresolv/sres.c | 452 +++++----- libsofia-sip-ua/sresolv/sres_blocking.c | 34 +- libsofia-sip-ua/sresolv/sres_cache.c | 56 +- libsofia-sip-ua/sresolv/sresolv.c | 38 +- libsofia-sip-ua/sresolv/sresolv.docs | 20 +- libsofia-sip-ua/sresolv/test_sresolv.c | 154 ++-- libsofia-sip-ua/sresolv/torture_sresolv.c | 34 +- libsofia-sip-ua/stun/ChangeLog | 18 +- libsofia-sip-ua/stun/lookup_stun_server.c | 14 +- libsofia-sip-ua/stun/sofia-sip/stun.h | 62 +- libsofia-sip-ua/stun/sofia-sip/stun_common.h | 12 +- libsofia-sip-ua/stun/stun.c | 392 ++++----- libsofia-sip-ua/stun/stun_common.c | 50 +- libsofia-sip-ua/stun/stun_dns.c | 30 +- libsofia-sip-ua/stun/stun_internal.h | 2 +- libsofia-sip-ua/stun/stun_mini.c | 38 +- libsofia-sip-ua/stun/stun_tag.c | 24 +- libsofia-sip-ua/stun/stunc.c | 44 +- libsofia-sip-ua/su/ChangeLog | 2 +- libsofia-sip-ua/su/Makefile.am | 2 +- libsofia-sip-ua/su/addrinfo.c | 4 +- libsofia-sip-ua/su/foo.c | 30 +- libsofia-sip-ua/su/getopt.c | 352 ++++---- libsofia-sip-ua/su/localinfo.c | 6 +- libsofia-sip-ua/su/memccpy.c | 6 +- libsofia-sip-ua/su/memcspn.c | 6 +- libsofia-sip-ua/su/memmem.c | 6 +- libsofia-sip-ua/su/memspn.c | 8 +- libsofia-sip-ua/su/poll.c | 6 +- libsofia-sip-ua/su/smoothsort.c | 30 +- libsofia-sip-ua/su/sofia-sip/heap.h | 18 +- libsofia-sip-ua/su/sofia-sip/htable.h | 6 +- libsofia-sip-ua/su/sofia-sip/htable2.h | 16 +- libsofia-sip-ua/su/sofia-sip/rbtree.h | 26 +- libsofia-sip-ua/su/sofia-sip/su.h | 32 +- libsofia-sip-ua/su/sofia-sip/su_addrinfo.h | 12 +- libsofia-sip-ua/su/sofia-sip/su_alloc.h | 6 +- libsofia-sip-ua/su/sofia-sip/su_alloc_stat.h | 8 +- libsofia-sip-ua/su/sofia-sip/su_bm.h | 4 +- libsofia-sip-ua/su/sofia-sip/su_config.h | 10 +- .../su/sofia-sip/su_configure.h.in | 8 +- libsofia-sip-ua/su/sofia-sip/su_debug.h | 14 +- libsofia-sip-ua/su/sofia-sip/su_errno.h | 2 +- libsofia-sip-ua/su/sofia-sip/su_localinfo.h | 8 +- libsofia-sip-ua/su/sofia-sip/su_log.h | 6 +- libsofia-sip-ua/su/sofia-sip/su_md5.h | 2 +- libsofia-sip-ua/su/sofia-sip/su_os_nw.h | 8 +- libsofia-sip-ua/su/sofia-sip/su_osx_runloop.h | 6 +- libsofia-sip-ua/su/sofia-sip/su_strlst.h | 10 +- libsofia-sip-ua/su/sofia-sip/su_tag.h | 24 +- libsofia-sip-ua/su/sofia-sip/su_tag_class.h | 6 +- libsofia-sip-ua/su/sofia-sip/su_tag_inline.h | 18 +- libsofia-sip-ua/su/sofia-sip/su_tag_io.h | 8 +- libsofia-sip-ua/su/sofia-sip/su_tagarg.h | 12 +- libsofia-sip-ua/su/sofia-sip/su_time.h | 28 +- libsofia-sip-ua/su/sofia-sip/su_types.h | 30 +- libsofia-sip-ua/su/sofia-sip/su_uniqueid.h | 24 +- libsofia-sip-ua/su/sofia-sip/su_vector.h | 4 +- libsofia-sip-ua/su/sofia-sip/su_wait.h | 46 +- libsofia-sip-ua/su/sofia-sip/tstdef.h | 42 +- libsofia-sip-ua/su/strcasestr.c | 4 +- libsofia-sip-ua/su/strtoull.c | 10 +- libsofia-sip-ua/su/su.c | 54 +- libsofia-sip-ua/su/su.docs | 20 +- libsofia-sip-ua/su/su_addrinfo.c | 48 +- libsofia-sip-ua/su/su_alloc.c | 110 +-- libsofia-sip-ua/su/su_alloc_lock.c | 6 +- libsofia-sip-ua/su/su_base_port.c | 56 +- libsofia-sip-ua/su/su_bm.c | 38 +- libsofia-sip-ua/su/su_default_log.c | 12 +- libsofia-sip-ua/su/su_devpoll_port.c | 94 +- libsofia-sip-ua/su/su_epoll_port.c | 84 +- libsofia-sip-ua/su/su_errno.c | 8 +- libsofia-sip-ua/su/su_global_log.c | 20 +- libsofia-sip-ua/su/su_kqueue_port.c | 76 +- libsofia-sip-ua/su/su_localinfo.c | 182 ++-- libsofia-sip-ua/su/su_log.c | 36 +- libsofia-sip-ua/su/su_md5.c | 56 +- libsofia-sip-ua/su/su_module_debug.h | 4 +- libsofia-sip-ua/su/su_open_c_localinfo.cpp | 24 +- libsofia-sip-ua/su/su_os_nw.c | 6 +- libsofia-sip-ua/su/su_osx_runloop.c | 230 ++--- libsofia-sip-ua/su/su_perf.c | 16 +- libsofia-sip-ua/su/su_poll_port.c | 102 +-- libsofia-sip-ua/su/su_port.c | 36 +- libsofia-sip-ua/su/su_port.h | 58 +- libsofia-sip-ua/su/su_proxy.c | 52 +- libsofia-sip-ua/su/su_pthread_port.c | 22 +- libsofia-sip-ua/su/su_root.c | 92 +- libsofia-sip-ua/su/su_select_port.c | 82 +- libsofia-sip-ua/su/su_socket_port.c | 22 +- libsofia-sip-ua/su/su_sprintf.c | 16 +- libsofia-sip-ua/su/su_strdup.c | 10 +- libsofia-sip-ua/su/su_strlst.c | 54 +- libsofia-sip-ua/su/su_tag.c | 6 +- libsofia-sip-ua/su/su_tag_io.c | 6 +- libsofia-sip-ua/su/su_taglist.c | 236 +++--- libsofia-sip-ua/su/su_time.c | 84 +- libsofia-sip-ua/su/su_time0.c | 22 +- libsofia-sip-ua/su/su_timer.c | 14 +- libsofia-sip-ua/su/su_uniqueid.c | 32 +- libsofia-sip-ua/su/su_vector.c | 42 +- libsofia-sip-ua/su/su_wait.c | 32 +- libsofia-sip-ua/su/su_win32_port.c | 100 +-- libsofia-sip-ua/su/tag_dll.awk | 18 +- libsofia-sip-ua/su/test_htable.c | 18 +- libsofia-sip-ua/su/test_htable2.c | 16 +- libsofia-sip-ua/su/test_memmem.c | 12 +- libsofia-sip-ua/su/test_poll.c | 12 +- libsofia-sip-ua/su/test_su.c | 28 +- libsofia-sip-ua/su/test_su_osx.c | 34 +- libsofia-sip-ua/su/torture_heap.c | 6 +- libsofia-sip-ua/su/torture_rbtree.c | 68 +- libsofia-sip-ua/su/torture_su.c | 36 +- libsofia-sip-ua/su/torture_su_alloc.c | 6 +- libsofia-sip-ua/su/torture_su_bm.c | 24 +- libsofia-sip-ua/su/torture_su_port.c | 12 +- libsofia-sip-ua/su/torture_su_root.c | 112 +-- libsofia-sip-ua/su/torture_su_root_osx.c | 40 +- libsofia-sip-ua/su/torture_su_tag.c | 72 +- libsofia-sip-ua/su/torture_su_time.c | 18 +- libsofia-sip-ua/su/torture_su_timer.c | 2 +- libsofia-sip-ua/tport/ChangeLog | 6 +- libsofia-sip-ua/tport/Makefile.am | 2 +- libsofia-sip-ua/tport/sofia-sip/tport.h | 2 +- .../tport/sofia-sip/tport_plugins.h | 12 +- libsofia-sip-ua/tport/sofia-sip/tport_tag.h | 6 +- libsofia-sip-ua/tport/test_tport.c | 208 ++--- libsofia-sip-ua/tport/tls_test_client.c | 10 +- libsofia-sip-ua/tport/tls_test_server.c | 20 +- libsofia-sip-ua/tport/tport.c | 562 ++++++------ libsofia-sip-ua/tport/tport.docs | 8 +- libsofia-sip-ua/tport/tport_internal.h | 76 +- libsofia-sip-ua/tport/tport_logging.c | 28 +- libsofia-sip-ua/tport/tport_sigcomp.c | 134 +-- libsofia-sip-ua/tport/tport_stub_sigcomp.c | 24 +- libsofia-sip-ua/tport/tport_stub_stun.c | 20 +- libsofia-sip-ua/tport/tport_tag.c | 24 +- libsofia-sip-ua/tport/tport_threadpool.c | 116 +-- libsofia-sip-ua/tport/tport_tls.c | 72 +- libsofia-sip-ua/tport/tport_tls.h | 4 +- libsofia-sip-ua/tport/tport_type_connect.c | 42 +- libsofia-sip-ua/tport/tport_type_sctp.c | 34 +- libsofia-sip-ua/tport/tport_type_stun.c | 26 +- libsofia-sip-ua/tport/tport_type_tcp.c | 40 +- libsofia-sip-ua/tport/tport_type_tls.c | 42 +- libsofia-sip-ua/tport/tport_type_udp.c | 42 +- libsofia-sip-ua/url/sofia-sip/url.h | 30 +- libsofia-sip-ua/url/sofia-sip/url_tag.h | 4 +- libsofia-sip-ua/url/sofia-sip/url_tag_class.h | 2 +- libsofia-sip-ua/url/torture_url.c | 86 +- libsofia-sip-ua/url/url.c | 216 ++--- libsofia-sip-ua/url/url.docs | 26 +- libsofia-sip-ua/url/url_tag.c | 10 +- libsofia-sip-ua/url/urlmap.c | 72 +- libsofia-sip-ua/url/urlmap.h | 6 +- m4/sac-coverage.m4 | 18 +- m4/sac-general.m4 | 60 +- m4/sac-openssl.m4 | 8 +- m4/sac-su2.m4 | 50 +- m4/sac-tport.m4 | 2 +- open_c/build_sources.cmd | 2 +- open_c/version.awk | 4 +- packages/ChangeLog | 4 +- packages/Makefile.am | 2 +- packages/sofia-sip.spec.in | 12 +- rules/lcov.am | 4 +- rules/recursive.am | 2 +- rules/valcheck.am | 6 +- scripts/coverage | 20 +- scripts/fix-include-sofia-sip | 4 +- scripts/hide_emails.sh | 2 +- scripts/lcov-report | 8 +- scripts/rpmbuild-snaphot | 20 +- scripts/uncovered | 16 +- tests/check_sofia.c | 2 +- tests/test_100rel.c | 46 +- tests/test_basic_call.c | 72 +- tests/test_call_hold.c | 30 +- tests/test_call_reject.c | 26 +- tests/test_cancel_bye.c | 44 +- tests/test_extension.c | 2 +- tests/test_init.c | 10 +- tests/test_nat.c | 26 +- tests/test_nat.h | 2 +- tests/test_nua.c | 6 +- tests/test_nua.h | 4 +- tests/test_nua_api.c | 14 +- tests/test_nua_params.c | 8 +- tests/test_offer_answer.c | 20 +- tests/test_ops.c | 10 +- tests/test_proxy.c | 114 +-- tests/test_proxy.h | 10 +- tests/test_refer.c | 14 +- tests/test_register.c | 26 +- tests/test_session_timer.c | 4 +- tests/test_simple.c | 44 +- tests/test_sip_events.c | 2 +- utils/ChangeLog | 6 +- utils/Doxyfile.in | 6 +- utils/apps_utils.h | 32 +- utils/sip-date.c | 20 +- utils/sip-dig.c | 22 +- utils/sip-options.c | 64 +- utils/utils.docs | 6 +- win32/ChangeLog | 22 +- win32/README.txt | 6 +- win32/build_sources.cmd | 2 +- win32/config.h.in | 12 +- win32/libsofia-sip-ua/sofia-sip-ua.def | 4 +- win32/sofia-sip/su_configure.h | 4 +- win32/version.awk | 4 +- 489 files changed, 10287 insertions(+), 10290 deletions(-) diff --git a/AUTHORS b/AUTHORS index cc18cae9..b7df46c2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -31,7 +31,6 @@ Urpalainen, Jari Whittaker, Colin Zabaluev, Mikhail -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 diff --git a/COPYING b/COPYING index 1f7c8cc6..148d531c 100644 --- a/COPYING +++ b/COPYING @@ -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 diff --git a/COPYRIGHTS b/COPYRIGHTS index 09a1d2f7..f82e57e8 100644 --- a/COPYRIGHTS +++ b/COPYRIGHTS @@ -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 @@ -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. ---------------------------------------------------------------------------- diff --git a/ChangeLog b/ChangeLog index 53b11fac..56190603 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/ChangeLog.ext-trees b/ChangeLog.ext-trees index 26df6891..6931926f 100644 --- a/ChangeLog.ext-trees +++ b/ChangeLog.ext-trees @@ -20,18 +20,18 @@ * 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. @@ -74,22 +74,22 @@ - 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. @@ -99,11 +99,11 @@ * 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. @@ -118,7 +118,7 @@ Avoid #include ordering problem with . * Removed utf8 and unicode-related stuff from library. - + Source files are still included in source tar. * Reordered #includes in sip module. @@ -137,9 +137,9 @@ * 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. @@ -166,18 +166,18 @@ * 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 @@ -252,10 +252,10 @@ * 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. @@ -277,7 +277,7 @@ * 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. @@ -286,7 +286,7 @@ * 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). @@ -371,7 +371,7 @@ const *, too. * Added SOFIAPUBFUN to auth_struct_copy(), too. - + * iptsec module (by Martti Mela): * ntlm support now compiles, not working. @@ -393,7 +393,7 @@ * 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. @@ -403,7 +403,7 @@ 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. @@ -743,7 +743,7 @@ 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 @@ -800,7 +800,7 @@ 2006-04-11 Kai Vehmanen - Synchronizing CVS with darcs (other contributors pp = Pekka Pessi, + Synchronizing CVS with darcs (other contributors pp = Pekka Pessi, mm = Martti Mela). * NDEBUG oops. (pp) @@ -897,7 +897,7 @@ 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 @@ -915,7 +915,7 @@ 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, @@ -923,7 +923,7 @@ 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(), @@ -1330,7 +1330,7 @@ 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 @@ -1574,12 +1574,12 @@ 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 @@ -1613,7 +1613,7 @@ * 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 @@ -1645,7 +1645,7 @@ 2006-03-16 Pekka Pessi Synchronizing CVS with darcs. - + * Fixed lib-sofia-sip-ua-glib Makefile.ams. Tried to sanitize glib-less compilation. @@ -1718,7 +1718,7 @@ * 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. @@ -1753,13 +1753,13 @@ M ./libsofia-sip-ua/nua/nua_stack.c -1 +1 2006-03-13 Martti Mela - + * win32 defs, compiles and installs in mingw environment 2006-03-09 Kai Vehmanen - * 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 @@ -1978,8 +1978,8 @@ 2006-03-01 Pekka Pessi - * Synchronized darcs and CVS. - + * Synchronized darcs and CVS. + * Added utils/Doxyfile A ./utils/Doxyfile @@ -2122,7 +2122,7 @@ 2006-02-15 Pekka Pessi * Release 1.11.6. - + * Fixed problems in doxygen documentation and dist. * Updated PRACK and nta_outgoing_prack(). @@ -2173,19 +2173,19 @@ . 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. @@ -2193,7 +2193,7 @@ * 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 @@ -2286,12 +2286,12 @@ 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 @@ -2393,7 +2393,7 @@ 2006-01-03 Pekka Pessi Syncinc darcs and CVS. - + * Added more tests for call hold. * Using msg_header_replace_param() in nua_stack.c. @@ -2410,7 +2410,7 @@ * 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. @@ -2420,7 +2420,7 @@ * 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. @@ -2429,7 +2429,7 @@ * Use #include 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 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 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 @@ -3409,9 +3409,9 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com 2005-11-28 Martti Mela * 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 - * configure.ac: Added VER_LIBSOFIA_SIP_UA variables. + * configure.ac: Added VER_LIBSOFIA_SIP_UA variables. 2005-11-14 Pekka Pessi @@ -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 - + * 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 * 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 * Importing darcs-to-cvs-2005-09-29. - + 2005-09-28 Pekka Pessi * Added nua improvements. @@ -4347,7 +4347,7 @@ Tue Dec 20 19:51:57 EET 2005 Pekka.Pessi@nokia.com 2005-09-23 Pekka Pessi * 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 diff --git a/Makefile.am b/Makefile.am index 6bdceebc..84fe9528 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/README b/README index e560df5e..a503fb23 100644 --- a/README +++ b/README @@ -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 ---------- diff --git a/README.developers b/README.developers index ac121846..611c7bc2 100644 --- a/README.developers +++ b/README.developers @@ -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 /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. ;) diff --git a/RELEASE b/RELEASE index 611367c1..da6bf2f0 100644 --- a/RELEASE +++ b/RELEASE @@ -17,17 +17,17 @@ API/ABI changes and versioning **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 +/> - **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 -------------------------- diff --git a/RELEASE.template b/RELEASE.template index 611367c1..da6bf2f0 100644 --- a/RELEASE.template +++ b/RELEASE.template @@ -17,17 +17,17 @@ API/ABI changes and versioning **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 +/> - **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 -------------------------- diff --git a/TODO b/TODO index 0cd2bdaa..970f6733 100644 --- a/TODO +++ b/TODO @@ -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] diff --git a/autogen.sh b/autogen.sh index e460abb6..e8fcf2c6 100644 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh set -x AUTOMAKE=${AUTOMAKE:-automake-1.9} ACLOCAL=${ACLOCAL:-aclocal-1.9} diff --git a/configure.ac b/configure.ac index 4fbc60a3..438ace6e 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl Copyright (C) 2005-2006 Nokia Corporation dnl Contact: Pekka Pessi 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 diff --git a/docs/build_system.txt b/docs/build_system.txt index ae9db277..6e746a14 100644 --- a/docs/build_system.txt +++ b/docs/build_system.txt @@ -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 diff --git a/docs/devel_platform_notes.txt b/docs/devel_platform_notes.txt index 9d7cc4f1..c24366dd 100644 --- a/docs/devel_platform_notes.txt +++ b/docs/devel_platform_notes.txt @@ -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 diff --git a/docs/release_management.txt b/docs/release_management.txt index 3d9e99af..333d9481 100644 --- a/docs/release_management.txt +++ b/docs/release_management.txt @@ -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. diff --git a/libsofia-sip-ua-glib/Makefile.am b/libsofia-sip-ua-glib/Makefile.am index 43f707d9..b2a6f5b9 100644 --- a/libsofia-sip-ua-glib/Makefile.am +++ b/libsofia-sip-ua-glib/Makefile.am @@ -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 diff --git a/libsofia-sip-ua-glib/su-glib/sofia-sip/su_glib.h b/libsofia-sip-ua-glib/su-glib/sofia-sip/su_glib.h index f6f2448d..4f7dfea7 100644 --- a/libsofia-sip-ua-glib/su-glib/sofia-sip/su_glib.h +++ b/libsofia-sip-ua-glib/su-glib/sofia-sip/su_glib.h @@ -27,7 +27,7 @@ /** * @file su_glib.h - * + * * @author Pekka Pessi * @author Kai Vehmanen */ diff --git a/libsofia-sip-ua-glib/su-glib/sofia-sip/su_source.h b/libsofia-sip-ua-glib/su-glib/sofia-sip/su_source.h index 142a8bca..5d8fde16 100644 --- a/libsofia-sip-ua-glib/su-glib/sofia-sip/su_source.h +++ b/libsofia-sip-ua-glib/su-glib/sofia-sip/su_source.h @@ -27,16 +27,16 @@ /** * @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 * @author Kai Vehmanen - * + * * @date Created: Thu Mar 4 19:58:50 2004 ppessi - * + * */ #ifndef SU_WAIT_H diff --git a/libsofia-sip-ua-glib/su-glib/su_glib.docs b/libsofia-sip-ua-glib/su-glib/su_glib.docs index 1cc9f208..2a187804 100644 --- a/libsofia-sip-ua-glib/su-glib/su_glib.docs +++ b/libsofia-sip-ua-glib/su-glib/su_glib.docs @@ -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 /* ... */ - + 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 ) */ diff --git a/libsofia-sip-ua-glib/su-glib/su_source.c b/libsofia-sip-ua-glib/su-glib/su_source.c index 583b2c77..df326d15 100644 --- a/libsofia-sip-ua-glib/su-glib/su_source.c +++ b/libsofia-sip-ua-glib/su-glib/su_source.c @@ -25,15 +25,15 @@ /** * @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 . - * + * * @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) { diff --git a/libsofia-sip-ua-glib/su-glib/su_source_test.c b/libsofia-sip-ua-glib/su-glib/su_source_test.c index 559348b6..e8bda630 100644 --- a/libsofia-sip-ua-glib/su-glib/su_source_test.c +++ b/libsofia-sip-ua-glib/su-glib/su_source_test.c @@ -28,7 +28,7 @@ * @brief Test program for glib and su root event loop integration. * * @author Pekka Pessi - * + * * @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; } diff --git a/libsofia-sip-ua-glib/su-glib/torture_su_glib_timer.c b/libsofia-sip-ua-glib/su-glib/torture_su_glib_timer.c index 13fb84c2..2d431add 100644 --- a/libsofia-sip-ua-glib/su-glib/torture_su_glib_timer.c +++ b/libsofia-sip-ua-glib/su-glib/torture_su_glib_timer.c @@ -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 ()*/); diff --git a/libsofia-sip-ua/ChangeLog b/libsofia-sip-ua/ChangeLog index d03b272b..bde1819a 100644 --- a/libsofia-sip-ua/ChangeLog +++ b/libsofia-sip-ua/ChangeLog @@ -9,7 +9,7 @@ 2006-10-12 Kai Vehmanen * libsofia-sip-ua interface v3 frozen (3:0:3) for the 1.12.3 release - + 2006-09-26 Kai Vehmanen * 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 - + * 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 @@ -49,13 +49,13 @@ * /Doxyfile: Fixed the use of doxytags. Now a separate 'doxytags_MODNAME' file is created for each module. - + 2005-11-15 Kai Vehmanen - * /Makefile.am: Changed to use the 'include_sofia_HEADERS' + * /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 * Always including stun library. @@ -84,7 +84,7 @@ 2005-10-14 Pekka Pessi - * Shell syntax exercise. + * Shell syntax exercise. M ./autogen.sh -4 +4 @@ -94,7 +94,7 @@ 2005-10-13 Kai Vehmanen - * /Makefile.am: Build all submodules as proper shared + * /Makefile.am: Build all submodules as proper shared libraries (noinst_LTLIBRARIES). Fixes sf.net:#1264030. 2005-09-09 Pekka Pessi @@ -179,7 +179,7 @@ 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 @@ -319,7 +319,7 @@ M ./url/url.c -1 +6 Thu Sep 8 18:01:17 EEST 2005 Pekka.Pessi@nokia.com - * Explicitly using + * Explicitly using M ./msg/msg.c +2 M ./msg/msg_mclass.c +1 @@ -369,10 +369,10 @@ 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(). @@ -386,7 +386,7 @@ 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 @@ -403,7 +403,7 @@ M ./sdp/sdp.h +2 M ./sdp/sdp_parse.c +10 - + 2005-09-08 Kai Vehmanen * Makefile.am: Workaround for automake bug related to adding @@ -416,7 +416,7 @@ 2005-08-17 Pekka Pessi - * Fixed BEGIN()/END() pairs in test programs. + * Fixed BEGIN()/END() pairs in test programs. 2005-08-04 Pekka Pessi diff --git a/libsofia-sip-ua/Makefile.am b/libsofia-sip-ua/Makefile.am index 2b181af6..c089364b 100644 --- a/libsofia-sip-ua/Makefile.am +++ b/libsofia-sip-ua/Makefile.am @@ -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!index!'$$d'_index!' \ 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!index!'$$d'_index!' \ 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 diff --git a/libsofia-sip-ua/bnf/bnf.c b/libsofia-sip-ua/bnf/bnf.c index d6199bde..e40bbe5e 100644 --- a/libsofia-sip-ua/bnf/bnf.c +++ b/libsofia-sip-ua/bnf/bnf.c @@ -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 diff --git a/libsofia-sip-ua/bnf/bnf.docs b/libsofia-sip-ua/bnf/bnf.docs index abd1b3ab..bbd1536b 100644 --- a/libsofia-sip-ua/bnf/bnf.docs +++ b/libsofia-sip-ua/bnf/bnf.docs @@ -10,9 +10,9 @@ * * The interface used for validating hostnames and IP addresses is in * . - * + * * @CONTACT Pekka Pessi - * + * * @STATUS @SofiaSIP Core library * * @LICENSE LGPL diff --git a/libsofia-sip-ua/bnf/sofia-sip/bnf.h b/libsofia-sip-ua/bnf/sofia-sip/bnf.h index 46661986..1c9b191e 100644 --- a/libsofia-sip-ua/bnf/sofia-sip/bnf.h +++ b/libsofia-sip-ua/bnf/sofia-sip/bnf.h @@ -26,11 +26,11 @@ #define BNF_H /**@file sofia-sip/bnf.h - * + * * Parsing macros and prototypes for HTTP-like protocols. - * + * * @author Pekka Pessi - * + * * @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 "{}|\\^[]`" diff --git a/libsofia-sip-ua/bnf/sofia-sip/hostdomain.h b/libsofia-sip-ua/bnf/sofia-sip/hostdomain.h index 02f01c22..fe9fe95c 100644 --- a/libsofia-sip-ua/bnf/sofia-sip/hostdomain.h +++ b/libsofia-sip-ua/bnf/sofia-sip/hostdomain.h @@ -27,11 +27,11 @@ #define SOFIA_SIP_HOSTDOMAIN_H /**@file sofia-sip/hostdomain.h - * + * * Predicates for handling host names: IP addresses or domain names. - * + * * @author Pekka Pessi - * + * * @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); diff --git a/libsofia-sip-ua/bnf/torture_bnf.c b/libsofia-sip-ua/bnf/torture_bnf.c index 75be3aed..fce3b4cc 100644 --- a/libsofia-sip-ua/bnf/torture_bnf.c +++ b/libsofia-sip-ua/bnf/torture_bnf.c @@ -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")); diff --git a/libsofia-sip-ua/docs/ChangeLog b/libsofia-sip-ua/docs/ChangeLog index c8d7972b..6c841fe7 100644 --- a/libsofia-sip-ua/docs/ChangeLog +++ b/libsofia-sip-ua/docs/ChangeLog @@ -13,7 +13,7 @@ 2005-09-08 Kai Vehmanen * 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. diff --git a/libsofia-sip-ua/docs/Doxyfile.conf b/libsofia-sip-ua/docs/Doxyfile.conf index 3bb75f27..bc4a2423 100644 --- a/libsofia-sip-ua/docs/Doxyfile.conf +++ b/libsofia-sip-ua/docs/Doxyfile.conf @@ -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 \ diff --git a/libsofia-sip-ua/docs/Doxyfile.in b/libsofia-sip-ua/docs/Doxyfile.in index eb9b2fae..225c02a7 100644 --- a/libsofia-sip-ua/docs/Doxyfile.in +++ b/libsofia-sip-ua/docs/Doxyfile.in @@ -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 diff --git a/libsofia-sip-ua/docs/Makefile.am b/libsofia-sip-ua/docs/Makefile.am index 37c3fe22..1fced800 100644 --- a/libsofia-sip-ua/docs/Makefile.am +++ b/libsofia-sip-ua/docs/Makefile.am @@ -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 diff --git a/libsofia-sip-ua/docs/conformance.docs b/libsofia-sip-ua/docs/conformance.docs index 8d5bdce4..0dd8beb1 100644 --- a/libsofia-sip-ua/docs/conformance.docs +++ b/libsofia-sip-ua/docs/conformance.docs @@ -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 - 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. 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(). @@ -1131,7 +1131,7 @@ below. 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 diff --git a/libsofia-sip-ua/docs/docguide.docs b/libsofia-sip-ua/docs/docguide.docs index 718132ab..2b01c66a 100644 --- a/libsofia-sip-ua/docs/docguide.docs +++ b/libsofia-sip-ua/docs/docguide.docs @@ -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 http://www.doxygen.org. +home page is at http://www.doxygen.org. 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 javadoc style guide. 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 \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, -Doxyfile. As a convention, a module-specific Doxyfile includes -a common file libsofia-sip-ua/docs/Doxyfile.conf. This makes it possible +Doxyfile. 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 \.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. diff --git a/libsofia-sip-ua/docs/mainpage.docs b/libsofia-sip-ua/docs/mainpage.docs index b7eb2649..d00ecc38 100644 --- a/libsofia-sip-ua/docs/mainpage.docs +++ b/libsofia-sip-ua/docs/mainpage.docs @@ -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:
-nua -su -features -soa -sdp -nta -tport -sresolv -sip -msg -url -stun -iptsec -nea -nth -http -bnf -ipt +nua +su +features +soa +sdp +nta +tport +sresolv +sip +msg +url +stun +iptsec +nea +nth +http +bnf +ipt @section who Contact Information -You can download latest Sofia SIP from the project -home page at +You can download latest Sofia SIP from the project +home page at Sourceforge.net. Please contact us if you have questions regarding this software: -
    +
    • Pekka Pessi
    • Kai Vehmanen
    • -
    +
Or post to the Sofia-SIP mailing list: @@ -68,7 +68,7 @@ Common runtime library: SIP Signaling: - "nua" - SIP User Agent library - "nea" - SIP Event API - - "iptsec" - + - "iptsec" - Digest authentication for HTTP and SIP - "nta" - SIP transaction engine - "tport" - Message transport @@ -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 \.docs -(where the \ of course referes to the actual name of -the module). +libsofia-sip-ua directory hierarchy that contains a file \.docs +(where the \ 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 . +home-based memory management functions from . 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 , which can be used to define hash tables types and accessor functions for different object, and red-black tree, defined in . @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 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 developer.gnome.org. Autobook provides more detailed documentation for autoconf and automake. -The GNU make manual +The GNU make manual 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() diff --git a/libsofia-sip-ua/features/features.c b/libsofia-sip-ua/features/features.c index 36d1bc9f..1e90d1db 100644 --- a/libsofia-sip-ua/features/features.c +++ b/libsofia-sip-ua/features/features.c @@ -43,15 +43,15 @@ */ 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 #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. diff --git a/libsofia-sip-ua/features/features.docs b/libsofia-sip-ua/features/features.docs index b198220d..9bde692e 100644 --- a/libsofia-sip-ua/features/features.docs +++ b/libsofia-sip-ua/features/features.docs @@ -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. diff --git a/libsofia-sip-ua/http/Doxyfile.in b/libsofia-sip-ua/http/Doxyfile.in index eb4fca4e..8ba200bd 100644 --- a/libsofia-sip-ua/http/Doxyfile.in +++ b/libsofia-sip-ua/http/Doxyfile.in @@ -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 diff --git a/libsofia-sip-ua/http/Makefile.am b/libsofia-sip-ua/http/Makefile.am index 808b6f63..d683c713 100644 --- a/libsofia-sip-ua/http/Makefile.am +++ b/libsofia-sip-ua/http/Makefile.am @@ -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} diff --git a/libsofia-sip-ua/http/http.docs b/libsofia-sip-ua/http/http.docs index 684d8390..06dc4678 100644 --- a/libsofia-sip-ua/http/http.docs +++ b/libsofia-sip-ua/http/http.docs @@ -26,13 +26,13 @@ * - @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 SIP Parser module. * The parser provider interface makes it possible to extend HTTP parser with diff --git a/libsofia-sip-ua/http/http_basic.c b/libsofia-sip-ua/http/http_basic.c index 1e662a81..f93adf7d 100644 --- a/libsofia-sip-ua/http/http_basic.c +++ b/libsofia-sip-ua/http/http_basic.c @@ -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); diff --git a/libsofia-sip-ua/http/http_extra.c b/libsofia-sip-ua/http/http_extra.c index f9f8fa5d..898ed3a0 100644 --- a/libsofia-sip-ua/http/http_extra.c +++ b/libsofia-sip-ua/http/http_extra.c @@ -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; diff --git a/libsofia-sip-ua/http/http_header.c b/libsofia-sip-ua/http/http_header.c index 60c9e9d9..4ae01598 100644 --- a/libsofia-sip-ua/http/http_header.c +++ b/libsofia-sip-ua/http/http_header.c @@ -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, ...) diff --git a/libsofia-sip-ua/http/http_parser.c b/libsofia-sip-ua/http/http_parser.c index d3b2b357..fe4bba28 100644 --- a/libsofia-sip-ua/http/http_parser.c +++ b/libsofia-sip-ua/http/http_parser.c @@ -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; -} +} diff --git a/libsofia-sip-ua/http/http_parser_table.c.in b/libsofia-sip-ua/http/http_parser_table.c.in index 993664e6..d5ffdb05 100644 --- a/libsofia-sip-ua/http/http_parser_table.c.in +++ b/libsofia-sip-ua/http/http_parser_table.c.in @@ -31,7 +31,7 @@ */ /**@internal - * @CFILE http_parser_table.c + * @CFILE http_parser_table.c * @brief HTTP parser table * * #AUTO# diff --git a/libsofia-sip-ua/http/http_status.c b/libsofia-sip-ua/http/http_status.c index 222925f8..aef456d2 100644 --- a/libsofia-sip-ua/http/http_status.c +++ b/libsofia-sip-ua/http/http_status.c @@ -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) { diff --git a/libsofia-sip-ua/http/http_tag.c.in b/libsofia-sip-ua/http/http_tag.c.in index 57cc4503..531a2c4e 100644 --- a/libsofia-sip-ua/http/http_tag.c.in +++ b/libsofia-sip-ua/http/http_tag.c.in @@ -1,4 +1,4 @@ -/**@HTTP +/**@HTTP * @IFILE http_tag.c.in * * Template for . @@ -35,7 +35,7 @@ * This file is autogenerated from . * * #AUTO# - * + * * @author Pekka Pessi */ @@ -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); diff --git a/libsofia-sip-ua/http/http_tag_class.c b/libsofia-sip-ua/http/http_tag_class.c index aaa627b0..f69ff0cd 100644 --- a/libsofia-sip-ua/http/http_tag_class.c +++ b/libsofia-sip-ua/http/http_tag_class.c @@ -49,7 +49,7 @@ #include #include -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; diff --git a/libsofia-sip-ua/http/sofia-sip/http.h b/libsofia-sip-ua/http/sofia-sip/http.h index a80fd3a9..d5bb6179 100644 --- a/libsofia-sip-ua/http/sofia-sip/http.h +++ b/libsofia-sip-ua/http/sofia-sip/http.h @@ -26,10 +26,10 @@ /** Defined when has been included. */ #define HTTP_H -/**@file sofia-sip/http.h - * +/**@file sofia-sip/http.h + * * HTTP message, methods, headers. - * + * * @sa RFC 2616 * * @author Pekka Pessi . @@ -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; diff --git a/libsofia-sip-ua/http/sofia-sip/http_hclasses.h b/libsofia-sip-ua/http/sofia-sip/http_hclasses.h index dc116e34..1394889c 100644 --- a/libsofia-sip-ua/http/sofia-sip/http_hclasses.h +++ b/libsofia-sip-ua/http/sofia-sip/http_hclasses.h @@ -28,9 +28,9 @@ /**@file sofia-sip/http_hclasses.h * @brief HTTP header classes. - * + * * @author Pekka Pessi - * + * */ #ifndef MSG_TYPES_H diff --git a/libsofia-sip-ua/http/sofia-sip/http_header.h b/libsofia-sip-ua/http/sofia-sip/http_header.h index 6f8cf29f..ba34a605 100644 --- a/libsofia-sip-ua/http/sofia-sip/http_header.h +++ b/libsofia-sip-ua/http/sofia-sip/http_header.h @@ -26,7 +26,7 @@ /** Defined when 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); diff --git a/libsofia-sip-ua/http/sofia-sip/http_parser.h b/libsofia-sip-ua/http/sofia-sip/http_parser.h index 5801fedf..22790772 100644 --- a/libsofia-sip-ua/http/sofia-sip/http_parser.h +++ b/libsofia-sip-ua/http/sofia-sip/http_parser.h @@ -24,7 +24,7 @@ #ifndef HTTP_PARSER_H /**Defined when 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 diff --git a/libsofia-sip-ua/http/sofia-sip/http_protos.h.in b/libsofia-sip-ua/http/sofia-sip/http_protos.h.in index 8d6ca568..b91774ac 100644 --- a/libsofia-sip-ua/http/sofia-sip/http_protos.h.in +++ b/libsofia-sip-ua/http/sofia-sip/http_protos.h.in @@ -32,12 +32,12 @@ /** Defined when 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 */ @@ -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); diff --git a/libsofia-sip-ua/http/sofia-sip/http_status.h b/libsofia-sip-ua/http/sofia-sip/http_status.h index 875b2129..5893b185 100644 --- a/libsofia-sip-ua/http/sofia-sip/http_status.h +++ b/libsofia-sip-ua/http/sofia-sip/http_status.h @@ -22,10 +22,10 @@ * */ -#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. * diff --git a/libsofia-sip-ua/http/sofia-sip/http_tag.h.in b/libsofia-sip-ua/http/sofia-sip/http_tag.h.in index f057ef3d..c6bd61b8 100644 --- a/libsofia-sip-ua/http/sofia-sip/http_tag.h.in +++ b/libsofia-sip-ua/http/sofia-sip/http_tag.h.in @@ -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. diff --git a/libsofia-sip-ua/http/sofia-sip/http_tag_class.h b/libsofia-sip-ua/http/sofia-sip/http_tag_class.h index e12d378f..34c29cf6 100644 --- a/libsofia-sip-ua/http/sofia-sip/http_tag_class.h +++ b/libsofia-sip-ua/http/sofia-sip/http_tag_class.h @@ -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 diff --git a/libsofia-sip-ua/http/test_http.c b/libsofia-sip-ua/http/test_http.c index 118ea59f..c9e698eb 100644 --- a/libsofia-sip-ua/http/test_http.c +++ b/libsofia-sip-ua/http/test_http.c @@ -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"); diff --git a/libsofia-sip-ua/ipt/base64.c b/libsofia-sip-ua/ipt/base64.c index 2a59107f..c61be09f 100644 --- a/libsofia-sip-ua/ipt/base64.c +++ b/libsofia-sip-ua/ipt/base64.c @@ -36,7 +36,7 @@ #include #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 RFC 2045, + * @sa RFC 2045, * "Multipurpose Internet Mail Extensions (MIME) Part One: * Format of Internet Message Bodies", * 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 RFC 2045, + * @sa RFC 2045, * "Multipurpose Internet Mail Extensions (MIME) Part One: * Format of Internet Message Bodies", * 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]; diff --git a/libsofia-sip-ua/ipt/ipt.docs b/libsofia-sip-ua/ipt/ipt.docs index 73f6e1ae..1dddd7d0 100644 --- a/libsofia-sip-ua/ipt/ipt.docs +++ b/libsofia-sip-ua/ipt/ipt.docs @@ -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 * - BASE64 encoding/decoding, and * - encoding/decoding binary as SIP/HTTP token. */ diff --git a/libsofia-sip-ua/ipt/rc4.c b/libsofia-sip-ua/ipt/rc4.c index 44fb1d38..a343c130 100644 --- a/libsofia-sip-ua/ipt/rc4.c +++ b/libsofia-sip-ua/ipt/rc4.c @@ -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 @@ -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'); } diff --git a/libsofia-sip-ua/ipt/sofia-sip/base64.h b/libsofia-sip-ua/ipt/sofia-sip/base64.h index 10552e09..296b1a86 100644 --- a/libsofia-sip-ua/ipt/sofia-sip/base64.h +++ b/libsofia-sip-ua/ipt/sofia-sip/base64.h @@ -34,10 +34,10 @@ * [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 RFC 2045, + * @sa RFC 2045, * "Multipurpose Internet Mail Extensions (MIME) Part One: * Format of Internet Message Bodies", - * N. Freed, N. Borenstein, + * N. Freed, N. Borenstein, * November 1996. * * @author Pekka Pessi diff --git a/libsofia-sip-ua/ipt/sofia-sip/rc4.h b/libsofia-sip-ua/ipt/sofia-sip/rc4.h index 1d3332b6..1edbfd66 100644 --- a/libsofia-sip-ua/ipt/sofia-sip/rc4.h +++ b/libsofia-sip-ua/ipt/sofia-sip/rc4.h @@ -28,9 +28,9 @@ /**@file sofia-sip/rc4.h * @brief Arcfour random number generator. - * + * * @author Pekka Pessi - * + * * @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) diff --git a/libsofia-sip-ua/ipt/sofia-sip/uniqueid.h b/libsofia-sip-ua/ipt/sofia-sip/uniqueid.h index 51ad90ac..6f9a1c01 100644 --- a/libsofia-sip-ua/ipt/sofia-sip/uniqueid.h +++ b/libsofia-sip-ua/ipt/sofia-sip/uniqueid.h @@ -24,7 +24,7 @@ #ifndef UNIQUEID_H /** Defined when 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 diff --git a/libsofia-sip-ua/ipt/sofia-sip/utf8.h b/libsofia-sip-ua/ipt/sofia-sip/utf8.h index b75a8b03..fa85605d 100644 --- a/libsofia-sip-ua/ipt/sofia-sip/utf8.h +++ b/libsofia-sip-ua/ipt/sofia-sip/utf8.h @@ -32,7 +32,7 @@ * * @date Created: Tue Apr 21 15:32:38 1998 pessi - * @sa RFC 2279, + * @sa RFC 2279, * "UTF-8, a transformation format of ISO 10646", * 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 */ diff --git a/libsofia-sip-ua/ipt/token64.c b/libsofia-sip-ua/ipt/token64.c index dd7548f9..0bf6c5c7 100644 --- a/libsofia-sip-ua/ipt/token64.c +++ b/libsofia-sip-ua/ipt/token64.c @@ -22,13 +22,13 @@ * */ -/**@internal @file token64.c +/**@internal @file token64.c * * Token encoding. * * @author Pekka Pessi * - * @date Created: Wed Apr 3 10:45:47 2002 ppessi + * @date Created: Wed Apr 3 10:45:47 2002 ppessi */ #include "config.h" @@ -39,10 +39,10 @@ #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]; diff --git a/libsofia-sip-ua/ipt/ucs2.c b/libsofia-sip-ua/ipt/ucs2.c index 7ad59f14..328604fd 100644 --- a/libsofia-sip-ua/ipt/ucs2.c +++ b/libsofia-sip-ua/ipt/ucs2.c @@ -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++)) ; diff --git a/libsofia-sip-ua/ipt/ucs4.c b/libsofia-sip-ua/ipt/ucs4.c index 19946c19..1c6eafca 100644 --- a/libsofia-sip-ua/ipt/ucs4.c +++ b/libsofia-sip-ua/ipt/ucs4.c @@ -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) { diff --git a/libsofia-sip-ua/ipt/utf8.c b/libsofia-sip-ua/ipt/utf8.c index bd6e6e08..715f3b84 100644 --- a/libsofia-sip-ua/ipt/utf8.c +++ b/libsofia-sip-ua/ipt/utf8.c @@ -22,7 +22,7 @@ * */ -/**@CFILE utf8.c +/**@CFILE utf8.c * * utf8 string handling. * diff --git a/libsofia-sip-ua/ipt/utf8internal.h b/libsofia-sip-ua/ipt/utf8internal.h index f7ed661d..730ddaf2 100644 --- a/libsofia-sip-ua/ipt/utf8internal.h +++ b/libsofia-sip-ua/ipt/utf8internal.h @@ -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 diff --git a/libsofia-sip-ua/ipt/utf8test.c b/libsofia-sip-ua/ipt/utf8test.c index 8a1d22cf..cf2fde6e 100644 --- a/libsofia-sip-ua/ipt/utf8test.c +++ b/libsofia-sip-ua/ipt/utf8test.c @@ -38,27 +38,27 @@ 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); diff --git a/libsofia-sip-ua/iptsec/Doxyfile.in b/libsofia-sip-ua/iptsec/Doxyfile.in index 2198c400..098099f1 100644 --- a/libsofia-sip-ua/iptsec/Doxyfile.in +++ b/libsofia-sip-ua/iptsec/Doxyfile.in @@ -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 diff --git a/libsofia-sip-ua/iptsec/auth_client.c b/libsofia-sip-ua/iptsec/auth_client.c index 66bdf581..20d12872 100644 --- a/libsofia-sip-ua/iptsec/auth_client.c +++ b/libsofia-sip-ua/iptsec/auth_client.c @@ -57,14 +57,14 @@ #include -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 diff --git a/libsofia-sip-ua/iptsec/auth_client_ntlm.c b/libsofia-sip-ua/iptsec/auth_client_ntlm.c index ec012378..3fe6e076 100644 --- a/libsofia-sip-ua/iptsec/auth_client_ntlm.c +++ b/libsofia-sip-ua/iptsec/auth_client_ntlm.c @@ -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); diff --git a/libsofia-sip-ua/iptsec/auth_common.c b/libsofia-sip-ua/iptsec/auth_common.c index 2fd6a6e2..ad40282d 100644 --- a/libsofia-sip-ua/iptsec/auth_common.c +++ b/libsofia-sip-ua/iptsec/auth_common.c @@ -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. * diff --git a/libsofia-sip-ua/iptsec/auth_digest.c b/libsofia-sip-ua/iptsec/auth_digest.c index 7a458095..cae56f16 100644 --- a/libsofia-sip-ua/iptsec/auth_digest.c +++ b/libsofia-sip-ua/iptsec/auth_digest.c @@ -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")); diff --git a/libsofia-sip-ua/iptsec/auth_module.c b/libsofia-sip-ua/iptsec/auth_module.c index a4148b43..cd37c3aa 100644 --- a/libsofia-sip-ua/iptsec/auth_module.c +++ b/libsofia-sip-ua/iptsec/auth_module.c @@ -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. diff --git a/libsofia-sip-ua/iptsec/auth_module_http.c b/libsofia-sip-ua/iptsec/auth_module_http.c index 3de7c348..98a63e4b 100644 --- a/libsofia-sip-ua/iptsec/auth_module_http.c +++ b/libsofia-sip-ua/iptsec/auth_module_http.c @@ -25,7 +25,7 @@ /**@internal * @file auth_module_http.c * @brief Authenticate HTTP request - * + * * @author Pekka Pessi * @author Jari Urpalainen * @@ -43,10 +43,10 @@ #include -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 */ diff --git a/libsofia-sip-ua/iptsec/auth_module_sip.c b/libsofia-sip-ua/iptsec/auth_module_sip.c index c9563ff0..a634cdac 100644 --- a/libsofia-sip-ua/iptsec/auth_module_sip.c +++ b/libsofia-sip-ua/iptsec/auth_module_sip.c @@ -25,7 +25,7 @@ /**@internal * @file auth_module_sip.c * @brief Authenticate SIP request - * + * * @author Pekka Pessi * @author Jari Urpalainen * @@ -45,19 +45,19 @@ #include -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); diff --git a/libsofia-sip-ua/iptsec/auth_ntlm.c b/libsofia-sip-ua/iptsec/auth_ntlm.c index d8249e51..b0b09723 100644 --- a/libsofia-sip-ua/iptsec/auth_ntlm.c +++ b/libsofia-sip-ua/iptsec/auth_ntlm.c @@ -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")); diff --git a/libsofia-sip-ua/iptsec/auth_plugin.c b/libsofia-sip-ua/iptsec/auth_plugin.c index 6e203eac..3b032472 100644 --- a/libsofia-sip-ua/iptsec/auth_plugin.c +++ b/libsofia-sip-ua/iptsec/auth_plugin.c @@ -25,9 +25,9 @@ /**@internal * @file auth_plugin.c * @brief Plugin interface for authentication verification modules. - * + * * @author Pekka Pessi - * + * * @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; } diff --git a/libsofia-sip-ua/iptsec/auth_plugin_delayed.c b/libsofia-sip-ua/iptsec/auth_plugin_delayed.c index 69178a1c..4a5853f8 100644 --- a/libsofia-sip-ua/iptsec/auth_plugin_delayed.c +++ b/libsofia-sip-ua/iptsec/auth_plugin_delayed.c @@ -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; diff --git a/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c b/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c index 42a44592..9c11ad25 100644 --- a/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c +++ b/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c @@ -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); } } diff --git a/libsofia-sip-ua/iptsec/auth_tag.c b/libsofia-sip-ua/iptsec/auth_tag.c index 9b850318..6d383940 100644 --- a/libsofia-sip-ua/iptsec/auth_tag.c +++ b/libsofia-sip-ua/iptsec/auth_tag.c @@ -40,14 +40,14 @@ #include /**@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 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 diff --git a/libsofia-sip-ua/iptsec/iptsec.docs b/libsofia-sip-ua/iptsec/iptsec.docs index 715a7243..9aa07760 100644 --- a/libsofia-sip-ua/iptsec/iptsec.docs +++ b/libsofia-sip-ua/iptsec/iptsec.docs @@ -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 @@ -25,13 +25,13 @@ * 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 diff --git a/libsofia-sip-ua/iptsec/iptsec_debug.c b/libsofia-sip-ua/iptsec/iptsec_debug.c index a85ea3c8..81377789 100644 --- a/libsofia-sip-ua/iptsec/iptsec_debug.c +++ b/libsofia-sip-ua/iptsec/iptsec_debug.c @@ -24,9 +24,9 @@ /**@internal @file iptsec_debug.c * @brief Debug log for IPTSEC module. - * + * * @author Pekka Pessi - * + * * @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 , #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. */ diff --git a/libsofia-sip-ua/iptsec/iptsec_debug.h b/libsofia-sip-ua/iptsec/iptsec_debug.h index 9619da3f..bca87f39 100644 --- a/libsofia-sip-ua/iptsec/iptsec_debug.h +++ b/libsofia-sip-ua/iptsec/iptsec_debug.h @@ -29,9 +29,9 @@ /**@internal * @file iptsec_debug.h * @brief Debug log for IPTSEC module. - * + * * @author Pekka Pessi - * + * * @date Created: Thu Dec 19 15:56:35 2002 ppessi */ diff --git a/libsofia-sip-ua/iptsec/sofia-sip/auth_client.h b/libsofia-sip-ua/iptsec/sofia-sip/auth_client.h index 645025c0..f5bea767 100644 --- a/libsofia-sip-ua/iptsec/sofia-sip/auth_client.h +++ b/libsofia-sip-ua/iptsec/sofia-sip/auth_client.h @@ -24,7 +24,7 @@ #ifndef AUTH_CLIENT_H /** Defined when 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 diff --git a/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h b/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h index b6ccdfd1..36104ec8 100644 --- a/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h +++ b/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h @@ -24,17 +24,17 @@ #ifndef AUTH_CLIENT_PLUGIN_H /** Defined when 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 - * + * * @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); diff --git a/libsofia-sip-ua/iptsec/sofia-sip/auth_common.h b/libsofia-sip-ua/iptsec/sofia-sip/auth_common.h index 5b8fa7e6..638413cd 100644 --- a/libsofia-sip-ua/iptsec/sofia-sip/auth_common.h +++ b/libsofia-sip-ua/iptsec/sofia-sip/auth_common.h @@ -26,7 +26,7 @@ /** Defined when 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); diff --git a/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h b/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h index 8bc22e8f..0f400613 100644 --- a/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h +++ b/libsofia-sip-ua/iptsec/sofia-sip/auth_digest.h @@ -26,14 +26,14 @@ /** Defined when 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, * "HTTP Authentication: Basic and Digest Access Authentication", - * 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 diff --git a/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h b/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h index a9bcfd1e..de4e72d5 100644 --- a/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h +++ b/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h @@ -24,9 +24,9 @@ #ifndef AUTH_MODULE_H /** Defined when 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 . @@ -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 */ diff --git a/libsofia-sip-ua/iptsec/sofia-sip/auth_ntlm.h b/libsofia-sip-ua/iptsec/sofia-sip/auth_ntlm.h index c84e96d7..0176b9b8 100644 --- a/libsofia-sip-ua/iptsec/sofia-sip/auth_ntlm.h +++ b/libsofia-sip-ua/iptsec/sofia-sip/auth_ntlm.h @@ -24,20 +24,20 @@ #ifndef AUTH_NTLM_H /** Defined when 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 - * RFC 2617, + * @sa + * RFC 2617, * "HTTP Authentication: Basic and Ntlm Access Authentication", - * J. Franks et al, + * J. Franks et al, * June 1999. * - * @sa Section 19 from + * @sa Section 19 from * 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[] = "\n" "\n" "\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); diff --git a/libsofia-sip-ua/msg/ChangeLog b/libsofia-sip-ua/msg/ChangeLog index f48ee71f..bc43f501 100644 --- a/libsofia-sip-ua/msg/ChangeLog +++ b/libsofia-sip-ua/msg/ChangeLog @@ -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). @@ -40,14 +40,14 @@ * 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 * Initial import of the module to Sofia-SIP tree. diff --git a/libsofia-sip-ua/msg/Makefile.am b/libsofia-sip-ua/msg/Makefile.am index 441e99bd..a1d0203e 100644 --- a/libsofia-sip-ua/msg/Makefile.am +++ b/libsofia-sip-ua/msg/Makefile.am @@ -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 diff --git a/libsofia-sip-ua/msg/msg.c b/libsofia-sip-ua/msg/msg.c index 96e6954f..264ca267 100644 --- a/libsofia-sip-ua/msg/msg.c +++ b/libsofia-sip-ua/msg/msg.c @@ -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 . 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. diff --git a/libsofia-sip-ua/msg/msg.docs b/libsofia-sip-ua/msg/msg.docs index ad44f3a9..5ce63d61 100644 --- a/libsofia-sip-ua/msg/msg.docs +++ b/libsofia-sip-ua/msg/msg.docs @@ -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: -- parsing functions, macros -- message factory object definition +parsers are as follows: +- parsing functions, macros +- message factory object definition - 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 , , and . 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 diff --git a/libsofia-sip-ua/msg/msg_auth.c b/libsofia-sip-ua/msg/msg_auth.c index c81e9f0c..5bab45d1 100644 --- a/libsofia-sip-ua/msg/msg_auth.c +++ b/libsofia-sip-ua/msg/msg_auth.c @@ -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; diff --git a/libsofia-sip-ua/msg/msg_basic.c b/libsofia-sip-ua/msg/msg_basic.c index fad8fe68..44fbf3a0 100644 --- a/libsofia-sip-ua/msg/msg_basic.c +++ b/libsofia-sip-ua/msg/msg_basic.c @@ -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) diff --git a/libsofia-sip-ua/msg/msg_date.c b/libsofia-sip-ua/msg/msg_date.c index 3b09b31f..d5886b22 100644 --- a/libsofia-sip-ua/msg/msg_date.c +++ b/libsofia-sip-ua/msg/msg_date.c @@ -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 , which may have + * + * The function msg_date_d() decodes , 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 * 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 field. * * The 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() "" or +/** Decode a HTTP date or delta + * + * Decode a @ref msg_date_d() "" or * @ref msg_delta_d() "" field. */ issize_t msg_date_delta_d(char const **ss, diff --git a/libsofia-sip-ua/msg/msg_generic.c b/libsofia-sip-ua/msg/msg_generic.c index b0b80678..897663ea 100644 --- a/libsofia-sip-ua/msg/msg_generic.c +++ b/libsofia-sip-ua/msg/msg_generic.c @@ -22,15 +22,15 @@ * */ -/**@internal +/**@internal * @ingroup msg_parser * @file msg_generic.c * @brief Functions for generic headers - * + * * @author Pekka Pessi * * @date Created: Thu Jan 23 20:08:00 2003 ppessi - * + * */ #include "config.h" @@ -55,17 +55,17 @@ * * 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; diff --git a/libsofia-sip-ua/msg/msg_header_copy.c b/libsofia-sip-ua/msg/msg_header_copy.c index f5380f48..bcae5413 100644 --- a/libsofia-sip-ua/msg/msg_header_copy.c +++ b/libsofia-sip-ua/msg/msg_header_copy.c @@ -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 @@ -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) diff --git a/libsofia-sip-ua/msg/msg_header_make.c b/libsofia-sip-ua/msg/msg_header_make.c index 5a8ad8aa..c2be7ead 100644 --- a/libsofia-sip-ua/msg/msg_header_make.c +++ b/libsofia-sip-ua/msg/msg_header_make.c @@ -61,14 +61,14 @@ #include /** 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, ...) diff --git a/libsofia-sip-ua/msg/msg_internal.h b/libsofia-sip-ua/msg/msg_internal.h index 72203325..b73561c9 100644 --- a/libsofia-sip-ua/msg/msg_internal.h +++ b/libsofia-sip-ua/msg/msg_internal.h @@ -24,10 +24,10 @@ #ifndef MSG_INTERNAL_H /** Defined when 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 * @@ -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; } diff --git a/libsofia-sip-ua/msg/msg_mclass.c b/libsofia-sip-ua/msg/msg_mclass.c index 01914ce9..e049f872 100644 --- a/libsofia-sip-ua/msg/msg_mclass.c +++ b/libsofia-sip-ua/msg/msg_mclass.c @@ -22,7 +22,7 @@ * */ -/**@ingroup msg_parser +/**@ingroup msg_parser * @CFILE msg_mclass.c * * Message factory object. @@ -63,12 +63,12 @@ * 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; diff --git a/libsofia-sip-ua/msg/msg_mime.c b/libsofia-sip-ua/msg/msg_mime.c index f3099b5d..109a7ab8 100644 --- a/libsofia-sip-ua/msg/msg_mime.c +++ b/libsofia-sip-ua/msg/msg_mime.c @@ -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); diff --git a/libsofia-sip-ua/msg/msg_mime_table.c.in b/libsofia-sip-ua/msg/msg_mime_table.c.in index 0d26ae0c..e7843bd5 100644 --- a/libsofia-sip-ua/msg/msg_mime_table.c.in +++ b/libsofia-sip-ua/msg/msg_mime_table.c.in @@ -31,8 +31,8 @@ */ /**@ingroup msg_mime - * - * @CFILE msg_mime_table.c + * + * @CFILE msg_mime_table.c * @brief Parser table used for testing. * * #AUTO# diff --git a/libsofia-sip-ua/msg/msg_name_hash.c b/libsofia-sip-ua/msg/msg_name_hash.c index c937340e..91f79bfe 100644 --- a/libsofia-sip-ua/msg/msg_name_hash.c +++ b/libsofia-sip-ua/msg/msg_name_hash.c @@ -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 * * @date Tue Aug 20 16:27:01 EEST 2002 ppessi diff --git a/libsofia-sip-ua/msg/msg_parser.awk b/libsofia-sip-ua/msg/msg_parser.awk index 3bc0cd80..4590618e 100644 --- a/libsofia-sip-ua/msg/msg_parser.awk +++ b/libsofia-sip-ua/msg/msg_parser.awk @@ -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; diff --git a/libsofia-sip-ua/msg/msg_parser.c b/libsofia-sip-ua/msg/msg_parser.c index a037c95a..b5e8d337 100644 --- a/libsofia-sip-ua/msg/msg_parser.c +++ b/libsofia-sip-ua/msg/msg_parser.c @@ -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) diff --git a/libsofia-sip-ua/msg/msg_parser_util.c b/libsofia-sip-ua/msg/msg_parser_util.c index 6223b1be..d14b553b 100644 --- a/libsofia-sip-ua/msg/msg_parser_util.c +++ b/libsofia-sip-ua/msg/msg_parser_util.c @@ -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 name [ "=" value]. 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 name "=" value * 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 * * * @@ -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); diff --git a/libsofia-sip-ua/msg/msg_tag.c b/libsofia-sip-ua/msg/msg_tag.c index c6364ea5..2be30b04 100644 --- a/libsofia-sip-ua/msg/msg_tag.c +++ b/libsofia-sip-ua/msg/msg_tag.c @@ -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; diff --git a/libsofia-sip-ua/msg/sofia-sip/msg.h b/libsofia-sip-ua/msg/sofia-sip/msg.h index ddfd10d5..99e9be7b 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg.h @@ -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), diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_addr.h b/libsofia-sip-ua/msg/sofia-sip/msg_addr.h index a213e6c9..fbeb1dea 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_addr.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_addr.h @@ -24,10 +24,10 @@ #ifndef MSG_ADDR_H /** Defined when 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 @@ -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 diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_buffer.h b/libsofia-sip-ua/msg/sofia-sip/msg_buffer.h index f35ce966..027d3a30 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_buffer.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_buffer.h @@ -27,10 +27,10 @@ #define MSG_BUFFER_H /**@file sofia-sip/msg_buffer.h - * @brief Internal buffer management functions. - * + * @brief Internal buffer management functions. + * * @author Pekka Pessi - * + * * @date Created: Fri Nov 8 12:23:00 2002 ppessi * */ diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_date.h b/libsofia-sip-ua/msg/sofia-sip/msg_date.h index 9c8305f5..4e215c78 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_date.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_date.h @@ -24,16 +24,16 @@ #ifndef MSG_DATE_H /** Defined when 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 * * @date Created: Thu Jun 8 19:28:55 2000 ppessi - * + * */ #ifndef SU_TYPES_H diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_header.h b/libsofia-sip-ua/msg/sofia-sip/msg_header.h index b80aeccd..91fd7231 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_header.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_header.h @@ -33,7 +33,7 @@ * @author Pekka Pessi * * @date Created: Mon Aug 27 15:44:27 2001 ppessi - * + * */ #include @@ -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) { diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_mclass.h b/libsofia-sip-ua/msg/sofia-sip/msg_mclass.h index 0e5caf80..473fe279 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_mclass.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_mclass.h @@ -41,20 +41,20 @@ 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); diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_mclass_hash.h b/libsofia-sip-ua/msg/sofia-sip/msg_mclass_hash.h index 4e349219..1eba2b24 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_mclass_hash.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_mclass_hash.h @@ -24,7 +24,7 @@ #ifndef MSG_MCLASS_HASH_H /** Defined when 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 * * @date Created: Tue Aug 21 16:03:45 2001 ppessi - * + * */ #include @@ -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; diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_mime.h b/libsofia-sip-ua/msg/sofia-sip/msg_mime.h index 33e6651f..ee9a1429 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_mime.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_mime.h @@ -24,7 +24,7 @@ #ifndef MSG_MIME_H /** Defined when 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 * * @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, diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in b/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in index ffd0779b..4ba204b2 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in +++ b/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in @@ -30,7 +30,7 @@ #ifndef MSG_MIME_PROTOS_H /** Defined when 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]; /* 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 diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_parser.h b/libsofia-sip-ua/msg/sofia-sip/msg_parser.h index 701a55ed..c2fc31f8 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_parser.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_parser.h @@ -24,7 +24,7 @@ #ifndef MSG_PARSER_H /** Defined when 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 */ diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in b/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in index 49e6a7ef..43427094 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in +++ b/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in @@ -30,7 +30,7 @@ #ifndef MSG_PROTOS_H /** Defined when 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 { /* 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 diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_tag_class.h b/libsofia-sip-ua/msg/sofia-sip/msg_tag_class.h index 4adbb2cd..089d4943 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_tag_class.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_tag_class.h @@ -24,7 +24,7 @@ #ifndef MSG_TAG_CLASS_H /** Defined when 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); diff --git a/libsofia-sip-ua/msg/sofia-sip/msg_types.h b/libsofia-sip-ua/msg/sofia-sip/msg_types.h index e8f061ec..aaf1bee4 100644 --- a/libsofia-sip-ua/msg/sofia-sip/msg_types.h +++ b/libsofia-sip-ua/msg/sofia-sip/msg_types.h @@ -28,9 +28,9 @@ /**@file sofia-sip/msg_types.h * @brief Types for messages and common headers - * + * * @author Pekka Pessi - * + * * @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, diff --git a/libsofia-sip-ua/msg/test_class.c b/libsofia-sip-ua/msg/test_class.c index e458bfb7..1de4c086 100644 --- a/libsofia-sip-ua/msg/test_class.c +++ b/libsofia-sip-ua/msg/test_class.c @@ -24,7 +24,7 @@ /**@ingroup test_msg * @file test_class.c - * + * * Message class for testing parser and transports. * * @author Pekka Pessi @@ -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; diff --git a/libsofia-sip-ua/msg/test_class.h b/libsofia-sip-ua/msg/test_class.h index 83a60b6c..038a6657 100644 --- a/libsofia-sip-ua/msg/test_class.h +++ b/libsofia-sip-ua/msg/test_class.h @@ -24,7 +24,7 @@ #ifndef TEST_CLASS_H /** Defined when 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]; diff --git a/libsofia-sip-ua/msg/test_msg.c b/libsofia-sip-ua/msg/test_msg.c index 9efcd7ee..78ed94b2 100644 --- a/libsofia-sip-ua/msg/test_msg.c +++ b/libsofia-sip-ua/msg/test_msg.c @@ -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: " 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 "part 3" CRLF +#define BODY3 "part 3" 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: " 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 "part 3" CRLF +#define BODY3 "part 3" CRLF BODY3 /* 14 */ CRLF /* 15 */ - "--LaGqGt4BI6Ho--" CRLF; + "--LaGqGt4BI6Ho--" CRLF; char const part1[] = "This is text\n"; char const part2[] = "This is 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(); } diff --git a/libsofia-sip-ua/msg/test_protos.h.in b/libsofia-sip-ua/msg/test_protos.h.in index 3563a68e..dc7da323 100644 --- a/libsofia-sip-ua/msg/test_protos.h.in +++ b/libsofia-sip-ua/msg/test_protos.h.in @@ -1,4 +1,4 @@ -/**-*- c -*- +/**-*- c -*- * @ingroup msg * @internal @file test_protos.h.in * @@ -31,15 +31,15 @@ #ifndef TEST_PROTOS_H /** Defined when 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 */ @@ -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 diff --git a/libsofia-sip-ua/msg/test_table.c.in b/libsofia-sip-ua/msg/test_table.c.in index d9453ee0..68ac0c22 100644 --- a/libsofia-sip-ua/msg/test_table.c.in +++ b/libsofia-sip-ua/msg/test_table.c.in @@ -31,8 +31,8 @@ */ /**@ingroup test_msg - * - * @CFILE test_table.c + * + * @CFILE test_table.c * @brief Parser table used for testing. * * #AUTO# diff --git a/libsofia-sip-ua/nea/Doxyfile.in b/libsofia-sip-ua/nea/Doxyfile.in index 484147fb..04f526e6 100644 --- a/libsofia-sip-ua/nea/Doxyfile.in +++ b/libsofia-sip-ua/nea/Doxyfile.in @@ -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 diff --git a/libsofia-sip-ua/nea/Makefile.am b/libsofia-sip-ua/nea/Makefile.am index 43b4cce9..c538214e 100644 --- a/libsofia-sip-ua/nea/Makefile.am +++ b/libsofia-sip-ua/nea/Makefile.am @@ -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 diff --git a/libsofia-sip-ua/nea/nea.c b/libsofia-sip-ua/nea/nea.c index 778c8761..3e1cfb86 100644 --- a/libsofia-sip-ua/nea/nea.c +++ b/libsofia-sip-ua/nea/nea.c @@ -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; } diff --git a/libsofia-sip-ua/nea/nea.docs b/libsofia-sip-ua/nea/nea.docs index bd49828d..04013f5e 100644 --- a/libsofia-sip-ua/nea/nea.docs +++ b/libsofia-sip-ua/nea/nea.docs @@ -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); @@ -83,16 +83,16 @@ * * 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 diff --git a/libsofia-sip-ua/nea/nea_debug.c b/libsofia-sip-ua/nea/nea_debug.c index 38c024a6..9128ba1c 100644 --- a/libsofia-sip-ua/nea/nea_debug.c +++ b/libsofia-sip-ua/nea/nea_debug.c @@ -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 , 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. */ diff --git a/libsofia-sip-ua/nea/nea_event.c b/libsofia-sip-ua/nea/nea_event.c index 66268d9e..d9e0ad6c 100644 --- a/libsofia-sip-ua/nea/nea_event.c +++ b/libsofia-sip-ua/nea/nea_event.c @@ -25,7 +25,7 @@ /**@internal * @file nea_event.c * @brief Default MIME type for certain events. - * + * * @author Pekka Pessi * * @date Created: Thu Dec 11 20:28:46 2003 ppessi diff --git a/libsofia-sip-ua/nea/nea_server.c b/libsofia-sip-ua/nea/nea_server.c index 92de8664..b726954f 100644 --- a/libsofia-sip-ua/nea/nea_server.c +++ b/libsofia-sip-ua/nea/nea_server.c @@ -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: *
* @@ -339,26 +339,26 @@ void nea_subnode_init(nea_subnode_t *sn, nea_sub_t *s, sip_time_t now) * *
NEATAG_MINSUB() *
Minimum duration of a subscription. - * + * *
NEATAG_THROTTLE() *
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. - * + * *
NEATAG_MINTHROTTLE() *
Minimum allowed throttle value (by default, 5 seconds). - * + * *
NEATAG_EVENTLIST() *
If true, the subscribers must support eventlists. If SIPTAG_REQUIRE() * is given, it must contain the "eventlist" feature. * *
NEATAG_DIALOG() *
Give an optional NTA destination leg to event server. - * + * *
SIPTAG_REQUIRE()/SIPTAG_REQUIRE_STR() *
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) *
NEATAG_FAKE(fak) *
If @a fake is true, 'fake' view is updated. * - *
NEATAG_VIEW(view) + *
NEATAG_VIEW(view) *
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) *
Application-provided @a context pointer. * The @a context pointer is returned by nea_view_magic() function. * - *
NEATAG_RELIABLE(reliable) - *
The @a reliable flag determines how overlapping updates are handled. + *
NEATAG_RELIABLE(reliable) + *
The @a reliable flag determines how overlapping updates are handled. * If @a reliable is true, all updates are delivered to the subscribers. * *
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. - * + * *
NEATAG_MINTHROTTLE() *
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) { diff --git a/libsofia-sip-ua/nea/sofia-sip/nea.h b/libsofia-sip-ua/nea/sofia-sip/nea.h index 5e6f3080..f8c37e82 100644 --- a/libsofia-sip-ua/nea/sofia-sip/nea.h +++ b/libsofia-sip-ua/nea/sofia-sip/nea.h @@ -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, ...); diff --git a/libsofia-sip-ua/nta/Doxyfile.in b/libsofia-sip-ua/nta/Doxyfile.in index 5a061087..8b3ec0b5 100644 --- a/libsofia-sip-ua/nta/Doxyfile.in +++ b/libsofia-sip-ua/nta/Doxyfile.in @@ -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 diff --git a/libsofia-sip-ua/nta/Makefile.am b/libsofia-sip-ua/nta/Makefile.am index 364823c6..e36906a0 100644 --- a/libsofia-sip-ua/nta/Makefile.am +++ b/libsofia-sip-ua/nta/Makefile.am @@ -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 diff --git a/libsofia-sip-ua/nta/invite.msc b/libsofia-sip-ua/nta/invite.msc index 587c99de..1a83c856 100644 --- a/libsofia-sip-ua/nta/invite.msc +++ b/libsofia-sip-ua/nta/invite.msc @@ -86,14 +86,14 @@ Agent | | |nta_leg_destroy | | | |---------------------------|--------->| | | ¦ | X - | X ¦ | + | X ¦ | User Agent Server Accepting a Call ---------------------------------- APP ¦ NTA -User ¦ NTA +User ¦ NTA Agent ¦ agent | ¦ | INVITE | ¦ |<---------------------- diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c index e5ebdcf0..e6f91563 100644 --- a/libsofia-sip-ua/nta/nta.c +++ b/libsofia-sip-ua/nta/nta.c @@ -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 - * + * * @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 , #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 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 can be used to manipulate the request message. + * SIP tags from 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 can be used to manipulate the request message. + * SIP tags from 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); diff --git a/libsofia-sip-ua/nta/nta.docs b/libsofia-sip-ua/nta/nta.docs index f82d6980..f3fe03c7 100644 --- a/libsofia-sip-ua/nta/nta.docs +++ b/libsofia-sip-ua/nta/nta.docs @@ -17,28 +17,28 @@ * @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 and , * respectively. The various SIP headers are also defined in * . - * + * * @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 @@ -46,61 +46,61 @@ * 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 @@ -112,9 +112,9 @@ * @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, @@ -126,34 +126,34 @@ * 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 @@ -163,20 +163,20 @@ * 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; * } @@ -187,37 +187,37 @@ * } * } * @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 100rel 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 @@ -236,11 +236,11 @@ * 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. * @@ -252,7 +252,7 @@ * 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 * @@ -261,7 +261,7 @@ * 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, @@ -269,30 +269,30 @@ * 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 @@ -306,14 +306,14 @@ * 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 @@ -324,15 +324,15 @@ * 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. * @@ -341,11 +341,11 @@ * * 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 @@ -356,31 +356,31 @@ * 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; @@ -391,10 +391,10 @@ * 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. + * * * @section nta_stateless_callback Stateless Processing of SIP Messages * @@ -427,27 +427,27 @@ * 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. * @@ -459,15 +459,15 @@ * { * 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 @@ -477,7 +477,7 @@ * @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()); @@ -495,17 +495,17 @@ * } * @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: @@ -513,22 +513,22 @@ * 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; } - + ... } diff --git a/libsofia-sip-ua/nta/nta_internal.h b/libsofia-sip-ua/nta/nta_internal.h index ba3fc440..b5e97d24 100644 --- a/libsofia-sip-ua/nta/nta_internal.h +++ b/libsofia-sip-ua/nta/nta_internal.h @@ -24,7 +24,7 @@ #ifndef NTA_INTERNAL_H /** Defined when 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; diff --git a/libsofia-sip-ua/nta/nta_tag.c b/libsofia-sip-ua/nta/nta_tag.c index d054a879..e5d25ca2 100644 --- a/libsofia-sip-ua/nta/nta_tag.c +++ b/libsofia-sip-ua/nta/nta_tag.c @@ -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 @@ -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 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 503 + * given limit, the stack will automatically respond with 503 * Service Unavailable. * * @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 100 Trying 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 408 Request Timeout 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 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(), diff --git a/libsofia-sip-ua/nta/portbind.c b/libsofia-sip-ua/nta/portbind.c index 7a2f6aa1..1e14eb63 100644 --- a/libsofia-sip-ua/nta/portbind.c +++ b/libsofia-sip-ua/nta/portbind.c @@ -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 - * + * * @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)); diff --git a/libsofia-sip-ua/nta/run_test_nta b/libsofia-sip-ua/nta/run_test_nta index cfff3f99..8e5ded7c 100644 --- a/libsofia-sip-ua/nta/run_test_nta +++ b/libsofia-sip-ua/nta/run_test_nta @@ -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 diff --git a/libsofia-sip-ua/nta/sl_read_payload.c b/libsofia-sip-ua/nta/sl_read_payload.c index 0f17cb0a..4385e08f 100644 --- a/libsofia-sip-ua/nta/sl_read_payload.c +++ b/libsofia-sip-ua/nta/sl_read_payload.c @@ -22,13 +22,13 @@ * */ -/**@ingroup sl_utils +/**@ingroup sl_utils * @CFILE sl_read_payload.c * * @brief Functions for reading SIP message payload from a file. - * + * * @author Pekka Pessi - * + * * @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'; diff --git a/libsofia-sip-ua/nta/sl_utils.docs b/libsofia-sip-ua/nta/sl_utils.docs index 61ea5a1e..6511aa61 100644 --- a/libsofia-sip-ua/nta/sl_utils.docs +++ b/libsofia-sip-ua/nta/sl_utils.docs @@ -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. * diff --git a/libsofia-sip-ua/nta/sl_utils_log.c b/libsofia-sip-ua/nta/sl_utils_log.c index 16cf81cb..b5eef429 100644 --- a/libsofia-sip-ua/nta/sl_utils_log.c +++ b/libsofia-sip-ua/nta/sl_utils_log.c @@ -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 @@ -45,7 +45,7 @@ #include #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) diff --git a/libsofia-sip-ua/nta/sl_utils_print.c b/libsofia-sip-ua/nta/sl_utils_print.c index f999832c..1b5b5a0b 100644 --- a/libsofia-sip-ua/nta/sl_utils_print.c +++ b/libsofia-sip-ua/nta/sl_utils_print.c @@ -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 @@ -42,7 +42,7 @@ #include #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; } diff --git a/libsofia-sip-ua/nta/sofia-sip/nta.h b/libsofia-sip-ua/nta/sofia-sip/nta.h index 39a4c732..edd2ec63 100644 --- a/libsofia-sip-ua/nta/sofia-sip/nta.h +++ b/libsofia-sip-ua/nta/sofia-sip/nta.h @@ -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); diff --git a/libsofia-sip-ua/nta/sofia-sip/nta_stateless.h b/libsofia-sip-ua/nta/sofia-sip/nta_stateless.h index a4fc8bea..48ee5252 100644 --- a/libsofia-sip-ua/nta/sofia-sip/nta_stateless.h +++ b/libsofia-sip-ua/nta/sofia-sip/nta_stateless.h @@ -24,9 +24,9 @@ #ifndef NTA_STATELESS_H /** Defined when 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 @@ -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, ...); diff --git a/libsofia-sip-ua/nta/sofia-sip/nta_tag.h b/libsofia-sip-ua/nta/sofia-sip/nta_tag.h index b1eb0b42..d14aa5c3 100644 --- a/libsofia-sip-ua/nta/sofia-sip/nta_tag.h +++ b/libsofia-sip-ua/nta/sofia-sip/nta_tag.h @@ -26,7 +26,7 @@ /** Defined when 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 @@ -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)) diff --git a/libsofia-sip-ua/nta/sofia-sip/nta_tport.h b/libsofia-sip-ua/nta/sofia-sip/nta_tport.h index 704fb2b3..3d3a1059 100644 --- a/libsofia-sip-ua/nta/sofia-sip/nta_tport.h +++ b/libsofia-sip-ua/nta/sofia-sip/nta_tport.h @@ -29,11 +29,11 @@ /** * @file sofia-sip/nta_tport.h * @brief Transport and SigComp handling - * + * * @author Pekka Pessi - * + * * @date Created: Thu Oct 7 20:04:39 2004 ppessi - * + * */ #ifndef NTA_H diff --git a/libsofia-sip-ua/nta/sofia-sip/sl_utils.h b/libsofia-sip-ua/nta/sofia-sip/sl_utils.h index cdef936f..18cca431 100644 --- a/libsofia-sip-ua/nta/sofia-sip/sl_utils.h +++ b/libsofia-sip-ua/nta/sofia-sip/sl_utils.h @@ -24,10 +24,10 @@ #ifndef SL_UTILS_H /** Defined when 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 @@ -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), diff --git a/libsofia-sip-ua/nta/test_nta.c b/libsofia-sip-ua/nta/test_nta.c index 4fa9b077..8f599bea 100644 --- a/libsofia-sip-ua/nta/test_nta.c +++ b/libsofia-sip-ua/nta/test_nta.c @@ -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 -#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 @@ -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(); diff --git a/libsofia-sip-ua/nta/test_nta_api.c b/libsofia-sip-ua/nta/test_nta_api.c index 9862722a..47a7b345 100644 --- a/libsofia-sip-ua/nta/test_nta_api.c +++ b/libsofia-sip-ua/nta/test_nta_api.c @@ -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(""), SIPTAG_TO_STR(""), @@ -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, ";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); diff --git a/libsofia-sip-ua/nth/Doxyfile.in b/libsofia-sip-ua/nth/Doxyfile.in index 7b287c0c..5c84f05e 100644 --- a/libsofia-sip-ua/nth/Doxyfile.in +++ b/libsofia-sip-ua/nth/Doxyfile.in @@ -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 diff --git a/libsofia-sip-ua/nth/http-client.c b/libsofia-sip-ua/nth/http-client.c index c016c022..39add225 100644 --- a/libsofia-sip-ua/nth/http-client.c +++ b/libsofia-sip-ua/nth/http-client.c @@ -32,7 +32,7 @@ #include "config.h" /**@page http_client Make HTTP request - * + * * @par Name     * http-client - HTTP request tool * @@ -41,10 +41,10 @@ * http-client [OPTIONS] url * * @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); diff --git a/libsofia-sip-ua/nth/nth.docs b/libsofia-sip-ua/nth/nth.docs index 6777ed15..9a515065 100644 --- a/libsofia-sip-ua/nth/nth.docs +++ b/libsofia-sip-ua/nth/nth.docs @@ -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 diff --git a/libsofia-sip-ua/nth/nth_client.c b/libsofia-sip-ua/nth/nth_client.c index f9236b63..59c93984 100644 --- a/libsofia-sip-ua/nth/nth_client.c +++ b/libsofia-sip-ua/nth/nth_client.c @@ -24,16 +24,16 @@ /**@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 - * + * * @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) { diff --git a/libsofia-sip-ua/nth/nth_server.c b/libsofia-sip-ua/nth/nth_server.c index dadf51b1..3ee91c21 100644 --- a/libsofia-sip-ua/nth/nth_server.c +++ b/libsofia-sip-ua/nth/nth_server.c @@ -24,9 +24,9 @@ /**@internal @file nth_server.c * @brief HTTP server. - * + * * @author Pekka Pessi - * + * * @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 #include @@ -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 , 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), "\n" "%u %s\n" "

%u %s

\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; diff --git a/libsofia-sip-ua/nth/nth_tag.c b/libsofia-sip-ua/nth/nth_tag.c index 369d7310..745bf89f 100644 --- a/libsofia-sip-ua/nth/nth_tag.c +++ b/libsofia-sip-ua/nth/nth_tag.c @@ -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 diff --git a/libsofia-sip-ua/nth/sofia-sip/nth.h b/libsofia-sip-ua/nth/sofia-sip/nth.h index 4040d846..63e105a4 100644 --- a/libsofia-sip-ua/nth/sofia-sip/nth.h +++ b/libsofia-sip-ua/nth/sofia-sip/nth.h @@ -31,10 +31,10 @@ */ /* ---------------------------------------------------------------------- - * 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); diff --git a/libsofia-sip-ua/nth/sofia-sip/nth_tag.h b/libsofia-sip-ua/nth/sofia-sip/nth_tag.h index 76626b4b..3f9a07d7 100644 --- a/libsofia-sip-ua/nth/sofia-sip/nth_tag.h +++ b/libsofia-sip-ua/nth/sofia-sip/nth_tag.h @@ -28,9 +28,9 @@ /**@file sofia-sip/nth_tag.h * @brief Tags for @b nth, HTTP engine module. - * + * * @author Pekka Pessi - * + * * @date Created: Sun Oct 13 22:23:48 2002 ppessi */ diff --git a/libsofia-sip-ua/nth/test_nth.c b/libsofia-sip-ua/nth/test_nth.c index d059cdb2..3b6859e4 100644 --- a/libsofia-sip-ua/nth/test_nth.c +++ b/libsofia-sip-ua/nth/test_nth.c @@ -24,9 +24,9 @@ /**@file test_nth.c * @brief Tests for nth module - * + * * @author Pekka Pessi - * + * * @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("Hello\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 ("sub/sub\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("sub/\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 ("sub/sub/\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("sub2/\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 ("sub2/sub/\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 ("auth/\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 ("auth/\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; diff --git a/libsofia-sip-ua/nua/ChangeLog b/libsofia-sip-ua/nua/ChangeLog index b81273c2..376f9155 100644 --- a/libsofia-sip-ua/nua/ChangeLog +++ b/libsofia-sip-ua/nua/ChangeLog @@ -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 @@ -208,7 +208,7 @@ 2005-10-10 Pekka Pessi - * Fixed basic call test run. + * Fixed basic call test run. M ./libsofia-sip-ua/nua/test_nua.c -8 +11 @@ -217,7 +217,7 @@ 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 @@ -259,11 +259,11 @@ 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 @@ -444,7 +444,7 @@ * Do not pass soa handle to application. M ./libsofia-sip-ua/nua/nua_stack.c -3 +3 - + 2005-09-23 Kai Vehmanen * nua_stack.c: Fix delivering nua_i_active. @@ -457,7 +457,7 @@ * 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 @@ -466,15 +466,15 @@ 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 * 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 * Initial import of the module to Sofia-SIP tree. diff --git a/libsofia-sip-ua/nua/nua.c b/libsofia-sip-ua/nua/nua.c index 08534bc7..bda8fa58 100644 --- a/libsofia-sip-ua/nua/nua.c +++ b/libsofia-sip-ua/nua/nua.c @@ -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 : - * 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 * - 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 diff --git a/libsofia-sip-ua/nua/nua.docs b/libsofia-sip-ua/nua/nua.docs index 2a44c57b..d633c9d5 100644 --- a/libsofia-sip-ua/nua/nua.docs +++ b/libsofia-sip-ua/nua/nua.docs @@ -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 sofisip_cli.c 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 diff --git a/libsofia-sip-ua/nua/nua_common.c b/libsofia-sip-ua/nua/nua_common.c index 19e2655e..c378ea1a 100644 --- a/libsofia-sip-ua/nua/nua_common.c +++ b/libsofia-sip-ua/nua/nua_common.c @@ -23,12 +23,12 @@ */ /**@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; } diff --git a/libsofia-sip-ua/nua/nua_dialog.c b/libsofia-sip-ua/nua/nua_dialog.c index fd0c93c1..eb6a2739 100644 --- a/libsofia-sip-ua/nua/nua_dialog.c +++ b/libsofia-sip-ua/nua/nua_dialog.c @@ -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 ""; 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); diff --git a/libsofia-sip-ua/nua/nua_dialog.h b/libsofia-sip-ua/nua/nua_dialog.h index 04b75a83..e24cbeaf 100644 --- a/libsofia-sip-ua/nua/nua_dialog.h +++ b/libsofia-sip-ua/nua/nua_dialog.h @@ -26,7 +26,7 @@ /** Defined when has been included. */ #define NUA_DIALOG_H -/**@IFILE nua_dialog.h +/**@IFILE nua_dialog.h * @brief Dialog and dialog usage handling * * @author Pekka Pessi @@ -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); diff --git a/libsofia-sip-ua/nua/nua_event_server.c b/libsofia-sip-ua/nua/nua_event_server.c index fd6c6b7f..df7faf2d 100644 --- a/libsofia-sip-ua/nua/nua_event_server.c +++ b/libsofia-sip-ua/nua/nua_event_server.c @@ -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); diff --git a/libsofia-sip-ua/nua/nua_extension.c b/libsofia-sip-ua/nua/nua_extension.c index c9237b6b..f327d998 100644 --- a/libsofia-sip-ua/nua/nua_extension.c +++ b/libsofia-sip-ua/nua/nua_extension.c @@ -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? */ diff --git a/libsofia-sip-ua/nua/nua_message.c b/libsofia-sip-ua/nua/nua_message.c index 1d6c3a22..fc9f5760 100644 --- a/libsofia-sip-ua/nua/nua_message.c +++ b/libsofia-sip-ua/nua/nua_message.c @@ -51,14 +51,14 @@ /**@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? */ diff --git a/libsofia-sip-ua/nua/nua_notifier.c b/libsofia-sip-ua/nua/nua_notifier.c index 4a204bc8..f77cfb34 100644 --- a/libsofia-sip-ua/nua/nua_notifier.c +++ b/libsofia-sip-ua/nua/nua_notifier.c @@ -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 notifier dialog usage 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. * diff --git a/libsofia-sip-ua/nua/nua_options.c b/libsofia-sip-ua/nua/nua_options.c index 462a15f5..5c7ab9e6 100644 --- a/libsofia-sip-ua/nua/nua_options.c +++ b/libsofia-sip-ua/nua/nua_options.c @@ -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); } diff --git a/libsofia-sip-ua/nua/nua_params.c b/libsofia-sip-ua/nua/nua_params.c index 8460111e..1869793e 100644 --- a/libsofia-sip-ua/nua/nua_params.c +++ b/libsofia-sip-ua/nua/nua_params.c @@ -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 * , and nta tags, defined in . - * + * * @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 . * - * 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)) diff --git a/libsofia-sip-ua/nua/nua_publish.c b/libsofia-sip-ua/nua/nua_publish.c index f12b2cdf..924fa7c7 100644 --- a/libsofia-sip-ua/nua/nua_publish.c +++ b/libsofia-sip-ua/nua/nua_publish.c @@ -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)) diff --git a/libsofia-sip-ua/nua/nua_register.c b/libsofia-sip-ua/nua/nua_register.c index 47d7d8c0..c38ac1ff 100644 --- a/libsofia-sip-ua/nua/nua_register.c +++ b/libsofia-sip-ua/nua/nua_register.c @@ -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 * * draft-lennox-sip-reg-payload-01.txt. * - * 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; } diff --git a/libsofia-sip-ua/nua/nua_registrar.c b/libsofia-sip-ua/nua/nua_registrar.c index ece57673..3a38ae0f 100644 --- a/libsofia-sip-ua/nua/nua_registrar.c +++ b/libsofia-sip-ua/nua/nua_registrar.c @@ -93,11 +93,11 @@ * @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 */ diff --git a/libsofia-sip-ua/nua/nua_stack.c b/libsofia-sip-ua/nua/nua_stack.c index 4a21249a..ccf9a8f4 100644 --- a/libsofia-sip-ua/nua/nua_stack.c +++ b/libsofia-sip-ua/nua/nua_stack.c @@ -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. * - 904 No matching challenge:\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; diff --git a/libsofia-sip-ua/nua/nua_stack.h b/libsofia-sip-ua/nua/nua_stack.h index 81a01636..e83a38b1 100644 --- a/libsofia-sip-ua/nua/nua_stack.h +++ b/libsofia-sip-ua/nua/nua_stack.h @@ -25,7 +25,7 @@ #ifndef NUA_STACK_H /** Defined when 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 @@ -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); diff --git a/libsofia-sip-ua/nua/nua_subnotref.c b/libsofia-sip-ua/nua/nua_subnotref.c index 13de5568..6be3f867 100644 --- a/libsofia-sip-ua/nua/nua_subnotref.c +++ b/libsofia-sip-ua/nua/nua_subnotref.c @@ -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 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()); diff --git a/libsofia-sip-ua/nua/nua_tag.c b/libsofia-sip-ua/nua/nua_tag.c index 8e52b21e..fa533045 100644 --- a/libsofia-sip-ua/nua/nua_tag.c +++ b/libsofia-sip-ua/nua/nua_tag.c @@ -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 diff --git a/libsofia-sip-ua/nua/nua_types.h b/libsofia-sip-ua/nua/nua_types.h index f8022a66..18fb05a6 100644 --- a/libsofia-sip-ua/nua/nua_types.h +++ b/libsofia-sip-ua/nua/nua_types.h @@ -26,7 +26,7 @@ /** Defined when 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 @@ -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 diff --git a/libsofia-sip-ua/nua/outbound.c b/libsofia-sip-ua/nua/outbound.c index cf4f7722..8d9b204c 100644 --- a/libsofia-sip-ua/nua/outbound.c +++ b/libsofia-sip-ua/nua/outbound.c @@ -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; diff --git a/libsofia-sip-ua/nua/outbound.h b/libsofia-sip-ua/nua/outbound.h index c1e13e6f..2a239c5b 100644 --- a/libsofia-sip-ua/nua/outbound.h +++ b/libsofia-sip-ua/nua/outbound.h @@ -25,7 +25,7 @@ #ifndef OUTBOUND_H /** Defined when 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); diff --git a/libsofia-sip-ua/nua/sofia-sip/nua.h b/libsofia-sip-ua/nua/sofia-sip/nua.h index aa95cafe..37b76677 100644 --- a/libsofia-sip-ua/nua/sofia-sip/nua.h +++ b/libsofia-sip-ua/nua/sofia-sip/nua.h @@ -22,7 +22,7 @@ * */ -/**@file sofia-sip/nua.h +/**@file sofia-sip/nua.h * @brief Sofia-SIP User Agent Library API * * @author Pekka Pessi @@ -53,13 +53,13 @@ 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); diff --git a/libsofia-sip-ua/nua/test_s2.c b/libsofia-sip-ua/nua/test_s2.c index d9f1918d..366f38ee 100644 --- a/libsofia-sip-ua/nua/test_s2.c +++ b/libsofia-sip-ua/nua/test_s2.c @@ -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 : ""); } 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 ", 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, diff --git a/libsofia-sip-ua/nua/test_s2.h b/libsofia-sip-ua/nua/test_s2.h index cfb02c03..9626c063 100644 --- a/libsofia-sip-ua/nua/test_s2.h +++ b/libsofia-sip-ua/nua/test_s2.h @@ -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 diff --git a/libsofia-sip-ua/sdp/ChangeLog b/libsofia-sip-ua/sdp/ChangeLog index 6b2f4f98..5274ed38 100644 --- a/libsofia-sip-ua/sdp/ChangeLog +++ b/libsofia-sip-ua/sdp/ChangeLog @@ -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 * Added SDPTAG_TYPEDEF(). diff --git a/libsofia-sip-ua/sdp/errata b/libsofia-sip-ua/sdp/errata index 1a363ca0..90049393 100644 --- a/libsofia-sip-ua/sdp/errata +++ b/libsofia-sip-ua/sdp/errata @@ -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 diff --git a/libsofia-sip-ua/sdp/run_test_sdp b/libsofia-sip-ua/sdp/run_test_sdp index e579a483..b6cd00a3 100644 --- a/libsofia-sip-ua/sdp/run_test_sdp +++ b/libsofia-sip-ua/sdp/run_test_sdp @@ -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 diff --git a/libsofia-sip-ua/sdp/sdp.c b/libsofia-sip-ua/sdp/sdp.c index 2d69e3bb..dda452c9 100644 --- a/libsofia-sip-ua/sdp/sdp.c +++ b/libsofia-sip-ua/sdp/sdp.c @@ -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=: ' 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; diff --git a/libsofia-sip-ua/sdp/sdp.docs b/libsofia-sip-ua/sdp/sdp.docs index d351064c..582db48c 100644 --- a/libsofia-sip-ua/sdp/sdp.docs +++ b/libsofia-sip-ua/sdp/sdp.docs @@ -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; diff --git a/libsofia-sip-ua/sdp/sdp_parse.c b/libsofia-sip-ua/sdp/sdp_parse.c index c4c0273d..4d46bcaa 100644 --- a/libsofia-sip-ua/sdp/sdp_parse.c +++ b/libsofia-sip-ua/sdp/sdp_parse.c @@ -23,7 +23,7 @@ */ /**@ingroup sdp_parser - * @CFILE sdp_parse.c + * @CFILE sdp_parse.c * @brief Simple SDP parser interface. * * @author Pekka Pessi @@ -46,7 +46,7 @@ #include #include -/** @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); } diff --git a/libsofia-sip-ua/sdp/sdp_print.c b/libsofia-sip-ua/sdp/sdp_print.c index 59d52c3c..536bf3e3 100644 --- a/libsofia-sip-ua/sdp/sdp_print.c +++ b/libsofia-sip-ua/sdp/sdp_print.c @@ -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) diff --git a/libsofia-sip-ua/sdp/sdp_tag.c b/libsofia-sip-ua/sdp/sdp_tag.c index ddbc06f0..2b3ce8c0 100644 --- a/libsofia-sip-ua/sdp/sdp_tag.c +++ b/libsofia-sip-ua/sdp/sdp_tag.c @@ -25,11 +25,11 @@ /**@internal * @file sdp_tag.c * @brief SDP Tags - * + * * @author Pekka Pessi - * + * * @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 }}; diff --git a/libsofia-sip-ua/sdp/sofia-sip/sdp.h b/libsofia-sip-ua/sdp/sofia-sip/sdp.h index 657571a0..bb39bca5 100644 --- a/libsofia-sip-ua/sdp/sofia-sip/sdp.h +++ b/libsofia-sip-ua/sdp/sofia-sip/sdp.h @@ -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, diff --git a/libsofia-sip-ua/sdp/sofia-sip/sdp_tag.h b/libsofia-sip-ua/sdp/sofia-sip/sdp_tag.h index e513414c..098064e0 100644 --- a/libsofia-sip-ua/sdp/sofia-sip/sdp_tag.h +++ b/libsofia-sip-ua/sdp/sofia-sip/sdp_tag.h @@ -26,7 +26,7 @@ /** Defined when 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 @@ -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) diff --git a/libsofia-sip-ua/sdp/test_sdp.c b/libsofia-sip-ua/sdp/test_sdp.c index 0be9cad1..98cac4c9 100644 --- a/libsofia-sip-ua/sdp/test_sdp.c +++ b/libsofia-sip-ua/sdp/test_sdp.c @@ -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); diff --git a/libsofia-sip-ua/sdp/torture_sdp.c b/libsofia-sip-ua/sdp/torture_sdp.c index 224a1452..8b3a7010 100644 --- a/libsofia-sip-ua/sdp/torture_sdp.c +++ b/libsofia-sip-ua/sdp/torture_sdp.c @@ -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))); diff --git a/libsofia-sip-ua/sip/ADD-A-HEADER b/libsofia-sip-ua/sip/ADD-A-HEADER index 2c96809f..5458021d 100644 --- a/libsofia-sip-ua/sip/ADD-A-HEADER +++ b/libsofia-sip-ua/sip/ADD-A-HEADER @@ -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 package), + - Create a header template for your header just like + sofia-sip/rfc2543.h.in (found in 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 . */ -#ifndef SIP_EXAMPLE_H +#ifndef SIP_EXAMPLE_H /** Defined when has been included. */ -#define SIP_EXAMPLE_H +#define SIP_EXAMPLE_H -/**@file sip_example.h +/**@file sip_example.h * * @brief Example header. * diff --git a/libsofia-sip-ua/sip/ChangeLog b/libsofia-sip-ua/sip/ChangeLog index 73de9a8b..93f094cd 100644 --- a/libsofia-sip-ua/sip/ChangeLog +++ b/libsofia-sip-ua/sip/ChangeLog @@ -1,7 +1,7 @@ 2006-01-25 Kai Vehmanen - * 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 @@ -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 * Initial import of the module to Sofia-SIP tree. diff --git a/libsofia-sip-ua/sip/Doxyfile.in b/libsofia-sip-ua/sip/Doxyfile.in index ca6472b7..10e13798 100644 --- a/libsofia-sip-ua/sip/Doxyfile.in +++ b/libsofia-sip-ua/sip/Doxyfile.in @@ -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 diff --git a/libsofia-sip-ua/sip/GRAMMAR b/libsofia-sip-ua/sip/GRAMMAR index 341dce99..9052f13b 100644 --- a/libsofia-sip-ua/sip/GRAMMAR +++ b/libsofia-sip-ua/sip/GRAMMAR @@ -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 @@ -50,18 +50,18 @@ * 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 @@ -103,13 +103,13 @@ * 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 ) @@ -137,7 +137,7 @@ * / ";" / ":" / "@" / "&" / "=" / "+" ) * query = *uric * SIP-Version = "SIP" "/" 1*DIGIT "." 1*DIGIT - * + * * message-header = (Accept * / Accept-Encoding * / Accept-Language @@ -183,7 +183,7 @@ * / 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 @@ -198,7 +198,7 @@ * *( message-header ) * CRLF * [ message-body ] - * + * * Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF * Status-Code = Informational * / Redirection @@ -210,21 +210,21 @@ * 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 @@ -253,7 +253,7 @@ * / "488" ; Not Acceptable Here * / "491" ; Request Pending * / "493" ; Undecipherable - * + * * Server-Error = "500" ; Internal Server Error * / "501" ; Not Implemented * / "502" ; Bad Gateway @@ -261,12 +261,12 @@ * / "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) @@ -280,23 +280,23 @@ * / ( "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 @@ -323,7 +323,7 @@ * 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 @@ -332,29 +332,29 @@ * 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" @@ -365,16 +365,16 @@ * / 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) @@ -390,9 +390,9 @@ * 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" @@ -405,32 +405,32 @@ * 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 @@ -453,53 +453,53 @@ * 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 @@ -518,7 +518,7 @@ * / 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 @@ -527,9 +527,9 @@ * ; 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) diff --git a/libsofia-sip-ua/sip/run-tests b/libsofia-sip-ua/sip/run-tests index de29fae6..ac6c41b5 100644 --- a/libsofia-sip-ua/sip/run-tests +++ b/libsofia-sip-ua/sip/run-tests @@ -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 diff --git a/libsofia-sip-ua/sip/run_test_sip_msg b/libsofia-sip-ua/sip/run_test_sip_msg index 7a5aeb78..0ca2c889 100755 --- a/libsofia-sip-ua/sip/run_test_sip_msg +++ b/libsofia-sip-ua/sip/run_test_sip_msg @@ -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" diff --git a/libsofia-sip-ua/sip/sip.docs b/libsofia-sip-ua/sip/sip.docs index af349299..3e73b038 100644 --- a/libsofia-sip-ua/sip/sip.docs +++ b/libsofia-sip-ua/sip/sip.docs @@ -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 . 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 @@ -134,7 +134,7 @@ * 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 @@ -151,7 +151,7 @@ * int sip_flags; * * sip_error_t *sip_error; // Erroneous headers - * + * * sip_request_t *sip_request; // Request line * sip_status_t *sip_status; // Status line * @@ -210,11 +210,11 @@ * 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 @@ -238,7 +238,7 @@ /**@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 and as * follows: @@ -247,13 +247,13 @@ * - 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). @@ -264,7 +264,7 @@ * 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]; @@ -295,7 +295,7 @@ * 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 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), diff --git a/libsofia-sip-ua/sip/sip.doxyaliases b/libsofia-sip-ua/sip/sip.doxyaliases index 8c35db4b..9acd3f00 100644 --- a/libsofia-sip-ua/sip/sip.doxyaliases +++ b/libsofia-sip-ua/sip/sip.doxyaliases @@ -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\"" \ diff --git a/libsofia-sip-ua/sip/sip_bad_mask b/libsofia-sip-ua/sip/sip_bad_mask index 2ce1c34e..1d3eefa1 100644 --- a/libsofia-sip-ua/sip/sip_bad_mask +++ b/libsofia-sip-ua/sip/sip_bad_mask @@ -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 diff --git a/libsofia-sip-ua/sip/sip_basic.c b/libsofia-sip-ua/sip/sip_basic.c index c13ec046..0bca27f2 100644 --- a/libsofia-sip-ua/sip/sip_basic.c +++ b/libsofia-sip-ua/sip/sip_basic.c @@ -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 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 is not UDP. * If 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) diff --git a/libsofia-sip-ua/sip/sip_caller_prefs.c b/libsofia-sip-ua/sip/sip_caller_prefs.c index 79d3c540..a5236c78 100644 --- a/libsofia-sip-ua/sip/sip_caller_prefs.c +++ b/libsofia-sip-ua/sip/sip_caller_prefs.c @@ -70,14 +70,14 @@ * @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: diff --git a/libsofia-sip-ua/sip/sip_event.c b/libsofia-sip-ua/sip/sip_event.c index cf9e1ec4..e17d8034 100644 --- a/libsofia-sip-ua/sip/sip_event.c +++ b/libsofia-sip-ua/sip/sip_event.c @@ -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); diff --git a/libsofia-sip-ua/sip/sip_extra.c b/libsofia-sip-ua/sip/sip_extra.c index a5f9db2b..ddf53987 100644 --- a/libsofia-sip-ua/sip/sip_extra.c +++ b/libsofia-sip-ua/sip/sip_extra.c @@ -24,13 +24,13 @@ /**@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 . - * + * * @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 diff --git a/libsofia-sip-ua/sip/sip_extra_headers.txt b/libsofia-sip-ua/sip/sip_extra_headers.txt index 7de56204..b20e6f45 100644 --- a/libsofia-sip-ua/sip/sip_extra_headers.txt +++ b/libsofia-sip-ua/sip/sip_extra_headers.txt @@ -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... diff --git a/libsofia-sip-ua/sip/sip_feature.c b/libsofia-sip-ua/sip/sip_feature.c index a072187c..625a8bba 100644 --- a/libsofia-sip-ua/sip/sip_feature.c +++ b/libsofia-sip-ua/sip/sip_feature.c @@ -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) diff --git a/libsofia-sip-ua/sip/sip_header.c b/libsofia-sip-ua/sip/sip_header.c index e3e6ba03..66100a9d 100644 --- a/libsofia-sip-ua/sip/sip_header.c +++ b/libsofia-sip-ua/sip/sip_header.c @@ -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, ...) diff --git a/libsofia-sip-ua/sip/sip_mime.c b/libsofia-sip-ua/sip/sip_mime.c index 4e39f3be..90cce374 100644 --- a/libsofia-sip-ua/sip/sip_mime.c +++ b/libsofia-sip-ua/sip/sip_mime.c @@ -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 * 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) diff --git a/libsofia-sip-ua/sip/sip_parser.c b/libsofia-sip-ua/sip/sip_parser.c index 1051354b..ee182dd1 100644 --- a/libsofia-sip-ua/sip/sip_parser.c +++ b/libsofia-sip-ua/sip/sip_parser.c @@ -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; } diff --git a/libsofia-sip-ua/sip/sip_parser.docs b/libsofia-sip-ua/sip/sip_parser.docs index 0b3188c8..576b3f51 100644 --- a/libsofia-sip-ua/sip/sip_parser.docs +++ b/libsofia-sip-ua/sip/sip_parser.docs @@ -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: @@ -15,14 +15,14 @@ * 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". * * @@ -33,18 +33,18 @@ * * 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 . */ -#ifndef SIP_EXAMPLE_H +#ifndef SIP_EXAMPLE_H /** Defined when 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. * diff --git a/libsofia-sip-ua/sip/sip_parser_table.c.in b/libsofia-sip-ua/sip/sip_parser_table.c.in index 6f86f820..05ffd745 100644 --- a/libsofia-sip-ua/sip/sip_parser_table.c.in +++ b/libsofia-sip-ua/sip/sip_parser_table.c.in @@ -29,7 +29,7 @@ * */ -/**@CFILE sip_parser_table.c +/**@CFILE sip_parser_table.c * @brief SIP parser table * * #AUTO# diff --git a/libsofia-sip-ua/sip/sip_prack.c b/libsofia-sip-ua/sip/sip_prack.c index 2f321c61..5226ee4d 100644 --- a/libsofia-sip-ua/sip/sip_prack.c +++ b/libsofia-sip-ua/sip/sip_prack.c @@ -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) diff --git a/libsofia-sip-ua/sip/sip_pref_util.c b/libsofia-sip-ua/sip/sip_pref_util.c index bb7d9800..4e3ca984 100644 --- a/libsofia-sip-ua/sip/sip_pref_util.c +++ b/libsofia-sip-ua/sip/sip_pref_util.c @@ -23,7 +23,7 @@ */ /**@CFILE sip_pref_util.c - * + * * SIP callercaps and callerprefs utility functions. * * @author Pekka Pessi . @@ -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; diff --git a/libsofia-sip-ua/sip/sip_reason.c b/libsofia-sip-ua/sip/sip_reason.c index 86e11fd8..0c5b4225 100644 --- a/libsofia-sip-ua/sip/sip_reason.c +++ b/libsofia-sip-ua/sip/sip_reason.c @@ -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. */ @@ -77,12 +77,12 @@ * @code * typedef struct sip_reason_s * { - * sip_common_t re_common[1]; // Common fragment info - * sip_reason_t *re_next; // Link to next - * 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 + * 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) { diff --git a/libsofia-sip-ua/sip/sip_refer.c b/libsofia-sip-ua/sip/sip_refer.c index a9b0a3b3..9aaa54bb 100644 --- a/libsofia-sip-ua/sip/sip_refer.c +++ b/libsofia-sip-ua/sip/sip_refer.c @@ -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; diff --git a/libsofia-sip-ua/sip/sip_security.c b/libsofia-sip-ua/sip/sip_security.c index 3bd85f46..744535e3 100644 --- a/libsofia-sip-ua/sip/sip_security.c +++ b/libsofia-sip-ua/sip/sip_security.c @@ -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 . * @@ -118,9 +118,9 @@ * 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; } diff --git a/libsofia-sip-ua/sip/sip_session.c b/libsofia-sip-ua/sip/sip_session.c index 32d25233..52e9c60a 100644 --- a/libsofia-sip-ua/sip/sip_session.c +++ b/libsofia-sip-ua/sip/sip_session.c @@ -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) { diff --git a/libsofia-sip-ua/sip/sip_status.c b/libsofia-sip-ua/sip/sip_status.c index 3d92cd88..f75da713 100644 --- a/libsofia-sip-ua/sip/sip_status.c +++ b/libsofia-sip-ua/sip/sip_status.c @@ -24,7 +24,7 @@ /**@ingroup sip_status_codes * @CFILE sip_status.c - * + * * SIP status codes and standard phrases. * * @author Pekka Pessi . @@ -37,22 +37,22 @@ #include #include -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) { diff --git a/libsofia-sip-ua/sip/sip_tag.c.in b/libsofia-sip-ua/sip/sip_tag.c.in index ec88be25..7ba01589 100644 --- a/libsofia-sip-ua/sip/sip_tag.c.in +++ b/libsofia-sip-ua/sip/sip_tag.c.in @@ -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 diff --git a/libsofia-sip-ua/sip/sip_tag_class.c b/libsofia-sip-ua/sip/sip_tag_class.c index 4c2aa3ab..9b93bf5c 100644 --- a/libsofia-sip-ua/sip/sip_tag_class.c +++ b/libsofia-sip-ua/sip/sip_tag_class.c @@ -23,7 +23,7 @@ */ /**@SIP_TAG - * + * * @CFILE sip_tag_class.c SIP Tag classes * * @author Pekka Pessi . @@ -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 diff --git a/libsofia-sip-ua/sip/sip_time.c b/libsofia-sip-ua/sip/sip_time.c index 9ad9d280..77fababe 100644 --- a/libsofia-sip-ua/sip/sip_time.c +++ b/libsofia-sip-ua/sip/sip_time.c @@ -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(); diff --git a/libsofia-sip-ua/sip/sip_util.c b/libsofia-sip-ua/sip/sip_util.c index 0b017d53..3bec98f9 100644 --- a/libsofia-sip-ua/sip/sip_util.c +++ b/libsofia-sip-ua/sip/sip_util.c @@ -23,7 +23,7 @@ */ /**@CFILE sip_util.c - * + * * SIP utility functions. * * @author Pekka Pessi . @@ -59,7 +59,7 @@ #include #include -/** +/** * Compare two SIP addresses ( @From or @To headers). * * @retval nonzero if matching. @@ -68,12 +68,12 @@ 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 and 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 ("1" | "." 1,3DIGIT) - * + * * @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 diff --git a/libsofia-sip-ua/sip/sofia-sip/sip.h b/libsofia-sip-ua/sip/sofia-sip/sip.h index a297b99c..1a235ca4 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip.h +++ b/libsofia-sip-ua/sip/sofia-sip/sip.h @@ -26,8 +26,8 @@ /** Defined when has been included. */ #define SIP_H -/**@file sofia-sip/sip.h - * +/**@file sofia-sip/sip.h + * * SIP objects. * * @author Pekka Pessi . @@ -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]; diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_hclasses.h.in b/libsofia-sip-ua/sip/sofia-sip/sip_hclasses.h.in index ee10ac87..e710a73e 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_hclasses.h.in +++ b/libsofia-sip-ua/sip/sofia-sip/sip_hclasses.h.in @@ -1,11 +1,11 @@ -/** -*- C -*- +/** -*- C -*- * * @file sofia-sip/sip_hclasses.h.in * * Template for . */ -/* +/* * 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 * * @date Created: Thu Jan 23 19:26:31 2003 ppessi @@ -50,18 +50,18 @@ SOFIA_BEGIN_DECLS -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 diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_header.h b/libsofia-sip-ua/sip/sofia-sip/sip_header.h index d76c67c4..c75500d1 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_header.h +++ b/libsofia-sip-ua/sip/sofia-sip/sip_header.h @@ -24,9 +24,9 @@ #ifndef SIP_HEADER_H /**Defined when 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 diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_parser.h b/libsofia-sip-ua/sip/sofia-sip/sip_parser.h index 133ba481..1c6a6cd3 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_parser.h +++ b/libsofia-sip-ua/sip/sofia-sip/sip_parser.h @@ -24,10 +24,10 @@ #ifndef SIP_PARSER_H /** Defined when 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 diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in b/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in index 41ebd6f4..5734ffc3 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in +++ b/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in @@ -30,14 +30,14 @@ #ifndef SIP_PROTOS_H /** Defined when 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 . * */ @@ -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 diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_status.h b/libsofia-sip-ua/sip/sofia-sip/sip_status.h index 1ba2e666..c5a73892 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_status.h +++ b/libsofia-sip-ua/sip/sofia-sip/sip_status.h @@ -24,10 +24,10 @@ #ifndef SIP_STATUS_H /** Defined when has been included. */ -#define SIP_STATUS_H +#define SIP_STATUS_H /**@addtogroup sip_status_codes - * @{ + * @{ */ /**@file sofia-sip/sip_status.h * diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in b/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in index d2d708a4..55abfbe8 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in +++ b/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in @@ -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#. diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_tag_class.h b/libsofia-sip-ua/sip/sofia-sip/sip_tag_class.h index 774eb765..32df99a5 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_tag_class.h +++ b/libsofia-sip-ua/sip/sofia-sip/sip_tag_class.h @@ -24,7 +24,7 @@ #ifndef SIP_TAG_CLASS_H /** Defined when 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 diff --git a/libsofia-sip-ua/sip/sofia-sip/sip_util.h b/libsofia-sip-ua/sip/sofia-sip/sip_util.h index 68942be3..cbd12a3b 100644 --- a/libsofia-sip-ua/sip/sofia-sip/sip_util.h +++ b/libsofia-sip-ua/sip/sofia-sip/sip_util.h @@ -24,9 +24,9 @@ #ifndef SIP_UTIL_H /** Defined when 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 . @@ -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); diff --git a/libsofia-sip-ua/sip/test_date.c b/libsofia-sip-ua/sip/test_date.c index 84613a30..6428d982 100644 --- a/libsofia-sip-ua/sip/test_date.c +++ b/libsofia-sip-ua/sip/test_date.c @@ -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); diff --git a/libsofia-sip-ua/sip/test_sip_msg.c b/libsofia-sip-ua/sip/test_sip_msg.c index 3a973afc..2dd91686 100644 --- a/libsofia-sip-ua/sip/test_sip_msg.c +++ b/libsofia-sip-ua/sip/test_sip_msg.c @@ -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) diff --git a/libsofia-sip-ua/sip/torture_sip.c b/libsofia-sip-ua/sip/torture_sip.c index a3b2b8e6..c469540f 100644 --- a/libsofia-sip-ua/sip/torture_sip.c +++ b/libsofia-sip-ua/sip/torture_sip.c @@ -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: ;tag=deadbeef\r\n" "From: ;\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: ;tag=deadbeef\r\n" "From: ;\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 , Helmi "))); @@ -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: ;tag=deadbeef\r\n" "From: ;\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\" ;" "screen=yes;party=called;id-type=user;privacy=\"name,uri-network\""; - char const canonic2[] = + char const canonic2[] = "Jaska Jokunen ;" "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 \r\n" "From: \"Bar Owner\" ;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, ";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 \r\n" "From: \"Bar Owner\" ;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 ;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: ;purpose=xcap\r\n" "Error-Info: ;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: \r\n" - "Alert-Info: \r\n" - "Reply-To: Bob \r\n" + "Alert-Info: \r\n" + "Reply-To: Bob \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: \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;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 " ";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 ;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 \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 \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, "") == 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/2.0\r\n" "To: John Smith \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 \r\n" "From: ;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\" ;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 ;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 " ";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: ;tag=deadbeef\r\n" "From: ;\r\n" @@ -2772,11 +2772,11 @@ static int test_route(void) TEST_1(p = sip_path_make(home, ";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, ";lr")); - TEST_1(!sip_service_route_make(home, + TEST_1(!sip_service_route_make(home, ";lr bar, sip:foo")); TEST_1(sr = sip_service_route_make(home, ";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 = "\" ! , \""; + s = "\" ! , \""; 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("\"!\"", "\"\"", &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("\",\"", - "\",\"", &error)); - TEST_1(!sip_prefs_matching("\",\"", "\"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\"", "\",\"", &error)); + TEST_1(!sip_prefs_matching("\",\"", + "\",\"", &error)); + TEST_1(!sip_prefs_matching("\",\"", "\"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\"", "\",\"", &error)); TEST(error, 12); error = 12; - TEST_1(!sip_prefs_matching("\",#=1\"", "\",\"", &error)); + TEST_1(!sip_prefs_matching("\",#=1\"", "\",\"", &error)); TEST(error, -1); error = 12; - TEST_1(!sip_prefs_matching("\",\"", "\",#=1\"", &error)); + TEST_1(!sip_prefs_matching("\",\"", "\",#=1\"", &error)); TEST(error, -1); error = 12; - TEST_1(!sip_prefs_matching("\",bar\"", "\",\"", &error)); + TEST_1(!sip_prefs_matching("\",bar\"", "\",\"", &error)); TEST(error, -1); error = 12; - TEST_1(!sip_prefs_matching("\",\"", "\",#12:12\"", &error)); + TEST_1(!sip_prefs_matching("\",\"", "\",#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, ";video;audio;type=\"
*
--all | -a
- *
All SIP headers will be printed. If the --all option is given, + *
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. *
@@ -82,7 +82,7 @@ * * @section environment Environment * #SIPADDRESS, #sip_proxy, #NTA_DEBUG, #TPORT_DEBUG, #TPORT_LOG. - * + * * @section bugs Reporting Bugs * Report bugs to . * @@ -117,13 +117,13 @@ typedef struct context_s context_t; #include 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); diff --git a/utils/utils.docs b/utils/utils.docs index 5df65767..e7210db9 100644 --- a/utils/utils.docs +++ b/utils/utils.docs @@ -1,7 +1,7 @@ /* -*- c -*- */ /**@MODULEPAGE "utils" - Sofia-SIP Command Line Utilities - * + * * @section utils_meta Module Meta Information * * Command line utilities for Sofia-SIP. @@ -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 diff --git a/win32/ChangeLog b/win32/ChangeLog index 8856b629..65f96c3d 100644 --- a/win32/ChangeLog +++ b/win32/ChangeLog @@ -1,20 +1,20 @@ 2006-05-11 Pekka Pessi * 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 @@ -26,19 +26,19 @@ * 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. diff --git a/win32/README.txt b/win32/README.txt index b31409cb..0073fe1b 100644 --- a/win32/README.txt +++ b/win32/README.txt @@ -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 diff --git a/win32/build_sources.cmd b/win32/build_sources.cmd index 6ebfded3..0f740537 100644 --- a/win32/build_sources.cmd +++ b/win32/build_sources.cmd @@ -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 ^ diff --git a/win32/config.h.in b/win32/config.h.in index 5bbca9de..363d33b3 100644 --- a/win32/config.h.in +++ b/win32/config.h.in @@ -25,7 +25,7 @@ /**@file win32/config.h.in * @brief used by Windows. * - * Use this on WIN32. + * Use this on WIN32. * * @author Pekka Pessi * @@ -151,7 +151,7 @@ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ -#if _MSC_VER > 1200 +#if _MSC_VER > 1200 #define HAVE_IPHLPAPI_H 1 #else // XXX: vehmanek-win32-fix for VC6 @@ -458,7 +458,7 @@ #define snprintf _snprintf -#ifndef _MSC_VER +#ifndef _MSC_VER #define vsnprintf _vsnprintf #endif #if _MSC_VER < 1500 @@ -485,14 +485,14 @@ #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+ @@ -505,7 +505,7 @@ #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" diff --git a/win32/libsofia-sip-ua/sofia-sip-ua.def b/win32/libsofia-sip-ua/sofia-sip-ua.def index 494bd640..c36ed959 100644 --- a/win32/libsofia-sip-ua/sofia-sip-ua.def +++ b/win32/libsofia-sip-ua/sofia-sip-ua.def @@ -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 diff --git a/win32/sofia-sip/su_configure.h b/win32/sofia-sip/su_configure.h index 8d01703a..c0217eba 100644 --- a/win32/sofia-sip/su_configure.h +++ b/win32/sofia-sip/su_configure.h @@ -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 @@ -104,7 +104,7 @@ #define snprintf _snprintf #endif #ifndef vsnprintf -#ifndef _MSC_VER +#ifndef _MSC_VER #define vsnprintf _vsnprintf #endif #if _MSC_VER < 1500 diff --git a/win32/version.awk b/win32/version.awk index bf5dd7cf..c610015f 100644 --- a/win32/version.awk +++ b/win32/version.awk @@ -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");
0do not prune
1prune parameters with identical names